|On this page|
For example, you might take a reference to a geometry node’s output:
>>> mygeo = hou.node("/obj/geo1/sphere1").geometry()
If after you take the reference something changes which causes the node to recook, and the recook fails, the geometry referred to by
mygeo is now invalid. Trying to access it will raise this exception.
>>> points = mygeo.points() hou.InvalidGeometry: ...
Tips and notes
If you call
.geometry()on a node that’s currently in error, you will get
Noneinstead of an invalid hou.Geometry object.
You can check if a
Geometryobject is valid before you use it with hou.Geometry.isValid().
if mygeo.isValid(): points = mygeo.points()
A Geometry reference turning invalid might happen if you grab geometry in code “outside” the cooking mechanism. If your code runs as part of the cook (for example, in a Python SOP), a valid
Geometryreference should stay valid for the duration of your script.
Methods from hou.Error
Return a description of the class of exception. The description is not related to the exception instance.
Return the name of the exception type. Instances of different
subclasses of hou.Error will return different names. Instances of the
base class will return
You can also use
str(e.__class__) to get the name of the subclass.
Return a message specific to the exception instance.