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: 

Color List in iLogic

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Myoula
1892 Views, 5 Replies

Color List in iLogic

How can I generate a list of colors to chose from?

Just as I can generate a list of materials to chose from:

 

MultiValue.List("primary_mat") = iProperties.Materials

 

I don't seem to be able to do the same for Colors:

 

MultiValue.List("primary_color") = iProperties.PartColor

 

The "iProperties.PartColor" was generated from the available code "snippets" in the iLogic editior, so I assume it is a valid choice.

 

I get the following error message:

"Unable to cast object of type 'System.String' to type 'System.Collections.IList'. "

 

Inv2011

 

Thanks,

Mike

 

5 REPLIES 5
Message 2 of 6
MjDeck
in reply to: Myoula

Here's a rule to get a list of the available colors:

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.PartColor will give you the current color of the part.  You can also use it to set the color of the part.  For instance:

 iProperties.PartColor = primary_color

 


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 6
Myoula
in reply to: MjDeck

Thanks! It worked!

How can one discover what functions to use if there are no appropriate "snippets" to use? How did you know about the RenderStyles object?

 

Thanks!

Mike

Message 4 of 6
MjDeck
in reply to: Myoula

The RenderStyles object is not specific to iLogic.  It's provided by the Inventor API.  You can see documentation for the API under Help -> Additional Resources -> Programming Help.  That has a lot of examples (mostly in VBA, but they can be converted to VB.NET for iLogic).

 We should probably add more snippets like this one to iLogic.

 

The main access points to the API from iLogic are the two predefined objects:

ThisDoc.Document  ' API type:  Inventor.Document

ThisApplication       ' API type :  Inventor.Application


Mike Deck
Software Developer
Autodesk, Inc.

Message 5 of 6
mies07
in reply to: MjDeck

Thanks again Mike,

I have a related question. I have done my best to sift through the topics in the   Help -> Additional Resources -> Programming Help section. For an interface that supposedly requires little if any programming background, it sure seems like you have to be an adavanced programmer to even know where to begin to look for inofrmation.

I am working through the iLogic tutorials, and the one for iLogic Assembly

http://wikihelp.autodesk.com/Inventor/enu/2012/Help/2144-Tutorial2144/2145-Inventor2145/2345-iLogic_...

 contains this code:

GoExcel.CellValue("part_number.xls", "Sheet1", "Block_Type") = component_type
GoExcel.CurrentCellValue("Block_Style") = block

 

How would I go about finding out what the difference is between

GoExcel.CellValue

and

GoExcel.CurrentCellValue

?

Thank you

 

 

 

 

Message 6 of 6
MjDeck
in reply to: mies07

The GoExcel functions are specific to iLogic.  They are not documented in the Additional Resources -> Programming Help.  The iLogic functions are described in the installed help on Inventor 2011, in the main help under:

Autodesk Inventor -> iLogic -> Functions -> Quick Reference

Excel Data Links functions are on that page.

For the online Wikihelp, it's in a similar location but under References instead of Quick Reference.  Here's a link for Inventor 2012:

http://wikihelp.autodesk.com/Inventor/enu/2012/Help/0073-Autodesk73/0673-iLogic673/0676-Function676#...

________________________

CurrentCellValue is very similar to CellValue.  In fact, you don't have to use CurrentCellValue.  You can use CellValue instead.

For CellValue, you can specify either:

-  the filename (or 3rd Party embedding or link name), sheet name and cell address

or

-  just the cell address

 

For CurrentCellValue, you can only specify the cell address.  That's the idea behind the name: it uses the current file and sheet name.  These are set up by a previous call to CellValue (or to GoExcel.Open).

 


Mike Deck
Software Developer
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report