Molding

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 -> Thickness

Change 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:

KindOperators
Arithmetic+ - * / % ** ^ (both power)
Compare== != < > <= >=
Conditionalcond ? 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

TypeUnit / meaning
lengthmillimetres
numberdimensionless real
integerwhole number (e.g. a count)
angleradians
booleanyes / no (literal true/false, no formula)
texta string label (literal, no formula)
multilineTextmulti-line string (literal, no formula)
materiala Revit material name (literal, no formula)
urla URL string (literal, no formula)
areammΒ²
volumemmΒ³
forceN
masskg
sloperise/run
speedm/s
currencycurrency value

Instance vs type, and groups

  • instance parameter β€” editable on each placed copy in the model (e.g. a door's Width).
  • type parameter β€” 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 / 180 and point the field at it β€” a V field takes the raw radian number.
  • A P field left on (select parameter) has no value β€” pick one, or switch it to V.
  • To mirror, use the βˆ’ button on the P field, not a formula like HalfWidth * -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, and parseInt are 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.

πŸ“– 4 min read