When you are talking about equations in SOLIDWORKS, you usually think about the obvious stuff. Like, 2 x 2 or something like that. Perhaps you want the width to be half of the height (height dim/2). Did you know that you can do if/then statements with SOLIDWORKS equations? Let’s look at a simple example of a radius on a block. I want to control the radius so that if the part falls below a certain dimensional value, the fillet will be suppressed. In the figure below, you can see a cube with a radius on it and the cube is 5 in.
The symbol next to the dimension value is letting you know that this dimension is controlled by a global variable. I created the global variable in the Equations dialog box to control the height and the length. To enter an equation, go to Tools, Equations. Create a global variable named Height and Length with a value of 5.
What I want to control is the fillet. I want the fillet to be controlled by the size of the cube. For instance, I want the fillet to disappear if the cube has a size of 4 inches or less. To do that, I need to create an if/then statement. = IIF ( “Height” < = 4 , “suppressed” , “unsuppressed” ). In the Value/Equation field type = to activate the equation then select Functions and then select iif() as seen below.
Once the function is selected, I then need to tell SOLIDWORKS what to do. In this case, I select the global variable “Height” from the global variables pull down. I then use < = 4 and select “suppressed”, “unsuppressed” from global variable dropdown. Meaning, if the cube is 4 inches or less I want the fillet suppressed. Anything larger than 4, unsuppress the fillet. I see the green check at the end of my equation meaning the syntax is correct so let’s check it out to see if it works correctly.
= IIF ( “Height” < = 4 , “suppressed” , “unsuppressed” )
Notice I changed the Height dimension to 4 and the fillet is now suppressed. Now I am going to change the height to something greater than 4 to see what happens.
As you can see, I am using equations to drive the design using an if/then type statement. This was a pretty simple example but hopefully you see the power of equations and what it can potentially do for your designs and efficiency!!
Field Technical Services Manager