Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


nx open Move Datum CSYS Completely From Layer

nx open Move Datum CSYS Completely From Layer

nx open Move Datum CSYS Completely From Layer


Searching the forums I found very helpful information. cowski posted some NX Open code that I was hoping him or someone else could help me with.. The Code is to completely move datum Csys (origin, 3 axes, 3 planes) to a new layer.

I cant figure out how to specify to only move the datum csys from a particular layer. Ex. "move all datum csys completely from layer 2 to layer 99" And not effect the Datum Csys on say layer 3 they stay where they are at.

Here is the code i found before:

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)

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

End If


End Sub
End Module

RE: nx open Move Datum CSYS Completely From Layer

Here's one possible solution:


Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF

Module Module131

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()
    Dim lw As ListingWindow = theSession.ListingWindow()

    Sub Main()

        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "datum csys layer")


        Const layerMoveFrom As Integer = 2
        Const layerMoveTo As Integer = 99

        For Each tempFeat As Features.Feature In theSession.Parts.Work.Features
            If Not TypeOf (tempFeat) Is Features.DatumCsys Then
                Continue For
            End If

            Dim myDatumCsys As Features.DatumCsys = tempFeat

            Dim dispObj As DisplayableObject = myDatumCsys.GetEntities(0)
            If dispObj.Layer = layerMoveFrom Then
                Dim myDatumCsysObjs As New List(Of DisplayableObject)
                For Each temp As DisplayableObject In myDatumCsys.GetEntities
                theSession.Parts.Work.Layers.MoveDisplayableObjects(layerMoveTo, myDatumCsysObjs.ToArray)
            End If


    End Sub

    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 


RE: nx open Move Datum CSYS Completely From Layer

Cowski.... You always have the answers when it comes to NX Open questions. It worked Great, exactly what I needed, Thank you very much!

While you are here, whats the best way to find NX Open samples to leverage? I got on the GTAC Support Center and they have alot of samples but its hard to find specific things.

RE: nx open Move Datum CSYS Completely From Layer

In the GTAC solution center, after you enter your search phrase, you can filter by document type; choose the "nx_api" to get the code samples. You can further filter by programming language used, if there are multiple results returned.

This forum has a pretty good search function (the search button can be found on this page right below the thread title). When I'm searching for code, I use "journal" as one of the keywords.

Siemens has a forum dedicated to NX customizaion and programming; it also has a search function.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


White Paper - How to Capitalize on HVAC/R Trends to Drive Business Growth
According to Steve Yurek, CEO of the Air Conditioning, Heating and Refrigeration Institute, the HVAC/R industry is facing change on all fronts. This includes challenging trends on contractors and distributors like new refrigerants, growing automation, complex sensors and monitoring, green initiatives and a technician shortage. We look at these trends and outline actionable insights on how it all can be turned into a competitive advantage and business opportunity. Download Now
eBook - Manufacturing the Cars of Tomorrow
In this ebook, we'll explore how additive manufacturing is going to transform the way cars are made. This includes commentary from thought leaders such as Ford's CTO, Ken Washington, Customer case studies of ways 3D printing is being used today, and a variety of part examples where 3D printing is already impacting how automobiles are made. Download Now
White Paper - Smart Manufacturing for Semiconductor
New technologies and approaches present great opportunities for semiconductor manufacturers to achieve high levels of innovation, yield and improvement. This white paper explores some of these cutting-edge technologies and how they can be applied effectively in the semiconductor industry. Read about how Smart Manufacturing is transforming the semiconductor industry. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close