Hello everybody,
I have small problem. I have lot of bodies (50) with name solid1.... solid50.
How can I quickly rename all bodies according some template for example "Plate_01... Plate_50"?
It is possible to use ilogic? or maybe will be better to use vba.
Somebody have idea??
Thank you for helps,
TJ
Solved! Go to Solution.
Solved by barbara.han. Go to Solution.
hey friend i'm new at inventor and posting for help, and old with autocad , this sounds like just what I need, if you could help me too
thanks a lot
hi ,
I viewed this post recently , regarding a code that you have writen (
I personally like to use VBA. So what you want is to rename the solid1....solidX? The Inventor API allows you to change the Name of the solid - actually it's Name property of the SurfaceBody interface in Inventor API world.
Here is the code that you can try:
Sub changeSolidName()
Dim ptDoc As PartDocument
If ThisApplication.ActiveDocument.DocumentType <> kPartDocumentObject Then
MsgBox "please open a part document"
Exit Sub
End If
Set ptDoc = ThisApplication.ActiveDocument
Dim solid As SurfaceBody
Dim j As Integer
Dim prefix As String
prefix = "Plate_"
j = 1
For Each solid In ptDoc.ComponentDefinition.SurfaceBodies
solid.Name = prefix + IIf(j < 10, "0" + CStr(j), CStr(j))
j = j + 1
Next
End Sub
Hope this helps.
Thank you for your help. The script work perfect. I modified a litle bit your script but source is the same.
Thank you one more time.
Hi Saturator
Did you recieve my message sent to your inbox?
I actually put an ilogic code in there for you to rename the solid names.
Please reply to my inbox message and i'll send through to you the code to automatically transfer the thickness, width and length of solids to their repected individual parts generated.
Hello to all,
I need help in renaming solid body names. We use copy design at my work place often and renaming the solid bodies is a part of the task we have to keep all things in sync. The auto rename is a great iLogic rule for first time use but here we mane extend that naming to LH End Panel. Using the above logic rule I would lose the LH End Panel for example XXXXXX01 LH End Panel new body name YYYYYY01 I would like a rule that I can change the first characters that I specify like a find and replace all.
Any help would be greatly appreciated.
Hi,
You could create a rule like this, where you can set what to replace with what:
myparam = InputBox( "/ ", "Replace In Solid Name", "ReplaceThis/WithThis (keep the '/' as separator)") If (myparam <> "") Then myparams = myparam.Split("/") replaceString = myparams(0) withString = myparams(1) For Each solid In ThisDoc.Document.ComponentDefinition.SurfaceBodies name = solid.Name name = name.Replace(replaceString, withString) solid.Name = name Next End If
E.g. if I provided "My/Your" then it will replace all instances of "My" with "Your"
I hope this helps.
Cheers,
Hi tauwkh1,
adam.nagy's code looks like it might work well for you, but I used the code provided by Barbara Han to do something similar in the past as well:
http://inventortrenches.blogspot.com/2012/02/ilogic-to-rename-all-solid-bodies.html
I just thought I'd share that link in case it helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Inventor Forum links: Inventor iLogic , API and Customization Forum | Inventor Ideas Forum | General Inventor Forum
Hi there,
In your (PACDrafting's) comment above you talked about pushing values of length, height, and thickness into each individual part file. Can I ask how you generally go about doing this? Do you have a specific parameter for length, height, and thickness tied to each solid body?
Sounds good. Thank you. I was just curious because it would be helpful for us to use something like this. However the material we model potentially each "piece" could and may have a different L, H, Thk. And these dimensions are not always on the same plane. So I was just interested how other people where working with it. I am not too familiar with sheet metal parts so I do not know if there is different functionality with that vs regular parts.
Thanks for the insight though.
I'm sorry I answered you incorrectly. The routine will ask you for what you want to replace with the new information. For example my solid is Steelxx and I want Alumyyy it works like find and replace
Hi akosi,
I don't have time to look at this at the moment, but this link has an example that looks at Sketch Block names, so it might help you move forward:
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Inventor Forum links: Inventor iLogic , API and Customization Forum | Inventor Ideas Forum | General Inventor Forum
thanks for replying curtis...i was just checking out your inventortrenches blog..
im new in vba and am learning to code from this forum...
and i still have so much more to learn..
Could you tell me what I did wrong here?
I'm getting this error message:
Error in rule: Name, in document: Frame102-40Deriver.ipt
Conversion from string "22Deriver" to type 'Integer' is not valid.
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 5870 StartFragment: 314 EndFragment: 5838 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
myparam=InputBox("/", "Replace In Solid Name", "ReplaceFrame102-Deriver/WithFrame102-40Deriver (keep the '/' as separator)")If(myparam<>"")Thenmyparams=myparam.Split("/")replaceString=myparams("22Deriver")withString=myparams("40Deriver")ForEachsolidInThisDoc.Document.ComponentDefinition.SurfaceBodiesname=solid.Namename=name.Replace(replaceString, withString)solid.Name=nameNextEndIf
Can't find what you're looking for? Ask the community or share your knowledge.