zjie Posted October 24, 2018 Share Posted October 24, 2018 (edited) Hi, I want to customize buttons which will allow me to find the min/max speed attribute and set it back to the parameters. I am new to Houdini and python, will appreciate some helps, thanks. Edited October 24, 2018 by zjie Quote Link to comment Share on other sites More sharing options...
ftaswin Posted October 29, 2018 Share Posted October 29, 2018 node = hou.node('/obj/geo1/speed1') geo = node.geometry() pts = geo.points() buffer = [] for i in pts : v = i.attribValue("v") speed = hou.hscriptExpression("length({0},{1},{2})".format(v[0],v[1],v[2])) buffer.append(speed) buffer = sorted(buffer) minspeed = buffer[0] maxspeed = buffer[-1] hou.parm("/node/with/min/parm").set(minspeed) hou.parm("/node/with/max/parm").set(maxspeed) 2 Quote Link to comment Share on other sites More sharing options...
zjie Posted October 30, 2018 Author Share Posted October 30, 2018 14 hours ago, cloud68 said: node = hou.node('/obj/geo1/speed1') geo = node.geometry() pts = geo.points() buffer = [] for i in pts : v = i.attribValue("v") speed = hou.hscriptExpression("length({0},{1},{2})".format(v[0],v[1],v[2])) buffer.append(speed) buffer = sorted(buffer) minspeed = buffer[0] maxspeed = buffer[-1] hou.parm("/node/with/min/parm").set(minspeed) hou.parm("/node/with/max/parm").set(maxspeed) Hi cloud68, thanks for the help, may I know where should I input these script on? is it on the callback script on the buttons creation and changed from Hscript to python? Quote Link to comment Share on other sites More sharing options...
ftaswin Posted October 30, 2018 Share Posted October 30, 2018 (edited) You can put them in the button callback, change the language to python. The parameters need to exist otherwise it'll throw an error Edit: Callback does not take "\n". Anyway...... ft_getminmaxvelocity.7z Edited October 30, 2018 by cloud68 upload file 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.