DavidS81
Mechanical
- Jul 28, 2008
- 7
I am trying enable selection from a UI Styler dialog.
When I created the dialog in NX, I had Selection "enabled", "Robust" selection type selected, "Single Position" checked, and Scope set to "Any in Assembly."
In the constructor for the dialog I have (among other non - related commands) the following lines of code to "wire up" the callbacks to NX:
Mask and Callback "Wireup":
selectionHandle = attributeeditorDialog.GetSelectionHandle()
Dim selectionMask_array(0) As NXOpen.Selection.MaskTriple
With selectionMask_array(0)
.Type = NXOpen.UF.UFConstants.UF_component_type
.Subtype = NXOpen.UF.UFConstants.UF_component_subtype
.SolidBodySubtype = NXOpen.UF.UFConstants.UF_UI_SEL_FEATURE_SOLID_BODY
End With
theUFSession.Ui.SetSelType(selectionHandle.Handle, UF.UFConstants.UF_UI_SEL_TYPE_ROBUST_SELECTION)
theUI.SelectionManager.SetSelectionMask(selectionHandle, Selection.SelectionAction.ClearAndEnableSpecific, selectionMask_array)
theUI.SelectionManager.SetSelectionCallbacks(selectionHandle, AddressOf filterSelected_cb, AddressOf selected_cb)
CallBack Functions:
Private Function selected_cb(ByVal SelectedObjects() As NXObject, _
ByVal DeSelectedObjects() As NXObject, _
ByVal SelectionHandle As SelectionHandle) As Integer
'nothing implemented yet
End Function
Private Function filterSelected_cb(ByVal NXObject As NXObject, _
ByVal MaskTriples As Selection.MaskTriple, _
ByVal SelectionHandle As SelectionHandle) As Integer
'nothing implemented yet
End Function
By the way, the "selectionHandle" variable is a module level variable.
Here's the problem:
Both of the callbacks work as they should (as far as I can tell), but when I go to select a component in workspace, it:
1) does not hightlight the component - it acts as though my MaskTriple structure is incorrect - even though while running the program, it is using "Component" as the selection filter. The filterSelected_cb is triggered as I move the cursor over a component, passing in the component as NXObject.
2) passes NXobject arrays with a length of "0" (nothing in them) to the selection callback when the component is "picked" on - it acts as though it hadn't selected anything (the component is never highlighted).
The only thing that I could think to change is the Mask Type, Sub Type, and SolidBodySubType - but even then, I am using what worked before with other built in NX commands like UI.SelectionManager.SelectObjects(...).
By the way, I am running NX 5.0.6.3 in native.
Am I using these objects correctly? Am I missing something?
Any help would be very much appreciated.
David Stockdale
Wagstaff, Inc.
Spokane Valley, WA 99216
(509) 922-1404 ext. 3261
When I created the dialog in NX, I had Selection "enabled", "Robust" selection type selected, "Single Position" checked, and Scope set to "Any in Assembly."
In the constructor for the dialog I have (among other non - related commands) the following lines of code to "wire up" the callbacks to NX:
Mask and Callback "Wireup":
selectionHandle = attributeeditorDialog.GetSelectionHandle()
Dim selectionMask_array(0) As NXOpen.Selection.MaskTriple
With selectionMask_array(0)
.Type = NXOpen.UF.UFConstants.UF_component_type
.Subtype = NXOpen.UF.UFConstants.UF_component_subtype
.SolidBodySubtype = NXOpen.UF.UFConstants.UF_UI_SEL_FEATURE_SOLID_BODY
End With
theUFSession.Ui.SetSelType(selectionHandle.Handle, UF.UFConstants.UF_UI_SEL_TYPE_ROBUST_SELECTION)
theUI.SelectionManager.SetSelectionMask(selectionHandle, Selection.SelectionAction.ClearAndEnableSpecific, selectionMask_array)
theUI.SelectionManager.SetSelectionCallbacks(selectionHandle, AddressOf filterSelected_cb, AddressOf selected_cb)
CallBack Functions:
Private Function selected_cb(ByVal SelectedObjects() As NXObject, _
ByVal DeSelectedObjects() As NXObject, _
ByVal SelectionHandle As SelectionHandle) As Integer
'nothing implemented yet
End Function
Private Function filterSelected_cb(ByVal NXObject As NXObject, _
ByVal MaskTriples As Selection.MaskTriple, _
ByVal SelectionHandle As SelectionHandle) As Integer
'nothing implemented yet
End Function
By the way, the "selectionHandle" variable is a module level variable.
Here's the problem:
Both of the callbacks work as they should (as far as I can tell), but when I go to select a component in workspace, it:
1) does not hightlight the component - it acts as though my MaskTriple structure is incorrect - even though while running the program, it is using "Component" as the selection filter. The filterSelected_cb is triggered as I move the cursor over a component, passing in the component as NXObject.
2) passes NXobject arrays with a length of "0" (nothing in them) to the selection callback when the component is "picked" on - it acts as though it hadn't selected anything (the component is never highlighted).
The only thing that I could think to change is the Mask Type, Sub Type, and SolidBodySubType - but even then, I am using what worked before with other built in NX commands like UI.SelectionManager.SelectObjects(...).
By the way, I am running NX 5.0.6.3 in native.
Am I using these objects correctly? Am I missing something?
Any help would be very much appreciated.
David Stockdale
Wagstaff, Inc.
Spokane Valley, WA 99216
(509) 922-1404 ext. 3261