From the course: SOLIDWORKS 2021 Essential Training

Using equations and linked variables - SOLIDWORKS Tutorial

From the course: SOLIDWORKS 2021 Essential Training

Start my 1-month free trial

Using equations and linked variables

- [Instructor] SolidWorks has some powerful tools for working with equations and linked variables. And we can easily access that toolbar if I turn it on. So, right over here if I click on the very top icon here, on our part, right click on it and come down here to tree or hidden tree items, and below that you'll see hide and show tree items. Click in there. And right over here you can see equations and that's automatic. So that means if you start using equations that will show up but I want to just show it all the time. So just show all the time, click on okay. And now you can see we've got equations right over here, okay. So let's go ahead and manage the equations. That's going to pull up this box right here and we have several different types of equations. We have global variables, we have features, and we have just basic equations. So right in here I'm going to type in something like just the letter A. So here's my first equation A, and then hit tab. And then what I want that to equal to, so I'm going to say five inches, okay. Hit tab again, it's going to bring it in there. And then you can create another variable. So this time it's called B. Big B, tab it over. We'll say three, tab again. And that's all we need to start with with. So we've created a couple of global variables. Now when we go back to our sketch, we're going to tie in and use these global variables to drive our sketch. So click on okay. Let's go ahead and fire up a sketch. So I'm going to choose sketch right over here. Let's go ahead and use the front plane, and let's just draw a really basic corner rectangle. Starting at the origin and click there, drag out a rectangle. Now traditionally you would grab this smart dimensioning tool, come over here, grab like a line and then go ahead and type in like 2.0, right And that's how you would define the shape. However, we want this to be controlled by an equation. So instead of actually just typing in the value, right over here, I can hit the equals key on my keyboard and that'll bring up this little list to choose from global variables, functions or even file properties. But right now we want to use global variables and notice right over here are those two global variables that we've already created. So I'm going to choose the B variable here, say that's equal to that, click okay. And notice that this icon is now changed. So you can see the little sigma in front of there. So it's showing us that that variable is controlling that dimension. So if you want to go back and change the global variable, this schedule automatically adjust. Same thing over here. Let's create one more smart dimension from these side over to this side over here, go ahead and place the dimension. But instead of actually typing in a value, again hit equals on your keyboard, come down to the global variables and choose A. Click on okay, and now you can see that one also changes. So it's showing that it's controlled by a global variable. Let's go ahead and extrude this out. And I'm going to type in just one inch for right now, okay. So there's our block. Now, if we want to go back and change our global variables here's our equations, right? Manage equations. Let's go ahead and change them. Let's say this is going to be eight by something else. That's like eight by five, right? So we're going to change those, click okay, go back to our part and it automatically adjust to the size. Let's go back and take a look at that sketch. Here's my sketch. And now it's eight by five, because it's been driven by those variables. This is also great if you're making like a hole and you want to make a half inch hole all over your part. So every time you create a hole you just link it to that global variable. Then as your design progresses, if you decide, hey I would like change from a half inch hole to maybe a one inch hole, go and change that one global variable and every single hole in your part will automatically adjust because they're all linked to that variable. A couple other things. Right over here under the extrude, right? I can come over here and say add a feature and instead of actually typing a value over here, I can also do the same thing. I can link that to a global variable, right? So I've only got these two global variables in here right now. Let's choose B and click okay. And now that is also controlled by that global variable. Let's go try creating one more sketch. Right over here, I'm going to say this gets here, and I'm going to create just another simple rectangle. All right. And now what I want to do is I want to create a dimension. So I'm going to say, hey, this dimension or this length right up here. That dimension, I would like it to be equal to a global variable. But however, I don't have a global variable that are actually like, so I can create one right here. So I can say this is equal to, and we'll call it R. And if I click on something like an R, it gives us a little pop-up global, or like a little earth looking thing here. And I can say, hey, I want that R to be a global variable. And then I want that to be equal to whatever value I type in here. So the five inches and then click on, okay. Now on the fly, I was able to create that global variable. And notice over here, if you actually kind of hover over it says D1 at sketch2. That's what's being driven by that global variable, okay. And then over here, we can do something even cooler. So instead of actually creating a global variable, I can say, this is equal to this length. I'm going to click on it right here. So I'm going to click on the dimension, that dimension divided by two. So I can actually create an equation right in here, click on okay. And now that's always going to be half of what this dimension is over here. And you can use it more. So over here, you can make another dimension, right? This time, I'm going to say this guy's equal to this dimension over here, click on it, divided by, and then two and click okay. All right, so now we created several different linked variables or global variables. So let me show you how those all work. Let's go ahead and create another feature. Let's do an extrude, as far as what I want to link to. I can say also global variable, or I can create a function, something like that. I can do a bunch of other cool things here but let's go ahead and link this back over to that our variable, click okay. And there it is. And if I go ahead, take a look at the equations. You can see we've got those three different variables there. And if I go over here and manage the equations you can see I've got the three global variables but then I also have these linked to variables over here. So I'm linking and using this information down here that's bringing that information back and using these variables up here as well as creating some equations to define the shape. And you can do all kinds of really cool things with these equations. We can create very complex formulas, we can do trigonometry, we can pull properties from the parts themselves. So it's a really great way to leverage the power of SolidWorks to create some very intricate designs that are completely controlled by equations in SolidWorks.

Contents