I need to be able to select multiple objects (each object is 1 flat mesh) and all I want is for each object to work out it's own area and rename it self to that number.... how could I achieve this to multiple meshes / polys objects? I'm really against time at the moment and all other avenues have failed for me so this is my last chance!
Forum topic · General Scripting
Need help quick!
By THINKTANK · 2016-11-04
Description
Comments (2)
.
miauu · 2016-11-07
(
selObjsArr = selection as array
if selObjsArr.count != 0 then
(
local moGetFaceArea = meshop.getFaceArea
for o in selObjsArr do
(
tmpObj = snapShotAsMesh o
totalArea = 0
facesBA = #{1..(tmpObj.numfaces)}
for f in facesBA do
(
totalArea += moGetFaceArea tmpObj f
)
delete tmpObj
o.name = (totalArea as string)
)
)
else
messagebox "Select some objects" title:"Empty Selection"
)
will this do...
vusta · 2016-11-04
disclaimer: I'm a shithouse maxscripter...but try this until some pro help comes along..
for obj in selection do
(
tempcopy = copy obj
convertToMesh tempcopy
faceSel= #()
myArea = 0.0
for f = 1 to tempcopy.numfaces do myArea += meshop.getFaceArea tempcopy #{f}
delete tempcopy
obj.name = "Area_" + myArea as string
)
You can change the prefix Area_ to whatever....or even delete it...
(if you select a circle spline say, it actually calculates the area as if it was a solid mesh...coz it 'treats' it as a mesh...)