C++
//获取UI界面的值
//Get the chamfer angle and edge selection list from the dialog
PropertyList* angleDoubleProps = angleDouble->GetProperties();
double creationAngle = angleDoubleProps->GetDouble("Value");
delete angleDoubleProps;
angleDoubleProps = NULL;
//获取UI界面选择对象
PropertyList* edgeSelectProps = edgeSelect->GetProperties();
std::vector<NXOpen::TaggedObject *> edges = edgeSelectProps->GetTaggedObjectVector("SelectedObjects");
delete edgeSelectProps;
edgeSelectProps = NULL;
//Add a chamfer to each selected edge
for (unsigned int ii = 0; ii < edges.size(); ++ii)
{
NXOpen::Edge* selectedEdge = dynamic_cast<NXOpen::Edge*>(edges[ii]);
addChamfer(selectedEdge, creationAngle);
}
//设置过虑(注释处改动即可使用)
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
std::vector<Selection::MaskTriple> maskArray(1);
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype/*此处控制选择的类型,右键点转到定义查开
类型*/, 0 /*此处控制选择的类型,在头文件uf_ui_types.可以查到*/ ); // Bodies
selection0/*此处blockID需按实际改*/->GetProperties()->SetSelectionFilter("SelectionFilter",action,maskArray);
//以下为设置过虑用不同类型的代码,具体看行后备注
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_CYLINDRICAL_FACE); // 圆柱
面
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components
maskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
maskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting
objects
//设置选择只选择组件
NXOpen::Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
std::vector<NXOpen::Selection::MaskTriple>selectionMask_array(2);
selectionMask_array[0].Type = UF_component_type ;
selectionMask_array[0].Subtype = UF_component_subtype ;
selectionMask_array[1].Type = UF_component_type;
selectionMask_array[1].Subtype = UF_part_occurrence_subtype;
NXOpen::BlockStyler::PropertyList *selComponentProps = selection0->GetProperties();
selComponentProps->SetSelectionFilter("SelectionFilter",action,selectionMask_array);
delete selComponentProps;
selComponentProps = NULL;
=====================================================================================================================
//获取的格式
1. PropertyList* a = blockID->GetProperties();
2.类型 b = a->getxxx();
3.delete a;
4.a = Null;
======================================================================================================================
=====================================================================================================================
过滤的值
======================================================================================================================
/* Constants for selection solid_type */
#define UF_UI_SEL_NOT_A_FEATURE (-1)
#define UF_UI_SEL_FEATURE_BODY 0
#define UF_UI_SEL_FEATURE_ANY_EDGE 1
#define UF_UI_SEL_FEATURE_LINEAR_EDGE 2
#define UF_UI_SEL_FEATURE_CIRCULAR_EDGE 3
#define UF_UI_SEL_FEATURE_ELLIPTICAL_EDGE 4
#define UF_UI_SEL_FEATURE_INTERSECTION_EDGE 5
#define UF_UI_SEL_FEATURE_BCURVE_EDGE 6
#define UF_UI_SEL_FEATURE_SPCURVE_EDGE 7
#define UF_UI_SEL_FEATURE_FOREIGN_EDGE 8
#define UF_UI_SEL_FEATURE_CNST_PARM_EDGE 9
#define UF_UI_SEL_FEATURE_ANY_WIRE_OR_EDGE 10
/* 11-18 are reserved for additional solid_type use */
#define UF_UI_SEL_FEATURE_ANY_SHEET 19 /* Do not use this, use _SHEET_BODY or _ANY_FACE */
#define UF_UI_SEL_FEATURE_ANY_FACE 20
#define UF_UI_SEL_FEATURE_PLANAR_FACE 21
#define UF_UI_SEL_FEATURE_CYLINDRICAL_FACE 22
#define UF_UI_SEL_FEATURE_CONICAL_FACE 23
#define UF_UI_SEL_FEATURE_SPHERICAL_FACE 24
#define UF_UI_SEL_FEATURE_TOROIDAL_FACE 25
#define UF_UI_SEL_FEATURE_PARAMETRIC_FACE 26
#define UF_UI_SEL_FEATURE_BLENDING_FACE 27
#define UF_UI_SEL_FEATURE_OFFSET_FACE 28
#define UF_UI_SEL_FEATURE_SWEPT_FACE 29
#define UF_UI_SEL_FEATURE_SWUNG_FACE 30
#define UF_UI_SEL_FEATURE_FOREIGN_FACE 31
#define UF_UI_SEL_FEATURE_ANY_COMPOSITE_BODY 32
#define UF_UI_SEL_FEATURE_ANY_COMPOSITE_FACE 33
#define UF_UI_SEL_FEATURE_ANY_COMPOSITE_EDGE 34
#define UF_UI_SEL_FEATURE_SHEET_BODY 35
#define UF_UI_SEL_FEATURE_SOLID_BODY 36 /* non-sheet-body */
#define UF_UI_SEL_FEATURE_MAX_FEATURE 36
/* 40-90 are reserved for feature type selection use */
/* Special features, no type or subtype is needed. */
#define UF_UI_SEL_FEATURE_ROUTING_CURVE_ONLY 91 /* This should be first of special feature types */
#define UF_UI_SEL_FEATURE_ROUTING_SOLID_ONLY 92
#define UF_UI_SEL_FEATURE_WORK_PART_COMP 93
/*
*/
#define UF_UI_SEL_FEATURE_WELD_RESIS_SPOT 94
#define UF_UI_SEL_FEATURE_WELD_ARC_SPOT 95
#define UF_UI_SEL_FEATURE_WELD_MEC_CLINCH 96
#define UF_UI_SEL_FEATURE_WELD_DOLLOP 97
#define UF_UI_SEL_FEATURE_WELD_NUT 98
#define UF_UI_SEL_FEATURE_WELD_STUD 99
#define UF_UI_SEL_FEATURE_WELD_CUSTOM1 100
#define UF_UI_SEL_FEATURE_WELD_CUSTOM2 101
#define UF_UI_SEL_FEATURE_WELD_CUSTOM3 102
#define UF_UI_SEL_FEATURE_WELD_CUSTOM4 103
#define UF_UI_SEL_FEATURE_WELD_CUSTOM5 104
#define UF_UI_SEL_FEATURE_WELD_GROOVE 105
#define UF_UI_SEL_FEATURE_WELD_FILLET 106
#define UF_UI_SEL_FEATURE_WELD_USER_DEFINED 107
#define UF_UI_SEL_FEATURE_WELD_FILL 108
#define UF_UI_SEL_FEATURE_WELD_BEAD 109
#define UF_UI_SEL_FEATURE_WELD_JOINT 110
#define UF_UI_SEL_FEATURE_WELD_EDGE 111
#define UF_UI_SEL_FEATURE_WELD_RESIS_SEAM 112
#define UF_UI_SEL_FEATURE_WELD_PLUG_SLOT 113
#define UF_UI_SEL_FEATURE_WELD_SURFACE_WELD 114
#define UF_UI_SEL_FEATURE_WELD_JOINTMARK 115
/*
*/
#define UF_UI_SEL_FEATURE_WELD_COMPOUND 116
/*
*/
#define UF_UI_SEL_FEATURE_WELD_DATUM_SURFACE 117
#define UF_UI_SEL_FEATURE_WELD_DATUM_PIN 118
#define UF_UI_SEL_FEATURE_WELD_DATUM_CUSTOM1 119
#define UF_UI_SEL_FEATURE_WELD_DATUM_CUSTOM2 120
#define UF_UI_SEL_FEATURE_WELD_DATUM_CUSTOM3 121
/*
*/
#define UF_UI_SEL_FEATURE_WELD_MEASUREMENT_SURFACE 122
#define UF_UI_SEL_FEATURE_WELD_MEASUREMENT_HOLE 123
#define UF_UI_SEL_FEATURE_WELD_MEASUREMENT_STUD 124
#define UF_UI_SEL_FEATURE_WELD_MEASUREMENT_SLOT 125
#define UF_UI_SEL_FEATURE_WELD_MEASUREMENT_TRIM 126
#define UF_UI_SEL_FEATURE_WELD_MEASUREMENT_HEMMED_EDGE 127
#define UF_UI_SEL_FEATURE_WELD_MEASUREMENT_CUSTOM1 128
#define UF_UI_SEL_FEATURE_WELD_MEASUREMENT_CUSTOM2 129
#define UF_UI_SEL_FEATURE_WELD_MEASUREMENT_CUSTOM3 130
#define UF_UI_SEL_FEATURE_MAX_SPECIAL_FEATURE 131 /* This should be last of special feature types */