catchyid Posted November 29, 2020 Share Posted November 29, 2020 Hi, I am using Script solver inside a DOP RBD bullet sim, I was able to change velocities of individual RBD packed objects, however I don't know how to access/modify constraints network parameters (e.g strength, add/remove broken group, etc.)? The constraint network in defined globally "Relationships" subdata (i.e. not attached to each object), below is the code I am trying to write : from __future__ import with_statement def solveForObjects( solver_data, new_dop_objects, existing_dop_objects, time, timestep): dopsim = solver_data.simulation() relationships = dopsim.findRelationship("constraintnetwork1") constraintsnetwork = relationships.findSubData("constraintnetwork") # geometry lives inside 'constraintnetwork' subdata geo = constraintsnetwork.findSubData("Geometry") #that works, but it's not a hou.Geometry that can be edited! with constraintsnetwork.editableGeometry() as geo: #error: AttributeError: 'DopData' object has no attribute 'editableGeometry #.... do something here Quote Link to comment Share on other sites More sharing options...
catchyid Posted November 29, 2020 Author Share Posted November 29, 2020 did some investigating, it's possible to break constraints also but they must be attached to objects (and not the generic relationship subdata), attached file is an example if someone is interested pythonrbdscript.hip Quote Link to comment Share on other sites More sharing options...
Benyee Posted September 6, 2021 Share Posted September 6, 2021 On 2020/11/29 at 11:34 AM, catchyid said: Hi, I am using Script solver inside a DOP RBD bullet sim, I was able to change velocities of individual RBD packed objects, however I don't know how to access/modify constraints network parameters (e.g strength, add/remove broken group, etc.)? The constraint network in defined globally "Relationships" subdata (i.e. not attached to each object), below is the code I am trying to write : from __future__ import with_statement def solveForObjects( solver_data, new_dop_objects, existing_dop_objects, time, timestep): dopsim = solver_data.simulation() relationships = dopsim.findRelationship("constraintnetwork1") constraintsnetwork = relationships.findSubData("constraintnetwork") # geometry lives inside 'constraintnetwork' subdata geo = constraintsnetwork.findSubData("Geometry") #that works, but it's not a hou.Geometry that can be edited! with constraintsnetwork.editableGeometry() as geo: #error: AttributeError: 'DopData' object has no attribute 'editableGeometry #.... do something here u should just modify some code,like this: from __future__ import with_statement def solveForObjects(solver_data, new_dop_objects, existing_dop_objects, time, timestep): frame=time/timestep sim=solver_data.simulation() cnst_rel=sim.findRelationship('constraintnetwork1') for dop_object in existing_dop_objects: with cnst_rel.editableGeometry('constraintnetwork/Geometry') as geo_cnst: for prim in geo_cnst.prims(): if(prim.attribValue('angle')>.2): prim.setAttribValue('constraint_name','Glue') Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.