RigidBodyDynamics - simulate multi link mechanism

I’m trying to simulate a multi-link mechanism.
Based on the “double pendulum” example, I was able to define my mechanism, so far so good, my issue is this:
In my dynamic simulation there are times when I need to lock some links one to the other, and at other times in need to release them.
Can it be done?
If so, please help.
thanks in ahead

Please provide your code, otherwise we cannot help you…