Message 1 of 7
Calling all iLogic Gurus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am seeking assistance with recoding my iLogic script. To simplify the testing process, I have reduced my assembly to just two .ipt files. However, I continue to encounter the same errors repeatedly, regardless of the changes I make to the code.
My goal is to change the color appearance of multiple part files within an assembly without having to modify each part individually.
Thank you in advance for your help.
Best regards,
' iLogic rule to color parts in an assembly Dim oAssyDoc As AssemblyDocument oAssyDoc = ThisApplication.ActiveDocument Dim oCompOccs As ComponentOccurrences oCompOccs = oAssyDoc.ComponentDefinition.Occurrences ' Define colors Dim colorList As String() = {"Slate"} Dim colorIndex As Integer = 0 For Each oOcc As ComponentOccurrence In oCompOccs Try ' Get the appearance style from the document's appearance library Dim oAppearance As Asset oAppearance = oAssyDoc.Assets.Item(colorList(colorIndex)) ' Apply the appearance oOcc.Appearance = oAppearance colorIndex = (colorIndex + 1) Mod colorList.Length Catch ex As Exception MessageBox.Show("Error setting color for component: " & oOcc.Name & vbCrLf & "Error: " & ex.Message) End Try Next
My code:
' iLogic rule to color parts in an assembly Dim oAssyDoc As AssemblyDocument oAssyDoc = ThisApplication.ActiveDocument Dim oCompOccs As ComponentOccurrences oCompOccs = oAssyDoc.ComponentDefinition.Occurrences ' Define colors Dim colorList As String() = {"Slate"} Dim colorIndex As Integer = 0 For Each oOcc As ComponentOccurrence In oCompOccs Try ' Get the appearance style from the document's appearance library Dim oAppearance As Asset oAppearance = oAssyDoc.Assets.Item(colorList(colorIndex)) ' Apply the appearance oOcc.Appearance = oAppearance colorIndex = (colorIndex + 1) Mod colorList.Length Catch ex As Exception MessageBox.Show("Error setting color for component: " & oOcc.Name & vbCrLf & "Error: " & ex.Message) End Try Next