Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Change size of parts from top level of assembly

harland.jU5ZCW
Contributor

Change size of parts from top level of assembly

harland.jU5ZCW
Contributor
Contributor

Hello,

I have an assembly with 17 subassemblies. Each of these subassemblies is made up of parts from a custom content center.

I want to be able to change the size of parts based on Part Numbers from the top level of the assembly.

For example, if there is any instance of a part in all subassemblies with a Part Number of FTS14019, I want to change their size to another part from the same content center family with a Part Number of FTS9019.

What way would I approach this?

0 Likes
Reply
256 Views
4 Replies
Replies (4)

A.Acheson
Mentor
Mentor

The easiest method would be to use the ilogic API and the capture tool n the editor. 
Go to your part in the ilogic model browser right click and component add. This will process the code needed to add this specific occurrence. Use this as a guide only as you might not want to add this part on its own. 

In the ilogic snippet  browser you should find a function for content center replace of a component. This should allow you to replace one component for another and even allow multiple replacements within the sub assembly. 

Actually replacing all parts in all sub assemblies will be a little more difficult as you will need to dip into the Inventor API to start working with all the occurrence. See VBA sample of replacing one part manually picked.

I would suggest to work first with the ilogic API and just get a replacement of one part to happen. Then work from there. Post any code your having difficulty with. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes

Michael.Navara
Advisor
Advisor

This is not an easy job. It requires too much code and that's why I don't do it for you. But few suggestions:

 

1) For replacing components you can use ComponentOccurrence.Replace Method which allows you to replace all occurrences at the one level. You need to call this on every sub-assembly.

 

2) How to obtain info about content center part. You can read some useful info from iProperties set: Content Library Component Properties {B9600981-DEE8-4547-8D7C-E525B3A1727A} where are information which allows you to identify the ContentFamily and ContentRow. This is important when you look for content center source.

 

3) How to get ContentFamily. You can use the method ContentCenter.GetContentObject Method. As the first argument you need to pass string which looks like "v3#<FamilyId>#" where <FamilyId> is the value of FamilyId iProperty from property set mentioned above. See ContentIdentifier property of ContentFamily. In this family you need to look for appropriate ContentRow with specified PartNumber.

 

 4) Ensure the content center model. Use ContentFamily.CreateMember Method to create/update appropriate model from content center. This method returns the file name of the model which can be used in replace method mentioned above.

 

 

I hope it helps. :grinning_face:

0 Likes

Curtis_Waguespack
Consultant
Consultant

Hi @harland.jU5ZCW ,

 

Here is a basic example done with 2023, see attached example files. 

 

bSize = InputRadioBox("Prompt", "Short", "Long", True, Title := "iLogic")

If bSize = True Then
	Dim myBolt = Components.AddContentCenterPart("My Bolt", "Fasteners:Bolts:Countersunk", "AS 1427 - Metric", "M2 x 4", , grounded := True)
Else
	Dim myBolt = Components.AddContentCenterPart("My Bolt", "Fasteners:Bolts:Countersunk", "AS 1427 - Metric", "M2 x 25", grounded := True)
End if
 

 

The easy way to get this code is to extract it:

  • From within a rule in your assembly that has the CC part, right click on the part in the Model tab as shown and choose Capture Current State ( Components.Add)
  • Exit the rule and change the CC part size manually
  • Back in the rule, extract the code using Capture Current State again
  • Create the conditional logic to choose when to use each, etc

Curtis_Waguespack_0-1715880413853.png

 

 

This example uses a grounded component, but one that uses constraints would be similar, but you would choose Capture Current State ( Components Constraints.Add) to extract the constraint code as well

Curtis_Waguespack_1-1715880614673.png

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

0 Likes

harland.jU5ZCW
Contributor
Contributor

Thanks, sounds like a good spot to start!

0 Likes