呵 我也刚开始学c# 不太懂 试了下多选对话框selectwithclassdialog() 设定只有边和线可选 代码如下:
using NXOpen;
using NXOpen.UF;
using NXOpen.Utilities;
using NXOpenUI;
namespace SelectWithClass
{
public class Class1
{
public static NXOpen.Session theSession;
public static UFSession theUFSession;
public static NXOpen.Part workPart;
static int sel_init_proc(IntPtr select_,IntPtr user_data)
{
int num_triples = 2;
UFUi.Mask[] mask_triples = new UFUi.Mask[2]; /* enable only lines and edges */
mask_triples[0].object_type = UFConstants.UF_line_type;
mask_triples[0].object_subtype = 0;
mask_triples[0].solid_type = 0;
mask_triples[1].object_type = UFConstants.UF_solid_type;
mask_triples[1].object_subtype = 0;
mask_triples[1].solid_type = UFConstants.UF_UI_SEL_FEATURE_ANY_EDGE;
theUFSession.Ui.SetSelMask(select_, UFUi.SelMaskAction.SelMaskClearAndEnableSpecific, num_triples, mask_triples);
return UFConstants.UF_UI_SEL_SUCCESS;
}
public static void Main()
{
theSession = Session.GetSession();
theUFSession = UFSession.GetUFSession();
workPart = theSession.Parts.Work;
string cue = "Please Select Objects";
string title = "User Title";
int response;
int count;
Tag[] objects;
int i = 0;
IntPtr user_data = (IntPtr)i;
theUFSession.Ui.SelectWithClassDialog(cue, title, UFConstants.UF_UI_SEL_SCOPE_WORK_PART, sel_init_proc,user_data,out response, out count,out objects);
}
}
}
本帖最后由 ice-snow 于 2009-11-19 10:50 编辑 |