← Docs

Parameter design guidelines

Good parameter design is the difference between a useful tool and a confusing demo.

Name parameters clearly

Use descriptive names that match what the user sees in real life. Avoid abbreviations unless they are universally understood.

// Good
param wall_thickness: float = 2 [1:5:0.5] "Wall thickness (mm)"
param screw_diameter: float = 3 [2:8] "Screw diameter (mm)"

// Bad
param wt: float = 2 [1:5:0.5] "wt"
param sd: float = 3 [2:8] "sd"

Always include units in the label

All PPSCAD dimensions are in millimeters. Make this obvious:

param width: float = 80 [20:200] "Width (mm)"
param angle: float = 45 [0:90] "Angle (degrees)"

Choose sensible defaults

The default value should produce a useful, printable result. If someone hits Run without touching any sliders, the output should make sense.

  • Wall thickness default: 2mm (works on any FDM printer)
  • Corner radius default: 2–3mm (printable, looks finished)
  • Hole sizes: based on common screw sizes (M3, M4)

Set meaningful min/max ranges

Ranges should prevent physically impossible or unprintable values:

// Good: wall can't be thinner than one extrusion width
param wall: float = 2.0 [1.2:6:0.2] "Wall thickness (mm)"

// Good: corner radius capped at half the smallest dimension
param corner_r: float = 3 [0:10] "Corner radius (mm)"

// Bad: no limits, user can set wall to 0
param wall: float = 2.0 "Wall thickness (mm)"

Choose appropriate step sizes

Step size controls slider granularity. Match it to the precision that matters:

  • Integers (count of items): step = 1 (automatic)
  • Coarse dimensions (width, height): step = 1 or 0.5
  • Fine dimensions (wall, clearance): step = 0.1 or 0.2
  • Angles: step = 5 or 1, depending on sensitivity

Use boolean params for optional features

Let users toggle features on or off:

param vents: bool = true "Add ventilation slots"
param lid: bool = true "Generate lid"
param rounded: bool = true "Round corners"

if (vents) {
  // ventilation slot geometry
}

Use choice params for variants

When a feature has discrete options, use choice:

param mount_type: choice = "screws" ["screws", "magnets", "adhesive"] "Mount type"
param screw_size: choice = "M3" ["M2", "M3", "M4", "M5"] "Screw size"

Derive dependent values instead of exposing them

If one dimension depends on another, compute it rather than making it a separate parameter:

param width: float = 80 [40:200] "Width (mm)"
param wall: float = 2.0 [1.2:4:0.2] "Wall (mm)"

// Derived - not a separate parameter
let inner_width = width - wall * 2
let outer_width = width