TL;DR
A dimension in Revit cannot be negative — the moment a subtraction formula produces a value below zero, the family fails with 'constraints are not satisfied.' The abs() function returns the absolute value of any expression, so abs(A − B) is always a valid positive distance no matter which parameter is larger. Use it for clearances, offsets, and any difference between two user-controlled values.
Key Takeaways
- ✓Revit dimensions must be positive — a negative result breaks the constraint solver, not just the formula.
- ✓abs(x) returns x without its sign: abs(-75mm) = 75mm.
- ✓abs(A − B) is the safe way to express "the distance between A and B" when either could be larger.
- ✓Users will eventually enter values you did not expect — guard formulas are how a family survives other people.
- ✓abs() fixes the sign, but not a zero — combine it with IF when you also need a minimum value.
- ✓If a family breaks only at certain sizes, a negative intermediate value is the first thing to check.
Here is a family failure every Revit user has seen: the family works perfectly in the editor, works in the first project, then someone types an unusual combination of sizes and Revit throws “constraints are not satisfied.” Nine times out of ten, a subtraction somewhere went negative — and a dimension in Revit can never be negative.
Why Negative Values Break Geometry
Formulas feed dimensions, and dimensions drive geometry. A length of −25mm doesn't mean “25mm the other way” to the constraint solver — it means impossible. Consider a shelf inside a cabinet:
With Cabinet_Width = 600mm and Side_Thickness = 18mm, the shelf is 564mm. Fine. But if a user drops the cabinet to 30mm wide while testing — or loads the family into a project where the width comes from a schedule — the result is −6mm and the family stops regenerating. The formula was “correct.” The family still broke.
The abs() Function
abs() strips the sign from any expression. Its most valuable use is the difference pattern — expressing the distance between two values when you can't know which is larger:
Three Real Guard Formulas
Example 1 — Centerline Offset
A pipe fitting measures the offset between two connector centerlines. Either connector can sit higher, so the raw subtraction can flip sign:
Example 2 — Frame Clearance Check
A door leaf must always report its gap to the frame as a positive number for the schedule, regardless of how the opening was dimensioned:
Example 3 — Slope Direction Independence
A drainage component needs the rise between two invert levels — the magnitude matters, the direction is handled elsewhere:
abs() Alone Is Not Always Enough
abs() guarantees the sign, not a sensible value. If a result must also never fall below a practical minimum, combine it with an IF statement:
Now the value is always positive and never below 150mm — the family survives any input a user can throw at it. This defensive habit is what separates families that work on your machine from families that work in a 300-person office.
Debugging Tip: Hunt the Hidden Negative
When a family breaks only at certain size combinations, add a temporary reporting parameter for each intermediate calculation and flex the family until one goes negative. That is your culprit — wrap it in abs() or guard it with IF. The full systematic method is in the debugging chapter.
Chapter 2 of 10
Build families that survive real users
All 10 formula chapters with worked examples, HD Video Vault, and the Formula Cheat Sheet. 40% off at $18.
