brepjs API Reference
    Preparing search index...

    Function defineParams

    • Declare the parameters of a part.

      Type Parameters

      • const D extends Readonly<Record<string, ParamDef>>

      Parameters

      • defs: D & ChoiceDefaults<D>

      Returns Params<D>

      export const params = defineParams({
      width: { type: 'number', default: 50, min: 10, max: 200, unit: 'mm' },
      holes: { type: 'number', default: 4, min: 0, max: 12, integer: true },
      style: { type: 'choice', default: 'round', options: ['round', 'square'] },
      });

      export default (p = params.values) => box(p.width, 30, 20);

      The default argument lets the part run with no caller input, so a tool that calls the part function with no argument builds the part at its defaults.