iLogic won't update solid volume measurements

iLogic won't update solid volume measurements

mgaunt3DSG
Enthusiast Enthusiast
126 Views
1 Reply
Message 1 of 2

iLogic won't update solid volume measurements

mgaunt3DSG
Enthusiast
Enthusiast

I have created a file that has a pair of bodies being split by a workplane that is offset with the parameter "Dig_Depth" and would like to create a report that shows the volume of each body at each Dig Depth.

 

However, my code just reports a single set of numbers over and over again;

0231709.25.23E+08
1231709.25.23E+08
2231709.25.23E+08

The numbers are what the model shows before running the rule.

 

How can I get my code to update the Volumes?

 

My code;

oCSVfile = System.IO.File.CreateText(ThisDoc.PathAndFileName(False) & ".csv")

Dim doc As PartDocument= ThisDoc.Document
Dim oCD As ComponentDefinition = doc.ComponentDefinition

Dig_Depth = 0
For Dig_Depth = 0 To 2
	oCSVfile.WriteLine(Dig_Depth & "," & oCD.SurfaceBodies(1).Volume(0.01) & "," & oCD.SurfaceBodies(2).Volume(0.01))
Next Dig_Depth

oCSVfile.Close()

 

0 Likes
Accepted solutions (1)
127 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor
Accepted solution

Hi @mgaunt3DSG.  You can not set the value of a parameter directly by the 'definition line' of a loop, as if it were a local variable.  Try using some other variable for the iteration definition line, such as "i", then set the value of the parameter just inside that loop to the value of the variable.  Then you will likely need to use the 'RuleParametersOutput' line of code, which runs a Sub routine to push the altered variable value to the model.  Then update the document.  Then use your line of code for reading the volume.  Setting the value of the parameter to zero may not be permitted, depending on how things are set-up, because it may cause the feature to not have any effect on the model, which often causes a cautionary pop-up message to show.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes