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: 

Ilogic and excell

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
MrAcam04
1275 Views, 15 Replies

Ilogic and excell

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

15 REPLIES 15
Message 2 of 16
MjDeck
in reply to: MrAcam04

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).


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 16
MrAcam04
in reply to: MrAcam04

Thank you very much

Message 4 of 16
MrAcam04
in reply to: MrAcam04

Would it be possible to have the parameter Material & Color read staight from my styles Material & Colors?

Message 5 of 16
MjDeck
in reply to: MrAcam04

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.

 


Mike Deck
Software Developer
Autodesk, Inc.

Message 6 of 16
MrAcam04
in reply to: MrAcam04

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")
Message 7 of 16
MrAcam04
in reply to: MrAcam04

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()
Message 8 of 16
MjDeck
in reply to: MrAcam04

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
 


Mike Deck
Software Developer
Autodesk, Inc.

Message 9 of 16
MrAcam04
in reply to: MrAcam04

Ok, Thank you very much for your time

 

I am not familiar with API but I am ready and willing to learn.

Message 10 of 16
MrAcam04
in reply to: MjDeck

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

 

Message 11 of 16
MrAcam04
in reply to: MrAcam04

Where do I input this code you provided?

Message 12 of 16
MjDeck
in reply to: MrAcam04

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.

 


Mike Deck
Software Developer
Autodesk, Inc.

Message 13 of 16
MrAcam04
in reply to: MrAcam04

NICE!

 

That worked like a charm, thank you very much for all your help.

Message 14 of 16
MrAcam04
in reply to: MrAcam04

The parameter field filled in nicely, however when I pick a different color the part doesn't change with it. Would you know Why?

Message 15 of 16
MjDeck
in reply to: MrAcam04

You have to add another rule to hook up the Color parameter.  Add a rule with just this line:

 

iProperties.PartColor = Color


Mike Deck
Software Developer
Autodesk, Inc.

Message 16 of 16
MrAcam04
in reply to: MrAcam04

Looks good, thanks again

 

I was receiving errors because I was entering all the codes under one rule.

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

Post to forums  

Autodesk Design & Make Report