[Sidefx-houdini-list] call opparm from outside houdini

Ammon Riley ammon.riley at gmail.com
Wed Apr 25 13:50:34 EDT 2007

On 4/25/07, Luca Zappala <luca at cinesite.co.uk> wrote:
> hscript filename.hip -run "opparm -c /obj/geoTest cache_execute"

In addition to the already mentioned "put your command in a file"
methods, I'll also point out that since hscript reads input from stdin,
you can just pipe your commands to it with "echo" (or whatever else
you like):

    echo "opparm -c /obj/geoTest cache_execute" | hscript filename.hip

That way, if your command isn't static, you don't have to dump out a
file for every single command you want to run:

    # figure out opparm based on directory of hip
    if (`dirname $hipfile | grep -ic /test/` == 0) then
        set object = 'geoFinal'
        set object = 'geoTest'
    echo "opparm -c /obj/$object cache_execute" | hscript filename.hip

Hscript will terminate after it detects the end of input, which, in this case,
is the single opparm command.

If the implications of that aren't immediately obvious, beyond the example
above, essentially what that provides is a method for interactive control over
hscript that you can't get by using the "commands-in-a-file" approach. If
you're using a more feature-rich programming language than shell scripts
(okay, you can do it with shell scripts, too, but it's more painful), you can
open a pipe to hscript. For example, in perl:

    open HSCRIPT, "| hscript filename.hip" or die $!;
    print HSCRIPT "opparm -c /obj/geoTest cache_execute\n";
    close HSCRIPT;

Once that pipe is open, you can feed in whatever hscript commands you
like, and, if you're adventurous enough to delve into interprocess
communication, read the responses from hscript, too, using that information
to figure out more commands to send to hscript.


More information about the Sidefx-houdini-list mailing list