Hello everyone, I am new here, thanks VC on this forum I learned a lot. This is my problem:
The robot drop this component (part) in the clamp. And as I see it, this part is now a attached at the clamp. Now I want the moment when the signal “ready” is activated to enter in properties of this part and change the physics (to simulate cutting). But I don’t know how to access to this specific component.
this is my code what I have for now:
from vcScript import *
app = getApplication()
sim = app.Simulation
comp = getComponent()
#---------------------- WRONG ---------------------
physJoint_1 = comp.findBehaviour("PhysicsJointD6_1")
physEntity_1 = comp.findBehaviour("PhysicsEntity_1")
physJoint_2 = comp.findBehaviour("PhysicsJointD6_2")
physEntity_2 = comp.findBehaviour("PhysicsEntity_2")
physJoint_3 = comp.findBehaviour("PhysicsJointD6_3")
physEntity_3 = comp.findBehaviour("PhysicsEntity_3")
physJoint_4 = comp.findBehaviour("PhysicsJointD6_4")
physEntity_4 = comp.findBehaviour("PhysicsEntity_4")
physJoint_5 = comp.findBehaviour("PhysicsJointD6_5")
physEntity_5 = comp.findBehaviour("PhysicsEntity_5")
physJoint_6 = comp.findBehaviour("PhysicsJointD6_6")
physEntity_6 = comp.findBehaviour("PhysicsEntity_6")
#----------------------------------------------------
ready = comp.getBehaviour("BooleanSignal")
def OnSignal( signal ):
if (signal.Name == 'BooleanSignal'):
if signal.Value:
do_physics_stuff()
def OnRun():
pass
# "break" all the joints and activate #In Physics
# knife cutting simulation: the blue boxes fall down
# and the yellow head part remains.
def do_physics_stuff():
try:
physJoint_1.delete()
type_ = physEntity_1.getProperty('Physics Type')
type_ .Value = 0
#---
physJoint_2.delete()
type_ = physEntity_2.getProperty('Physics Type')
type_ .Value = 0
#---
physJoint_3.delete()
type_ = physEntity_3.getProperty('Physics Type')
type_ .Value = 0
#---
physJoint_4.delete()
type_ = physEntity_4.getProperty('Physics Type')
type_ .Value = 0
#---
physJoint_5.delete()
type_ = physEntity_5.getProperty('Physics Type')
type_ .Value = 0
#---
physJoint_6.delete()
type_ = physEntity_6.getProperty('Physics Type')
type_ .Value = 0
except: print 'problem!!!'
thanks in advance!