You could do everything in python script, create a new action and/or modifiy the action script of robot, etc.
I would recommend doing it in python script and not messing with actions at all. But if you want to pursue the action route, here is a layout with simple modification to the action script that adds boolean property EmptyingContainer and if true, release action attaches everything in the container to the 3D world node.
I don’t want to study the action script in detail, but there is probably something that updates the grasp_components global variable after grasp action. Since the dynamic components are created and transferred to container automatically, they are probably not considered grasped, thereby script ignores them.
Layout- Custom Action Script for Releasing.vcmx (880.5 KB)
Python Script in robot
from vcScript import *
comp = getComponent()
creator = comp.findBehaviour("ComponentCreator")
Action script (removed reference to version in Program Files, and then used Snippet > ActionScript and modified Release function)
def Release( output, detection_tolerance ):
global robot, grasp_container, grasp_association, grasped_components
# Find first the part to be released
physicsType = None
set_phys = False
part = None
if len(grasped_components) == 0:
release_node = sim.World
for c in grasp_container.Components:
pm = c.WorldPositionMatrix
c.PositionMatrix = pm
return "No component to release"
But I don’t recommend doing this. Just use python script with signals and the attach() and grab() methods for node and container objects.