Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

(MEL)Help finding Volume of unenclosed mesh

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
absoluteKelvin
694 Views, 3 Replies

(MEL)Help finding Volume of unenclosed mesh

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
Tags (3)
3 REPLIES 3
Message 2 of 4

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


Message 3 of 4
mspeer
in reply to: absoluteKelvin

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]};
Message 4 of 4

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


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

Post to forums  

Autodesk Design & Make Report