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: 

Body Volume to be assigned to a parameter

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
fakeru
5636 Views, 15 Replies

Body Volume to be assigned to a parameter

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
15 REPLIES 15
Message 2 of 16
johnsonshiue
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)
Software Test Engineer
Message 3 of 16
johnsonshiue
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)
Software Test Engineer
Message 4 of 16
fakeru
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...Smiley Sad

 

 

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

 

Autodesk Inventor 2015 Certified Professional
Message 5 of 16
fakeru
in reply to: fakeru

So, no one can help? Smiley Sad

Autodesk Inventor 2015 Certified Professional
Message 6 of 16
MjDeck
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
Autodesk, Inc.

Message 7 of 16
fakeru
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 🙂

 

Regards

Autodesk Inventor 2015 Certified Professional
Message 8 of 16
fakeru
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... Smiley Frustrated

 

Thanks!

Autodesk Inventor 2015 Certified Professional
Message 9 of 16
oscarohn
in reply to: fakeru

hey did you find a good solution? 

 

I have the same problem with digger buckets one solide is the SAE volume and the rest is the bucket body. 

 

the set up i have now is to change a dimension some times until i reatch the desired volume. 

 

I would like a rule that would drive that parameter based on the volume of solid1 

 

 

Message 10 of 16
BlueJay1234
in reply to: fakeru

Hi

I followed your instructions on how to implement the code - no luck so far.

I dont have alot of experience with ilogic - but what I would like to accomplish is the following.

I want to write the specific volumes of multibodies into the parameters, to use for further caculations. As I understood your code should get this done.

 

Would be great if you or anybody else could give me a hint how to get this done

Greetings

Alex

 

 

 

Message 11 of 16
MjDeck
in reply to: BlueJay1234

@BlueJay1234 , the code you have should work with a few changes.
First, change the line:

AddVbRule "SolidBody"

to

AddVbRule "SolidFunctions"

That's the rule name you're showing in the iLogic Browser. I'm guessing that it contains the same code as SolidBody.vb posted above. If it doesn't, please post your part (or a simplified version).
Then, create User parameters in the part and name them Volume_1 and Volume_2. Give them units of volume. 
Then edit the rule. Just hit Save and Run. That will connect the rule to the parameters.
Here's your rule for reference:

AddVbRule "SolidFunctions"
Dim bodies As New SolidBodies(ThisDoc.Document)

Volume_1 = bodies.Body("1").Volume
Volume_2 = bodies.Body("2").Volume

Mike Deck
Software Developer
Autodesk, Inc.

Message 12 of 16
BlueJay1234
in reply to: MjDeck

Thanks MjDeck,

for the quick reply - I did implement the changes, however no functionallity yet?

Please have a look at the posted part - it would be great if you could tell me what I am missing to make it work.

 

Many thanks for your help

 

Alex

 

 

Message 13 of 16
MjDeck
in reply to: BlueJay1234

@BlueJay1234 , your Call rule has the "Straight VB code" option set (on the Options tab) in the rule editor. The Call rule is not straight VB. Please un-check that option.

The iLogic system might have set that option itself. This is a defect. If you use Straight VB rules elsewhere, please keep an eye on this option.


Mike Deck
Software Developer
Autodesk, Inc.

Message 14 of 16
BlueJay1234
in reply to: MjDeck

Got it working - many thanks for the great help!!

 

Message 15 of 16
w.landkoer
in reply to: MjDeck

Fakeru,

 

I get this error in your iLogic rule. Any idea how to solve it?

 

wlandkoer_0-1625472934021.png

 

Kind regards,

Wesley

Message 16 of 16
MjDeck
in reply to: w.landkoer

@w.landkoer , the code in SolidBodies.vb won't run as a rule by itself. It contains functions that you can use from another rule. There are some examples above. What are you trying to do?


Mike Deck
Software Developer
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report