The process I've followed is: create a tank and another part to represent the insides of the tank (the empty volume). This is linked to the tank so that they both update when the tank is changed. (I used either derive or copy face tools).
Next I wrote a rule that linked the 2 together and told Ilogic to keep adding 0.1mm to the tank height until the required volume was reached or, remove 0.1mm if current volume was too high.
The problem I found was that the rule I built worked for whole numbers only ie, the volume worked out exactly using the 0.1mm incriments; this isnt likely to happen in real life however. How do we get round this?? Well add a tolerance in to the optimisation rule and hey presto the tank configures itself.
The rule is below however done worry if you cant recreate it or need to know more as we're only a call away. I think that some of you will find this useful but I'm sure we can adapt it to your needs.
If anyone has stories or ILogic code they would like to share then please let us know! The forums free to post on!
Heres that ILogic code:
TQ = InputBox("Pick Volume", "Target Volume", "125000")
If iProperties.VolumeOfComponent("Solid2:1") < TQ Then
While iProperties.VolumeOfComponent("Solid2:1") < TQ
Parameter("layout:1","d12") = Parameter("layout:1","d12") + 0.1
RuleParametersOutput()
InventorVb.DocumentUpdate(False)
test = Parameter("layout:1","d12")
EqualWithinTolerance (test, TQ, 0.5)
End While
ElseIf iProperties.VolumeOfComponent("Solid2:1") > TQ Then
While iProperties.VolumeOfComponent("Solid2:1") > TQ
Parameter("layout:1","d12") = Parameter("layout:1","d12") - 0.1
RuleParametersOutput()
InventorVb.DocumentUpdate(False)
test = Parameter("layout:1","d12")
EqualWithinTolerance (test, TQ, 0.5)
End While
End If
Just play around with the tolerances
Ps. dont set the tolerance too fine compaired to the incriment or you could be sat for a bit waiting for it to iterate. I used 0.1mm and 0.5mm but thats after making the mistake of using 0.001mm on both with a low laptop battery
Enjoy the world of Automation!
