ScriptSpot

Forum topic · General Scripting

Center of Editable Mesh face

By JokerMartini · 2011-07-19

Description

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 (4)

Script

JokerMartini · 2011-07-20

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.

heh...

Anubis · 2011-07-20

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.

Results....

JokerMartini · 2011-07-20

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
)

Anubis · 2011-07-19

meshop.getFaceCenter