Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX9 Navigator Order Journal

Status
Not open for further replies.

Kenja824

Automotive
Nov 5, 2014
949
In July of 2014, JPETACH posted this journal to change the Navigator Order

Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim componentOrder1 As Assemblies.ComponentOrder = CType(workPart.ComponentAssembly.OrdersSet.FindObject("Chronological"), Assemblies.ComponentOrder)
componentOrder1.Activate()
End Sub
End Module


This works fine if you are in an assembly, however if you are in a single detail it errors out. I know.... why would I want to set the order in a single detail, right?

I have a set up button that most of us run to set a bunch of attribute for drafting preferences and such. We use this button for all files we work on. I would like to paste this into the set-up journal so that it will automatically set the Navigator order to Alphanumeric.

So I ask, can anyone please help me with a journal code that will set this order to assembly files and when you are in a single detail it simply gets ignored and doesnt error out?

I attached the Setup Journal I will add it to in case this will help the process.
 
 http://files.engineering.com/getfile.aspx?folder=3397293f-1a11-49cf-92bf-b9eaeb9b4877&file=Setup.vb
Replies continue below

Recommended for you

Looks like you should check if the assembly has any components before using OrdersSet().

You could try:

if (theNxDataController.NXPart.ComponentAssembly.RootComponent == null)
&& (theNxDataController.NXPart.ComponentAssembly.RootComponent.GetChildren().Length == 0)

Paul

Paul Turner
CAD & Process Engineer
Mastip Technology
 
Thanks for the help PaulBarryTurner, but unfortunatlely, I know extremely little about Journal Code. I have learned to look for certain types of code on a journal and copy and paste it to another to merge them, but that is even touch and go. lol

To be honest, I am not sure where to insert your code to my setup journal, as everytime I try it, it keeps giving me errors.

'IF' must end with a matching 'End If'
'theNXDataController' is not declared.
Expression Expected
'null' is not declared. 'Null' Constant is no longer supported; use 'System.DBNull' instead.
Syntax Error.


I think it would be best if you helped me as if you were teaching a child to tie his shoes. .... Though I am guessing there are no Bunny Ear tricks in Journal Code. lol

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor