Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations Danlap on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

export bodies into individual files

Status
Not open for further replies.

cadrebel

Mechanical
May 11, 2011
46
I model using all my pieces as bodies in one file. I am looking for a way to export each body into individual files that would be named the same as the body name.
I would also like to know if there is a simple way to take this main file and convert it to an assembly.
 
Replies continue below

Recommended for you

a simple way to take this main file and convert it to an assembly
If you navigate to Assemblies -> Components -> Create New Component, it will allow you to select one of your solid bodies and export it to its own file, then import it back in as a component. Repeat for each solid you wish to make into a component. If you have many solid bodies, it may be worth the time to create a journal to automate this process.

 
This is called the "Top down" method.
You may want to search your NX doc for those two words.
 
thanks for the info. I would like to get to the bulk version of export. All the bodies at once.
I was not aware of the "top down" term, I will check it out.
if I write a vb for this, does anyone know how to get it to pull the name from the body property?
 
does anyone know how to get it to pull the name from the body property?
If you have given the solid bodies names, the following journal will display them in the listing window. If the journal indicates it has no name, perhaps you renamed a feature rather than the solid body (if the name shows up in the part navigator, you most likely have renamed a feature).

To display names of entities on screen, go to Preferences -> Visualization -> Names/Borders and select the 'work view' setting for 'object name display'. The name the journal returns will match the name displayed with this setting.

To return the feature name will require a different approach.

Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal
Sub Main

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim lw As ListingWindow = theSession.ListingWindow
Dim mySolidBodies() as Body

lw.Open

lw.WriteLine("Collecting solid bodies...")
mySolidBodies = displayPart.Bodies.ToArray

For each obj as Body in mySolidBodies
	lw.WriteLine("Object Tag: " & obj.Tag)
	if obj.Name = "" then
		lw.WriteLine("Solid Body has no name")
	else
		lw.WriteLine("Name: " & obj.Name)
	end if
	
	lw.WriteLine("")
Next

lw.Close

End Sub

End Module

 
thank you for the help, I will give it a try
 
rebel, if you artificially create a DESC attribute in the Part Nav with Timestamp Order = OFF you may be able to have your generated component to read that name.
I searched for your threads as you had responded to one of mine earlier about Model Size. I did not get an email notification of that response. The thread is now closed, unfortunately.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor