Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

change ipart occurence color in assembly

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
411 Views, 2 Replies

change ipart occurence color in assembly

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

2 REPLIES 2
Message 2 of 3
nagwani
in reply to: Anonymous

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
Message 3 of 3
Anonymous
in reply to: nagwani

Yeah,It works now. Thanks Ishwar.

 

It seems my array declare was not right.

 

John

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report