change ipart occurence color in assembly

change ipart occurence color in assembly

Anonymous
Not applicable
496 Views
2 Replies
Message 1 of 3

change ipart occurence color in assembly

Anonymous
Not applicable

hi,

 

This one work:

 If L(i) = 1 Then oOcc.RenderStyle = _invApp.ActiveDocument.RenderStyles.Item("Red")
                    If L(i) = 2 Then oOcc.RenderStyle = _invApp.ActiveDocument.RenderStyles.Item("Yellow")

 But I want to change like this and it not work:

Lcolor(1)="Red"
Lcolor(2)="Yellow"

L(2)=1
L(1)=2

for i=1 to 2
oOcc.RenderStyle = _invApp.ActiveDocument.RenderStyles.Item(Lcolor(L(i)))
next

 What's wrong?

 

Thank for help

 

John

0 Likes
Accepted solutions (1)
497 Views
2 Replies
Replies (2)
Message 2 of 3

nagwani
Alumni
Alumni
Accepted solution
Hi There, I could not reproduce the issue. I tried following sample code in VBA and it worked fine. Regards, -Ishwar N Sub occRender() Dim doc As AssemblyDocument Set doc = ThisApplication.ActiveDocument Dim def As AssemblyComponentDefinition Set def = doc.ComponentDefinition Dim occ As ComponentOccurrence Set occ = def.Occurrences.Item(1) Dim lColor(1 To 2) As String Dim l(1 To 2) As Integer lColor(1) = "Red" lColor(2) = "Yellow" l(2) = 1 l(1) = 2 For i = 1 To 2 occ.RenderStyle = doc.RenderStyles.Item(lColor(l(i))) Next End Sub
0 Likes
Message 3 of 3

Anonymous
Not applicable

Yeah,It works now. Thanks Ishwar.

 

It seems my array declare was not right.

 

John

0 Likes