See hou.DopData for a description of DOP data, records, and fields.
Methods ¶
field()
→ int
, bool
, float
, str
, hou.Vector2, hou.Vector3, hou.Vector4, hou.Quaternion, hou.Matrix3, or hou.Matrix4
Return the value of a field inside this record, or None
if no such field
exists.
Note that you can add the suffixes “x”, “y”, and “z” to a vector field’s name to access the individual float values.
# The following code assumes you have created a box from the shelf and used # Rigid Bodies > RBD Object on the shelf to make it a rigid body. >>> record = hou.node("/obj/AutoDopNetwork").simulation().findData("box_object1/Forces/Gravity_gravity1").options() >>> record.fieldNames() ('force', 'handlepos') >>> record.field("force") <hou.Vector3 [0, -9.80665, 0]> >>> record.field("forcey") -9.8066501617431641 >>> record.fieldType("force") fieldType.Vector3 >>> record.fieldType("forcey") fieldType.Float
This example function creates a dict out of a record:
def recordAsDict(record): return dict((field_name, record.field(field_name)) for field_name in record.fieldNames())
The following function returns the geometry transform of an object:
def dopGeometryTransform(dopnet_node, object_name): subdata = dopnet_node.simulation().findObject(object_name).findSubData("Geometry") return subdata.record("Transform").field("transform")
fieldNames()
→ tuple of str
Return the names of all the fields inside this record. See hou.DopRecord.field for an example.
fieldType(field_name)
→ hou.fieldType enum value
Return a hou.fieldType enumerated value that describes the type
of data stored in a field. Returns hou.fieldType.NoSuchField
if
no field exists with that name.
See hou.DopRecord.field for an example.
recordIndex()
→ int
Return the index of this record. See hou.DopData.record and hou.DopData.records for more information.
recordType()
→ str
Return the name of this record. See hou.DopData.recordTypes for more information.
setField(field_name, value)
Set a field to the specified value. You would call this method from a
script solver DOP. value
may be an int
, float
, str
,
hou.Vector2, hou.Vector3, hou.Vector4,
hou.Quaternion, hou.Matrix3, or hou.Matrix4.
Unfortunately, this method cannot be used to set a field to a boolean (True or False) value. If you pass a boolean to this method, it will set the field to the integer 1 or 0. To properly set it to a boolean value, use hou.DopRecord.setFieldBool.
Raises hou.PermissionError if called from outside a script solver DOP.
setFieldBool(field_name, value)
Set a field to the specified boolean value. You would call this method from a script solver DOP.
To set a field to a different type, use hou.DopRecord.setField.
Raises hou.PermissionError if called from outside a script solver DOP.