單選和多選及過(guò)濾
1 char sCue[] = "選擇"; 2 char sTitle[] = "功能測(cè)試"; 3 int iScope = UF_UI_SEL_SCOPE_NO_CHANGE; 4 int iResponse; 5 tag_t tObject; 6 tag_t viewTag = NULL_TAG; 7 double cursor[3]; 8 double min_corner[3] = { 0.0,0.0,0.0 }; 9 double directions[3][3]; 10 double distances[3]; 11 UF_UI_select_with_single_dialog(sCue, sTitle, iScope, init_face, NULL, &iResponse, &tObject, cursor, &viewTag);
單選
1 char sCue[] = "象選擇對(duì)話框"; 2 char sTitle[] = "象選擇對(duì)話框"; 3 int iScope = UF_UI_SEL_SCOPE_NO_CHANGE; 4 int iResponse; 5 tag_t *tObject; 6 int count = 0; 7 UF_UI_select_with_class_dialog(sCue, sTitle, iScope, init_proc, NULL, &iResponse, &count, &tObject); 8 多選
1 static int select_filter_proc_fn(tag_t object, int type[1], void* user_data, UF_UI_selection_p_t select) 2 { 3 if (object == NULL) 4 { 5 return UF_UI_SEL_REJECT; 6 } 7 else 8 { 9 return UF_UI_SEL_ACCEPT; 10 } 11 } 12
static int init_proc_body(UF_UI_selection_p_t select, void* user_data)
{
int errorCode = 0;
int num_triples = 1;
UF_UI_mask_t mask_triples[] = { UF_solid_type,UF_solid_face_subtype, UF_UI_SEL_FEATURE_CYLINDRICAL_FACE };
errorCode = UF_UI_set_sel_mask(select, UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, num_triples, mask_triples);
if ((UF_UI_set_sel_procs(select, select_filter_proc_fn, NULL, user_data)) == 0)
{
return UF_UI_SEL_SUCCESS;
}
else
{
return UF_UI_SEL_FAILURE;
}
}
過(guò)濾
1 //selection控件設(shè)置過(guò)濾類型 2 void SetSelectionType(NXOpen::BlockStyler::SelectObject* selectionID) 3 { 4 //設(shè)置過(guò)濾 5 Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific; 6 std::vector<Selection::MaskTriple> maskArray; 7 //maskArray.push_back(Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, UF_UI_SEL_FEATURE_SOLID_BODY )); // 實(shí)體 8 //maskArray.push_back(Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE)); // 面 9 maskArray.push_back(Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_PLANAR_FACE)); //平面 10 //maskArray.push_back(Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE)); // 邊 11 //maskArray.push_back(Selection::MaskTriple( UF_component_type, 0, 0)); //組件 12 //maskArray.push_back(Selection::MaskTriple( UF_point_type, 0, 0 )); 13 //maskArray.push_back(Selection::MaskTriple( UF_line_type, 0, 0 )); // 線 14 //maskArray.push_back(Selection::MaskTriple( UF_circle_type, 0, 0 )); //圓弧 15 //maskArray.push_back(Selection::MaskTriple( UF_spline_type, 0, 0 )); 16 //maskArray.push_back(Selection::MaskTriple( UF_coordinate_system_type, 0, 0 )); 17 //maskArray.push_back(Selection::MaskTriple( UF_datum_axis_type, 0, 0 )); 18 //maskArray.push_back(Selection::MaskTriple( UF_datum_plane_type, 0, 0 )); 19 //maskArray.push_back(Selection::MaskTriple( UF_plane_type, 0, 0 )); 20 //maskArray.push_back(Selection::MaskTriple( UF_axis_type, 0, 0 )); 21 //maskArray.push_back(Selection::MaskTriple( UF_drafting_entity_type, 0, 0 )); // 制圖對(duì)象 22 selectionID->GetProperties()->SetSelectionFilter("SelectionFilter", action, maskArray); 23 }
NXOpen控件過(guò)濾
1 std::vector<NXOpen::Selection::MaskTriple> selectionfilter(1); 2 NXOpen::Selection::MaskTriple maskTriple1 ; 3 maskTriple1.Type = UF_solid_type; 4 maskTriple1.Subtype = UF_solid_face_subtype; 5 maskTriple1.SolidBodySubtype = UF_UI_SEL_FEATURE_ANY_FACE; 6 selectionfilter.push_back(maskTriple1); 7 8 PropertyList *selectionToolFaceProps = selectionToolFace->GetProperties(); 9 selectionToolFaceProps->SetSelectionFilter("SelectionFilter", NXOpen::Selection::SelectionAction::SelectionActionClearAndEnableSpecific, selectionfilter); 10 delete selectionToolFaceProps; 11 selectionToolFaceProps = NULL;
控件不過(guò)濾
1 PropertyList* selectionObjProps = selectionObj->GetProperties(); 2 std::vector<TaggedObject*> selObjs; 3 selObjs = selectionObjProps->GetTaggedObjectVector("SelectedObjects"); 4 delete selectionObjProps; 5 selectionObjProps = NULL;

浙公網(wǎng)安備 33010602011771號(hào)