Parameters & coordinates
This is the one idea that makes Molding click. When you select an element on the Generators tab, every position / size / depth / radius / angle field shows two small buttons β V and P. That toggle is the whole coordinate concept:
Each field is V or P
V(value) β a fixed number you type, in millimetres for lengths or radians for angles:45,0,1.5708.P(parameter) β the field follows a parameter you pick from the dropdown, so it changes whenever that parameter does. Theβbutton next to it negates the parameter (mirror across the origin), e.g.HalfWidthβ-HalfWidth.
That is the whole grammar: a field is either a fixed number or one parameter (optionally negated). There is one thing you will look for and not find:
There is no place to type a formula into a geometry field. A field is only ever V (a number) or P (one parameter). Any arithmetic goes into a parameter instead.
Where the math lives: parameter formulas
To centre a rectangle at half its height, you do not compute Height / 2 on the field. You add a parameter that computes it, then point the field's P at it:
Parameter HalfHeight formula: Height / 2 (Parameters tab)
Rectangle center Y: P -> HalfHeight (Generators tab)Why split it this way? Because it keeps every field trivial and identical in the browser preview and the Revit runner β both only ever ask "is this a number, or a parameter to look up?". The arithmetic lives in exactly one place (the parameter's formula), and Revit's own solver owns it.
The door panel, as parameters and fields
This is the family you built in Getting started, written out:
Parameters tab
Width length default 900 Instance
Height length default 2100 Instance
Thickness length default 45
HalfHeight length formula Height / 2
Generators tab
Rectangle
width = P -> Width
height = P -> Height
center = [ V 0 , P -> HalfHeight ]
Extrusion
profile = [x] Rectangle (ticked in the checkbox list)
depth = P -> ThicknessChange Width and the rectangle widens; HalfHeight updates through its formula so the panel stays centred β all from one edit. The extrusion's depth just points at Thickness because no math is needed there.
Formula operators
Formulas (not coordinates) carry the arithmetic. They may reference other parameter keys:
| Kind | Operators |
|---|---|
| Arithmetic | + - * / % ** ^ (both power) |
| Compare | == != < > <= >= |
| Conditional | cond ? a : b |
Logical
&&||!are not supported (Revit has no such operators) β use a conditional, e.g.count > 1 ? Spacing : 0.
Built-in helpers available in formulas: Math, Number, Boolean, isNaN, parseFloat, parseInt.
Width / 2 // halve a length
Height * 0.5 // scale
hasGlass ? GlassThickness : 0 // optional part
Math.max(600, Width) // clamp to a minimum
Math.sin(Angle) * Reach // trig (Angle is in radians)Parameter types
| Type | Unit / meaning |
|---|---|
| length | millimetres |
| number | dimensionless real |
| integer | whole number (e.g. a count) |
| angle | radians |
| boolean | yes / no (literal true/false, no formula) |
| text | a string label (literal, no formula) |
| multilineText | multi-line string (literal, no formula) |
| material | a Revit material name (literal, no formula) |
| url | a URL string (literal, no formula) |
| area | mmΒ² |
| volume | mmΒ³ |
| force | N |
| mass | kg |
| slope | rise/run |
| speed | m/s |
| currency | currency value |
Instance vs type, and groups
instanceparameter β editable on each placed copy in the model (e.g. a door'sWidth).typeparameter β set per family type, shared by every instance of that type.groupβ which section of Revit's Properties palette it appears under:dimensions,constraints,materialsβ¦- Shared checkbox β marks the parameter as a Revit shared parameter so it can appear in multi-category schedules and be reused across families. Most parameters do not need this.
Parameter display options
In the expanded parameter settings panel there are four optional fields:
- Label β display name shown in Revit's Properties palette (defaults to the key if left blank).
- min / max β clamp the value in Revit's UI so users cannot enter out-of-range numbers.
- step β the increment arrow increases/decreases the value by this amount.
These are stored as meta.label, meta.min, meta.max, meta.step in the JSON.
Gotchas
- Lengths are millimetres; angles are radians. To use degrees, make a parameter with a formula like
Angle * Math.PI / 180and point the field at it β aVfield takes the raw radian number. - A
Pfield left on(select parameter)has no value β pick one, or switch it toV. - To mirror, use the
βbutton on thePfield, not a formula likeHalfWidth * -1. - Parameter keys must be unique within a family; renaming a key updates every field that points at it.
- The names
Math,Number,Boolean,isNaN,parseFloat, andparseIntare reserved β they are the built-in formula helpers and cannot be used as parameter or node keys.
Next: see every element you can add in the Node reference.