Dim componentA = Components.AddContentCenterPart

Dim componentA = Components.AddContentCenterPart

donaldleigh
Advocate Advocate
942 Views
1 Reply
Message 1 of 2

Dim componentA = Components.AddContentCenterPart

donaldleigh
Advocate
Advocate

Hi all

 

Has anyone noticed that when you use the 

Dim componentA = Components.AddContentCenterPart

 to change a CC part the browser name does not change. IE I'm setting up an assembly that changes the size of bolts, nuts and washers. I have the rule working correct but the name in the browser dose not reflect the size of the bolt. I have attached a screen shot

 

Is there a way to have the browser show the correct name

 

Donald

Inventor 2021

0 Likes
Accepted solutions (1)
943 Views
1 Reply
Reply (1)
Message 2 of 2

dutt.thakar
Collaborator
Collaborator
Accepted solution

@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
0 Likes