Jeff's MCAD Blogging
Jeffrey Rowe has more than 40 years of experience in all aspects of industrial design, mechanical engineering, and manufacturing. On the publishing side, he has written well over 1,000 articles for CAD, CAM, CAE, and other technical publications, as well as consulting in many capacities in the … More »
Is FeatureScript One of Onshape’s Best Features?
August 4th, 2016 by Jeff Rowe
Almost all of today’s CAD products are pretty capable right out of the box, but I’ve often wanted them to do more to suit my particular needs and workflow. Over the years I’ve created macros and used Visual Basic and AutoLISP for defining, customizing, and automating functions and processes not found in CAD products out of the box. My results varied widely – some were good, some were OK, and some were downright unpredictable and bad.
Several years passed and I didn’t really do too much with CAD programming, so my interest waned. That all changed, though, when cloud-based Onshape’s FeatureScript came along earlier this summer.
FeatureScript is a programming language designed by Onshape for building and working with 3D parametric models. The language is built into Onshape and provides the foundation of Part Studio modeling, including geometric references, parametric tools, and a type system with types built for math in three dimensions.
The standard feature types in Onshape, such as Extrude, Fillet, and Helix are already written as FeatureScript functions. Using FeatureScript, custom feature types extend this same function mechanism to Onshape.
Is FeatureScript the first specific programming language to be released for a CAD product? No, not exactly, but it is unique in many ways and adds to Onshape’s positive differentiation in the crowded CAD marketplace.
Introducing Onshape’s FeatureScript
FeatureScript is associated with the Onshape Standard Library that provides all of Onshape’s features, such as Extrude and Fillet, as well as a large number of functions and types designed to work with geometry and help build custom features. All functions in the Standard Library are imported by default into all new Feature Studios (tabs containing FeatureScript).
I’ll admit, I don’t have a strong coding/programming background (or inherent talent) by any means, but have found FeatureScript relatively easy to learn and use.
All CAD systems have features, but no matter how many features there are in a CAD system, every user wants features that don’t exist. Either features that have slight differences from the ones that are there, or specialized ones that would never otherwise appear.
With FeatureScript, you can create your own built-in Onshape features – or modify existing ones using Onshape’s original source code.
By making FeatureScript public, Onshape provides a customizable parametric CAD feature set.
“This is the first time that a professional CAD system has made the implementation of its parametric features open and extensible,” says Ilya Baran, Onshape’s Director of FeatureScript. “In the past, the only way to change your feature toolbar would be to submit an enhancement request to your CAD vendor and wait forever. And most of those requests are never fulfilled. FeatureScript swings the pendulum back and puts you in control.”
“In traditional desktop-installed CAD systems, it is possible to write add-on or macro features, but they are never as good as the built-in ones,” he adds. “FeatureScript offers the first opportunity to create features that are first-class citizens – as much a part of the system as the ones the development team wrote themselves.”
Under the open source MIT License, Onshape is also sharing the FeatureScript source code for all of its own features, allowing customers to copy, modify or adapt them as they see fit. New Onshape features can now be created in Onshape’s new “Feature Studio,” a user-friendly development environment with an editor, in-line help, and documentation.
Creating A Custom Feature Using FeatureScript
A few possible uses for FeatureScript include:
“For 30 years, feature-based modeling has relied on a limited set of off-the-shelf features. With FeatureScript, we are ushering in a new era of custom parametrics,” says Onshape founder Jon Hirschtick. “Our early adopters have proven that with the ability to use custom features that they write or have others write for them, they’re able to significantly speed up their design process.”
“Customers who develop new features in FeatureScript are free to do with them as they please,” he adds. “Some may wish to sell them or share them with the community. Others might choose to keep their FeatureScript features proprietary as a competitive advantage.”
Onshape states on its website that FeatureScript not only helps a programmer like develop an appreciation for CAD, but helps CAD users develop an appreciation for programming. I couldn’t agree more.
Although Onshape’s new FeatureScript programming language does have its limits. For example, you cannot write code that interacts with external online parties (due to Onshape’s tight online security) or generate drawings. On a positive note, though, Onshape has introduced an open programming language that takes it’s cloud-based CAD service to a new level of customization.
Onshape didn’t exactly release FeatureScript with a lot of fanfare, but that’s the nature of the company – less hype and more reality. However, FeatureScript is one of the most significant features of Onshape and one of the many things that separate it from the competition.
Editor’s Note: As many of you know, I was a middle school math teacher (actually a Math Fellow) for Denver Public Schools (DPS) for the 2015-2016 school year. That’s behind me now, but I will remain involved with DPS going forward in more of a part-time fill-in role. However, since I am no longer a full-time teacher, to help fill my time I have volunteered to help run the IdeaLAB at Denver’s main public library – a free makerspace and digital media lab. It’s a new adventure for me, and like my teaching experience, I’m sure I’ll learn as much from those who come into the IdeaLAB as they learn from me.