Revit offers a number of mathematical functions in its calculation expressions - see the overview in Tip 12777. However, there are no functions min() and max() for finding the minimum and maximum values from several numbers (parameters), e.g. height and width, or from the dimensions of successive grommets.
If you need to find the extremum of only a few numbers, you can replace the function with successive nested conditions, i.e. IF functions. The IF function has the syntax IF(condition, iftrue, iffalse).
Returns the larger of parameters:
IF (Length1 > Length2, Length1, Length2)
or just a string to display:
IF (Length1 > Length2, "L1 is larger", "L2 is larger or equal")
Checks the upper and lower limit of a parameter:
resulting_value: = IF (myparameter < min_value, min_value, IF (myparameter > max_value, max_value, myparameter))
So in general, the maximum of 2 values:
IF(A > B, A, B)
The maximum of 3 values:
IF(A > C, IF(A > B, A, B), IF(B > C, B, C))
And the maximum of 4 values:
IF(A > D, IF(A > C, IF(A > B, A, B), IF(B > C, B, C)), IF(B > D, IF(B > C, B, C), IF(C > D, C, D)))
0 Comments