Editor’s note: Those who know know that FeatureScript is one of the most powerful tools PTC’s Onshape has to offer. With FeatureScript, users can create their own Custom Features to accelerate design processes and build a tailored CAD experience.

Users have built games within Onshape using FeatureScript (fun!), as well as important tools that make work easier (like these public Custom Features for Wire Routing and Freeform Spline). 

While FeatureScript can solve a gamut of problems, SmartBenchSoftware’s Caden Armstrong helps narrow down practical applications that positively impact design workflows. SmartBench Software offers a full range of software services, including internal development support, training, consulting, and white-glove service for deployed solutions using Onshape FeatureScript.

The following is Armstong’s blog republished with permission from SmartBenchSoftware.com.


FeatureScript is discussed a lot in the Onshape space. It is what makes Onshape Onshape. Unlike other automation methods, like macros and APIs, it is not an afterthought; it is the core of Onshape. Onshape uses FeatureScript to create Onshape.

Beyond the publicly available FeatureScripts, most applications of FeatureScript are hidden behind the closed doors of protected IP. Even for my presentation demos, I wasn’t able to show customer data. All of the samples shown here have been purpose-made for this blog, scrubbing any actual design data. But this also shows how fast a Custom Feature can be made; it's not a weeks-long effort, I was able to spin up some functional demo features in a few hours.

There are many uses of FeatureScript, but I wanted to isolate three categories that I see the most often and provide a clear value proposition. 

Standardization

In a parametric CAD, “features” tend to be design elements like extrudes, fillets, lofts, etc. As parametric CAD matured, this extended to more complex features like weldments and sheet metal. 

FeatureScript opens the opportunity to rethink how designs are made, focusing on “feature”: common design elements, and designing around them. Like building from Lego bricks. 

Ditching the tedious process of sketches, extrudes, etc., to make repetitive design elements brings in the benefit of faster designs and fewer mistakes. When designs are highly constrained to a standard, encapsulating the design into a feature prevents the potential for human error.

When to use?

  • Common design elements

  • Design must adhere to a specific standard

Examples:

Hydraulic Manifold

SAE J1926
Onshape SAE J1926 Straight thread port feature

In Hydraulic Manifold design, common ports are added to a block to create a hydraulic circuit. Port must meet a specific standard, as off-the-shelf components must fit and thread into the cavity. These ports are so common that Porting Tools that match the specific standard are used to quickly and accurately cut the holes. Each port is a series of stepped holes with various chamfers and fillets. Having a designer sketch the port for each and every use is not only incredibly labor intensive but ripe for costly mistakes. 

Bottom Bracket

The bottom bracket on a bicycle frame is a standardized design element that needs to work with off-the-shelf components. A frame designer is not going to redesign the bottom bracket for each frame (at least not without making everyone very mad). The bottom bracket is a design choice: which standard to pick. While the design is fairly simple, it presents opportunities for mistakes and adds additional time to creating a design.

With the feature demoed below, it’s as simple as a few clicks, and the bottom bracket is added to the frame. It’s so fast you can blink and miss it. An additional benefit of the feature is the choice not to allow placement. For this client, the bottom bracket is the origin of the model and needs to be in a specific plane. Fixing the position of the feature adds an additional check to the frame design to ensure mistakes aren't being made.

Bottom Bracket feature - on a definitely real bike frame.

Process Automation

Automating a series of clicks to produce a result of a number of steps is perhaps the most intuitive option for a custom FeatureScript when a user is coming from the desktop CAD world. 

Process automation is a big time saver and a great use of FeatureScript. For a well-described process, multiple features can be combined into a single custom feature to ensure process standards are met with minimal design effort.

Let’s look at an example: PCB breakaway tabs. These tabs are a common element of manufacturing PCBs, providing fixturing for the boards while they are being cut, with the added benefit of providing a no-tool option to free the board from the larger panel. Changes to the PCB design propagate down this design tree requiring extensive sketch modifications in order to place the breakaway, create routing channels, margins, etc. With the Custom Feature shown below, that all becomes a single step.


The additional benefit of FeatureScript is that this feature is parametric. Changes to the PCB design don't require re-running an entire process, changes propagate through the feature tree as they would for any other feature. Because Onshape is built on FeatureScript, Custom Features can even be configured, just like any other feature. This means that designs can be quickly and easily iterated.

Complexity

It's not difficult to think of data-driven modeling challenges that currently can't be done with the current tool set. FeatureScript opens up new options for generating features that previously couldn't be created. Unlike a macro, FeatureScript has the added benefit of keeping the feature parametric, configurable, and with design intent as inputs.

Take a variable pitch helix, for example. How would you create one in a traditional method? The best I could come up with is a fit spline sketch that is then wrapped around a cylinder. But what about a variable pitch helix on a conical surface?

variable pitch vs constant pitch

This variable pitch helix can create a curve that otherwise wouldn't be possible. And unlike a macro, it’s fully parametric. The inputs aren't complicated equations; they are simple parameters driven by design intent.

Experience as a Developer

To answer the question that nobody was asking: What is the experience like as a FeatureScript developer? This is an important question because all of the great things about FeatureScript culminate in a very positive experience. 

Coming from the desktop CAD world, many of the issues I had simply don't exist with FeatureScript development. There is a reason why I have shifted my business to focusing on FeatureScript and Onshape integrated applications. They are just less stressful to deal with. I waste less time on non-development issues, and I’m better able to focus on new and cutting-edge ideas.



(Caden Armstrong is the industry-leading expert in Onshape Automation. You can contact him at caden.armstrong@smartbenchsoftware.com.)

The Onshape
Discovery Program

Learn how qualified CAD professionals
can get Onshape Professional
for up to 6 months – at no cost!