Skip to main content

property()

Publishes a named value computed by the part — the part's scalar interface, the outbound counterpart of param() (values in), beside connector() (mate frames out) and expose() (geometry out). Declared inside a part(...) block, the property is recorded on the variant the body is building, so an insert with overrides reads the values its own parameters produced:

export const bushing = part('Bushing', () => {
const width = param('Width', 40);
const wall = param('Wall', 3);
...
property('Internal width', 'internalWidth', width - 2 * wall);
property('Bolt count', 'boltCount', 4);
});

// assembly:
const b = insert(bushing, { Width: 60 });
insert(plate, { Width: b.properties.internalWidth }); // 54

// another part (the default variant):
const w = bushing.properties.internalWidth;

Values are plain: a number, string, boolean, or an array of numbers or strings. Numbers are handed over verbatim, in the part file's unit, like a param() override. Geometry is not a value — publish it with expose(). Nothing is built while the body runs, so a property is computed from the part's parameters and arithmetic, never measured from its shapes.

Returns: number | string | boolean | (string | number)[]

tip

See the guide for detailed usage examples.

Signatures​

property(label: string, name: string, value: T): T

Publishes a named value computed by the part — the part's scalar interface, the outbound counterpart of param() (values in), beside connector() (mate frames out) and expose() (geometry out). Declared inside a part(...) block, the property is recorded on the variant the body is building, so an insert with overrides reads the values its own parameters produced:

export const bushing = part('Bushing', () => {
const width = param('Width', 40);
const wall = param('Wall', 3);
...
property('Internal width', 'internalWidth', width - 2 * wall);
property('Bolt count', 'boltCount', 4);
});

// assembly:
const b = insert(bushing, { Width: 60 });
insert(plate, { Width: b.properties.internalWidth }); // 54

// another part (the default variant):
const w = bushing.properties.internalWidth;

Values are plain: a number, string, boolean, or an array of numbers or strings. Numbers are handed over verbatim, in the part file's unit, like a param() override. Geometry is not a value — publish it with expose(). Nothing is built while the body runs, so a property is computed from the part's parameters and arithmetic, never measured from its shapes.

ParameterTypeDescription
labelstringWhat the parameters panel shows for the property, like a param() label.
namestringIdentifier the property is registered under, unique within the part.
valueTThe value to publish. Returned unchanged, so the statement doubles as the declaration of a local: const w = property('W', 'w', ...).