Hello!
I would like to run python script in specified scene(.hip) via hbatch.
In the case of maya,
mayabatch.exe -file someMayaFile.ma -command “someMelScript.mel”
How to write in hbatch?
How to write hbatch command
10360 3 2- ys11
- Member
- 2 posts
- Joined: March 2014
- Offline
- old_school
- Staff
- 2540 posts
- Joined: July 2005
- Offline
I assume the question is how to run Houdini non-graphically in a shell passing in a scene file and a script file.
Two main ways to run houdini in non-graphic mode from a shell:
- hscript command.
- hython command.
Both run on scene files passed in as the first argument.
Both can have additional files specified that will be executed in turn.
hscript
This is Houdini's native command language. It is a pseudo-c-shell like language that allows you to run Houdini hscript commands. These commands can be wrapped up in to a .cmd file and run as an argument.
hscript -c hscript_commands.cmd my_scene_file.hip asset1.otl asset2.otl
This will open the boudini file “my_scene_file.hip” and then load in the asset definitions asset1.otl and asset2.otl and then run the hscript_commands.cmd hscript file.
Just type:
hscript -h
in a shell to get the command-line help.
hython
hython is a python wrapper that includes python and adds a couple extra arguments used specifically by Houdini such as -j for number of procs. This means that you can use all of the python command line arguments and options which are quite numerous.
hython my_scene_file.hip asset1.otl asset2.otl -c commands.py myarg1
This will open a python session with the “hou” module installed along with the hip file and the two assets, or any other number of files. Then using standard python arguments, you can pass in commands, arguments and more.
Hope that helps.
Two main ways to run houdini in non-graphic mode from a shell:
- hscript command.
- hython command.
Both run on scene files passed in as the first argument.
Both can have additional files specified that will be executed in turn.
hscript
This is Houdini's native command language. It is a pseudo-c-shell like language that allows you to run Houdini hscript commands. These commands can be wrapped up in to a .cmd file and run as an argument.
hscript -c hscript_commands.cmd my_scene_file.hip asset1.otl asset2.otl
This will open the boudini file “my_scene_file.hip” and then load in the asset definitions asset1.otl and asset2.otl and then run the hscript_commands.cmd hscript file.
Just type:
hscript -h
in a shell to get the command-line help.
hython
hython is a python wrapper that includes python and adds a couple extra arguments used specifically by Houdini such as -j for number of procs. This means that you can use all of the python command line arguments and options which are quite numerous.
hython my_scene_file.hip asset1.otl asset2.otl -c commands.py myarg1
This will open a python session with the “hou” module installed along with the hip file and the two assets, or any other number of files. Then using standard python arguments, you can pass in commands, arguments and more.
Hope that helps.
There's at least one school like the old school!
- goldleaf
- Staff
- 4199 posts
- Joined: Sept. 2007
- Offline
Here's a really simple hython script I've used to render a ROP in a hip file:
https://gist.github.com/crydalch/3167162 [gist.github.com]
https://gist.github.com/crydalch/3167162 [gist.github.com]
I'm o.d.d.
- ys11
- Member
- 2 posts
- Joined: March 2014
- Offline
-
- Quick Links