Retrive an assembly file name

Dear all,
I'm new to NXOpen API, I'm developing a batch program which should be able to open an nx file and export it in Step format.
I need to extract from the model its file name. If the model is a part I can get its name using the following instruction

part.FullPath

where part is a NXOpen.Part object.
However for an assembly file I was not able to find anything similar, do you have any suggestion?

Thanks for your attention,

Silvia

An assembly file is also a part file, so the part.FullPath would work just as well. Just be sure that you are referencing the assembly part of interest, not one of its component parts.

If you open the assembly and it is currently the displayed part, you can use:


Dim theSession As Session = Session.GetSession()
Dim displaypart As Part = theSession.Parts.Display

msgbox(displaypart.FullPath)

This simple example will just pop up a message box with the part's full path, you'll need to add code to use the information accordingly.

Also, the .net framework (IO.Path class) provides methods to extract just the file name from the path, or just the parent folder, the root drive, etc. So, if you are after just the file name, as opposed to the full path, it is easier to use one of these methods rather than writing code to parse the full path.

For more info see: MSDN IO.Path

Below code gives full path but I need only file name. How to get it, please guide

Dim theSession As Session = Session.GetSession()
Dim displaypart As Part = theSession.Parts.Display

msgbox(displaypart.FullPath)

There is a code example in this thread:
http://nxjournaling.com/content/code-query-part-file-name

Thank you very much, this really helped!