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

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
nomé
331 Views, 2 Replies

Ilogic loop to excell

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. 

 

Hope someone can help 

2 REPLIES 2
Message 2 of 3
andrewiv
in reply to: nomé

I modified your code to include an update before writing the mass to the "C" column and to also tell it to change the HoogteVolumePercent parameter to be the i value. This works for me

 

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

 

Andrew In’t Veld
Designer

Message 3 of 3
nomé
in reply to: andrewiv

Thanks Andrew !

Your solution works perfect !

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

Post to forums  

Autodesk Design & Make Report