Datum Plane and Datum Axis Selection

Good Morning

I want users to select Datum Plane and Datum Axis to create constrains. In my Journal I use the SelectionManager command

'theUI.SelectionManager.SelectObject(prompt, "Selection", Selection.SelectionScope.AnyInAssembly,False, typeArray, selobj, cursor)'

The issue is that Users are able to select, by mistake, something else in the 3D model because on the typeArray we cannot define something like
'Selection.SelectionType.Datums'

Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.All, _
Selection.SelectionType.Faces, _
Selection.SelectionType.Edges, _
Selection.SelectionType.Features}

What is the command to force the SelectionManager command to select only Datums features and nothing else ?

Thanks

Fabrice

The following journal shows one way to select a datum plane or axis.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module2

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Const undoMarkName As String = "NXJ journal"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

Dim selDatum As DisplayableObject
If SelectObject("select datum plane or axis", selDatum) = Selection.Response.Cancel Then
Return
End If

lw.WriteLine("datum type: " & selDatum.GetType.ToString)
lw.WriteLine("layer: " & selDatum.Layer)

lw.Close()

End Sub

Function SelectObject(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response

Dim theUI As UI = UI.GetUI
Dim title As String = "Select an object"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
Dim cursor As Point3d
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim selectionMask_array(1) As Selection.MaskTriple

With selectionMask_array(0)
.Type = UFConstants.UF_datum_plane_type
.Subtype = 0
End With

With selectionMask_array(1)
.Type = UFConstants.UF_datum_axis_type
.Subtype = 0
End With

Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt,
title, scope, selAction,
includeFeatures, keepHighlighted, selectionMask_array,
selObj, cursor)
If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If

End Function

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module

Thanks a lot NXJournal.
Is there a UG VB Siemens Documentation where I can find all Methods, Objects and Properties I can use in the Journal to control UG .

Fab

The "programming and customization" help files are not installed by default, you may need to re-run the help installer and choose the option to install those files. When you do get them installed, there is an "API reference" document that lists all the available functions, objects, properties, and methods available.

If you have a webkey, you can access the documentation from Siemens' site (NX 10 programming help):
https://docs.plm.automation.siemens.com/tdoc/nx/10/nx_api/#uid:index

If you follow that link then go to NXOpen -> Open for .NET, you will find a link for the API reference mentioned above that covers all the functions available. It is worth looking through the general sections of the programming help as well.