A formula is used to connect or define the parameter in the project or family. It is a challenge to make a complex family without using any formula. Knowing the formula will allow you to create/manage the family and project easier and efficient, but do not make it over-complicated.
There are all formulas available in the Autodesk knowledge, so please have a look. Putting parameter names is case-sensitive in the formula, so make sure to write lower/upper case correctly. For instance, the formula will not recognise width if the parameter is Width. Moreover, it is recommended not to use a dash (-) when naming parameters.
Syntax for Conditional Statements
Conditional Statements can be applied in numeric values, numeric parameter names, and yes/no parameters. Make sure to use the same parameter type in the formula. Otherwise, it will not work.
[IF]
Syntax Structure IF(condition, outcome if true, outcome if false) To use this syntax, it needs a nested parameter to control the value of the host parameter.
Examples
Formula Explained If the value of the ‘Width Constraint’ parameter is more than 1000mm, the value of the ‘Width’ parameter is 500mm. Otherwise, the value of the ‘Width’ parameter is 1000mm. In this case, the nested parameter is ‘Width Constraint’, whereas ‘Width’ is the host parameter.
[Type of Parameter - Yes/No]
Yes/No in the IF statement =1<2 True (yes) =1>2 False (no) When the formula is applied, the value will be greyed out which means it is locked.
[NOT]
(<= or >= are not recognised in the IF condition, so should 'NOT' be used)
Examples
Formula Explained If the value of the ‘Yes’ parameter is yes (the box is checked), the value of the ‘Yes/No Parameter’ parameter is Yes (the box checked). Otherwise, the value of the ‘Yes/No Parameter’ parameter is No (the box is unchecked). The reason why the ‘if true’ value is 2>1, is to make it true. If it is 2<1, the outcome will be reversed. In this case, the nested parameter is ‘Yes’, whereas ‘Yes/No Parameter’ is the host parameter.
Formula Explained If the value of the ‘Not’ parameter is Yes (the box is checked), the value of the ‘Not Parameter’ parameter is No (the box unchecked). Otherwise, the value of the ‘Not Parameter’ parameter is Yes (the box is checked). In this case, the nested parameter is ‘Not’, whereas ‘Not Parameter’ is the host parameter.
Function Syntax
[+] addition [-] subtraction [*] multiplication [/] division
[Round(x)] round to the nearest whole number
[Roundup(x)] always round up to the largest integral value
[Rounddown(x)] always round down to the smallest integral value
They are commonly used for simple mathematics in the project as well as family creation.
[^] exponentiation [log] logarithm [in] natural logarithm [sqrt] square root
[sin] sine [cos] cosine [tan] tangent [asin] arcsine [acos] arccosine [atan] arctangent
[exp(x)] mathematical constant e raised to the power of x [abs] absolute value [Pi] Ratio of a circle's circumference to its diameter These syntaxes are not commonly used unless you are good at math, and it is difficult to manage them as few people can understand the complex syntaxes.
Comments