MATLAB: How to maintain physical constraints when importing a Solidworks model into Simulink

Simscape Multibody

I am importing a model into Simulink using "smimport" command.
In Solidworks, when I turn on the physical constraints command, the model follows the real world physical constraints, such as a solid object not being able to pass through another solid object.
But the imported model in Simulink does not seem to follow such constraints. Is there a way to make sure such constraints are maintained after importing the model into Simulink?

Best Answer

Unilateral contact constraints like this are not respected when importing a model from CAD into Simscape Multibody. To add these constraints, you will need to post-process the model after it is imported.
There are two ways to add the constraint that the end-effector does not go through walls in the the model:
1. Add a Planar Joint to the model that connects the World Frame and the end-effector. Then set limits on the x and y prismatic primitives of the joint that coincide with the walls.
2. Add two Spatial Contact Force blocks to the model to model the contact between the walls and the end-effector. However, Spatial Contact Force blocks cannot currently be used with CAD geometry, so the user would have to add "proxy geometry" as discussed here: