How to select Datum coordinate system features

Hello,

I used the following code in a journal to move NX stuff to specific layers.
It works fine for Datums, Sketches and Curves.
Problem is I want datum coordinate system features to go to an other layer e.g. 61
So first I select al datums and move them to layer 3

After that I want to move all datum coordinate systems to layer 61 but as this is not part of NXOpen.part I don't know how to achieve this.

Any help will be very much appreciated

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpenUI

Module move_all_datums_and_csys_to_specified_layer
Sub Main

Dim theSession As Session = Session.GetSession()
Dim WP as Part = theSession.Parts.Work
Dim objArray(0) As DisplayableObject
Dim strLayer As String

strLayer = 3
For Each obj As DisplayableObject In WP.Datums
If Not obj.IsBlanked AndAlso WP.Layers.GetState(obj.Layer) <> Layer.State.Hidden Then
objArray(0) = obj
WP.Layers.MoveDisplayableObjects(Val(strLayer), objArray)
End If
Next

End Sub
End Module

The code below is one approach. It looks at all the features in the work part; when it finds a datum csys, it uses a UF function to collect the objects and finally it moves each object to the desired layer.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Features
Imports NXOpen.Utilities
Imports NXOpen.UF

Module ChangeDatums

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow
Const Layno As Integer = 41

For Each myFeature As Feature In workPart.Features

If TypeOf (myFeature) Is DatumCsys Then

'uncomment the following If block to skip internal features
'If myFeature.IsInternal Then
' Continue For
'End If

Dim csys_tag As Tag
Dim origin_tag As Tag
Dim daxes As Tag()
Dim dplanes As Tag()
ufs.Modl.AskDatumCsysComponents(myFeature.Tag, csys_tag, origin_tag, daxes, dplanes)
ufs.Obj.SetLayer(origin_tag, Layno)
ufs.Obj.SetLayer(csys_tag, Layno)

For Each thisObj As NXOpen.Tag In daxes
ufs.Obj.SetLayer(thisObj, Layno)
Next

For Each thisObj As NXOpen.Tag In dplanes
ufs.Obj.SetLayer(thisObj, Layno)
Next

End If

Next

End Sub
End Module

Great! Thanks for your help