Have you ever wondered whether you can derive features or dimensions in a SOLIDWORKS part off another dimension in the same part? The answer is yes, you can! This tutorial is an introduction to using If/Then Statements in SOLIDWORKS in order to achieve this.
To derive features or dimensions off another dimension in the same part, we use the nested IF statement within the Equation tool in SOLIDWORKS. The first thing to remember when writing an IF statement is that they are written as “IIF” instead of “IF”. The IF statement will not work if it is written with just one ‘I’.
IF equations can get complicated, but for now I will go over the basic IF statement. Here is the generic way to create an IF statement:
IF statements are super handy to use when there are one or several dimensions that rely on other dimensions in the part design. They save a lot of time because otherwise, these changes would have to be created manually.
The following example will go over the basics steps to adding those IF equations to help automate a part's design.
How I chose to start was by creating some global variables for the equations to relate to (which isn’t necessary to do but it is one way to organize your equations).
To add global variables, you will need to open the Equations tool by going to Tools > Equations, and you can add them in the top section called Global Variables. The IF statements that I will be creating will be input in the Features, as well as the Equations section of that same Equations tool.
Part Design
For this part, I chose to write IF statements to drive the height of the vertical boss, the width of the base, and whether the fillets are active, on the total length of the base.
Steps
1 – In the Global Variables section of the Equation tool, I input the variables that I wanted to see for the height and width, that I will use to refer to within the IF equation. The different variables I chose were:
Height 1 = 35 mm Height 2 = 45 mm Width 1 = 10 mm Width 2 = 20 mm
2 – In the Features section, I created an IF statement that will suppress the Fillet feature if the Length value is less than or equal to 130 mm, and unsuppressed if it's greater than 130 mm.
Equation: Fillet2 = IIF ( "Length" < = 130 , "suppressed" , "unsuppressed" )
3 – In the Equations section of the Equation tool I created an IF statement that will make the Height = Height 1 if Length is less than or equal to 130 mm, and Height = Height 2 if Length is greater than 130 mm.
Equation: Width = IIF ( "Length" < = 130 , "Height 1" , "Height 2" )
I hope you found this SOLIDWORKS tutorial helpful. Learn more SOLIDWORKS tips and tricks below.
SOLIDWORKS Copy and Paste Features: Same or Different Parts
SOLIDWORKS Routing 101: Pipe Design
SOLIDWORKS Convert to Sheet Metal Command Explained
How to Create a Lip/Groove Feature in SOLIDWORKS
About Tashayla Openshaw
Tashayla Openshaw is a SOLIDWORKS Technical Support Engineer based out of our Headquarters in Salt Lake City, Utah. She earned her Bachelor’s degree in Mechanical Engineering from the University of Utah in 2018 and has been part of the GoEngineer family since February 2019.
Get our wide array of technical resources delivered right to your inbox.
Unsubscribe at any time.