HOM Print Hip Stats Example: Load a .hip File and Inspect it
Overview
This example shows how to load a hip file from a standard Python shell and inspect its contents. This particular example loops through all the object in /obj and prints out the positions of each of the points in the object.
Location
Supporting files for this example are in $HFS/mozilla/documents/hom/cookbook/print_hip_stats, also found in the cookbook/print_hip_stats directory of cookbook_files.tar.gz.
Running the Example
Run python2.5 print_stats.py to print out the contents of file_to_load.hip.
#!/usr/bin/python2.5 import sys, os # Adjust sys.path so it contains $HFS/houdini/scripts/python. Then we can # safely import the hou module. Importing this module will bring a Houdini # session into the Python interpreter. sys.path.append(os.environ['HFS']+"/houdini/scripts/python") import hou hou.hipFile.load("file_to_load.hip") for object in hou.node("/obj").children(): print "Points in", object.path() for point in object.displayNode().geometry().points(): print point.position() print # Release the Houdini Batch license. If we wanted to, this script could # continue running, but it would no longer consume a license. When this # script accesses the hou module again it will reacquire the license # automatically. (Note that only later versions of Houdini implement # hou.releaseLicense()). if hasattr(hou, "releaseLicense"): hou.releaseLicense()