Python for curve expression

   4408   4   0
User Avatar
Member
176 posts
Joined: 7月 2005
Offline
How can I get this to generate points in a curve parameter? I forgot how to use a python expression, any help is appreciated!

for (x,y,z) in zip(range(10),range(10),range(10)):
print “%f,%f,%f ” % (x,y,z)

(Im using a mac btw if that makes it a different story)
User Avatar
Member
17 posts
Joined: 7月 2007
Offline
Right click Coordinates Parameter first, select expression->toggle expression, then enter the code as follow.


a=' ‘
for (x,y,z) in zip(range(10),range(10),range(10)):
a+=’%f,%f,%f ' %(x,y,z)
return a
User Avatar
Member
176 posts
Joined: 7月 2005
Offline
seems as though the coords parm doesn't like that…. is there something to let Houdini know when you type in python?
User Avatar
Member
1922 posts
Joined: 11月 2006
Offline
It looks like the coordinates parameter isn't able to change the expression type. A solution is to add a spare parm and use that to contain your code and reference that from the coordinate parameter. See attached.

You might also be able to do it using a custom Python Sop operator.

I'll see about submitting a bug for not being able to change the parameter to Python.

Attachments:
python_curve.hip (43.7 KB)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
176 posts
Joined: 7月 2005
Offline
thanks a million!
  • Quick Links