Search - User list
Full Version: Adding points to a curve using Python?
Root » Houdini Indie and Apprentice » Adding points to a curve using Python?
Array
Hey guys,

I have a curve which was defined as such:



curve = hou.node('/obj').createNode('geo', ‘curve’)
curve.node('file1').destroy()
curve.createNode('curve')



And I am accessing the data in the curve as follows:



curve = hou.node('/obj/curve/curve1').geometry()



How do I add points to this curve procedurally using Python? I looked into createPoint(), but that just confused me further. :?
edward
Nodes such as SOP are meant to create the geometry data from its parameters. So modifying the output of the node is not a good idea. So you have two choices:
- Manipulate the node's parameters instead, OR
- Create a Python SOP operator, which then you can write the code for that creates the geometry.
Array
Hmmm, is there any way to declare a curve and all of its points in one fell swoop then?
edward
Setting point positions on the Curve SOP's parameters (in python) should be ok, no?
Array
edward
Setting point positions on the Curve SOP's parameters (in python) should be ok, no?

I'm not quite sure what you mean. Can you elaborate please?

I think I should have been more specific in the outset of this thread…what I'm trying to do is to make a curve which follows the geometry of a polygonal object. That is to say, given that I have an object in the scene, I want to make a curve whose set of points is a superset of the verticies of a polygonal object.
edward
Here's how to do it using the Curve SOP. If you want to do it in python, then it's just a matter of setting the Curve SOP's parameter to the appropriate point numbers.
Array
edward
Here's how to do it using the Curve SOP. If you want to do it in python, then it's just a matter of setting the Curve SOP's parameter to the appropriate point numbers.

Cool, thanks for taking the time to upload that file. I guess what I'm really having trouble with is figuring out just how to set the parameters using Python.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB