I created a parameter name called Material (multi line) and an excell file called Material as well. (A1=Nest-Pine A2=Nest-Oak A3=Nest-Maple). I need help on the ilogic end in order to have the parameter read the list in excell. I linked the excell file to my part file as well. Looking for help, thank you
Solved! Go to Solution.
Solved by MjDeck. Go to Solution.
Here's a rule statement that should do it:
MultiValue.List("Material") = GoExcel.CellValues("3rd Party:filename.xls", "Sheet1", "A1", "")
This will read down the column until it finds a blank cell.
If you want it to read only up to a particular cell (such as A3), use this instead:
MultiValue.List("Material") = GoExcel.CellValues("3rd Party:filename.xls", "Sheet1", "A1", "A3")
This is looking on Sheet1. Change the filename and sheet name if necessary.
(In the iLogic rule editor, this is in the System Snippets under Excel Data Links -> MultiValue list from Excel).
This is not available for colors (but you could do it with the API).
For materials, here's a snippet:
MultiValue.List("Material") = iProperties.Materials
This is on the System Snippets, under iProperties -> List of Materials
It gives you all materials, so it's probably too much for any given part.
Is it possible to pull the list of colors from the xml file? I tried this but it doesn't work
MultiValue.List("Color") = iLogicVb.Automation.ParametersXmlLoad(ThisDoc.Document, “G:\Design\Design Data\Colors.xml")
In Ilogic under iproperties there is PartColor, is there a snippet that will allow me parameter field read the color iproperty. I tried the one below and received errors.
MultiValue.List("Color") = iProperties.PartColor
InventorVb.DocumentUpdate()
This is pretty easy using the API. Here's how to do it:
Dim colors as New ArrayList
For Each renderStyle As RenderStyle In ThisDoc.Document.RenderStyles
colors.Add(renderStyle.Name)
Next
MultiValue.List("Color") = colors
This looks like a great place to begin learning. Thought I would help others find the information as well. Good Luck to you all
http://modthemachine.typepad.com/my_weblog/begging-api/
http://www.caddigest.com/subjects/adsk_inventor/tutorials.htm
Autodesk Inventor API
Part 1-3
The code I provided:
Dim colors as New ArrayList
For Each renderStyle As RenderStyle In ThisDoc.Document.RenderStyles
colors.Add(renderStyle.Name)
Next
MultiValue.List("Color") = colors
can be used as an iLogic rule by itself. Add a new rule in a part and paste in this code.
The parameter field filled in nicely, however when I pick a different color the part doesn't change with it. Would you know Why?
You have to add another rule to hook up the Color parameter. Add a rule with just this line:
iProperties.PartColor = Color