I recently gave a talk about the practical applications of FeatureScript, but for those unable to see it in person, I decided to write it up as a blog post. FeatureScript gets talked about a lot in the Onshape space, it what makes Onshape Onshape. Unlike other automation methods, like macros and APIs; its not an afterthought, its 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 talk, scrubbing any actual design data. But this also shows how fast a feature can be made; its 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 3 categories that I see the most often and provide a clear value proposition. Standardization, Process automation, Complex designs.
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 bring in the benefit of faster designs and fewer mistakes. When designs are highly constrained to a standard, encapsulating the design into a feature prevents potential for human error.
When to use?
Common design elements
Design must adhere to a specific standard
Examples
Bicycle frame bottom brackets
Hydraulic Manifold design
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 opportunity for mistakes, and adds additional time to creating a design.
With the feature demoed below, its as simple as a few clicks, and the bottom bracket is added to the frame. Its so fast, you can blink as miss it. An additional benefit of the feature is in the choice to not allow placement. For this client, the bottom bracket is the origin of the model, and needs to be in a specific plane. By fixing the position of the feature, it adds an additional check to the frame design to ensure mistakes aren't being made.
Process Automation
Automating a series of click 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 timer saver, and a great use of FeatureScript. For a process that is well described, multiple features can be combined into a single custom feature to ensure process standards are met with minimal design effort.
Lets 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
Its not difficult to think of data driven modelling 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 for example, a variable pitch helix. How would you create a variable pitch helix 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?
This variable pitch helix is able to create a curve that otherwise wouldn't be possible. And unlike a macro, its fully parametric. The inputs aren't complicated equations, they are simple parameters drive 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. I am better able to focus on new and cutting edge ideas.
Desktop CAD | Onshape | |
---|---|---|
Environment | "But it works on my computer" | Everyone has the same Onshape |
Deployment | Emailing installers, requires IT to help deploy | Instantly available |
Data Security | Emailing files | Restrict with Onshape permissions, code developed inside your own enterprise, models never leave |
Version Control | Up to the developer | built in version control |
Bug fixes | Requires replication and redeployment | Documents with issues can be shared, no need to replicate. Bug fixes are as simple as updating the linked feature. |
Result | Slow, annoying | So fast, so easy |
Awesome read Caden, appreciate the work you put into recreating the examples!