Next, will made another function that to select the objects...fn CalculateVolume obj =
(
local Volume= 0.0
local Center= [0.0, 0.0, 0.0]
local theMesh = snapshotasmesh obj
local numFaces = theMesh.numfaces
for i = 1 to numFaces do
(
local Face= getFace theMesh i
local vert2 = getVert theMesh Face.z
local vert1 = getVert theMesh Face.y
local vert0 = getVert theMesh Face.x
local dV = Dot (Cross (vert1 - vert0) (vert2 - vert0)) vert0
Volume+= dV
)
delete theMesh
Volume /= 6
Volume
)
... and here is the example usage:fn selectObjByVolume volLimit =
(
select (
for obj in geometry where \
CalculateVolume obj <= volLimit collect obj
)
)
selectObjByVolume 337
Enjoy!
No comments:
Post a Comment
Thanks for your comment