06-27-2022
05:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-27-2022
05:36 AM
For something like this I think you can do everything in a single loop instead of multiple loops and trying to keep track of everything. Try this.
Dim assemblyDoc As Inventor.AssemblyDocument = ThisApplication.ActiveDocument
Dim cubeOccurrencePrefix = "Cube:"
Dim numberOfOccurrences As Integer = 0
For Each occurrence As Inventor.ComponentOccurrence In assemblyDoc.ComponentDefinition.Occurrences
If occurrence.Name.Contains(cubeOccurrencePrefix) Then
numberOfOccurrences += 1
occurrence.Name = cubeOccurrencePrefix & numberOfOccurrences
Component.IsActive(occurrence.Name) = False
End If
Next