NX二次开发源码分享:选择管道routing线段的方法
NX二次开发源码分享:选择管道routing线段的方法
代码是C#的,主要是告诉大家masktriple的设置如下:
mask.Type = 0;
mask.Subtype = 0;
mask.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_ROUTING_CURVE_ONLY;
public static Selection.Response select_route_segment(string prompt, ref TaggedObject obj)
{
TaggedObject selobj;
UI ui = UI.GetUI();
Selection.MaskTriple[] mask = new Selection.MaskTriple;
{
mask.Type = 0;
mask.Subtype = 0;
mask.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_ROUTING_CURVE_ONLY;
}
Point3d cursor = default(Point3d);
Selection.Response resp = ui.SelectionManager.SelectTaggedObject(prompt, prompt, Selection.SelectionScope.AnyInAssembly, Selection.SelectionAction.ClearAndEnableSpecific, false, false, mask, out selobj, out cursor);
if (resp == Selection.Response.ObjectSelected | resp == Selection.Response.ObjectSelectedByName)
{
obj = selobj;
return Selection.Response.Ok;
}
else
{
return Selection.Response.Cancel;
}
}
页:
[1]