Roll Your Own CAD

If you find a feature lacking in your CAD program, you can now create it yourself, if your CAD program is Onshape—and if you have some programming skills.

Onshape announced FeatureScript last week, which lets you use a JavaScript-like language to create features.

“It is the same language which our developers have been using to code our existing features,”said Darren Henry, director of marketing at Onshape. “We are making it available to users.”
Written by a user with FeatureScript, the HexInfill command creates a parametric hexagonal cell structure in a specified area. (picture supplied by Onshape)
Programming languages are not new to CAD. Perhaps the most famous one is AutoLISP, a variant of LISP that is used with AutoCAD. The popularity of AutoCAD has resulted in millions of applications, from simple shortcuts to sophisticated, full-blown programs, and has helped create a thriving third-party development community. But all the real AutoCAD development has been done in a high-level programming language like C++. With FeatureScript, a user can write a program using the same language as a program developer. That may be a first. “Other CAD vendors can’t do this; they use an API,”said Henry.“We can do it because we built Onshape with FeatureScript. We used FeatureScript ourselves to write the features.”
Twelve of the 14 features developed by users with FeatureScriptareinitially available to all users. (Image courtesy of Onshape.)
A few users have already developed features using FeatureScript. The most interesting is a feature that lets the user fill a space with a honeycomb structure. It was created by Fast Radius CEO Mitch Free, formerly of MFG.com, who needed a way to 3D print structurally rigid parts without using a lot of material. Henry said that several more user-written features are in the works.

Features developed by one user can be available to other Onshape users. Onshape plans to create a marketplace where users can offer their features for sale.

How Hard Is It?

Cody Armstrong, who was able to do a demo for ENGINEERING.com, showed the actual script. It will look familiar to you if you have used JavaScript. “I’m not a developer,”said Armstrong, as if to say, if I can do this, so can you. But perhaps realizing that most engineers don’t work for software companies and don’t have coding in their job descriptions, Onshape also provides detailed tutorials, videos and a comprehensive reference guide on its site.
The language of FeatureScript is based on JavaScript. (Image source: Onshape.)
FeatureScript is offered to users at no additional cost. Any existing Onshape user, either using it for free or atthe premium rate ($100/month), will have full access to FeatureScript.