Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX9 JOURNAL FOR MOVING OBJECTS TO LAYERS

Status
Not open for further replies.

Kenja824

Automotive
Nov 5, 2014
949
Objective = VB code for moving all Curves, Dimensions, Notes, Labels,Symbols and Groups to layer 254 (done in drafting)

Reason = File Checker insists on specific objects to be on specific layers. Too often a detailer will take a new detail and just start detailing it up, and not until they are done will they realize they forgot to set the work layer to 253 or 254 which is supposed to hold all of the drafting objects. So everything is on layer 1 (or whatever layer they had set as their work layer). If they window around everything and move to layer 254, it can also select solid bodies, sheet bodies etc... inside the views. So I would like to create a button that when selected it will automatically do a Move to Layer, and use the filters to select everything (Not in the views) to layer 254.

Note:
If I record a journal to do this and select by filters, I dont see where it shows it is selecting specific objects by filter settings. It seems to record each individual object being selected instead.
 
Replies continue below

Recommended for you

Can someone please let me know if this is something that just isnt possible? All sheets are 11x17 so maybe there is a way to filter it and select by a window around the area?

If I can learn how to get just a couple different objects through the filter and select all, like Curves and Points, I am pretty sure I can fix it to find other objects like Dimensions, Notes, Labels and symbols.

I dont understand why there is so much that recording a Journal will not record. This makes it really hard for people who are amateurs to VB code to learn. Sorry if I sound frustrated. It is just that I had an easier time recording and manipulating macros than I have with VB.
 
It is possible. Most of the objects you are interested in are contained within "collections" in the part. This makes it easy to gather up all the notes, dimensions, ID symbols, etc. The last time that I worked with groups, the collection wasn't fully implemented and I had to use the .CycleObjsInPart function to find all the groups. However, that was a few releases ago, hopefully they have their own collection now.

www.nxjournaling.com
 
Recording a selection process isn't going to give you what you want, because you want an automated process that doesn't involve selection.

There is a fairly well-known set of techniques for removing selection code from journals. The best description of it is in the "Getting Started with SNAP" document. Search for "FindObject".

Using SNAP functions, what you want is easy. It's basically just something like
Code:
For Each obj As Snap.NX.NXObject in workPart.Objects
   If object is a suitable type
      obj.Layer = 254
   End
End

Using NX/Open functions will be somewhat clunkier, but not too bad.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor