Skip to content
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. Half Width → -Half Width.

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  Half Height   formula:  Height / 2     (Parameters tab)
Rectangle  center Y:    P -> Half Height           (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:

Category Doors, template Metric Door

Parameters tab
  Width         length
  Height        length
  Thickness     length
  Rough Width   length   formula  Width
  Rough Height  length   formula  Height
  Half Height   length   formula  Height / 2   group Constraints

Types tab
  "0900 x 2100mm"   Width 900   Height 2100   Thickness 45

Generators tab
  Rectangle
    width   = P -> Width
    height  = P -> Height
    center  = [ V 0 , P -> Half Height ]
  Extrusion
    profile = [x] Rectangle      (ticked in the checkbox list)
    endOffset = P -> Thickness

Change Width and the rectangle widens; Half Height updates through its formula so the panel stays centred — all from one edit. The extrusion's endOffset just points at Thickness because no math is needed there.

A parameter has no value — family types do

This is Revit's own rule and Molding follows it exactly: a parameter declares what it is (name, type, group, instance-or-type, and maybe a formula), and a family type holds what it is set to. A family with no type has nowhere to put a number, so every family has at least one type.

"parameters": [
  { "key": "Width",        "type": "length" },
  { "key": "Height",       "type": "length" },
  { "key": "Thickness",    "type": "length" },
  { "key": "Rough Width",  "type": "length", "formula": "Width" },
  { "key": "Rough Height", "type": "length", "formula": "Height" },
  { "key": "Half Height",  "type": "length", "group": "constraints", "formula": "Height / 2" }
],
"types": [
  { "name": "0800 x 2100mm", "values": { "Width": 800, "Height": 2100, "Thickness": 45 } },
  { "name": "0900 x 2100mm", "values": { "Width": 900, "Height": 2100, "Thickness": 45 } }
]

Two rules follow from that:

  • A parameter is driven either by a formula or by per-type values, never both. Half Height has a formula, so it never appears in values — Revit computes it for every type.
  • Every parameter without a formula has a value in each type. The exception is the string-storage types (text, material, url, multilineText): leaving the key out means "no value", which is what Revit shows as an empty parameter.
  • A type parameter's formula cannot read an instance parameter. A type parameter holds one value per family type, so it has no way to follow a value that varies per placed copy, and Revit answers SetFormula with "Formula setting failed." (measured 2026-09-24, Revit 2023). Either mark the dependent parameter instance too — Half Height may read an instance Height as long as Half Height is itself an instance parameter (in a private family: the dictionary row a published family must match makes Half Height a type parameter) — or keep the one it reads a type parameter. Molding refuses the combination before generation rather than letting Revit drop the formula.

Adding a second type is how you ship a size catalog (0800 x 2100mm, 0900 x 2100mm, …). The user picks a type when placing the family; instance parameters stay tunable per placement on top of that.

Formula operators

A formula is written in Revit's family-formula language, not JavaScript — the string is handed verbatim to Revit's FamilyManager.SetFormula, so Molding accepts exactly what Revit accepts. Formulas (not coordinates) carry the arithmetic and may reference other parameter keys.

KindOperators
Arithmetic+ - * / ^ (^ is power)
Compare< > = (equality is a single =)
Signunary + and -

There is no %, no **, no == / != / <= / >=, no ternary a ? b : c, and no && / || / !. The validator rejects them and tells you the Revit spelling: <= → not(a > b), != → not(a = b), && → and(a, b), || → or(a, b), ! → not(a), ** → ^.

Formula functions

The complete set — any other name is refused as an unknown function, and a call with the wrong number of arguments is refused too:

FunctionMeaning
abs(x)absolute value
sqrt(x)square root
exp(x)e raised to x
log(x)base-10 logarithm
sin(x), cos(x), tan(x)sine, cosine, tangent of an angle in radians
asin(x), acos(x), atan(x)inverse sine, cosine, tangent; the result is an angle in radians
round(x)nearest whole number; a half rounds up toward +∞ (round(2.5) = 3, round(-2.5) = −2)
roundup(x)smallest whole number ≥ x (ceiling)
rounddown(x)largest whole number ≤ x (floor)
pi()π ≈ 3.14159 — takes no argument
if(test, whenTrue, whenFalse)whenTrue when test holds, else whenFalse — exactly three arguments
and(a, b, …)Yes when every argument is Yes — two or more arguments
or(a, b, …)Yes when any argument is Yes — two or more arguments
not(a)the opposite of a

There are no objects or namespaces — Math.PI is rejected as "unsupported member access"; write pi().

The formula examples below and in the units table use private-family names (hasGlass, Radius, IsWide…): they pass the structural level. A family published to the catalog uses template parameters and dictionary names — see Parameter names.

Width / 2                          // halve a length
Height * 0.5                       // scale
if(hasGlass, GlassThickness, 0)    // optional part
Radius ^ 2 * pi()                  // area of a circle
sin(Angle) * Reach                 // trig — Angle must be an angle parameter
if(Width < 600, 1, 2)              // a choice based on a size
and(Width > 600, Height > 600, IsBig)   // and/or take more than two conditions — Yes/No only
"Standard"                         // a text parameter's formula is a quoted string

A text, URL, multi-line or material parameter takes a formula too, but its value is a string: quote it ("Standard"). Its per-type value, by contrast, is a plain literal — no quotes, never parsed ("Frame Material": "Wood - Walnut").

Formulas carry units

Revit refuses a formula whose result is a different kind of quantity than the parameter it feeds ("inconsistent units"), so Molding refuses it too, before generation rather than during it:

FormulaOn a…
Width * Heightlengthrejected — that is an area
Width * Heightareafine
sqrt(Width * Height)lengthfine — the root of an area is a length
Widthnumberrejected — a length is not a plain number
Width + 100lengthfine — a bare number takes the unit around it
Width + Angleanythingrejected — not a quantity at all
asin(Ratio)anglefine — the arc functions return an angle
sin(Count)anythingrejected — sin/cos/tan need an angle
round(Width)anythingrejected — round/roundup/rounddown take a plain number
100 / Widthnumberfine — the literal takes mm, so the ratio is unit-free
Height / Widthslopefine — a slope is a ratio
if(c, Width, 100 / Zero)lengthfine — only the whenTrue branch sets the unit
Width > 500Yes/Nofine — a comparison answers yes or no
Width > 500numberrejected — Yes/No is its own kind, not 1 and 0
and(IsWide, IsTall)numberrejected — and / or / not answer Yes/No too

A comparison (<, >, =) and and / or / not all produce a Yes/No result, and Revit lets that drive a Yes/No parameter and nothing else — it is not a number you can add to or multiply. Put the test inside if(...) when you need a number: if(Width > 500, 2, 1) on a number parameter is fine.

Powers follow the same algebra: Width ^ 2 is an area, Width ^ 3 a volume, and a dimensioned value can only be raised to a literal whole power.

Numbers with a unit

A number may carry a Revit unit symbol, and then it is a constant of that quantity rather than a bare number: Width + 10mm is 610 mm when Width is 600 mm, and 10mm cannot drive a number parameter. The symbol may follow the number directly or after a space, and its case does not matter (10mm, 10 mm, 10MM).

QuantitySymbols
lengthmm cm dm m in " ft ' LF USft
areamm² cm² m² in² ft² SF acres hectare
volumemm³ cm³ m³ in³ ft³ CF yd³ yd^3 CY L gal
angle° rad grad

^n right after a symbol raises the unit: 2 m^2 is 2 m² and 1 cm^2 is 100 mm². Feet and inches join into one length (1' 6" and 1'6" are 457.2 mm), but 1'-6" is a subtraction (152.4 mm). Anything else is not a symbol and is refused: 30 deg (write 30°), 2 ft2 and 1 m2 (write ft² / m^2). A symbol needs a number in front of it, so a parameter named mm is still read as that parameter, while 5 cm is always 50 mm, even when a parameter is named 5 cm.

Parameter types

TypeUnit / meaning
lengthmillimetres
numberdimensionless real
integerwhole number (e.g. a count)
angleradians
booleanyes / no (a type value is true/false; a formula such as Width > 500 is allowed)
texta string label
multilineTextmulti-line string
materiala Revit material name
urla URL string
areamm²
volumemm³
forceN
masskg
sloperise/run
speedm/s
currencycurrency value
heatTransferCoefficientW/(m²·K), Revit's Coefficient of Heat Transfer (a window's Heat Transfer Coefficient (U))
thermalResistancem²·K/W, Revit's Thermal Resistance (Thermal Resistance (R))

Solar Heat Gain Coefficient and Visual Light Transmittance are number parameters in Revit's window and door templates. Give thermal values only when a document states them for the family's construction.

The fields of a parameter

The record is flat — one field per thing Revit's FamilyParameter knows about:

FieldMeans
keythe parameter's name in Revit; what coordinates, formulas and properties reference
typeits data type — length, angle, boolean, material… (see the table above)
groupwhich section of Revit's Properties palette it appears under — one of dimensions, constraints, construction, graphics, materials, identity (Identity Data), text, data, general, structural, electrical, mechanical, plumbing, analysis (Analytical Properties). Absent → the runner picks one from the type: Dimensions for length / number / angle / area / volume, Construction for Yes/No, Identity Data for text / url / multi-line text, Materials for material, General otherwise.
instancetrue makes it editable on each placed copy in the model (e.g. a door's Width). Default false: a type parameter, set per family type and shared by every instance of that type.
descriptiontooltip text in the Properties palette, written for the people who use the family. Not allowed on a template's built-in parameter: Revit refuses to set it there.
shared{ "guid": "…" } makes it a Revit shared parameter, so it can appear in multi-category schedules, drive tags and be reused across families. The GUID is its identity, so it is stored in the file and stays the same every time the family is regenerated. Most parameters do not need this.
formulaa Revit formula that computes the value (see above). A parameter with one takes no per-type value.
labeldisplay name in the editor only; never reaches Revit. Absent → the key is shown.
slider{ "min": …, "max": …, "step": … } — the editor's slider domain. Editor-only, never sent to Revit.
sourcewhere the parameter or its formula comes from — a maker document and page, the derivation of a constant. Editor-only, never sent to Revit, so it never shows in the Properties palette tooltip.
{ "key": "Glass Width", "type": "length", "group": "constraints",
  "formula": "Width - 236",
  "source": "Glass edge 118 = 56 + 79 - 17 (glass bite 17, VEKA Softline 70 AD data sheet p2)" }

There is no args and no properties on a parameter, and no default value — the value for each family type lives in types[].values.

Parameter names

A parameter's key is its name in Revit. How freely you may choose it depends on where the family goes (see Validation levels).

Every family — private, draft or public:

  • The name must read back in a formula as exactly one name. A space is fine — Half Height / 2 reads the parameter Half Height, written bare, with no quotes or brackets — but there must be no leading or trailing space and no operator or bracket character: Frame-Width would read as Frame minus Width. Otherwise the key is refused (invalidKey).
  • A name the template already ships drives the template's own parameter. Each Revit template ships some — Metric Window and Metric Door ship Width, Height, Rough Width and Rough Height, Metric Door also Thickness, Metric Generic Model Default Elevation, every model template the Identity Data ones such as Manufacturer and Model. Declare such a name with its Revit type and nothing else: no group, no shared, and no description on a built-in one, which Revit refuses to set (templateParameterOverride).

Within those two rules a private family may name its parameters as it likes (ColH, Shelf Count).

A family published to the catalog uses the catalog's shared vocabulary. Every key is one of two things:

  1. A parameter of the template, as above.
  2. A row of the parameter dictionary registered for the family's category. The dictionary holds the standard names of Autodesk's Revit Model Content Style Guide (for example Egress, U Value or Product Page URL, with their shared parameter GUIDs) and the names Molding's own catalog families use (Frame Material, Glass Width, Half Height…). A row fixes the type, the group, type-or-instance and the GUID of its name, and the declaration must match it (dictionaryMismatch). A row applies only to the categories it is registered for: Half Height and Half Width to Doors and Windows, Thickness to Doors, Sash Top to Windows.

Any other name is a name_unregistered finding. The editor suggests the name you probably meant, as a button under Did you mean in the findings list at the top of the panel; clicking it renames the parameter everywhere it is used. A known variant names its replacement directly (HalfWidth → Half Width); otherwise the suggestions are up to five registered names for the category, at most two letters away (Glas Width → Glass Width).

Dictionary names use Title Case words separated by spaces (Half Height, Default Sill Height), as the style guide asks.

Each category adds a few publish rules of its own — doors and windows are sized by the template's Width and Height, which the geometry must use; their Rough Width and Rough Height are formulas of them; and their type names follow XXXX x YYYYmm. See the category in the JSON format.

Editing parameters in the app

The Parameters tab header carries a family type dropdown (tooltip Active family type) next to the + button. It says which type's values the rows below are editing — a value belongs to a type, so the list would be ambiguous without it. The same switch is the radio button on each card of the Types tab, which also tints the active card.

Each parameter row is: its key (editable in place — renaming it updates every field that points at it), then the value in the active type, then ⚙ and ×. For a formula parameter the value cell shows the formula instead, greyed and read-only: Revit computes it, so no type holds a value to edit.

The ⚙ (Parameter settings) popover holds everything else about the parameter:

  • Type and Group — two dropdowns.
  • Instance and Shared checkboxes. Ticking Shared mints a GUID once and shows it in a read-only Shared GUID field — that GUID is the parameter's identity in Revit, so it is stored and never regenerated.
  • Label — display name in the editor (defaults to the key if left blank). The key is what Revit names the parameter; label is editor chrome only.
  • Description — the tooltip Revit shows in the Properties palette.
  • Source — where the parameter comes from (a document and page, a derivation). Editor-only: it is saved with the family but never sent to Revit.
  • Formula — a Revit formula. Filling it in makes the parameter computed; clearing it hands the parameter back to the per-type values.
  • Range (min / max / step) — three inputs, shown only for numeric parameter types. min / max clamp the value in the editor's slider; step is the amount the increment arrow adds or subtracts. They are editor-only and never sent to Revit.

There is no Default value field: a parameter has no default, only a value per family type.

Gotchas

  • Lengths are millimetres; angles are radians. To use degrees, make a parameter with a formula like Angle * 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 Half Width * -1.
  • Parameter keys must be unique within a family; renaming a key updates every field that points at it.
  • The Revit function names — abs, sqrt, exp, log, sin, cos, tan, asin, acos, atan, round, roundup, rounddown, pi, if, and, or, not — are reserved and cannot be used as a key in any lane: not as a parameter key, a node key, a material key or a subcategory key. So are __proto__, constructor, and prototype. All four lanes share one key space, so a reserved name would be just as unresolvable in a material or subcategory field as in a formula.

Next: see every element you can add in the Node reference.

📖 16 min read