Mastering Sketch Constraints and Global Variables in SOLIDWORKS for Smarter Playground Design

Learn how to fully define sketches using dimensions, references, and global variables in SOLIDWORKS to streamline and future-proof your playground design.

Discover how to define sketch entities in SOLIDWORKS and apply global variables to your designs. This article explores various ways to fix a sketch entity, use the smart dimension feature, create references, and work with the equations tool to define global variables.

Key Insights

  • There are three main ways to define a sketch entity in SOLIDWORKS: using smart dimensions, creating a reference, and utilizing global variables. Each method has its unique applications and benefits.
  • Global variables are particularly useful for creating definitions that can be used multiple times across a design. Changes to these global variables can update all linked entities simultaneously, saving time and ensuring consistency in your design.
  • While the 'Fix' feature can be used to define sketch entities, it's not recommended for designs that might undergo changes. This is because fixed entities may cause errors if they can't reconcile with changing entities around them.

This lesson is a preview from our SOLIDWORKS Certification Course Online (includes software & exam). Enroll in this course for detailed lessons, live instructor support, and project-based training.

This is a lesson preview only. For the full lesson, purchase the course here.

In this video, we're going to discuss equations and global variables,  we're going to set the dimensions of the materials we plan to use to build our playground,  and we're going to discuss the various ways that you can fix a sketch entity in space. So let's begin with the various ways you can fix a sketch entity. Go ahead and open up a new part in SOLIDWORKS.

You can see I have two parts open. I have the dataset, which I'll be referencing shortly,  and a new part, which you can follow along with. In this part, let's make sure that we have a sketch open, say, on the front plane,  and let's just draw a rectangle.

We'll pick a corner rectangle, and let's just draw it arbitrarily there in space. We'll hit escape to get out of the rectangle task bar, and here we are. As you can see, because it's blue, it is fully undefined, and we want to define it.

Now, we've learned one way to define something already, and that's by using smart dimension. If we click this button, we can start adding dimensions. Let's do, let's call this 60 inches, and we'll call this 20 inches.

Wonderful. We'll click the green check mark to close it out. Close and save the sketch, and while we're at it,  we go down here to the custom tab and switch to inches.

There we go. Let's go back, open the sketch by clicking on it and selecting this edit sketch button. We've defined the height and width of this rectangle.

The lines are still blue because they can still move freely in space,  even though the rectangle itself is defined. That brings us to the next method by which we can define a sketch entity,  and that's by creating a reference. Now, there's nothing in this graphics area except for this rectangle that we just created and one other thing, and that's the origin right here.

We can reference to this origin, and there are a number of ways to do that. We can simply grab a corner, drag it on the origin,  watch them click and watch them fasten to each other. Now, it's stuck to the origin at that corner, and it is fully defined in black.

We'll go ahead and control Z, undo that. I can also select this line, hold down the shift bar, select the origin,  and then it will give me a couple options of other references I can apply to fix this rectangle in space. Now, we just did coincidence, but we'll see it again.

There we go. Click the green check mark because we're satisfied with that. We've just created a reference between the bottom line of the rectangle and the origin,  and you can see the bottom line and the top line are now black because the coincident relationship means that this line and this origin will always follow on the exact same line, thereby setting the bottom and the top of our rectangle.

But the sides are still blue, so how do we create a reference that defines those sides? We can click on that sidebar, click on the origin by holding shift at the same time,  create, say, a midpoint reference. And it's not going to allow us to do that. Let's go ahead and exit out of that.

Let's select coincident. There we go. And click the green check mark.

So that origin is now coincident to the bottom line and coincident to the side line,  the left-hand side line, which is to say it's touching the bottom line and touching the left-hand side line. So that is an example of a reference that helps to define our sketch. Let's go ahead and hit control z and hit control z again until we get ourselves back to a fully undefined rectangle.

Great. Let's go ahead and mouse gesture and grab our center line. I'm going to place the first part of the center line here and the second part here.

Hit escape to get out of that. And let's grab a reference between this line and the origin. Let's try midpoint now.

Okay. Now the origin lives on the exact midpoint of this center line,  thereby defining the entire rectangle. So this rectangle is defined by both smart dimensions and references.

You can define a sketch entity by references alone. And we will be doing that a lot during this course. It's a great way of making sure that aspects of your design appropriately affect other aspects of your design,  so that if you change one thing, other things update in response.

Let's go ahead and close this out. So let's discover a new way to create a fixed entity in a sketch. Let's go back to the front plane and create a new sketch.

And let's go ahead and grab the center circle,  start it right here at the origin, and then just drag it out arbitrarily. Click the green check mark, and then let's close and save the sketch. Now we know this circle isn't fully defined.

The center and location of the circle is defined, but the size is not. Now we could grab smart dimension and apply a dimension to it,  say like three inches or 10 inches, whatever we want. Or we could go up here to tools.

If you'll just click that bar, go down to equations. And we can set what's called a global variable. See this first row here? We can populate this text.

Let's give this new global variable a name. We'll call it circle diameter. We have to give that global variable a value.

Let's call it 10 inches, and we'll click outside of the box. OK, we've just created a global variable called circle diameter. Let's click OK to close that out.

Great. Now let's go back into that sketch. All right, now again, this circle, the size is undefined.

So let's go ahead and go to smart dimension, click the circle,  and you can see it's already starting to assume a diameter,  smart dimension, which is the right assumption. We'll click again. Now we could put a value here, like say 40 inches or 50 inches.

But instead of that, we're going to hit the equals sign. And then it brings up a menu, global variables. And we can scroll over to the right to find our circle diameter global variable that we recently created.

Let's click that. And we'll click the check mark to close it out. And there we have it.

It's now fully defined. And if you look at the dimension, it not only gives us the value of that global variable,  it also has this sigma sign, which tells us that it's linked to a global variable or an equation that we created to define it. So what's the point of having global variables as opposed to using smart dimension? Well, with smart dimension, you have to define every entity every time you need a new definition.

With global variables, you can set a global variable,  define as many entities you want with that same global variable. And then anytime you change that global variable in the future,  everything that's linked to it will update automatically at the exact same time. Let's go ahead and do that now.

Let's close and save the sketch. Let's go back up to tools, back into equations. You can see the circle diameter global variable is here.

The value is there. It added an equation because we've told SOLIDWORKS,  we'd like to reference this global variable at least once. And so it's added that instance here for us.

And as we reference it more and more, it'll add each of those equations in chronological order. But let's go up to this value here and go from 10 to say 20. Once we have it, click enter.

All right. Now let's go back into the sketch. You can see that the circle diameter has updated to 20 inches.

Let's go ahead and create a few more circles. One right here, one right here, one right here. Hold down shift, select the center of each of these circles.

And let's give them a reference horizontal,  which means they will all lie on the same horizontal line. Now, if we try to click and drag these, they can only move left to right. We can change the size, but we can't move them up and down.

We can only move them left to right. And let's assign a smart dimension to each of these. I'd like this circle to have our global variable equals global variable circle diameter.

Great. I'd like this circle to be our global variable, say, minus or rather divided by two. We're creating a new equation.

All right. You can see it updated to 10, which is half of 20. And let's make this global variable a fourth.

All right. Divide by four. Click the green check mark.

And there we go. Close out the sketch and save it. Now, let's go back up to tools, back into equations.

And let's change this value to, say, 40. All right. Click OK.

All of our circles have updated as a result. Let's go in and take a look at them. Right.

We've got the two that are simply the global variable itself, listed at 40. This one, which is half, listed at 20. And this one, which is a quarter of the size, listed at 10.

OK, great. And that's the value of using global variables, is you can make changes that affect many parts of your design at the exact same time. One of the ways that you can save time when you're editing your designs.

Let's go ahead and close out this sketch. And we can hold Control and select both sketches, right-click and click Delete. We can either delete one at a time or all at the exact same time.

Let's delete them all. Great. Now that we've done that, we have a little error here.

We can see that in red. We've lost some of the equations. Let's go take a look at that.

There are four equations that we use the global variable to find that no longer exist. And the program has a problem with that. So let's just go through and highlight each of these bars and delete the equations that are no longer relevant to us.

OK, great. We still have our global variable, but we no longer have any equations that reference it. Click OK to get out of it.

All right. Now we've learned three ways to fix a sketch entity. I'll teach you one more way right here.

So let's go into Front Plane. Click Sketch. Let's grab a circle.

And then we'll zoom in with the scroll wheel, set the center of the circle, set the outside. We can change the diameter of the circle. As we know, the center is set.

It's coincident to the origin. So that reference set the location of that circle. I could use smart dimension or a global variable to set this diameter.

But instead, I'm going to highlight that sketch entity and select Fix. We'll go ahead and click this green checkmark. You can see it's now fully defined.

And if we click on it, we can see an icon of what that type of fully defined aspect is. In this case, it's an anchor fixing it to the screen. Now, although this is a way to fix sketch entities and make them fully defined,  it tends to not be a very robust way if you're making a design that might change.

Because if you change a design and you have some sketch entities that are fixed,  it might break your part and cause some errors to occur because it can't reconcile something that's fixed in 3D space with things around it that are changing. So I try to avoid using the fixed reference as much as possible. But it is there in case you need it.

Sometimes it's nice to use it as a placeholder while you're creating designs. So you can come back and then maybe change it to a smart dimension later. Let's go ahead and close out the sketch without saving by pressing this red X. All right.

We've learned all the ways to fix a sketch entity. Now let's go ahead and make some global variables that will apply to the materials we plan to use for our playground. I'm going to go ahead and open this up.

Just watch and follow along. There are a couple universal materials that are going to be used many times over. The first is a, we'll call this our narrow board.

And next is a board that's a little bit wider. We'll be cutting notches out of it for these stairs and altering it in other ways for other parts. There's going to be a 2x4 plank.

And then we're also going to have these beams,  these structural beams which are going to keep our playground nice and sturdy, nice and safe. And we're going to go ahead and apply global variables that assign the sizes of these materials. Assuming we found these materials online or maybe found them at a hardware store where we know we're going to be working with materials at that dimension, at that thickness.

So let's make it easy on ourselves and set them as global variables because we'll be referencing them over and over and over again. I'm going to go ahead and close this out. Now we're back in our part.

And this is a part of the video that you can do with me. Let's go up to tools, down to equations. Let's go ahead and delete the circle diameter global variable.

And we're going to create some new global variables. The first is going to be our standard board thickness. So let's go ahead and give it a name, board thickness.

And for this, let's call it one and a half inches. Beautiful. The next will be the thickness of our planks.

Go ahead and type in plank thickness. And we'll call this 0.375, three eighths. Great.

The next will be our narrow board width. And let's make this one three and three eighths, 3.375. The next will be wide board width. And we'll make that five and three eighths.

And for this, let's put five space three dash eight. Here we go. Let's see if that… Oh, it's not recognizing that.

So let's put 5.375. Great. We know it recognizes it once it updates in the evaluates to column. That's how we know we've created a global variable successfully.

After that, let's do the width of our planks. Plank width. And we know that's going to be two feet, two FT.

And that evaluates to 24 inches. Great. Then there's plank length.

We'll set that at four FT, four feet, which evaluates to 48 inches. We're going to be using gaps between our boards during our construction. So let's set a standard gap width.

We'll call this just gap. And let's call that one eighth. So I'm going to put 0.125. Great.

And then there's going to be the beams, the structural beams. And the depth and width of those are going to be the same. So let's just go ahead and make one global variable to apply to both.

We'll call that beam thickness. Here we go. And let's make that five and a half inches.

Great. Once we're satisfied with our global variables,  and everything has an evaluates to amount,  let's go ahead and click OK. Great.

We've now got all of the thicknesses and dimensions of our materials set. We are ready to begin our playground. At this moment, let's go ahead and save this part because this is going to be the playground that we're working on regularly throughout this course.

I have my hotkey set to Control Shift S for Save As. And let's create a new folder for this called Playground. Let's open up that folder.

And let's call this Master File. And you can even do underscore playground if you want to know what it's referencing. Once we're satisfied with the location and the name, click Save.

All right. And yes, there's nothing in our graphics area. That's OK.

There's still plenty of data in our equations. Here we go. In our equations over here.

That's going to be used over and over and over again as we create our design. Thank you. That's it for this video.

In the next video, we're going to create a ground plan sketch. We're going to set dimensions and learn a little bit more about the references that we're going to be using as we create our design.

photo of William Tenney

William Tenney

William Tenney is a career Solidworks designer. He began his career in consumer products then shifted to retail display design, corporate interiors, and finally furniture. His time with Solidworks spans almost two decades where in that time he designed many pieces for mass production, was awarded co-inventor status on five patents, obtained the Professional Certification and Surfacing Certification for Solidworks, and also contributed to many pieces shown in such publications as Architectural Digest, Interior Design Magazine, Fashion Magazine, and 1st Dibs. Outside of his work life, he is a husband to a wonderful spouse and a father to two future creatives.

More articles by William Tenney

How to Learn SolidWorks

Develop 2D and 3D modeling skills for construction and product design. 

Yelp Facebook LinkedIn YouTube Twitter Instagram