Inventor General Discussion

Inventor General Discussion

Reply
Distinguished Contributor
fakeru
Posts: 113
Registered: ‎03-07-2010
Message 1 of 8 (933 Views)
Accepted Solution

Body Volume to be assigned to a parameter

933 Views, 7 Replies
09-26-2012 07:54 AM

Hello everybody!

I need to find a way how to set a custom parameter to be equal with a body volume, assuming I have a multibody part.

 

I have found how to assign total volume of the part to a parameter using iLogic rule.:

Total_Volume = iProperties.Volume

and that's it.

You can do it also for a component in an assembly , but can't see how to do it for a body...

 

Please help!

 

Regards

Sandu

 

Autodesk Inventor 2015 Certified Professional
AIP 2014 SP2
Windows 7 x64
Dell Precision T7400 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (4 CPU's), 32GB RAM, NVIDIA Quadro K4000 3072MB GDDR3

SolidBodies.zip has a rule to calculate the volume of a solid body.  It has a few other functions for solids.  It can be used as an external rule, but for a content center part it might be best to put it in the part.  You can add a rule (name it SolidFunctions) and paste in the text.  Set the Straight VB Code option on the Options tab:

 

SolidFunctionsStraightVb.png

 

Then create another rule for your code.  Here's a sample.  This is in a part with bodies named ContentsBody and ContainerBody.


AddVbRule "SolidFunctions"

Dim bodies As New SolidBodies(ThisDoc.Document)
ContentsVolume = bodies.Body("ContentsBody").Volume
ContainerVolume = bodies.Body("ContainerBody").Volume

 

Note that this rule won't run automatically when the volume changes.  You can add lines that refer to model parameters to make it run:

trigger = d0 + d1 + PartLength  ' etc.

Or you can use the Event Triggers command and set it to run on the Before Save Document event.

Employee
johnsonshiue
Posts: 2,345
Registered: ‎04-30-2008
Message 2 of 8 (919 Views)

Re: Body Volume to be assigned to a parameter

09-26-2012 02:56 PM in reply to: fakeru

Hi! I could be wrong but I am not aware of body level volume in a part file. The physical properties are all evaluated on a per part basis, not per body basis.

The original design intent of Multi-Solid Body workflows is that each solid body would be derived as individual parts eventually. For your case, you should be able to query each body volume if the bodies are all derived into different parts. Can I ask you why you need to have body level volume?

Thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Senior Principal SQA Engineer, Inventor
Mechanical Design
Autodesk, Inc.

Employee
johnsonshiue
Posts: 2,345
Registered: ‎04-30-2008
Message 3 of 8 (898 Views)

Re: Body Volume to be assigned to a parameter

09-27-2012 07:24 AM in reply to: fakeru

Hi! I have to revert my prior statement. The body level physical properties can be found if you right-click on Body node -> Properties in the browser. However, the parameters associated with these properties are not exposed to the user. I need to find out why or how. I will get back to you with my findings.

I am very sorry for the misinformation I posted earlier.

Thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Senior Principal SQA Engineer, Inventor
Mechanical Design
Autodesk, Inc.

Distinguished Contributor
fakeru
Posts: 113
Registered: ‎03-07-2010
Message 4 of 8 (896 Views)

Re: Body Volume to be assigned to a parameter

09-27-2012 07:34 AM in reply to: johnsonshiue

The point is that you can see each solid(body) volume in its properties. See the attached screen capture.

 

The main ideea is to make a container (one body) with product volume as separate solid (second body). Then I want this to publish to Content Center.

When inserting the part (container), the custom parameter will be the volume. Depending on the volume, the height of the container will be calculated by Inventor. This will be possible with an iLogic rule. I made it for a single body part.

 

If only it would be possible to publish assemblies to Content Center... but no way...:smileysad:

 

 

Update: I just saw your last replay on  that. Thanks for looking at that.

 

Autodesk Inventor 2015 Certified Professional
AIP 2014 SP2
Windows 7 x64
Dell Precision T7400 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (4 CPU's), 32GB RAM, NVIDIA Quadro K4000 3072MB GDDR3
Distinguished Contributor
fakeru
Posts: 113
Registered: ‎03-07-2010
Message 5 of 8 (863 Views)

Re: Body Volume to be assigned to a parameter

10-01-2012 07:12 AM in reply to: fakeru

So, no one can help? :smileysad:

Autodesk Inventor 2015 Certified Professional
AIP 2014 SP2
Windows 7 x64
Dell Precision T7400 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (4 CPU's), 32GB RAM, NVIDIA Quadro K4000 3072MB GDDR3
Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 6 of 8 (850 Views)

Re: Body Volume to be assigned to a parameter

10-01-2012 08:22 AM in reply to: fakeru

SolidBodies.zip has a rule to calculate the volume of a solid body.  It has a few other functions for solids.  It can be used as an external rule, but for a content center part it might be best to put it in the part.  You can add a rule (name it SolidFunctions) and paste in the text.  Set the Straight VB Code option on the Options tab:

 

SolidFunctionsStraightVb.png

 

Then create another rule for your code.  Here's a sample.  This is in a part with bodies named ContentsBody and ContainerBody.


AddVbRule "SolidFunctions"

Dim bodies As New SolidBodies(ThisDoc.Document)
ContentsVolume = bodies.Body("ContentsBody").Volume
ContainerVolume = bodies.Body("ContainerBody").Volume

 

Note that this rule won't run automatically when the volume changes.  You can add lines that refer to model parameters to make it run:

trigger = d0 + d1 + PartLength  ' etc.

Or you can use the Event Triggers command and set it to run on the Before Save Document event.



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Distinguished Contributor
fakeru
Posts: 113
Registered: ‎03-07-2010
Message 7 of 8 (830 Views)

Re: Body Volume to be assigned to a parameter

10-01-2012 11:02 PM in reply to: MjDeck

That's just brilliant! Thanks a bunch!

 

But what are the other functions of this SolidBodies.vb rule? Just beeing curious :smileyhappy:

 

Regards

Autodesk Inventor 2015 Certified Professional
AIP 2014 SP2
Windows 7 x64
Dell Precision T7400 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (4 CPU's), 32GB RAM, NVIDIA Quadro K4000 3072MB GDDR3
Distinguished Contributor
fakeru
Posts: 113
Registered: ‎03-07-2010
Message 8 of 8 (820 Views)

Re: Body Volume to be assigned to a parameter

10-02-2012 12:40 AM in reply to: fakeru

It looks like I need a little bit more help to reach my main goal.

 

I want a rule that changes a parameter until 2 parameters are equal.

Let me explain you this way:

 

If Volume1<>ProductVolume Then

 

d12=choose a value until Volume1=ProductVolume

 

End If

 

I suppose it should be simple, but I struggle a lot with programming... :smileyfrustrated:

 

Thanks!

Autodesk Inventor 2015 Certified Professional
AIP 2014 SP2
Windows 7 x64
Dell Precision T7400 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (4 CPU's), 32GB RAM, NVIDIA Quadro K4000 3072MB GDDR3
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.