Need help quick!

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!

Comments

Comment viewing options

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

.

(
	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"
)
vusta's picture

will this do...

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...)

Comment viewing options

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