@donaldleigh
When you use Component.AddContentCenterPart function the first thing you are passing as an argument after bracket is the occurrence name, it will keep the same name if you write something in it. As an example, in below code, I have written "My Bolt" just after starting the function, that is the name you see in the browser, here we are adding M6 x 10 bolt, after using this, it will add the correct bolt but the browser will show "My Bolt" only. If you then again go to iLogic and change the designation from "M6 x 10" to "M6 x 12" it will replace the bolt but the name will be "My Bolt" only.
Dim componentA = Components.AddContentCenterPart("My Bolt", "Fasteners:Bolts:Socket Head", "DIN 404",
"M6 x 10", position := Nothing, grounded := False,
visible := True, appearance := Nothing)
If you don't want it this way, you can just left the first field blank and keep rest of the thing same. As mentioned below, you can see I have removed "My Bolt" here and now it will place the same fastener but it will keep the name as per the content center format. But now if you are thinking to change the size of the same bolt you have placed earlier it will not work, because to do that you need something in the beginning of this function argument like I had "My Bolt" in above code.
Dim componentA = Components.AddContentCenterPart("", "Fasteners:Bolts:Socket Head", "DIN 404",
"M6 x 10", position := Nothing, grounded := False,
visible := True, appearance := Nothing)
What I found useful is you can use ThisAssembly.BeginManage and ThisAssembly.EndManage in the beginning and ending of the code. Look at below code that does the same what you are looking for. In below example, I am changing the size based on a multivalue parameter named as Bolt, and it is replacing the size with the correct names in the browser.
ThisAssembly.BeginManage("Fastener")
If Bolt = "A"
Dim componentA = Components.AddContentCenterPart("", "Fasteners:Bolts:Socket Head", "DIN 404",
"M6 x 10", position := Nothing, grounded := False,
visible := True, appearance := Nothing)
Else
Dim componentA = Components.AddContentCenterPart("", "Fasteners:Bolts:Socket Head", "DIN 404",
"M8 x 10", position := Nothing, grounded := False,
visible := True, appearance := Nothing)
End If
ThisAssembly.EndManage("Fastener")
I guess, for now this will serve your purpose and do exactly what you are asking in the question.
Please accept it as solution, if this has answered your question.
Regards,
Dutt Thakar
If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!
Regards,
Dutt Thakar
LinkedIn