Page 352 - Mastering SolidWorks
P. 352
|
UndErSTAndIng EqUATIOnS 325
Figure 10.9
Figuring the flat pattern
of the auger
Using Equation Tricks
SolidWorks equations allow several mathematical operators, such as sine, cosine, tangent, and
others. SolidWorks also allows IF statements, conditional operators (=, <, >, < >, =>, <=), and file
properties.
Using IF Statements
In words, this is how an IF statement is used:
If some relationship is fulfilled, then the IF function returns a value. If the relationship is not
fulfilled, then it returns a different value.
A more technical description is
IF(expression, value if true, value if false)
In practice, you could use it like this:
IF(x > 5, x-1, x+1)
which reads, “if x is greater than 5, then subtract 1 from x; if not, then add 1 to x.” One of the
reasons why this is considered a parlor trick is that this function causes the value of x to oscillate
between two numbers (depending on the number that it starts with) with each rebuild.
SolidWorks also identifies this as a circular reference because the same value is on both sides of
the equation. It may be difficult to imagine an application where this sort of behavior would be
desirable, but when you combine it with a macro that simply rebuilds a model a number of
times, you can use it to create a certain animation effect. Figure 10.10 shows an equation using
the IF function.