- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
3 main ideas should be mentioned.
Step 1
You should scan AssmblyDocument.AllReferencedDocuments collection to find if your “Bracket 1234” part is used in the active assembly. You may check iProperties, parameters, attributes, filenames, etc. to identify your part.
Step 2
If “Bracket 1234” part document was found you may find all occurrences for this PartDocument:
'find all occurrences for every part found Dim oOccEnum As ComponentOccurrencesEnumerator Set oOccEnum = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oPartDocument)
This oOccEnum collection will contain all occurrences (from all hierarchy levels), so you do not need to traverse recursively the top-level assembly tree.
Step 3
Each component in the oOccEnum collection may be replaced by another component using ComponentOccurrence.Replace method.
If you prefer iLogic then you may consider the following function:
Component.Replace(“ComponentToReplaceName”, “OtherPartfilename.ipt”, <replaceAll>)
The third Boolean argument allows you to replace all instances of this component or just the single named instance.
http://help.autodesk.com/view/INVNTOR/2015/ENU/?guid=GUID-AFA099F1-B161-4822-914D-307F5CD8FE20
Hope this helps.
Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network