DocWhite Posted November 9, 2015 Share Posted November 9, 2015 (edited) Hello, what I would like to do is very simple, just for an exercise. I would like to run Houdini from a Python script using the hou module. What I am trying to get working is something like: import sys import subprocess sys.path.append('/opt/hfs15.0.244.16/houdini/python2.7libs') import hou hou.hipFile.load(file_name='/home/ramon/hello.hipnc') sf_geo = hou.node('/obj').createNode('geo') But I get no UI. I could do subprocess.Popen(['houdinifx', '/path/to/hipfile.hpnc']) but it creates deatached from the python script. Maybe should I create it first through shell (subprocess.Popen) and then load it using hou.hipFile? and start playing with it inside the python script? I would like to have a self-contained example. Just a python file that the user just runs like python script.py no more. Thanks and sorry for the stupid question. EDIT: I think I found out what I was looking for... haha... now i can compile vfls using Popen subprocesses and import them afterwards and doing everything in a self-contained file. cool. import sys import subprocess sys.path.append('/opt/hfs15.0.244.16/houdini/python2.7libs') import hou hou.hipFile.save(file_name='/home/ramon/hello.hipnc') hou.hipFile.load(file_name='/home/ramon/hello.hipnc') sf_geo = hou.node('/obj').createNode('geo') hou.hipFile.save(file_name='/home/ramon/hello.hipnc') subprocess.Popen(['houdinifx', '/home/ramon/hello.hipnc']) Edited November 9, 2015 by DocWhite Quote Link to comment Share on other sites More sharing options...
asnowcappedromance Posted November 15, 2015 Share Posted November 15, 2015 Have you had a look at Hython? Comes installed with Houdini. Example: in the shell: hython script.py script.py contents: import shutil #copy hip template into another directory newfile = ‘/path/to/my/hip/file/newhipfile.hip’shutil.copy('/dir/file.hip', newfile) hou.hipFile.load(newfile)hou.node("/path/to/driver").pressButton() 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.