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 loop to excell problem

3 REPLIES 3
Reply
Message 1 of 4
nomé
282 Views, 3 Replies

Ilogic loop to excell problem

Hi InventorWizardz, 

 

I have a problem with the folowing script: 

 

Ivolume = iProperties.Volume/1000 '(in cm^3)GoExcel.CellValue("3rd Party:Embedding 2", "Blad1", "A2") = Ivolume
Parameter("HoogteVolumePercent") = 1
i = 1
If Parameter("HoogteVolumePercent") < 100 Then
    While (Parameter("HoogteVolumePercent") < 100)
        GoExcel.CellValue("3rd Party:Embedding 2", "Blad1", "C"&i) = Ivolume
        i = i + 1
        If i = 100 Then
            
            Exit While
        End If
    End While
End If
iLogicVb.UpdateWhenDone = True 

The purpose is to export the value of Ivolume at a certain percentage to an embedded Excel. But the when running this rule every cell has the same value.

I think Ilogic is writing the value after the completion of the rule. But I can't figue it out to get it to work.

In Attachements you can find a screenshot and the part (made in IV2013). 

 

Hope someone can help 

3 REPLIES 3
Message 2 of 4
VdVeek
in reply to: nomé

The problem you have is that the Parameter is not changing the part and updating it while runing the rule. When you begin your rule with:

Parameter.UpdateAfterChange = True

the parameter is updated after a change.

Rob.

Autodesk Inventor 2015 Certified Professional & Autodesk Inventor 2012 Certified Professional.
Message 3 of 4
Dennisvercauteren
in reply to: VdVeek

Hi Rob, 

 

Before I posted my question, I also posted on the Autodesk General Discussions forum. My mistake 😉

 

Andrewiv rewrote the code, and used another solution. He declares the property Ivolume again.

This solution works perfect for me.  

 

Thanks for your suggestion !! 

 

Greeting Dennis 

 

 

http://forums.autodesk.com/t5/Inventor-General-Discussion/Ilogic-loop-to-excell/td-p/5210879

 

 

 

Ivolume = iProperties.Volume/1000 '(in cm^3)
GoExcel.CellValue("3rd Party:Embedding 2", "Blad1", "A2") = Ivolume

i = 1
If Parameter("HoogteVolumePercent") < 100 Then
	While (Parameter("HoogteVolumePercent") < 100)
		Parameter("HoogteVolumePercent") = i
		InventorVb.DocumentUpdate()
		Ivolume = iProperties.Volume/1000 '(in cm^3)
		GoExcel.CellValue("3rd Party:Embedding 2", "Blad1", "C"&i) = Ivolume
		i = i + 1
		If i = 100 Then
			
			Exit While
		End If
	End While
End If
iLogicVb.UpdateWhenDone = True
Message 4 of 4

Hi Dennis,

 

I'm glad that you solved it, please flag as solved as well.

 

Thanks,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report