Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

(MEL)Help finding Volume of unenclosed mesh

absoluteKelvin
Collaborator

(MEL)Help finding Volume of unenclosed mesh

absoluteKelvin
Collaborator
Collaborator

I know using computePolysetVolume will find the volume of  a mesh thats closed. But What if I need it for a mesh thats has open border?

 

{
    float $bBox[] = `polyEvaluate -boundingBoxComponent`;
    vector $bBoxMin = {$bBox[0], $bBox[1] ,$bBox[2]};
    vector $bBoxMax = {$bBox[3], $bBox[4] ,$bBox[5]};
    
    vector $subVector = $bBoxMax - $bBoxMin ;
    float $volume = $subVector.x * $subVector.y * $subVector.z; //basic math for calculating volume length x width x height
    
    print $volume;
}

 

This is my attempt. But failed badly. for some reason a smaller object yields are greater number with this code.

https://www.artstation.com/kelvintam
0 Likes
Reply
Accepted solutions (2)
704 Views
3 Replies
Replies (3)

jordan.giboney
Autodesk Support
Autodesk Support

Hi @absoluteKelvin 

 

Thanks for posting! @mspeer, I see that you helped them out in their other post in the main Maya forum 🙂 Any thoughts on this one as well?

 

Thanks for being a part of our community!



Jordan Giboney
Technical Solutions Engineer | Media & Entertainment
Installation & Licensing forums | Contact product support | Autodesk AREA


0 Likes

mspeer
Consultant
Consultant
Accepted solution

Hi!

The order/assignment of the bbox values is wrong, it needs to be:

vector $bBoxMin = {$bBox[0], $bBox[2] ,$bBox[4]};
vector $bBoxMax = {$bBox[1], $bBox[3] ,$bBox[5]};

jordan.giboney
Autodesk Support
Autodesk Support
Accepted solution

Hi @absoluteKelvin 

 

Did you have a chance to review @mspeer's suggestion? Did this work for your project? 🙂

 

Thanks again for being a part of our forums!



Jordan Giboney
Technical Solutions Engineer | Media & Entertainment
Installation & Licensing forums | Contact product support | Autodesk AREA


0 Likes