Selection
Selection class contains methods that update the selection structure associated with the active dialog box. Some method declarations for class Selection are:
namespace NXOpen{ class Selection void SetSelectionMask ( NXOpen::SelectionHandle * select /** Selection handle */, NXOpen::Selection::SelectionAction action /** Mask action */, const std::vector<NXOpen::Selection::MaskTriple> & mask_array /** Mask triples */ ); public: void SetSelectionCallbacks ( NXOpen::SelectionHandle * select /** Selection handle */, const NXOpen::Selection::FilterCallback& filterproc /** Filter callback for additional user specific filtering. */, const NXOpen::Selection::SelectionCallback& selcb /** Selection callback for application specific processing. */ ); C++
To get the selection handle
NXOpen::SelectionHandle *selectH = changeDialog->GetSelectionHandle();
Create selection mask array
Dim selectionMask_array(0) As NXOpen.Selection.MaskTripleWith selectionMask_array(0).Type = NXOpen.UF.UFConstants.UF_solid_type.Subtype = NXOpen.UF.UFConstants.UF_solid_edge_subtype.SolidBodySubtype = NXOpen.UF.UFConstants.UF_UI_SEL_FEATURE_ANY_EDGEEnd With
Set the selection mask
UI::GetUI()->SelectionManager()->SetSelectionMask(selectH, NXOpen::Selection::SelectionActionClearAndEnableSpecific, selectionMask_array);
Set selection procedures
UI::GetUI()->SelectionManager()->SetSelectionCallbacks(selectH, make_callback(filter_cb), make_callback(sel_cb));
Define the filter_cb and sel_cb procedures as follows in order to register this in set selection procedure in the above step.
int filter_cb(NXOpen::NXObject *selectedObject, NXOpen::Selection::MaskTriple* selectionMask_array, NXOpen::SelectionHandle* selectHandle){ try { // write your code here } catch (const NXOpen::NXException& ex) { } return NXOpen::UIStyler:ialogStateContinueDialog;}int sel_cb(std::vector<NXOpen::NXObject *> selectedObject, std::vector<NXOpen::NXObject *> deselectedObjects, NXOpen::SelectionHandle* selectHandle){ try { // write your code here } catch (const NXOpen::NXException& ex) { } return NXOpen::UIStyler:ialogStateContinueDialog;}