Houdini 11 Houdini Object Model hou

A type of DOP data that contains an object in the simulation.

This object might be a rigid body, a fluid, cloth, etc. The type and properties of the DOP object are determined by the subdata attached to the object.

Methods

Inherited from hou.DopData: attachSubData, copyContentsFrom, createSubData, creator, dataType, dopNetNode, findAllSubData, findSubData, id, options, record, recordTypes, records, removeSubData, simulation, subData

editableGeometryIf this method is called from a Python solver DOP and it has SIM_Geometry (or SIM_GeometryCopy) subdata named "Geometry", it returns a Python guard object that can be used with the "with" statement to access and modify the corresponding hou.Geometry object.
geometryIf this DOP object has SIM_Geometry subdata named "Geometry", return its corresponding read-only hou.Geometry object. Otherwise, this method returns None.
matchesReturn whether or not this object’s name matches a pattern. * will match any number of characters and ? will match any single character. The pattern string contains only one pattern, so spaces in the pattern will be compared against the object name.
nameReturn the name of this DOP object.
objidReturn the index of this object in the output from hou.DopSimulation.objects. This method is a shortcut for self.options().field("objid").
transformReturn the transformation matrix for this object. If include_geometry_transform is False, the result is determined only by the object’s Position data. Otherwise, it is the transform in the object’s Geometry data, followed by the position transform.
name(self) str

Return the name of this DOP object.

matches(self, pattern) bool

Return whether or not this object’s name matches a pattern. * will match any number of characters and ? will match any single character. The pattern string contains only one pattern, so spaces in the pattern will be compared against the object name.

>>> obj = hou.node("/obj/AutoDopNetwork").simulation().objects()[0]
>>> obj.name()
'box_object1'
>>> obj.matches("box*")
True
>>> obj.matches("c*")
False
>>> obj.matches("box* b*")
False
>>> obj.matches("b?x_object1")
True
objid(self) int

Return the index of this object in the output from hou.DopSimulation.objects. This method is a shortcut for self.options().field("objid").

See hou.DopData.id for an example.

Some fields in DOP records store an objid to refer to other objects. The following function looks up an object by objid:

def findObjectByObjid(dopnet_node, objid):
    return dopnet_node.simulation().objects()[objid]

areObjectsAffectors(self, object_sequence)

This feature is not yet implemented

Given a sequence of DOP objects, return whether or not all of those obejcts are affectors of this object.

velocityAtPosition(self, position, use_point_velocity=True, use_volume_velocity=False) hou.Vector4

This feature is not yet implemented

Given a hou.Vector3 position, return the velocity at that position in the simulation. This method accounts for the velocity and angular velocity store in the object’s “Position” data.

use_volume_velocity

Whether or not the velocity is affected by the volumetric representation of the geometry.

use_point_velocity

Whether or not the velocity is affected by the velocity attribute on the object’s geometry. When used, Houdini adds this velocity to the velocity in the Position data.

If both use_volume_velocity and use_point_velocity are set then the volume velocity is used.

transform(self, include_geometry_transform=True) hou.Matrix4

Return the transformation matrix for this object. If include_geometry_transform is False, the result is determined only by the object’s Position data. Otherwise, it is the transform in the object’s Geometry data, followed by the position transform.

For simple DopData types, this method can be approximately implemented as follows:

def transform(self, include_geometry_transform=True):
    result = hou.hmath.identityTransform()

    geometry = self.findSubData("Geometry")
    if include_geometry_transform and geometry is not None:
        result *= geometry.record("Transform").field("transform")

    # Retrieve the position.  If there is Geometry data, use its
    # positionpath field to get the SIM_Position subdata.  If not, look
    # for data named Position.
    position = None
    if geometry is not None:
        position = geometry.findSubData(
            geometry.options().field("positionpath"))
    if position is None:
        position = self.findSubData("Position")

    # If we found position data, build a transformation from the pivot,
    # rotation quaternion, and translate.
    if position is not None:
        options = position.options()
        rotation = hou.Matrix4(options.field("orient").extractRotationMatrix3())
        result *= (hou.hmath.buildTranslate(-options.field("p")) *
            rotation *
            hou.hmath.buildTranslate(options.field("p")) *
            hou.hmath.buildTranslate(options.field("t")))

    return result

geometry(self) hou.Geometry or None

If this DOP object has SIM_Geometry subdata named "Geometry", return its corresponding read-only hou.Geometry object. Otherwise, this method returns None.

editableGeometry(self) → hou.EditableDopGeometryGuard or None

If this method is called from a Python solver DOP and it has SIM_Geometry (or SIM_GeometryCopy) subdata named "Geometry", it returns a Python guard object that can be used with the "with" statement to access and modify the corresponding hou.Geometry object.

In Python 2.5, the with statement is not enabled by default. To enable it, you need to add the following line at the beginning of your script/module:

from __future__ import with_statement

For example, the following code in a Python solver DOP will add a point at the origin of the geometry:

with dop_object.editableGeometry() as geo:
    geo.createPoint()

Raises hou.PermissionError if not called from a Python solver DOP.

Superclasses