Jump to content
CinnamonMetal

Iterate over points to setPosition

Recommended Posts

I want to set the position of the points of a object in python. I've looked in the HOM Python cookbook although I don't understand the error; SopNode is not iterable, when I attempt to iterate over them and setPosition() ?

 

 

Edited by CinnamonMetal

Share this post


Link to post
Share on other sites

After adding the PythonSOP, click the little down arrow in the upper right-hand corner of the code window. There you should find "Move Points Up":

node = hou.pwd()
geo = node.geometry()

# Add code to modify contents of geo.
for point in geo.points():
    pos = point.position()
    pos += hou.Vector3(0, 1, 0)
    point.setPosition(pos)

This should give you an idea of how to move points in python. 

-b

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×