Measure Nurb Curve Length in Python [SOLVED]
5222 5 3- NFX
- Member
- 183 posts
- Joined: Dec. 2011
- Offline
- pelos
- Member
- 619 posts
- Joined: Aug. 2008
- Offline
- NFX
- Member
- 183 posts
- Joined: Dec. 2011
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
check out the hou.hscript() python function:
https://www.sidefx.com/docs/houdini13.0/hom/hou/hscript [sidefx.com]
I use it quite a bit for things that are “not” in python yet.
if your curve is a single primitive, you can also use a measure SOP to measure the perimeter and store it in a prim attribute, or if it is multiple primitives, use measure, then an attribute promote SOP, and promote perimeter to detail set to sum
https://www.sidefx.com/docs/houdini13.0/hom/hou/hscript [sidefx.com]
I use it quite a bit for things that are “not” in python yet.
if your curve is a single primitive, you can also use a measure SOP to measure the perimeter and store it in a prim attribute, or if it is multiple primitives, use measure, then an attribute promote SOP, and promote perimeter to detail set to sum
-G
- NFX
- Member
- 183 posts
- Joined: Dec. 2011
- Offline
- NFX
- Member
- 183 posts
- Joined: Dec. 2011
- Offline
I have it figured out now. Turns out you need to use hou.hscriptExpression() with arclen() and can use string formatting to pass in python variables. Here is the test code that worked for me.
Thanks for your help guys!
nodePath = “/obj/geo1/line1”
primNum = 0
myExpression = ‘arclen(“{0}”,{1},0,1)’.format(nodePath,primNum)
print hou.hscriptExpression(myExpression)
Thanks for your help guys!
-
- Quick Links