Calling NX Selection Dialog from a WinForms Dialog
Calling NX Selection Dialog from a WinForms Dialog
(OP)
Dear Forum,
I am trying to call an NXOpen dialog from a winForms dialog. Instead of using block styler, I am using WinForms. The code opens the winForms and then I've connected the following below selection dialog to the button on the winForms. But, the code hangs and freezes ug and doesn't allow any selection. I am thinking that I either to pass in the uf session and / or the workpart.
Function SelectSheet(ByVal prompt As String) As Face
Dim theUI As UI = UI.GetUI
Dim message As String = prompt
Dim title As String = "Selection"
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim keepHighlighted As Boolean = False
Dim includeFeatures As Boolean = True
Dim selectionAction As Selection.SelectionAction = _
Selection.SelectionAction.ClearAndEnableSpecific
Dim selectionMask_array(0) As Selection.MaskTriple
With selectionMask_array(0)
.Type = UFConstants.UF_face_type
.Subtype = 0
.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_SHEET_BODY
End With
Dim selectedObject As NXObject = Nothing
Dim cursor As Point3d
theUI.SelectionManager.SelectTaggedObject(message, title, scope, _
selectionAction, includeFeatures, _
keepHighlighted, selectionMask_array, _
selectedObject, cursor)
Dim oSheet As Face = CType(selectedObject, Face)
If oSheet Is Nothing Then
Return Nothing
End If
Return oSheet
End Function
I am trying to call an NXOpen dialog from a winForms dialog. Instead of using block styler, I am using WinForms. The code opens the winForms and then I've connected the following below selection dialog to the button on the winForms. But, the code hangs and freezes ug and doesn't allow any selection. I am thinking that I either to pass in the uf session and / or the workpart.
Function SelectSheet(ByVal prompt As String) As Face
Dim theUI As UI = UI.GetUI
Dim message As String = prompt
Dim title As String = "Selection"
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim keepHighlighted As Boolean = False
Dim includeFeatures As Boolean = True
Dim selectionAction As Selection.SelectionAction = _
Selection.SelectionAction.ClearAndEnableSpecific
Dim selectionMask_array(0) As Selection.MaskTriple
With selectionMask_array(0)
.Type = UFConstants.UF_face_type
.Subtype = 0
.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_SHEET_BODY
End With
Dim selectedObject As NXObject = Nothing
Dim cursor As Point3d
theUI.SelectionManager.SelectTaggedObject(message, title, scope, _
selectionAction, includeFeatures, _
keepHighlighted, selectionMask_array, _
selectedObject, cursor)
Dim oSheet As Face = CType(selectedObject, Face)
If oSheet Is Nothing Then
Return Nothing
End If
Return oSheet
End Function





RE: Calling NX Selection Dialog from a WinForms Dialog
www.nxjournaling.com
RE: Calling NX Selection Dialog from a WinForms Dialog
RE: Calling NX Selection Dialog from a WinForms Dialog
Why do you need to keep the form open? Why not close it while the user makes a selection then re-open it? My preference, as a user of NX, is to only see one dialog open at any given time. An external form visible and potentially in the way could be annoying while attempting to make selection(s) in NX. </my2cents>
www.nxjournaling.com
RE: Calling NX Selection Dialog from a WinForms Dialog
Thank you.
RE: Calling NX Selection Dialog from a WinForms Dialog
www.nxjournaling.com