- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Change size of parts from top level of assembly
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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. ![]()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
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
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report