jmarkus
Mechanical
- Jul 11, 2001
- 377
I found this code which allows filtering by planar faces:
But what I really want to do is select all planar faces on a layer, or all planar faces on a body.
How do I "trap" that selection and reuse it in other functions?
Thanks,
Jeff
Code:
Function select_a_planar_face(ByRef face As NXOpen.Tag) As Selection.Response
Dim message As String = "Planar Face:"
Dim title As String = "Select a PLANAR FACE"
Dim scope As Integer = UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY
Dim response As Integer
Dim view As NXOpen.Tag
Dim cursor(2) As Double
Dim mask_face As UFUi.SelInitFnT = AddressOf mask_for_planar_faces
ufs.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
Try
ufs.Ui.SelectWithSingleDialog(message, title, scope, mask_face, Nothing, response, face, cursor, view)
Finally
ufs.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
End Try
If response <> UFConstants.UF_UI_OBJECT_SELECTED And response <> UFConstants.UF_UI_OBJECT_SELECTED_BY_NAME Then
Return Selection.Response.Cancel
Else
Return Selection.Response.Ok
End If
End Function
Function mask_for_planar_faces(ByVal select_ As IntPtr, ByVal userdata As IntPtr) As Integer
Dim num_triples As Integer = 1
Dim mask_triples(0) As UFUi.Mask
mask_triples(0).object_type = UFConstants.UF_solid_type
mask_triples(0).object_subtype = UFConstants.UF_solid_face_subtype
mask_triples(0).solid_type = UFConstants.UF_UI_SEL_FEATURE_PLANAR_FACE
ufs.Ui.SetSelMask(select_, UFUi.SelMaskAction.SelMaskClearAndEnableSpecific, num_triples, mask_triples)
Return UFConstants.UF_UI_SEL_SUCCESS
End Function
But what I really want to do is select all planar faces on a layer, or all planar faces on a body.
How do I "trap" that selection and reuse it in other functions?
Thanks,
Jeff