×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

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

Jobs

Using a Journal to organize the file

Using a Journal to organize the file

Using a Journal to organize the file

(OP)
Using NX6...

I am attempting to write a journal that will organize my file, mainly to place things on different layers so that the file conforms to our standards.

To start, I thought I would tackle moving each sketch to it's own unique layer. I was able to do this, but I discovered that it is looking at each layer in the order that they were created, NOT in the order that they are in the model tree, which is what I prefer.

Any ideas?

Chris T.
Project Design Analyst
Kohler Co. Engine Division
Using NX6

RE: Using a Journal to organize the file

Quote (wiengines)

it is looking at each layer in the order that they were created, NOT in the order that they are in the model tree

ummm, what?

I assume you meant "each sketch in the order they were created" but even so, to see how that is relevant you'll need to give more information.

Why must the sketches be presented in timestamp order, is the user verifying each one (interactively while the journal is running)? What layer(s) do you want the sketches on?

www.nxjournaling.com

RE: Using a Journal to organize the file

(OP)
Cowski,

Yes, I meant "each sketch ..." It's been a long week mad

I suppose I was a little vague in my original post, so hear is some more details.

Our standards state following:
That each sketch must be on thier own unique layer.
The layers we have reserved are 101-200.
As you progress down the model tree, the layers that each sketch is on should not jump around.

My end goal for this program is for the program to find each sketch, in timestamp order, and place them on thier own unique layer; starting with layer 101, without any user interaction.

The code I have written so far works great except for two intances:
1) If the sketches have been re-ordered in the model tree.
2) If the user makes a feature the current feature, creates a new sketch; and then continues on from there.

In both of those instances (which happen alot), the creation timestamp is different than the timestamp of the model tree, and that is my issue.

Having said all of that, I do feel that our stanards are a little overkill...but since I have bigger issues to deal with I would love to find a way to make it as painless as possible!

Chris T.
Project Design Analyst
Kohler Co. Engine Division
Using NX6

RE: Using a Journal to organize the file

(OP)
Here is my code so far...

CODE --> VB

Option Strict Off
Imports System
Imports NXOpen

Module organize_file

    Dim s As Session = Session.GetSession()
    Dim workPart As Part = S.Parts.Work
    Dim dispPart As Part = s.Parts.Display
    Dim lw As ListingWindow = s.ListingWindow
    Dim i As Integer
    Dim objArray(0) As DisplayableObject

    Sub Main()

        i = 100
        For Each sk As Sketch In s.Parts.Work.Sketches
            i = i + 1
            objArray(0) = sk
            workpart.Layers.MoveDisplayableObjects(i, objArray)
        Next

        

    End Sub

End Module 

Chris T.
Project Design Analyst
Kohler Co. Engine Division
Using NX6

RE: Using a Journal to organize the file

This will report the sketches in timestamp order:

CODE

Option Strict Off  
Imports System  
Imports NXOpen  

Module Module1  

    Sub Main()  

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

        Dim mySketchFeature As Features.SketchFeature  
        Dim mySketch As Sketch = Nothing  
        Dim myFeatures() As Features.Feature = workPart.Features.ToArray  

        lw.WriteLine("Sketch Name" & New String(vbTab, 2) & "Timestamp" & New String(vbTab, 1) & "Layer")  
        For Each feat As Features.Feature In myFeatures  
            If TypeOf feat Is Features.SketchFeature Then  
                mySketchFeature = feat  
                mySketch = mySketchFeature.Sketch  
                lw.WriteLine(mySketch.Name & New String(vbTab, 2) & feat.Timestamp & New String(vbTab, 2) & mySketch.Layer)  
            End If  
        Next  
        lw.WriteLine("")  


    End Sub  


    Public Function GetUnloadOption(ByVal dummy As String) As Integer  

 'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination  

    End Function  

End Module 

www.nxjournaling.com

RE: Using a Journal to organize the file

(OP)
Thank you very much cowski! This is exactly what I was looking for. Eventually, I plan on adding some code to this program to handle moving other objects to different layers as well...

Chris T.
Project Design Analyst
Kohler Co. Engine Division
Using NX6

RE: Using a Journal to organize the file

Can you describe how this ordering of the file helps you? Since the sketches are already in time stamp order what is the additional benefit of having each sketch on it's own layer?

As a comparison our standard is to have all sketches for a specific part feature on a separate layer. For example all the sketches for the mounting tabs are on layer 29. We contain all the sketches in the 20-29 range. As another example, the main body of our parts are made up of a group of extruded features, with the sketches on layer 21 and a group of revolved features, with the sketches on layer 20.

I am always interested in how others organize their parts, and what benefits they get from the organization.

I am a big proponent of establishing standards based on principles not specifics. I am continually fighting with my companies organizational groups that come up with standards 6000 miles away having never asked how we do business here in our office where we have been doing business for 30 years establishing standards what work for our products. I am in favor of the ISO/TSO style of standardizing process where the directive is that you must look at what you do and define that as your standard, and then tweek it as needed.

Nice rant huh!

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!


Resources