Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Way to rename solid body and component at same time

estringer
Advocate
Advocate

Way to rename solid body and component at same time

estringer
Advocate
Advocate

We create multi-solid models and then make components from those. Is there a way to rename the solid body and also have the component name update at the same time?

Reply
1,207 Views
5 Replies
Replies (5)

NachitoMax
Advisor
Advisor

Hey

 

Complicated. The solid body doesnt know what component its owned by, only the component knows that. When you rename a solid body, the named reference is downstreamed to the owning component(s) which can be seen when you expand the basemodel node in the browser

CompName.jpg

If i was to do this, i would probably have an assembly button to loop through the components and check the base model names against the current name. If they were different, save the component as a new component with the new name then replace the old with new, deleting the one replaced from file. If the component is in a sub assembly, you need to access the sub assembly first in order to change the component then look for other instances of the same component in the overall assembly to change them too.

 

Manually, you can Save and Replace the component in the assembly and use the new name. Save & Replace by code isnt the most straight forward process as its not exposed directly in the API

 

HTH

 

Nacho

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes

WCrihfield
Mentor
Mentor

I think I worked with a very similar situation the other day.  Give the solution I provided on this other post a look, and see if it's something you may be able to use as a reference to get you started here.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

estringer
Advocate
Advocate

I understand this until this part:

	oBody = oNode.NativeObject
	oFullPath = oNode.BrowserNodes.Item(1).FullPath
	oPName = Split(oFullPath, ":")(Split(oFullPath, ":").Length - 2)
	oIndex = Split(oFullPath,":")(Split(oFullPath,":").Length-1)
	oNewName = Replace(oPName,".ipt","") & "-" & oIndex
	oBody.Name = oNewName

How is this pushing the updated name to the Asembly? At the oNewName, it is removing the file extension to rename the part in the Assembly? It looks like the "-" is probably specific to the question that was being asked in the original post.

0 Likes

WCrihfield
Mentor
Mentor

Perhaps I need to better understand the exact process you're going through, and more specifically which documents you're wanting the code to effect, and at what times.

I am assuming you're starting out with a Multi-body Part file.  Then, either selecting all the bodies (in the "Solid Bodies" folder), right clicking, and choosing "Make Components" from that right click menu, or going to the Manage tab and clicking the Make Components tool button, then selecting the bodies from the Solid Bodies folder.  Is that right?

Then you're telling the dialog box to "Insert components in target assembly", specifying your assembly name, template file, path, and clicking Next.  Right?

Are you specifying new component names within this secondary dialog box, or accepting the default computer generated ones?  The component names specified in that dialog will become the individual part's file names.

Now the new assembly is open, and you have to save it at least once before the individual part files are generated, right?

Now are you wanting to change the names of the components within this assembly?

Do you want to change name of the Derived Part Feature below the Origin folder within the newly generated individual part files?

Do you want to change the names of the items in the Solid Bodies folder of the newly generated individual part files?

Or some combination of these options?

Do you maintain, suppress, or break the links between the derived parts and the original multi-body parts?

Do you need to access any of the iProperties of any of the files involved, as part of the re-naming process?

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

estringer
Advocate
Advocate

Yes, we use Make Components from the multi-solid, insert them into a target Assembly as you described. We accept the default names because typically they are edited to the part name that we will use in our BOM. Then we do the first save. Sometimes the parts need to have the names changed as an edit will be made to the part that justifies this. Currently we will change the name in the multi-solid and go and then change the name of the individual part name through Vault. I was wondering if there is a way to change the name of the part file or change the name of the original multi-solid and have this change affect the other "part" or instance. It may not be important to change the name of the Derived Part Feature below the origin folder as long as that does not cause problems with linking back to the original multi-solid model or the Assembly. We want to keep those links. As part of our process, we are pushing iProperties to the parts right after the Target Assembly has been created. I don't see a need to access them later but if the information changes, the iProperties will need to be updated as we are using them to auto-fill title blocks on our part drawings..

0 Likes