August 16, 2016
CAD modeling is where product designers express their creativity using splines, surfaces, and solid geometry. But the process also involves lots of repetitive tasks. Standard mechanical features like rounded corners, chamfered edges, aligned holes, screw bosses, and snap hooks are not difficult to model, but incredibly time-consuming. Most CAD software let you add rounded corners and chamfered edges with one or two clicks. But gears, bosses, and hooks have too many different configurations and cannot always be created with a few clicks.
Onshape, the browser-based parametric CAD program, recently introduced a series of FeatureScripts, which let you create and place common mechanical features using templates and macros. Users can select and load the desired scripts from a catalog, available from within the Onshape modeling environment. The current lineup includes scripts developed by Onshape and those submitted by users. Scripts to build Spur Gear, Lap Joint, Wave Spring, and Snap Hook come from the Onshape staff; scripts to create Laser Joint, End Flange, Pocket Holes, and Parametric Curve come from the Onshape community.
Onshape writes, “FeatureScript is a new programming language that lets you create new features that look, feel and behave just like Onshape’s built-in features. It’s the same language used by Onshape’s development team, that’s now available to you.”
With the Spur Gear script, you create a generic gear as your starting point, then configure it to your specific needs by specifying its diameter, number of teeth, plate thickness, and other characteristics. This template-driven approach is much more efficient then the conventional way to sketching a 2D profile and extruding, especially since you’ll most likely need to create a fair number of them in different styles for your assembly.
With Screw Boss and Snap Hook scripts, you use the Sketch tools to define the spots where you’d like to place these features. Then you activate the script to populate the designated surface with the features. Variables like height, diameter, and number of ribs can be adjusted through a dialog box.
The Hex Fill script is designed to turn a solid into a hallowed part, then fill the inside with rows of hexagons. This approach could help you create lighter parts by replacing solid pieces with hex-filled parts with sufficient structural strength, especially in 3D printing projects. (The Hex Fill script took me a few tries and some help from the Onshape forum to master. I learned that making a mistake with the input for wall thickness or forgetting to uncheck the hex pattern preview could prevent this script from running smoothly.)
Some commonly used mechanical elements cannot be reduced to a button on a menu. But they follow well-defined construction formulas, and could be distilled in macros and templates. FeatureScript is an example of this strategy. You can easily load the FeatureScripts when needed, put them use, then remove them from the software’s menu; therefore, you can keep the modeling space uncluttered.
Opening FeatureScript to the user community is prudent. Overtime, the library is expected grow, driven by submissions from Onshape users with a knack for building macros or programming knowhow. This enriches Onshape’s feature set in ways that its internal staff alone cannot do.
For more, check out video report below: