Message Boards Message Boards

8
|
6597 Views
|
0 Replies
|
8 Total Likes
View groups...
Share
Share this post:

How to add CAD-structures in SystemModeler

Posted 11 years ago

How can CAD-structures be added in SystemModeler to make nice animations of the models? I will show a very easy example on how to do that. SystemModeler supports CAD in DXF, OBJ and STL file format. If you don’t know how to create them by your own there are a lot of CAD examples downloadable on internet. But if you want to use them, make sure that it is ok with the creator of the CAD model.

For my model I will use components from the Modelica.Mechanics.MultiBody library. I assume that you have an interesting model that you just want to add CAD structures to, so I keep the model very simple. enter image description here

This very simple model creates the animation below, when simulating for 3 seconds:

enter image description here

But now to the real task, we want a CAD shape instead of the sphere. For this we go back to ModelCenter and add Modelica.Mechanics.MultiBody.Visualizers.FixedShape in parallel with our body. The model now looks like:

enter image description here

We need to set a few parameters of the box to be able to show our CAD structure. I have downloaded a CAD example from grabcad.com created by Adolf Rapp. We start by adding the filename to the parameter shapeType, and the length, width and height parameters of the box. This is done in the General tab.

enter image description here

We also set the animation parameter of the body to false, (animation = false), to avoid showing the sphere. Now we can make a first try to simulate the model. We got the animation:

enter image description here

This is obviously not correct, since the CAD model has been attached in the wrong direction. If we look a bit more at the animation we can see that we want the current y-axis of the CAD to be on the negative x-axis instead. And that the other direction should be on the negative z-axis. Let’s correct that. The parameters lenghtDirection and widthDirection are used for that. We can see that the default value of these parameters are:

lengthDirection = {1, 0, 0}
widthDirection = {0, 1, 0}

We have concluded just by looking at the first animation that we want the current y-axis (widthDirection) to be negative x-axis, and the current x-axis (lengthDirection) to be on the negative z-axis. Let’s correct that by setting the parameters.

enter image description here

Please note that the widthDirection and lenghtDirections needs to be perpendicular vectors. If they are not the widthDirection is calculated as a perpendicular vector to the lengthDirection. When we have set these two parameters of the box, the animation looks like:

enter image description here

Now the car is moving in the correct direction, and we are done with this simple example of how to add CAD structures to a SystemModeler model.

Attachments:
POSTED BY: Karin Hansen
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract