- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, here I share an idea to access each occurrence within each element of a pattern of components in an assembly. You will have to put the name of your pattern of components in the string that I have highlighted in green.
Dim oPatName As String = "Component Pattern 1:1" Dim doc As AssemblyDocument = ThisDoc.Document Dim oCD As AssemblyComponentDefinition = doc.ComponentDefinition Dim oPatt As RectangularOccurrencePattern = oCD.OccurrencePatterns.Item(oPatName) If Parameter("Belt", "BucketRowQ") = 1 Then For Each oEl As Inventor.OccurrencePatternElement In oPatt.OccurrencePatternElements For Each oCC As ComponentOccurrence In oEl.Occurrences oCC.BOMStructure = 51972 Next Next End If
Please note that this change is made at the assembly level, not at the component level. you can place the same component as a reference in one element and the same component is not a reference in another element of the pattern if you access in this way. Also keep in mind that the code you provide works for a rectangular pattern. If you have a circular pattern you should change the definition of the pattern to CircularOccurrencePattern
I hope this helps with your work. Cheers!
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn