Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic: Export parameters to Excel

10 REPLIES 10
Reply
Message 1 of 11
deltades
4326 Views, 10 Replies

iLogic: Export parameters to Excel

Hi I want to export reference parameters to an excel table using i-Logic

I found the function GoExcel.CellValues("filename.xls", "Sheet1", "A2", "A10") = MultiValue.List("d0")

It looks like the syntax calls for the file location and name if the xls file is not open and if open is not supposed to be required.

I have entered it both ways and with and with out the target file open and with the function GoExcel.Open("path\Filename.xls","sheet1") and continue to get the error:

 

Sorry, we couldn't find C:\Abell\Abell Vault\WorkSpace\DEVELOPMENT\AC100-0100MRL\TEST Table.xls. Is it possible it was moved, renamed or deleted?

 

Also, I was expecting that to fill in the sheet cell's would be MultiValue.List("d0","d1","d2")

but the system give me an error that says

Error on Line 3 : Overload resolution failed because no accessible 'List' accepts this number of arguments.

 

See below

 

GoExcel.Open("C:\Abell\Abell Vault\WorkSpace\DEVELOPMENT\AC100-0100MRL\TEST Table.xls", "AC-100-0101003-TEST")
GoExcel.CellValues("C:\Abell\Abell Vault\WorkSpace\DEVELOPMENT\AC100-0100MRL\TEST Table.xls", "AC-100-0101003-TEST", "A2", "A10") = MultiValue.List("d194_A")
GoExcel.Save
 
10 REPLIES 10
Message 2 of 11
swordmaster
in reply to: deltades

Hi,

The need to show the path to your excel file has nothing to do with its status (open or unopen)

If no path is given in the rule ilogic presumes that the workbook is in the same folder as the inventor document. So if it is not in the same folder you need to give the path.

Since you have included the filename and path in the GoExcel.Open line of code you do not need to include this  again in the ilogic rule therefore your next line can be simplified to

GoExcel.CellValues("A2", "A10") = MultiValue.List("d194_A")

 

You could also change ("A2","A10") to ("A2","")

then ilogic will use as many cells as needed to contain the values of your multivalue list

 

Hope this helps somewhat

Inventor 2010 Certified Professional
Message 3 of 11
deltades
in reply to: swordmaster

Thanks for the reply Sordmaster, Ok.. so the file is in the same location, no problem, ... Doh! I just realized that the file extension .xls was wrong.. its .xlsx. Ok.. that works

So how do I populate the MultiValue.List? I thought it would be something like MultiValue.List("d195_A","d196_B","d197_C") but after looking at similar discussion threads it looks like I need an array veriable and need to populate that array with my parameters and then set the MultiValue.List = to that

Thanks in advance...

I just found a related thread that seems to indicate that only Parameters that can be set as "MultiValue can be used in this manner. I was trying to capture data from reference Parameters, So I don't think this can be used in this way.

Any thoughts?

Thanks

Message 4 of 11
swordmaster
in reply to: deltades

I think i am not fully understanding what your trying to achieve (been a long day)

If you have your multivalue parameter already set up in your Inventor file AND want to send the individual values of that list to individual cells on the work book then use

GoExcel.CellValues("start cell","") = Multivalue.List("parameter")

 

So if you have a multivalue list with values 1,2,3,4,5 and your start cell in the excel is A10

A10 will get the value 1 , A11 will get the value 2 and so on

 

 

Inventor 2010 Certified Professional
Message 5 of 11
deltades
in reply to: swordmaster

Yes.. thats pretty much what I want..

See Bellow...

The MultiValue list consists of data from reference dimensions.

I can make the MultiValue.SetList(...) work ..now I want to pass that to GoExcel.CellValues("A2", "")=MultiValue.List(...)

I tried to put the param names in to it directly but it did not like that. I think because its all reference dimensions.

So I thought to make an array "MyList" to pass the data but thats not working so far.

the aultimate goal is to pass these to a tabel in a drawing.

 

Dim MyList As ArrayList

MyList = MultiValue.SetList("d194_A","d195_B","d196_C","d197_D","d198_E","d199_F","d200_G","d201_H","d202_J")
GoExcel.Open("TEST Table.xlsx","AC100-0101003-TEST")
GoExcel.CellValues("A2", "") = MultiValue.List(MyList)
GoExcel.Save
Message 6 of 11
deltades
in reply to: swordmaster

Accroding to all the research I have found with repect to this topic the statement below should work and yet no mater what I put in I get errors

"Value of type 'Autodesk.iLogic.Interfaces.DoubleForEquals' cannot be converted to 'System.Collections.IList'

"Overload resolution failed because no accessible 'CellValue' accepts this number of arguments." and
"Comma, ')', or a valid expression continuation expected." if I don't put the File name in "".

 

GoExcel.CellValue(fileName, "Sheet1", "A2") = d0

 

Message 7 of 11
swordmaster
in reply to: deltades

Tried a simple example one parameter passed to one cell

GoExcel.CellValue

("myexcel.xls", "Sheet1", "A2")=d1

GoExcel.Save

 

worked for me

Inventor 2010 Certified Professional
Message 8 of 11
deltades
in reply to: swordmaster

Yea... I think I figured out my problem... What I am trying to do is to exports a set of reference dimensions and the code that I have been working on does not allow for this. This code needs a "multi-var" setting on the paramater which you can not do to ref dims.

I realized earlier today that I did have a macro script that accomplished what I am trying to do but now I can't find the file. 😞

 

Message 9 of 11
swordmaster
in reply to: deltades

you  could create user parameters whose values are equal to the reference parameter.

Then export those user parameters

Inventor 2010 Certified Professional
Message 10 of 11
bespel
in reply to: swordmaster

Do you have an idea why this doesn't work?

 

 

 

MultiValue.List("myparameter") = GoExcel.CellValues("MyExcel.xlsx", "Sheet1", "A2", "A502")

GoExcel.CellValues("OtherExcel.xlsx", "Sheet1", "A3", "A503" = MultiValue.List("myparameter")
GoExcel.Save
GoExcel.Close

 

 

(I have created before a user parameter called myparameter )

 

I get an error "Property access must assign to the property or use its value"

Message 11 of 11
johnsonshiue
in reply to: bespel

Hi! I am not sure I understand the second line of the rule. There seems to be one parenthesis missing. Also, I am not sure the way the function works according to those arguments.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer

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

Post to forums