cancel
Showing results for 
Search instead for 
Did you mean: 

How to Identify Part vs. Assembly Files

Community Manager Community Manager
Community Manager

It's not difficult to tell parts from assemblies if you know what to look for, but at first it can seem tricky. Both parts and assemblies share the .prt file extension, so you won't be able to tell simply based on that. There are ways, though, that go beyond use of a naming convention which relies on accuracy and consistency of the user.

 

***This post originated as a thread in the NX Design Forum: How to identify if a part is an assembly.***

 

One method that works when you have a file in native mode is to run the "%UGII_ROOT_DIR%\ugpc.exe" utility which will list the components (if there are any).

 

Another method, while not a fail-safe, provides a quick way to accomplish this as well. You need to have 7-Zip installed (a free compression utility similar to WinZip).

 

Given the knowledge that a component usually has solid geometry and therefore a faceted representation, and also that an assembly has a default arrangement, you can use 7-zip to query the contents of a part file as follows:

 

Right click a .prt file and choose Z-Zip > Open archive and you'll see the following structure.  This will be the same for both assemblies and components.

Screenshot - 10_1_2014 , 11_32_46 AM.png

Double click the UG_PART folder and for an assembly you'll see two files; UG_PART and ExternalReferences.  For components you'll see additional JT files, therefore allowing you to distinguish between a piece part and an assembly:

Screenshot - 10_1_2014 , 11_35_14 AM.png

The caveat here is that assemblies can also contain bodies and so may also have JT references inside the UG_PART folder.  However, one additional feature that an assembly has is a default arrangement.  Go up one level in 7-Zip to return to the prt level and double click the part folder.  The component will only list attrs, whereas the assembly will also list arrangements, therefore allowing you to distinguish between an assembly and a piece part.

Screenshot - 10_1_2014 , 11_35_14 AM.png

These were simple parts, so the content inside the .prt container was minimal.  Expect to see differences if you use this approach.  This also helps to explain why renaming part files on the OS is not a good idea - as all you are doing is renaming the wrapper around the .prt content.

 

You may even be able to determine whether the file contains drawings. Again, not a fail-safe, but still a helpful piece of advice. 

Screenshot - 10_1_2014 , 11_50_39 AM.png'

Note: If all of the drawings are deleted, the drafting folder remains.  Whereas removing all components from an assembly will remove arrangements from the part folder and removing all bodies from a file will remove the JT references from the UG_PART folder.