As part of making SOP nodes compilable, we separated out the node’s basic operation code (what the node does to geometry) from the code that deals with the concerns of the node (caching, reading inputs, evaluating parameters, and so on). We call these functions verbs. You can use them in Python scripting to modify geometry held in a hou.Geometry object. This might be useful anywhere you need to programmatically alter geometry and don’t want to have to build a geometry network to do so.
Using a verb is a two-step process: set the parameters on the verb, then apply the verb to a hou.Geoemtry object.
Set the parameters on the verb.
Pass a dictionary to hou.NodeVerb.setParms where the keys are the internal names of the parameters. You can see the internal name of a parameter in the Parameter Editor by hovering over the parameter’s name.
Apply the node to a geometry object.
If your verb has inputs (for example, the Copy Stamp verb takes the geometry to copy and the points to copy onto), you can supply hou.Geometry objects representing the inputs in the second argument. You can get a live read-only reference to of the geometry from a node using hou.SopNode.geometry().
When you execute() a verb, it overwrites the geometry you pass it. If you want to combine multiple generators (or multiple generator/filter chains), you must generate each piece in a "buffer" Geometry object, and merge the pieces into a "main" Geometry using hou.Geometry.merge().
You can use a Python SOP to preview, test, or debug your geometry generation script. It outputs a hou.Geometry object you build in the node’s Python code parameter.
hou.NodeVerb.execute always overwrites the Geometry object you supply. If you want to add to an existing Geometry object, execute into an empty Geometry, then use hou.Geometry.merge() to merge it with another Geometry object.
# to explicitly write it back to the node's geometry.
The following example grabs the geometry from a node and applies the Subdivide and IsoOffset verbs to it.
# Get a hou.SopVerb that knows how to subdivide.
# Pass in a dictionary mapping parameter names to values.
# Node defaults are already set, so just set non-default things.
# list to represent an unwired input).