Center of Editable Mesh face

I'm trying to loop through an entire mesh finding the point 3 value of the center of each polygon of an editableMesh.

I have found out how to do it for an editable poly but not and editable mesh.
--newPos = polyop.getFaceCenter $ f --EditablePoly

--Editable Polygon Face
	numFaces = $.numfaces/2
	for f = 1 to numFaces do
	(
		newPos = --EditableMesh
		print newPos
	)

Comments

Comment viewing options

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

Script

I was working on a script for the public and I would like it to work with editableMesh and EditablePoly that was really the only reason.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

heh...

Of course the mesh and poly are not the same :) The polygon in epoly may consist of 1, 2 or more faces. Why just not convert your mesh (the original or snapshot) to epoly? Make your life easy.

my recent MAXScripts RSS (archive here)

JokerMartini's picture

Results....

Because the editable mesh is a triangulated mesh the results are not what I was expecting.

If you run this code you'll see.
It's creating twice as many spheres as it needs and they are not at the center of the entire polygon. Should I loop through and for every two spheres create a sphere at the middle distance of the 2 spheres created to get the proper sphere placement at the center of the actual polygon?

--Editable Mesh Face
	numFaces = $.numfaces
	for f = 1 to numFaces do
	(
		newPos = meshop.getFaceCenter $ f -- EditableMesh
		sphere radius:1 pos:NewPos
		print newPos
	)

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

meshop.getFaceCenter

meshop.getFaceCenter

my recent MAXScripts RSS (archive here)

Comment viewing options

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