ilogic to calculate a size based on a volume

Inventor issues / questions / workthroughs as well as Ilogic Code!

ilogic to calculate a size based on a volume

Postby Chris Atherton » Mon Jul 19, 2010 10:22 pm

I've been using the ILogic functionality inside inventor 2011 for virtualy everything I do since it came out. A few days ago one of our customers asked me to look at changing a water tanks dimensions to meet a target volume; this is fairly simple if the shape is a cube, rectangle or a circle and is done withn a simple rule and some even easier maths. But what happens though if the tank is not a regular shape? This is a common problem for some of you in the automotive and aerospace industries as well as a fair few in industrial or consumer product companies.

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!
Attachments
ilogic volume.rar
ilogic files
(225.87 KiB) Downloaded 15 times
Best Regards,
Chris

Chris Atherton
APPLICATIONS ENGINEER
SYMETRI
Chris Atherton
Site Admin
 
Posts: 30
Joined: Wed Mar 10, 2010 1:59 pm
Location: OSSETT, WEST YORKSHIRE

Return to Inventor 2011

Who is online

Users browsing this forum: No registered users and 1 guest

cron