Sunday, April 8, 2012

Sketching and Constraints

Hello everyone! I'm back with another tutorial. First off, I want to thank you all for your interest and kind comments. I'm more excited to keep this blog going, thanks! I will keep posting tutorials frequently.

So, this one will be about sketches. Sketches are the first step in creating 3 dimensional objects. These  are usually like shadows of the objects you would create. To accurately create 3 dimensional objects, sketching must be mastered, because you should be able to foresee what part would be going where and so on.

First, open a empty part file if one is not already open. Click File > New > Part > OK. Now the part design workbench should be open, the toolbars you see at the edges of the screen are toolbars of the part design workbench. By default, at the edge of the screen, you should see a sketch button, a little above the middle of the edge. This is how the button looks like:
After you click the button it should be highlighted in orange. This means that you can click on a plane or surface to start sketching. Click on any plane. Now we are in 2-D.

You can see that the workbench is also changed into the sketcher workbench. Firstly, I suggest you to turn snap to point option off, as it can be annoying. It simply does not allow you to draw on points other than the ones on the grid. It's under the sketch toolbar and looks like this:
With that out of the way, let's begin drawing. Click the rectangle button under the profile toolbar. There are several profiles in the profile toolbar, some of which we will be using a lot:

If you cant see the toolbars, just right click on the right hand side bar and there you can see which toolbar is on and which one is off, and toggle them on and off.

Let's have one corner of the rectangle on the origin. After clicking the rectangle button. Click once on the origin to set its corner on the origin. Than click anywhere on the plane to set the rectangle's opposite corner.

Now we have drawn a rectangle. But we don't have proper dimension yet. You can see that you can click and drag the edges and the corners of the rectangle to redraw it. But we need precice dimensions. That's where the constraint button does its job. You can find it under the constraint toolbar and it looks like this:
Click it once to enter constraint mode. There are several ways you can define a constraint. First let's try clicking on the upper edge of the rectangle. You will see a line with the dimension on top will appear. Click again to set it. This line's position doesn't matter as it is not a drawing, it's an indicator of the length. So place it anywhere you like.

Double click on the dimension to edit it and type 150. Now our rectangles width is set to 150 millimeters. You can see we are not editing only one edge, but the length applies to both opposite edges, since the shape is predefined as a rectangle. Let's try another way of defining the constraint while we are settin the height of our rectangle. After clicking the constraint button, this time click the top edge and then the bottom edge. This defines the distance between two lines, which is the height of our rectangle. Like before, double click the number and set it to 50 millimeters. This is what our rectangle should look like:

If you try to give more dimensions to the rectangle, you will overdefine the rectangle and see
that the new dimension becomes purple. Let's draw a line using the line button in the profile toolbar.
Click on the upper right corner of our rectangle and click somewhere above our rectangle's top edge.

Click the constraint button, click on the line and click on the top edge of the rectangle. This allows you the define the angle between our line and our rectangle. Let's set the angle to 50 degrees.

As you can see, you can make the line longer or shorter by dragging it back and forth. This is because we only gave dimension to the angle between two lines. But the upper point of the line is not constraint. That means we can move it anywhere, as long as the line has the same angle.

Let's delete all the constraints we have defined and try something new. To delete them, click on the constraints and press delete as they are highlighted into orange.  Now our shape has no dimensions. The only constraints are that our shape is a rectangle, its one corner is on the origin and the line has its one end on the rectangle's corner.

Say we want to get our previous constraints back without adding constraints one by one. Our shape has the same dimension as before, but we lack constraints. There is a quick way to get all the constraints at once. The feature is called auto constraint and you can access it under the constraint toolbar. First click and drag a box around our shape like you would do on your desktop of your computer. After selecting all the elements, click on the small triangle at the corner of the fix together button, which is a clip. A submenu will open. Click on the other button which is the auto constraint button:

If you have used this feature before, the button on the toolbar can be the auto constraint button instead of the clip, as the button shows the last button you have selected on the submenu. After clicking the auto constraint button, you can see that we got all our constraints back with an additional length of the line. As you see, this feature completely dimensions the sketch, leaving nothing free. This is why we got the extra constraint.

The last thing I want to show about constraints is the contact constraint. This feature does not make you set a length or an angle, but it sets the elements into contacts. Let's draw a circle right to our rectangle. The circle button is under the profile toolbar:
Click to a free space at the right side of our rectangle. At this point I'd like to point something out. When you drag your mouse around to set the circle's radius, you will occasionally see blue lines aligned with the rectangle. This means at that position, if you click, the circle will snap and it will be aligned with the rectangle in someway. For example, at the next picture, the blue line tells me that the circle's lowermost point will be on the same line with my rectangle's lower edge. In other words it will be tangent to the extension of the rectangle's edge:

For now, we will avoid this and put our circle in a position free of constraints.

Now click the contact constraint button. You can access it under the constraint toolbar. Click on the small triangle under the constraint button we used before and access the submenu. From the submenu select the contact constraint button.

Now click on the circle, then on the right edge of the rectangle. Now the circle is tangent to the edge of the rectangle. You can click and drag the circle to move it around, but you will see that it's always tangent to the edge or its extension. You can go forth and give dimensions to the circle, but the circle will always be tangent to the edge.

If you use the contact constraint feature on two circles they will be concentric:

These are all there is for dimensioning. This post has been an entry to sketching and covered its basics. Next post will be about some more advanced features of sketching. It may feel like we are progressing slowly, but that's because we're just covering the basics. With the basics out of the way, we will be much faster in doing more complex tutorials and exercises. Feel free to comment and ask questions. See you at the next tutorial!


  1. Looks very similar to AutoCAD, great tutorial.

  2. I'm following you! Maybe I can use this tutorial sometime!

  3. Nice tutorial, pics are really helpful thanks!

  4. Whoa! You put some serious effort into this post, really well done!

  5. Such a nice tutorial keep it up!

  6. Your tutorial id expanding nicely. Well done!

  7. nice & neat :) keep it going :)

  8. THX! That was very helpful 4me

  9. This is very useful.

  10. thank you it is very useful.
    one question ,,,,,,
    how can apply the "equal " constrain

  11. How to get setting for constraint initial when I created line

  12. This tutorial is very helpful for me plz also share some more tutorial of surfacing in solid works also.

  13. This comment has been removed by the author.

  14. nice this is very helpful for beginners plz share some more tutorials keep it up.

  15. I am a man of 60. Started Auto cad and catia in a tutorial where i am little uneasy to follow their handouts and practical. I have no computer backgrounds except hands-on experience.

    Can you help me with your tutorials. Your way of teachings are very much user friendly.