EngProgrammer
Aerospace
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