×
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

Journal (Part Cleanup)

Journal (Part Cleanup)

Journal (Part Cleanup)

(OP)
I have a Journal that I run to perform a Part Cleanup (Cleanup - Save - Close).

What I'd like to do, is enhance it so that it will execute against a specified folder. Is this possible ? Could someone give me some idea of what I need to add to the journal ?

NX 6.0.5.3 (NX 8 Testing)
Windows XP32 (Windows 7 64)

RE: Journal (Part Cleanup)

Quote:


What I'd like to do, is enhance it so that it will execute against a specified folder.

Does this mean you want to run a part cleanup on all parts in a particular folder?

Marc
NX Software Developer
 

RE: Journal (Part Cleanup)

(OP)
Marc,

Yes, that's correct.

Now I have used the following ... "Refile_part.exe -d <path> -l <log filename>  -nop -ndates -cleanup" ... but i'm guessing it's only a basic cleanup. It doesn't work.

NX 6.0.5.3 (NX 8 Testing)
Windows XP32 (Windows 7 64)

RE: Journal (Part Cleanup)

Refile is something else entirely; it is used to update the part from one NX version to another. In addition, -cleanup is just a switch to indicate that a part cleanup should be executed before updating the part.

It is very easy to get a list of files in a directory in .NET (take a look at the System.IO.GetFiles() method). The tricky thing is able to run a part cleanup externally. I am not sure if NX/Open has functionality to run the part cleanup automatically.

What you can do is to record a journal while running part cleanup interactively and see if anything is recorded. If you are lucky and something is recorded, then that code is what you need to call in your journal. If not, then you will have to see if NX has supplied the possibility by running a part cleanup using a separate program.

The major setback of what you are trying to accomplish via is a journal is performance. You will need to open each part in the specified folder, run the part cleanup, save it, close it, and repeat for all remaining parts.
 

Marc
NX Software Developer
 

RE: Journal (Part Cleanup)

(OP)
Marc,

I have the journal recorded ... Cleanup, Save, Close.

What I need to do is 'add' the lines to open a file from the folder, loop through the part cleanup section and then open the next file etc etc etc ...

NX 6.0.5.3 (NX 8 Testing)
Windows XP32 (Windows 7 64)

RE: Journal (Part Cleanup)

Gotcha. Which language did your record your language in? VB or C#?

Marc
NX Software Developer
 

RE: Journal (Part Cleanup)

(OP)
VB

NX 6.0.5.3 (NX 8 Testing)
Windows XP32 (Windows 7 64)

RE: Journal (Part Cleanup)

Here is some code showing the principle of how one might do it (untested!)

CODE

' Goes to the very top of your code
Imports System.IO
Imports NXOpen
Imports NXOpen.Utilities

Dim ufSession as UFSession = UFSession.GetUFSession()

' Path containing parts to clean up including subdirectories
Dim partPath as String = "c:\partstoclean"
Dim partFiles() as String = Directory.GetFiles(partPath, "*.prt", SearchOption.AllDirectores)

Dim partTag as Tag = Tag.Null
Dim loadStatus as UFPart.LoadStatus = Nothing
Dim partResponses as PartCloseResponses = Nothing

Try
For Each partFile as String in partFiles

' Open the part
ufSession.UFPart.Open(somePart, partTag, loadStatus)

' Convert Tag to Part
Dim somePart as Part = CType(NXObjectManager.Get(partTag), Part)

' Calls the function to clean up the part, save it, and close it.
CleanSaveClosePart(somePart)

End For
Catch ex as NXException

End Try

The function which cleans, saves and close the part should have the following signature:

CODE

Public Sub CleanSaveClosePart(ByVal partToUpdate as Part)

Marc
NX Software Developer
 

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