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: 

Sending values from Custom iProperties in drw. file to Excel

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
tomislav.peran
263 Views, 7 Replies

Sending values from Custom iProperties in drw. file to Excel

This snippet works when using parameters in assembly:

 

GoExcel.CellValue("My Excel.xlsm", "Sheet1", "D3") = iProperties.Value("Custom", "Number")

 But not when the same parameters are in the iProperties in the drawing file. Does anybody know why this does not work for drawings?

 

Tom

7 REPLIES 7
Message 2 of 8

How it "does not work"?

Program crash?  Give you wrong info?

 

Do you want to get the iProperty in drawing?

Or iProperty of the assembly/part in the drawing?

Message 3 of 8

Nothing happens, no errors, unfortunately.

 

I want to get value from the iProperty in the drawing. The rule is also written in the drawing.

 

 

Message 4 of 8
A.Acheson
in reply to: tomislav.peran

Is the custom iproperty in the drawing? 

Isolate the excel portion to check you get the correct value back from the drawing. Try this. 

If you get the value then you might have an issue contacting excel. Please attach any error messages your seeing. 

MessageBox.Show(iProperties.Value("Custom", "Number"))

 Also you mentioned parameters. Parameters work differently in the drawing. For text parameters there is no export option to iproperties at least in the older versions. Can you share a screen shot of the value in parameter window or iproperty window your trying to send to excel. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 5 of 8
tomislav.peran
in reply to: A.Acheson

Hi Acheson,

 

Thank you for checking my question.

 

Is the custom iproperty in the drawing? 

Yes, the value is in the iproperty of the drawing. 

 

Isolate the Excel portion to check you get the correct value back from the drawing. Try this. 

If you get the value then you might have an issue contacting excel. Please attach any error messages your seeing. 

MessageBox.Show(iProperties.Value("Custom", "Number"))

 That is a good idea. I have tested it and I do get the correct value in the MessageBox. 

 

Also you mentioned parameters. Parameters work differently in the drawing. For text parameters there is no export option to iproperties at least in the older versions. Can you share a screen shot of the value in parameter window or iproperty window your trying to send to excel. 

 

Sure, the value is a number, not a text. 

tomislavperan_0-1695624902292.png

 

The rule that I want to use to export the value is also in the drawing:

GoExcel.CellValue("MyExcel.xlsm", "Sheet1", "D68") = iProperties.Value("Custom", "VSSPUD_193.7x10x3000")

 

The Excel sheet is in the same folder as the drawing. 

 

I do not get any errors, just nothing happens. 

However, exporting values from assembly works well with the snippet above which makes me wonder if I should use some other snippet in the drawing. 

 

Tom

Message 6 of 8

So, if parameters need to be exported from the drawing then I need to use the following snippets:

 

GoExcel.Open("MyExcel.xlsm", "Sheet1")
GoExcel.Save
GoExcel.Close

 

But I do not use those snippets if I export values from assembly. 

 

I am a bit confused about why is that but at least this is solved. 

Thanks for the help.

Message 7 of 8
A.Acheson
in reply to: tomislav.peran

The cellvalue function had its own file open method internally so you shouldn't need the open line before hand but you will need to save,then afterwards close. See Go Excel functions help article here.

 

Maybe there is an issue getting the excel filename in the drawing folder? You could also use the ilogic path function and concatenate the string path and see does it work better. 

 

 

Dim fileName As String = ThisDoc.Path & "\MyExcel.xlsm"

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 8 of 8
tomislav.peran
in reply to: A.Acheson

Hello,

 

The cellvalue function had its own file open method internally so you shouldn't need the open line before hand but you will need to save it afterwards close. Go Excel functions

 

That explains it then. Thanks for the link!

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report