TomRaynor Posted May 29, 2014 Share Posted May 29, 2014 The Draw Curve tool on the shelf has the following code in it: """ import stroketoolutilskwargs['type'] = "curve"stroketoolutils.strokeSource(kwargs) """ I was wondering if there is any way for me to be able to grab the geometry node that gets created when this tool is run and store it in a variable? I tried modifying the line: stroketoolutils.strokeSource(kwargs) to read: curve = stroketoolutils.strokeSource(kwargs) but curve returns None. Any suggestions? Thanks. Quote Link to comment Share on other sites More sharing options...
edward Posted May 31, 2014 Share Posted May 31, 2014 Try just using the last selected node. Quote Link to comment Share on other sites More sharing options...
TomRaynor Posted May 31, 2014 Author Share Posted May 31, 2014 Yeah that was a bit silly of me. Shoulda thought of that, thanks Edward. I was making a little shelf tool to be able to sketch out curves that have a uniform divisions, tangent vectors and a parametric 0-1 value per curve. Might be useful to someone, see code below. Thanks again. ### #Create Normalized, even segemented curve with mapu attribute and tangents based on sketching a curve ### import stroketoolutils kwargs['type'] = "curve" stroketoolutils.strokeSource(kwargs) drawCurveSOP = hou.selectedNodes()[0] geoNode = drawCurveSOP.parent() resampleNode = geoNode.createNode("resample") resampleNode.setInput(0, drawCurveSOP) resampleNode.parm("dolength").set(0) resampleNode.parm("dosegs").set(1) resampleNode.parm("segs").set(30) pointNode = geoNode.createNode("point") pointNode.setInput(0, resampleNode) pointNode.parm("doedgef").set("on") attribNode = geoNode.createNode("attribute") attribNode.setInput(0, pointNode) attribNode.parm("frompt0").set("edge_dir") attribNode.parm("topt0").set("tangent") attribNode.parm("ptdel").set("edgef stroke*") attribNode.parm("primdel").set("stroke*") foreachNode = geoNode.createNode("foreach") foreachNode.setInput(0, attribNode) foreachNode.parm("fortype").set("prim") eachNode = foreachNode.children()[0] attribCreateNode = foreachNode.createNode("attribcreate::2.0") attribCreateNode.setInput(0, eachNode) attribCreateNode.parm("name1").set("mapu") attribCreateNode.parm("varname1").set("MAPU") attribCreateNode.parm("value1v1").setExpression("$PT/($NPT-1)") nullNode = geoNode.createNode("null") nullNode.setInput(0, foreachNode) nullNode.setName("OUT") colour = hou.Color((1.0,0.0,0.0)) nullNode.setColor(colour) geoNode.layoutChildren() nullNode.setDisplayFlag(1) nullNode.setRenderFlag(1) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.