Atomic Knowledge · Onshape

FeatureScript

Onshape's open parametric modeling language that lets users create custom features, extending the CAD system with shareable reusable operations.

Definition & Context

FeatureScript is Onshape's open-source programming language for defining custom parametric features. Unlike plugins that bolt onto a CAD system externally, FeatureScript features run inside Onshape's geometry kernel — they behave exactly like native features (extrude, fillet, etc.) with full parametric history, rollback, and update behavior. Every built-in Onshape feature is itself written in FeatureScript.

Use cases: industry-specific features (create a "Dovetail Joint" feature that generates the interlocking geometry from width/angle/depth parameters), design-rule-encoded features (a "Sheet Metal Bend" that automatically applies your firm's K-factor table), and workflow accelerators (a "Mounting Boss Pattern" that generates the boss array + holes + counterbores for a PCB mounting arrangement in one operation).

FeatureScript is shared through Onshape's document system — publish a custom feature and any Onshape user can add it to their toolbar. This creates a community-driven feature library (Onshape Feature Store) where engineers contribute and reuse specialized operations. The language includes access to topology queries, boolean operations, sketch geometry construction, and parametric dimension declaration. For engineers who also code, it provides unprecedented control over CAD behavior without reverse-engineering a closed API.

Why It Matters

FeatureScript is Onshape's open, typed programming language for authoring custom parametric features — the same language Onshape's own features are built in — enabling teams to encode bespoke geometry operations that behave like native tools.

Best Practices

  • Use the FeatureScript Standard Library and study built-in features as examples.
  • Type inputs precisely and validate them for robust custom features.
  • Develop in the Feature Studio with the built-in debugger/print.
  • Version and share custom features so the team reuses them.

Common Pitfalls

  • Poorly validated inputs causing custom features to fail on edit.
  • Reinventing geometry the Standard Library already provides.
  • Not versioning custom features, breaking documents on updates.
  • Ignoring performance in geometry-heavy custom features.

Standard Engineering Workflow for FeatureScript

4. GD&T Detailing & CNC Toolpath Export

Author 2D fabrication sheets with complete ASME Y14.5 / ISO 1101 geometric tolerances (Position, Flatness, Runout) and export STEP AP242 / Parasolid models for 5-axis CAM.

Common Failure Scenarios & Troubleshooting

Failure / Geometric IssueRoot Cause & Mitigation Strategy
Sketch breaks or flips geometry when adjusting dimensionsSketch was under-constrained. Always apply geometric constraints (tangency, horizontal/vertical) before adding driving numerical dimensions.
Shell or Fillet feature fails on complex curved topologyCurvature radius is tighter than fillet radius or minimum wall thickness. Inspect surface curvature using Zebra stripes and eliminate zero-radius sharp corners.
Assembly performance severely lags during rotationLarge assembly mode was disabled. Suppress non-essential cosmetic features (threads, knurls) and use lightweight component representations.

Industry Standards & Compliance Codes

  • ISO 1101 (Geometrical Product Specifications)
  • ISO 2768 (General Tolerances for Machining)
  • ASTM / DIN Material Specifications

Sources & Further Reading