Download the Onshape Mobile App

IOS Android
Illustration of FeatureScript MCP-built models
READ TIME:
12:36

Summary

FeatureScript is Onshape’s programming language for creating native parametric CAD features. Unlike a macro that replays commands or an API script that controls CAD from outside the modeling environment, FeatureScript runs as part of a Part Studio’s regeneration and can define its own interface, parameters, geometry, selection logic, and error handling.

Some layers of CAD customization are not new. Engineers have been recording macros and writing API scripts for decades. These tools can eliminate repetitive work, connect systems, and automate long sequences of commands.

FeatureScript does something fundamentally different.

FeatureScript is built into Onshape’s parametric modeling engine and provides the foundation for Part Studio modeling. Features in Onshape’s default toolbar—including features such as Extrude and Helix—are defined as functions in the Onshape Standard Library. When someone creates a custom feature, that feature does not sit outside the CAD system and drive it remotely. It becomes part of the modeling environment itself.

The simplest way to describe the difference is this:

Macros and API scripts can press the buttons. FeatureScript lets you invent a new button.

That distinction matters because the result is not merely automated geometry. It is a native, reusable, parametric CAD feature that captures design intent and regenerates with the model.

Skip to Section:

FeatureScript vs. CAD Macros and APIs

The three technologies overlap, but they operate at different levels.

Capability

CAD macro

External API script

Onshape FeatureScript

Primary purpose

Repeat or automate commands

Control CAD and connect external systems

Define native modeling capabilities

Where the custom logic runs

Outside the model or through the user interface

In an external application or service

Inside Part Studio regeneration

Uses existing feature types

Yes

Usually

Can define entirely new feature types

Custom user interface

Limited

Usually external

Native feature dialog

Representation in the feature tree

Created operations may appear

Created operations may appear

The custom feature itself appears

Response to upstream model changes

Depends on the resulting features and recorded selections

Must be anticipated and handled by the script

Built into parametric regeneration behavior

Geometry selection

Recorded selections or object references

IDs and API selection methods

Regenerating geometric queries

Captures reusable engineering intent

Limited

Possible, but the logic remains external

A core purpose

Best suited for

Repetitive command sequences

Integrations and workflow automation

Company-specific modeling features

This is not an argument that one technology replaces the others. A macro, an API, and FeatureScript solve different types of problems. The important question is where the engineering logic should live and what should remain after the automation finishes.

Is FeatureScript a CAD Macro?

No. A macro typically records or scripts a sequence of user actions. An engineer might use one to create a sketch, draw a profile, enter dimensions, extrude it, and apply a fillet. Instead of repeating those steps manually, the macro plays them back.

That can be extremely useful, especially when the same predictable sequence must be performed many times. But a macro generally begins with the available commands and automates their use.

FeatureScript defines the feature itself: its inputs, interface, geometric calculations, modeling operations, error handling, and regeneration behavior.

Imagine a company that designs lawn-care products and repeatedly needs detailed garden-hose threads.

A macro could replay the steps required to construct one particular thread. It might create a helix, sketch a profile, sweep or cut the thread, and add a chamfer. That may work well when the starting geometry closely matches the conditions under which the macro was created.

A FeatureScript custom feature can instead define the engineering concept Garden Hose Thread.

The user selects a cylindrical surface. The feature can determine whether the thread should be internal or external, create a cut or formed thread, control engagement depth and termination, reverse its direction, and chamfer the leading edge. Those choices appear in a purpose-built feature dialog.

Custom Feature: An intelligent Garden Hose Thread feature created with FeatureScript.

In the feature tree, the result is not an anonymous trail of automated commands. It is a single, recognizable Garden Hose Thread feature. The engineer can reopen it, change its parameters, suppress it, reorder it, configure it, or reuse it on another design.

FeatureScript packages the company’s engineering knowledge as a reusable modeling capability, not simply a sequence of actions.

How Is FeatureScript Different from a CAD API?

An API provides a broad connection to the CAD system. It can create or edit data, initiate actions, exchange information with other applications, manage documents, update metadata, export files, and automate workflows across many designs.

APIs are essential for integrations, batch processing, data management, and system-level automation. An external program could use an API to create a document, set properties, export a neutral file, or coordinate processes across CAD, PLM, ERP, and other business systems.

The custom logic, however, typically remains in the external program. The API tells the CAD system what to do, often by creating or modifying existing feature types and objects.

FeatureScript operates inside a Part Studio’s parametric regeneration. It can define a new modeling feature that becomes part of the model and remains there after the code has run.

A complete automation may use both technologies. An external application could use the Onshape REST API to create or locate a document, update metadata, and initiate a workflow. FeatureScript could then generate specialized geometry as a native feature inside the model.

The API orchestrates the process. FeatureScript embodies the modeling intelligence.

How Do FeatureScript Queries Work?

FeatureScript queries are rules for locating geometry in a model's current state. During regeneration, Onshape reevaluates those rules against the geometry that exists at that point in the feature tree.

This is important because parametric CAD geometry is constantly changing. Add a hole, and one face may become several. Increase the length and the edges move. Suppressing an upstream feature causes some entities to disappear entirely. Code that depends on a fixed face number or edge identifier can easily lose track of what it was meant to modify.

A FeatureScript query does not need to mean “use Edge 12.” It can express intent such as:

  • Find the faces created by this operation.
  • Find the edges adjacent to the selected cylindrical face.
  • Find the tangent-connected faces extending from this seed face.
  • Find the circular edges belonging to the selected part.
  • Find the bodies created by an earlier feature, then subtract them from the enclosure.

This gives FeatureScript a native mechanism for building parametric behavior that responds intelligently as the model changes.

What Is Query Replay?

Query replay means FeatureScript reevaluates the rule used to find geometry whenever the model regenerates. It does not simply remember that a feature originally modified “Edge 12.” It asks again for the geometry that satisfies the intended selection rule.

Consider a simple custom feature that fillets every edge that exists at its position in the feature tree. It does not need to store Edge 7, Edge 12, and Edge 19. Its query effectively says, “Find all edges that exist here.”

Now add a hole upstream. The hole creates new edges. When the Part Studio regenerates, the query runs again, and the new edges can be included. Suppress an earlier extrusion, and its edges disappear; the query simply returns the edges that still exist. There is no missing-edge error caused by a stale list of identifiers.

A more practical example might be an edge-treatment feature applied to a set of patterned ribs. Instead of storing a fixed list of the rib edges, its query can say, “Find the edges created by this rib operation and apply the specified fillet.”

If the engineer changes the upstream pattern from six ribs to 10, the topology of the part changes, and many new edges are created. During regeneration, the query is re-evaluated, identifies the edges created by all 10 ribs, and applies the treatment to the new set. The feature is not repeating the original operation against six remembered edges. It is reapplying the intended engineering rule to the model as it now exists.

Queries do not make every custom feature automatically indestructible. The author still has to define sensible selection logic and handle changing conditions. But queries provide the foundation needed to create robust parametric behavior rather than brittle command playback.

Why Are Custom Features Considered First-Class Features?

Calling a FeatureScript custom feature a first-class feature means that its custom logic participates directly in the same modeling environment as Onshape’s standard features. It is not merely a script that runs and disappears.

A FeatureScript custom feature can have:

  • Its own icon and place on the feature toolbar
  • A tailored parameter dialog with selections, dimensions, units, dropdowns, checkboxes, tables, and conditional inputs
  • On-screen manipulators for direct editing
  • Preview, validation, warnings, and meaningful regeneration errors
  • A named entry in the feature tree that can be edited, suppressed, reordered, patterned, and configured
  • Geometry that downstream features can reference
  • A controlled, versioned definition that can be shared and updated across a team

Each capability has a practical effect.

The native dialog allows engineers to use the feature without understanding its code. The feature-tree entry makes its purpose visible in the model. Parametric regeneration allows it to respond to upstream changes. Downstream references allow the rest of the design to build on its results. Versioning gives a company a controlled way to distribute and improve the feature.

The custom capability remains in the model. Its parameters remain editable. Its logic participates in regeneration. Its purpose is visible to the next engineer who opens the design.

That last point is especially important. A feature named Bearing Seat communicates far more design intent than a folder containing an offset, a revolve cut, a groove, two chamfers, and a fillet—even if both produce identical geometry today. The named feature explains what the geometry is for and preserves the rules used to create it.

What Can FeatureScript Create?

FeatureScript can do far more than create isolated geometric shortcuts. It can be used to build custom features for individual parts, configurable components, multi-part systems, and tools that analyze geometry or calculate engineering information.

Features Applied to Existing Parts

A custom feature can add specialized geometry or manufacturing details to an existing part. Examples include plastic threads, bearing seats, hydraulic cavities, retention-ring grooves, specialized blends, and company-specific edge treatments.

Custom Feature: An advanced blend corner treatment tool with G2 curvature, created with FeatureScript.

The engineer selects the relevant geometry, enters the required parameters, and applies the feature just as they would use a standard Onshape feature. The result remains editable and regenerates as the underlying part changes.

Configurable Components and Multi-Part Systems

FeatureScript can also create completely configurable components. Because Onshape Part Studios supports multiple related parts within the same modeling environment, a custom feature can extend beyond a single component to generate a coordinated system of parts.

That makes it possible to encode the relationships between parts—not just their individual dimensions. A custom feature could generate a manifold and its internal passages, a heat exchanger with its tubes and end plates, or an enclosure with coordinated covers, seals, mounting features, and internal clearances. When a driving parameter changes, the related parts can regenerate together while preserving their interfaces.

Custom Feature: A configurable Heat Exchanger created with FeatureScript.

Geometry Analysis and Engineering Calculations

FeatureScript does not have to create or modify geometry. It can interrogate the live model and combine its geometry with material properties, operating conditions, engineering equations, and company-specific calculation methods.

A custom tool could calculate the center of buoyancy and stability of a floating product, predict pressure drop or thermal performance in a heat exchanger, locate the focal points of a lens, or estimate beam and shaft deflection under load. Results can be displayed in a custom table, written to a computed property, represented by reference geometry, used to validate a requirement, or used to drive the model itself. As the design changes, the calculations update with it.

In principle, FeatureScript can calculate any engineering quantity that can be derived from the model and data, or the equations supplied by the engineer.

A Configurable Sprocket Example

Consider a sprocket.

A macro can create a sprocket by replaying the steps used to model one. An API program can calculate the tooth profile and assemble standard CAD features to produce a specific result. Both can save substantial time.

FeatureScript can create a Sprocket feature.

The feature can expose chain size, tooth count, strand count, bore diameter, hub style, keyway, set screw, and custom dimensions as native parameters. It can calculate the correct construction geometry, generate the tooth profile, pattern it, build the hub, and apply the appropriate details.

Change the tooth count from 18 to 24, and the feature regenerates. Switch from a single- to double-strand sprocket, and it rebuilds. Remove the keyway and the feature updates like any other parametric feature.

The real product of the development effort is not one automated sprocket. It is a reusable sprocket-design capability that can generate an entire family of editable parts.

The sprocket is one visible example, but the broader opportunity is even larger: FeatureScript can customize how a company designs parts, builds coordinated systems, and extracts engineering knowledge from its models.

How AI and FeatureScript MCP Are Ushering in Customizable CAD

For years, the barrier to FeatureScript was not capability but authorship. Creating a production-quality custom feature required programming expertise combined with a strong understanding of parametric modeling.

The Onshape Labs's FeatureScript MCP changes that equation. An engineer can describe a needed capability in plain language while an AI system writes, tests, debugs, and iterates on the FeatureScript code. It is a direct path from Text-to-Code-to-CAD.

The result is not a one-time piece of AI-generated geometry. It is deterministic FeatureScript code that becomes a native, editable, reusable feature inside Onshape. AI helps create the capability; Onshape regenerates it without requiring another AI call every time a parameter or model changes.

Together, AI and FeatureScript MCP are ushering in a new age of customizable CAD. Instead of every company relying on the same general-purpose collection of modeling commands, each can build capabilities tailored to its own products and processes—specialized features, configurable components, multi-part system generators, engineering calculators, design checks, and manufacturing rules. (In fact, all examples shown in the post were created by AI and FeatureScript MCP)

Over time, this library of custom capabilities becomes valuable company intellectual property. It captures engineering methods, product knowledge, standards, and hard-won expertise in tools that can be shared across the organization. That allows a company to scale its best practices, design more consistently, move faster, and turn its unique engineering knowledge into a lasting competitive advantage.

FeatureScript Turns Engineering Rules into CAD Capabilities

Macros automate work. APIs connect and orchestrate systems. FeatureScript turns engineering rules into native parametric CAD features.

AI makes those capabilities dramatically easier to create. The result is more than a faster way to model: it is a CAD system increasingly built around the company, its products, and the way it engineers—backed by a growing library of intellectual property its competitors do not have.

Stay in the Loop with Onshape Labs

Fill out the form so you’re first to know, first to try, and first to weigh in on everything Onshape Labs releases next.

Latest Content