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: 

Using iLogic to change a value in embedded excel

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
d.salas.lazzari
351 Views, 5 Replies

Using iLogic to change a value in embedded excel

Hello, I would like to ask you for help (if this is feasible to do) with something that i am trying to achieve.

I have some .ipt parts that carry an embedded excel spreadsheet. For example i have a WN flange that on the sheet1 page has a simple table with the parameters on it. These changes when the "nominal diameter" changes.

I would like to know if it possible to write an iLogic code that overwrites (changes) the "nominal diameter" value so all other parameters change autimatically an the part updates.

It would be very useful since it would avoid opening the excel file every time.

 

Thanks in advance to anyone that will be willing to help me

 

5 REPLIES 5
Message 3 of 6
d.salas.lazzari
in reply to: Stakin

Thanks! I will take a look at the posts!

Message 4 of 6
A.Acheson
in reply to: d.salas.lazzari

Hi @d.salas.lazzari 

This snippet exist in your ilogic editor and here is a help page to better understand these snippets and functions.

In your parameter box you will see the name of the embedded excel file so change the code to match this name.

 

The example below will search for a column for a specific value and then return the row number. Once you have a row number you can either search another column and get a value (shown below or you could set a value.

i = GoExcel.FindRow("3rd Party:Embedding 1", "Sheet1", "Dia", "=", 0.2)
MessageBox.Show("Row No " & 1 )
dia =  GoExcel.CurrentRowValue("Dia")

MessageBox.Show(dia)

 Set a value

GoExcel.CellValue("3rd Party:Embedding 1", "Sheet1", "A1")= "1234"

 

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

UPDATE: Nevermind, i found it

 

adding GoExcel.Save

 

it updates the part when value is changed!

 

Thank you very much! Always on point!

-------------------------------------------------------------------------------------------
Hello @A.Acheson, thanks for the reply, it seems that effectively that is the way.

So i just added the second part to change the value in the embedded excel, and it actually changes it!

BUT, i still have to open the excel in order to have all the parameters updated, otherwise the ipt won't update

 

I am adding the file on this post, if you could take a little look, hope to not be bothering

Message 6 of 6

posting the solved file as a start point for future posts, @A.Acheson if you have some advise it will be very much welcomed

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

Post to forums  

Autodesk Design & Make Report