how to calculate volume...

hi..i was sorry, i looking for max script to calculate irregular shape volume..anybody has? i have used BM breaker and it has none shown the value of object volume..thanks.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lantlant's picture

I like this script :)

I like this script :)

Martijn van Herk's picture

(No subject)

Here's a function which should return the volume as shown in the Measure Utility. 

(
fn calculateVolume obj =
(
local volume = 0.0
local objMesh = snapshotAsMesh obj
local objFaces = objMesh.numFaces
for f = 1 to objFaces do
(
v = getFace objMesh f
v1 = getVert objMesh v.x
v2 = getVert objMesh v.y
v3 = getVert objMesh v.z
volume += ((v2.y-v1.y)*(v3.z-v1.z)-(v2.z-v1.z)*(v3.y-v1.y))*(v1.x+v2.x+v3.x)
)
volume / 6.0
)
units.formatValue (calculateVolume $)
)

Cheers,
Martijn 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.