unrealblue opened this issue on Mar 04, 2020 ยท 30 posts
adp001 posted Sat, 07 March 2020 at 2:08 AM
And a bit extended:
from collections import namedtuple
sc = poser.Scene()
ac = sc.CurrentActor()
geom = ac.Geometry()
VERT_REC = namedtuple("VERT", "X Y Z idx")
verts = [VERT_REC(v.X(), v.Y(), v.Z(), i) for i, v in enumerate(geom.Vertices())]
_min, _max = min(verts), max(verts)
print "Min vert value in", ac.Name(), "=", _min
print "Max vert value in", ac.Name(), "=", _max
left_verts = [v for v in verts if v.X < 0]
right_verts = [v for v in verts if v.X > 0]
zeros = len(verts) - len(left_verts) - len(right_verts)
if zeros == 0:
print "There is no zeropoint in X."
else:
print zeros, "Zero points"
# now with tolerance
tolerance = 0.001
left_verts = [v for v in verts if v.X <= -tolerance]
right_verts = [v for v in verts if v.X >= tolerance]
zeros = len(verts) - len(left_verts) - len(right_verts)
if zeros == 0:
print "There is no point between", -tolerance, "and", tolerance
else:
print zeros, "Zero points with tolerance +/-{}".format(tolerance)