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: 

How can I find valid color style names for use in iLogic rules

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
AutoDsteinV
737 Views, 2 Replies

How can I find valid color style names for use in iLogic rules

I will appreciate any help with this question.

 

The following code returns a list of the render style names in Inventor 2014 :

 

Dim colorList As New ArrayList

For Each style As RenderStyle In ThisDoc.Document.RenderStyles

colorList.Add(Style.Name)

Next

MultiValue.List("primary_color") = colorList

iProperties.Value("Summary", "Comments") = _

ThisApplication.ActiveDocument.ActiveRenderStyle.Name

 

The code returns a list of  render style names:

 

Gold-Metal

Gunmetal-Polished

Titanium-Polished

Steel Blue

Silver

and more . . .

 

If I use these names in an iLogic rule to set the part color:

iProperties.PartColor="Gold-Metal"

 

I get an error (system argument exception).

 

The correct argument is:

iProperties.PartColor="Gold Metallic"

 

The following render style names also return an exception:

iProperties.PartColor="Gunmetal-Polished"

iProperties.PartColor="Titanium-Polished"

 

The correct arguments are:

iProperties.PartColor="Gunmetal (New/Polished)"

iProperties.PartColor="Metal-Titanium (Polished)"

 

Where/how can I get a list of correct color style names to use in iLogic rules in Inventor 2014 ?

 

Thank you for considering my request.

2 REPLIES 2
Message 2 of 3

Could you please test iLogic rules in the attached part model.  They works for me.

 

This rule populates multi-value parameter with the styles names:

 

MultiValue.SetValueOptions(True, DefaultIndex := 0) 

Dim colorList As New ArrayList
For Each style As RenderStyle In ThisDoc.Document.RenderStyles
    colorList.Add(Style.Name)
Next
MultiValue.List("primary_color") = colorList

Beep
MsgBox("Done")

 

This rule changes active style:

iProperties.PartColor =  primary_color
iProperties.Value("Summary", "Comments") = _
ThisDoc.Document.ActiveRenderStyle.Name

 cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

Vladimir Ananyev,

I was in Paris/France when you posted the code that solves the problem, and did not have access to my HP Z1 workstation to test your code.
I have now tested your code and it works.
The line “iProperties.PartColor = primary_color” in “This rule changes active style:” does the trick.
I can now use the color style names in the list “primary_color” to set the part color . . . with no errors.

I really appreciate your help.

AutoDsteinV

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

Post to forums  

Autodesk Design & Make Report