By Dennis Collin
When working with Revit families, there is often a need to limit parameters within certain limits. This could be a maximum length, minimum angle, or several items within an array. To achieve this, users can add formulas to their families which will prevent elements being drawn to excessive dimensions.
Recently I wrote a post on If statements for an array-able component. As experienced Revit users will tell you, if an array-able element has a value less than 2 items, an error message can result. To prevent this, a conditional If statement can be used to always make the minimum number 2 to avoid this problem.
A link to using a conditional IF formula for an array-able part, a repeating brick detail component can be found here:
Whilst useful, there is sometimes a need for greater control where a component might not want to exceed a value but also not be less than a certain value. For example, a scaffolding pole. There might be a maximum length a pole can be on site, but also a minimum length might be required to avoid zero length components, which would result in errors. In this instance a nested conditional If statement can be used.
Consider an example element with a simple pole family, which has been created with a line-based family, using the sweep tool. The requirement is to have a pole whose length does not exceed 5 metres. To ensure that this rule is adhered to, a Check Length parameter is created with a conditional IF formula which uses the following logic.
IF( CONDITION , VALUE IF TRUE, VALUE IF FALSE )
Apply the rules to our situation is follows, if the length exceeds 5 metres, force it to 5 metres, otherwise leave the length as it is. (i.e. Can be any length up to 5 metres).
The formula within the family reads therefore as thus:
If (Length > 5m, 5m, Length)
Typical operators can be used in formula including:
+ - * / Plus, Minus, Multiply and Divide
< > = Less than, More than and Equals etc.
This is not an exhaustive list of examples.
Another requirement is perhaps to set a minimum and maximum angle of positive and negative 60-degree slope. For this to work a nested conditional IF statement is required and follows this format using standard logic operators like AND, OR and NOT.
IF( OR (CONDITION1, CONDITION2), VALUE IF TRUE, VALUE IF FALSE )
I.e. if either condition is true, restrict the angle parameter. If both conditions need to be applied, then replace the OR statement with AND.
IF( AND (CONDITION1, CONDITION2), VALUE IF TRUE, VALUE IF FALSE )
For our pole example just the OR operator is required and the formula to limit the angle reads as follows:
IF(OR ( Angle > 60°, Angle < -60°), 60°, Angle)
Note. Spaces between functions do not matter but the position of brackets, and parameter name case do i.e. Length is a different parameter from LENGTH!).
Once loaded into a project, we can see limits on the components behaviour and will restrict the length to a maximum despite the cursors current position. Similar constraints can be placed with the angle either when drawn or when modifying the properties palette below.
Comments
0 comments
Please sign in to leave a comment.