Forum: Poser Python Scripting


Subject: Please help...Whats this error?

Josiah opened this issue on Nov 10, 2002 ยท 5 posts


Josiah posted Sun, 10 November 2002 at 7:02 PM

I am a real newbie to the python language and I am working on an ambitious script, however, I am havig some problems with some functions and have split these up into single scripts.
Th one I am having the most problem getting to work is this one posted below which for this script uses two spheres with the same number of vertices.

My intent with this script is to move each vertex in the "sphere01" (external name), to the location of it's corresponding vertex in "sphere02". The desired result is that "sphere01" will now be a clone of "sphere02" and occupy the same space.

This is the error I am getting and it is caused by the line "geom.vertex(i)";

Traceback (innermost last):
File "", line 10, in ?
AttributeError: vertex

#########################START SCRIPT
scene = poser.Scene()
actor = scene.Actor("sphere01")
geom = actor.Geometry()
numVerts = geom.NumVertices()

for i in range(numVerts):

~ actor = scene.Actor("sphere02")
~ geom = actor.Geometry()
~ geom.vertex(i)
~ targetX = vert.X()
~ targetY = vert.Y()
~ targetZ = vert.Z()

~ actor = scene.Actor("sphere01")
~ geom = actor.Geometry()
~ geom.vertex(i)
~ vert.SetX(targetX)
~ vert.SetY(targetY)
~ vert.SetZ(targetZ)

actor.MarkGeomChanged()
scene.DrawAll()

#########################END SCRIPT

The script should first get the number of verts in sphere01 and assign it to var "numverts. Next it should fetch the xyz location of vertex "i", in sphere02 then get vertex "i" in sphere01, and move it to the location of vertex "i" in sphere02. It should "loop" through all the verts to move all the verts in sphere01 to the positions of the corresponding verts in sphere02.

What's wrong? What's this error and how can I fix it?

Please, can anyone help me to get this script to work?
Thanks!
Josiah