hou.DopSimulation
class
A dynamics simulation contained inside a DOP network node.
See hou.DopData for more information about the contents of a DOP simulation.
Methods
findData(self, data_spec)→ hou.DopData orNone-
Return the DOP data with the given name. Note that the name may also be a slash-separated path to nested subdata.
Note that this method returns
Noneif the data name refers to a DOP object. Use hou.DopSimulation.findObject to look up DOP objects.See also hou.DopData.findSubData.
findAllData(self, data_spec)→ tuple of hou.DopData-
Given a pattern, return a tuple of DOP data whose names match the pattern. See also hou.DopSimulation.findData.
objects(self)→ tuple of hou.DopData-
Return a tuple of all the DOP objects in the simulation.
You cannot index into this list using the object ID (see hou.DopObject.objid). To create a dictionary mapping object IDs to hou.DopObjects, do this:
id_dict = dict((obj.objid(), obj) for obj in simulation.objects())
findObject(self, obj_spec)→ hou.DopObject orNone-
Return the DOP object with the given name, or
Noneif no object exists with that name. See also hou.DopSimulation.findData and hou.DopSimulation.objects. findAllObjects(self, obj_spec)→ tuple of hou.DopObject-
Given a pattern, return a tuple of DOP objects whose names match the pattern.
>>> simulation = hou.node("/obj/AutoDopNetwork").simulation() >>> [obj.name() for obj in simulation.findAllObjects("box_object?")] ['box_object1', 'box_object2'] >>> [obj.name() for obj in simulation.findAllObjects("o* b*")] ['obj1', 'obj2', 'box_object1', 'box_object2']
relationships(self)→ tuple of hou.DopRelationship-
Return a tuple of hou.DopRelationship objects for all the DOP relationships in the simulation.
# The following example assumes you have created two box objects and made # them rigid bodies. >>> simulation = hou.node("/obj/AutoDopNetwork").simulation() >>> relationship = simulation.relationships()[1] >>> affecting_objects = [ ... simulation.objects()[record.field("objid")] ... for record in relationship.records("ObjInAffectors")] >>> [obj.name() for obj in affecting_objects] ['box_object1'] >>> affected_objects = [ ... simulation.objects()[record.field("objid")] ... for record in relationship.records("ObjInGroup")] >>> [obj.name() for obj in affected_objects] ['box_object2']
findRelationship(self, rel_spec)→ hou.DopRelationship-
Find a DOP relationship by name. Return None if no such relationship with that name exists. See also hou.DopSimulation.relationships.
findAllRelationships(self, rel_spec)→ tuple of hou.DopRelationship-
Return a tuple of hou.DopRelationship objects whose names match a pattern. See also hou.DopSimulation.relationships and hou.DopSimulation.findRelationship.
dopNetNode(self)→ hou.Node-
Return the DOP network node containing this simulation.
save(self, file_name)-
Save the contents of this simulation to a
.simfile that you can load in with a file DOP. time(self)-
Return the simulation’s current time. This value is often the same as hou.time, unless the
Time ScaleorOffset Timeparameters of the DOP network have been changed from their default values. frame(self)-
Return the simulation’s current frame. This value is often the same as hou.frame, unless the
Time ScaleorOffset Timeparameters of the DOP network have been changed from their default values.This method is a shortcut for
hou.timeToFrame(self.time()). globalTimeToSimTime(self, global_time)-
Given a global (playbar time), return the corresponding simulation time. See hou.DopSimulation.time for more information.
globalFrameToSimTime(self, global_frame)-
Given a global (playbar frame), return the corresponding simulation frame. See hou.DopSimulation.frame for more information.
simTimeToGlobalTime(self, sim_time)-
Given a simulation time, return the corresponding global (playbar) time. See hou.DopSimulation.time for more information.
simTimeToGlobalFrame(self, sim_time)-
Given a simulation frame, return the corresponding global (playbar) frame. See hou.DopSimulation.frame for more information.
objectGroups(self)→tupleof hou.DopObjectGroup-
Return a tuple of hou.DopObjectGroup objects for the DOP object groups in this simulation.
findObjectGroup(self, name)→ DopObjectGroup or None-
Given a DOP object group name, return the corresponding hou.DopObjectGroup, or None if no such group exists.