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 ?
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)
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)
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)
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)
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)
Marc
NX Software Developer
RE: Journal (Part Cleanup)
NX 6.0.5.3 (NX 8 Testing)
Windows XP32 (Windows 7 64)
RE: Journal (Part Cleanup)
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
Marc
NX Software Developer