• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

rename bodies - mutibody part

  • Thread starter Thread starter il_Batto
  • Start date Start date

il_Batto

Guest
Hello, everyone!
I tried to search around (forum + internet) a tool or methodology to rename the bodies of a multibody part.

I find myself parts composed of multibody (about 500 solids) and I would like to rename them according to the customer's instructions.
I need this for, once exported as a derivative assembly, already have all the names of the settled parts.

I know I can rename the individual body one by one, but I would like to know if there is a way to automate the procedure.
the maximum would be to have a function like excel where renamed the first others rename by dragging a selection since my need is to have the codes in sequence.

so to understand:1591872598578.webpThank you.
the bat
 
Hi.
is a problem solved by "catafract"
 
Thank you! You saved me the afternoon!
And I'm sorry, but I didn't find the post.

If the first does not work, but the second yes, now I have another request for the most experienced.. .

I have already changed some parameters according to my needs, but how can I do to ensure that the sequence for the body is:
C201
...
...
C690

i.e. starting from 200 and not from 001
I ask why for some parts I have to start from 101 but for others I have to start from 201, 301, etc etc. (not to create cases in the workshop with the various parts)

this the text of the ilogic reported in the txt attached kindly by @matteo hats dis.cad

syntaxeditor code snippetdim sb as surfacebody
dim doc as partdocument = thisdoc.document
dim sbs as surfacebodies = doc.componentdefinition.surfacebodies
dim suffix as integer = 1

' loop through all solid bodies, renaming them
for each sb in sbs
sb.name = "c2" & cstr(suffix).padleft _
(len(cstr(doc.componentdefinition.surfacebodies.count)), "0")
suffix +=1
next
 
Here's what you're looking for:

'define the active document
partdoc = thisapplication.activedocument
dim solid as surfacebody
dim i as integer

character = inputbox("prompt", "reference letter", "c")
i = inputbox("prompt", "starting number", "200")

'rename all solid bodies incrementing suffix
for each solid in partdoc.componentdefinition.surfacebodies
if solid.visible = true
solid.name = character + iif (i < 10, "0" + cstr(i), cstr(i))
i = i + 1
end if

next
 
santa polenta!
@matteo hats dis.cad You're my idol!
Tell me where you live and I offer you everything you ask... lunch... dinner... beers... aperitifs.... anything!

Thank you very much! ! !
(also because I found out from a colleague who in a while will come a part with about 2500 bodies... it would be madness to call them one by one)
 
excellent
This wasn't "my bag flour."... I took it and changed it for your request
Good job
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top