马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如题。就是不用使用single_dialog 和class_dialog,点击菜单出现对话框后,就能直接进行选择操作。这个是怎么做的啊。
看了UG文档,在NXOPEN中有这么一段说明
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;} 按照说明的设置了下,现在可以进行类型的筛选操作了,但是怎么选择目标,得到目标的TAG值?是需要用到什么函数吗?希望各位高手指点啊!
另外小弟使用的是NX5.0,我知道6.0好像已经在BLOCK style中固化了这部分功能,但是在程序模板中看不到这些函数段。一直搞不懂是怎么实现的,在NX5中能实现吗? |