How to write hbatch command

   7746   3   2
User Avatar
Member
2 posts
Joined: March 2014
Offline
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?
User Avatar
Staff
2538 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.
There's at least one school like the old school!
User Avatar
Staff
3988 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]
I'm o.d.d.
User Avatar
Member
2 posts
Joined: March 2014
Offline
Thank you so much!!!
I was able to run script!
  • Quick Links