首页 > 其他 > 详细

单选和多选及过滤

时间:2020-05-10 16:18:23      阅读:77      评论:0      收藏:0      [点我收藏+]
 1 char         sCue[] = "选择";
 2     char         sTitle[] = "功能测试";
 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[] = "象选择对话框";
2     char sTitle[] = "象选择对话框";
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 
13 static int init_proc(UF_UI_selection_p_t select, void* user_data)
14 {
15     int  errorCode = 0;
16     int  num_triples = 1;
17     UF_UI_mask_t mask_triples[] = { UF_solid_type,UF_solid_face_subtype, UF_UI_SEL_FEATURE_CYLINDRICAL_FACE };
18     errorCode = UF_UI_set_sel_mask(select, UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, num_triples, mask_triples);
19     if (errorCode == 0)
20     {
21         return UF_UI_SEL_SUCCESS;
22     }
23     else
24     {
25         return UF_UI_SEL_FAILURE;
26     }
27 }

过滤
 1 //selection控件设置过滤类型
 2 void  SetSelectionType(NXOpen::BlockStyler::SelectObject* selectionID)
 3 {
 4 //设置过滤
 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 )); // 实体
 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 ));   // 制图对象
22 selectionID->GetProperties()->SetSelectionFilter("SelectionFilter", action, maskArray);
23 }

 

单选和多选及过滤

原文:https://www.cnblogs.com/liuxiaoqing1/p/12863429.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!