Store
Custom Search

Sum Simple Equations

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 2.00 out of 5)
Loading ... Loading ...
Jun 16th, 2008 | By Alex R. Ruiz | Category: Parts

This is for all those who proclaimed in high school algebra, “I will never use this…” We use equations every day, even if you don’t know it. My paycheck is ‘X‘ and my bills are ‘Y‘ , money for fun stuff is X-Y= -Z …D’oh!. SolidWorks has the ability to use equations that can be anywhere from very simple equations and variables, all the way up to very complex equations. Admittedly, I can not do the more complex equations, even though SolidWorks can handle it, but I do use equations almost everyday. Today I will show you some simple equations tricks that you may end up using daily as well.

Adding Equations

There are a number of way you access the Equations window where you can add, edit and delete equations but the easiest is from the Tools menu. To access the Equations window click Tools -> Equations..

In the Equations window you can add, edit and delete equations. You can even apply equations to specific configurations…but that’s a different post.

Creating a ‘Variable’

As you may remember from high school algebra a variable is:

a symbol (like x or y) that is used in mathematical or logical expressions to represent a variable quantity

In SolidWorks you can create variables to decrease the time to make updates when a value is used in multiple places in your model. I create variables when I am designing a new product and I am still not set on some dimensions that I know will be changing and are used throughout the part.

Here is a simple example , we have a base plate that have four holes that will hold four shafts who’s diameter has not been set. At this stage in the design we are assuming that the shafts will be 0.75″ but we totally expect that it will change. We can link the dimension to a global variable that we can later update easily or reference with other dimensions. In the Equations window click Add…

In the Add Equation window you are presented with a scientific calculator that allows you to enter algebraic and trigonometric functions as well as simple statements. In the text field we will create our variable. Enclose the variable name in quotation marks and follow it with an equal sign then the value.

Once created you can see the variable listed in the Equations window along with the value. Here you can also suppress the equation by unchecking Active.

Using Variables

Variables you create in this manner can be used as follows:

  • In other variables
  • In other equations
  • In dimensions
  • Referenced by the parent assembly
  • Custom Properties

For this example we will use the Shaft Dia variable we created to be used by a second variable, Shaft Hole. This new variable will drive the actually holes in the plate. The holes will be the proposed diameter of the shaft with a .010″ clearance. Doing it this way allows us to adjust the clearance for all holes quickly and updates the hole diameters as theĀ  shafts change. In the Add Equations window, we name the variable as we did with the first variable. For the subsequent formula we reference the previous variable in quotes and add the clearance value.

There is no use in creating variables if we are not going to use them. Now we need to attach the Shaft Hole variable to the actual hole dimension in the sketch. In the Modify dimension window, click the down arrow and select Link Value. We covered linking values in a previous post, Linking Dimensions in Sketches.

In the Shared Values, we can reference the variable we created. Click the down arrow in the Name field and select the Shaft Hole variable.

Click OK. The dimension is now linked to the variable. The dimension in sketch is now preceded with the link value and equation symbols. As the value of the Shaft Dia or clearance is changed, the dimension will be updated.

Using Linked Values in Simple Equations

Another equation I use often is a simple equation that uses linked values. Going back to the Base Plate from the previous example, we want the height of the plate to be directly proportional to the width. As the width of the plate is changed the height is updated based on the formula. First, create a linked value for the width of the plate.

In the Shared Values window apply the name Base Plate Width.

Then add the dimension to the height of the plate and select Add Equation in the Modify window.

Using the Add Equation function automatically begins a new equation with the name of the dimension. All you have to do is add the equation itself. Since we are making this dimension based off of the previously linked value, we type in the name of the linked value in quotes; “Base Plate Width” and finish the equation. We want the the height of the plate to be the width of the plate divided by 1.66667.

After clicking OK the evaluated value of the formula is listed in the Equations window.

In the sketch you will see the dimension preceded with either the linked value icon or the equation icon.

Viewing Named Equations

In the Equations folder in the FeatureManager you can view all the named equations.

Here you can change your equations or update the variables you created by right-clicking the equation and selecting Edit Equation.

If we need to change the shaft diameter as the design progresses, we update the variable and click OK.

Click OK in the Equations window and the variable along with all the referencing equations and dimensions will be updated.

That’s it. Your high school algebra teacher would be proud, you finally put what you learned to practical use. This is only a small part of what you can do with equations, sometime at a later date I will cover some tips and tricks when using equations.

If you enjoyed this post, make sure you subscribe to my RSS feed!

Related Links:
Linking Dimensions in Sketches...
Building a Stapler – Arm Spring...

Related posts brought to you by Yet Another Related Posts Plugin.

Tags: , , ,
  • Matt
    " My paycheck is ‘X‘ and my bills are ‘Y‘ , money for fun stuff is X-Y= -Z …D’oh!. "


    You call yourself a Geek? This equation would give a positive cashflow when Y>X. You should not have the (-) in front of the "Z".



    Go back to high school.
  • Alex Ruiz
    I never claimed to be a math geek. It was meant to be a joke... glad to see you got the joke.
  • I like that you used the golden ratio in your height calculation equation. Cool. I am also a big fan of equations, linked dimensions and design tables which is where I most use the above. Design tables also tend to be great for tabulated drawings.
  • I plan on doing a series on Design Tables, it is one of the most powerful tools in SolidWorks and most underused. It's probably going to be after my series on injection molded parts. Probably early fall...stay tuned
  • Chris
    How can I edit the list(pull down) for the Value / Text Expression in the Summary Information dialog box custom properties? I want to customize this list. the Edit List button edits the catagory list not the value list. working in Solidworks 2007.

    I don't know if you take questions but I need some help. Please

    Thanks,
    Chris
  • Hi Chris,

    Of course I take questions...In fact I encourage questions, that why I am
    here. If don't receive any questions, I start to think that no one likes me
    :)

    The Value / Text Expression in the Summary Information, as far as I know,
    can not be edited. By default the list consist of standard SolidWorks
    parameters, such as Material, Mass, Density, Volume, etc. However you can
    add to the list by creating global variables as described in this post and
    by creating linked values, as described in
    http://www.theswgeek.com/2008/05/19/linking-dim.... I will
    continue to look into this and if I happen to discover a way I will post a
    reply here.
  • RH
    Is it possible to drive a named variable using a design table? We have not been able to locate a way to specify named variables in the design table.
  • ryan
    how can you control decimal point placement with equations?
  • I am not exactly sure what you mean. Can you give me an example of what you are trying to do?
  • Joe
    Say I have a dim of .190. The equation Evaluates to .19. I want that 3rd decimal place to be visible.
  • Hi Joe,

    In the equations window, the trailing zeros will be ommited but in the graphics area the number will display the number of decimal places indicated in the PropertyManager.
  • Dave
    Is there a definitive list of equations (for non-programmers) somewhere? I know that you can use some VBA but not all.
  • Hi Dave,

    I have seen any list but I will do some digging around to see if I can find one. Check back again.
  • fred
    Hi there
    I have a question regarding variables in assemblies. I created some variables in the assembly and thinking that they are global try to use them in the parts of the assembly. However it does not give me the option to select them.
    Could you tell me how to solve this?
    cheers.fred
  • Fred,

    You simply append the assembly name after the variable.

    For example, take a part with dimension "D1@Sketch1" and an assembly named "Assem1.sldasm" with a variable defined in the assembly as "Width". To reference the "Width" variable in the assembly, set your part dimension as follows:

    "D1@Sketch1" = "Width@Assem1.sldasm"

    Please reply if you need more clarification.
  • Brian,

    Thank you. That's why there is a group of bloggers,instead of just one. This just goes to show that no one can know everything about SolidWorks. You are awesome!
  • Thanks for the reply Brian, I was just thinking about this Sunday while I was at work. Now I can cut and paste your response into my Tiddlywiki.
  • Hi Fred,

    I do not know of a way to pass a variable from a part file onto an assembly. This does not mean that it is impossible, but I have never encountered a way. What are you trying to do? Maybe there is a work around. I will also continue to play with passing a variable onto an assembly and I will let you know.
  • bigmikeo
    I'm trying to do a simple equation in a drawing table. I have the mass of my parts shown in the table and then the quantity of parts in the next column. The third column has the total mass, the obvious equation is SUM(C2*D2) but it will not accept it?

    Never mind, the SUM is not required.
blog comments powered by Disqus