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
Solved! Go to Solution.
Solved by Myoula. Go to Solution.
Solved by MjDeck. Go to Solution.
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
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
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
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
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
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:
________________________
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).