Atom Posted July 14, 2016 Share Posted July 14, 2016 (edited) Hi All, I am trying to assign an expression to a parameter using python. I want to link two objects together. I get a type error "Cannot set a numeric parm to a non-numeric value." I understand I am trying to assign a string to a number field, but the string contains the expression. Is this possible in using the current python in Houdini 15.5? Here is my code so far... trc_source = "/obj/trc" trc_target = "/obj/angela_1_T_pose_fbx" lst_source_blocks = ["Root"] lst_target_blocks = ["hip_To_abdomen"] for (i,name) in enumerate(lst_source_blocks): source_candidate = "%s/%s" % (trc_source, name) n = hou.node(source_candidate) if n != None: target_candidate = "%s/%s" % (trc_target, lst_target_blocks[i]) m = hou.node(target_candidate) if m != None: s = '`ch("%s/%s/tx")`' % (trc_source,name) m.parm("tx").set(s) Edited July 14, 2016 by Atom Quote Link to comment Share on other sites More sharing options...
graham Posted July 14, 2016 Share Posted July 14, 2016 You can use hou.Parm.setExpression() http://www.sidefx.com/docs/houdini15.5/hom/hou/Parm#setExpression to set an expression. Alternatively you can actually set parms to other parms and it will automatically create channel references for you: tx = hou.parm("/obj/geo1/tx") ty = hou.parm("/obj/geo1/ty") ty.set(tx) Quote Link to comment Share on other sites More sharing options...
Atom Posted July 14, 2016 Author Share Posted July 14, 2016 Thanks Grahm, that works! m.parm("tx").setExpression(s) 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.