Hey guys ! Welcome to yet another introductory series. This time we’re delving into mechanical engineering, for Nefastor Online is also about robotics and robotics means mechanical parts and assemblies. You can design those by hand or you can be smart and use CAD software… such as the excellent OnShape, which is the topic of this series of articles.
With the recent ubiquity of 3D printers, fablabs and makerspaces, you could assume that everyone knows where to find a good CAD program and how to use it. Reality is quite different. Due to the high cost and perceived complexity of so-called “traditional” CAD software, most makers end-up using a paintbrush to draw blueprints. It’s time to free them from Blender and SketchUp. Nefastor to the rescue !
Today I’m demonstrating that parametric CAD, the kind used to design rocket engines and expresso machines, is easy to use and can be very inexpensive. Before this article is over, you’ll have designed a robot wheel using OnShape, a free parametric CAD program.
Because I want to introduce many concepts with few words, we’ll talk and work at the same time. You can multitask, right ?
OnShape in a nutshell
OnShape is basically SolidWorks in your web browser, for free. No catch.
It is actually the product of people who worked on SolidWorks itself and it is very similar to it. Which is a Good Thing ™… even if you don’t know what SolidWorks is.
Since you’re reading this article you clearly have a browser and an internet connection, and OnShape is free. So your first step is simple : follow this link and create an account. The validation e-mail might take its sweet time coming, I’ll use that delay to lay some knowledge on you.
You’ve read me use the term parametric CAD and I’m sure you’re wondering what it means. Quite simply, it refers to your designs’ parameters, such as lengths, diameters, number of holes, etc… That’s the data that matters to CAD software, not triangle meshes.
If you’ve used a 3D printer already, you’re familiar with STL files, triangle meshes and how to create them. That process is not CAD, it’s called 3D modeling and it is not engineering, it’s art. It’s the perfect process if you’re out to create yet another Yoda head or truck nuts (are those art ? I’ll let philosophers decide).
When you need to design precise parts for a robot, where each dimension is dictated by a mechanical function the part must perform… that’s when you need CAD.
Enough talk, let’s do stuff !
Once you’ve received your account validation e-mail and did what it tells you to, your browser should show you this :
This is OnShape’s document explorer. You’ll see it every time you log in. A document is basically a whole project : it can contain any number of individual parts and part assemblies. This being a Cloud-based application, your documents are stored on the web, and we all know what that means. You can access them from anywhere as long as you have an internet connection, and you can share them with other people. Better yet, there are very powerful OnShape mobile apps.
You can have as many documents as you want, within a 5 GB limit. But because you’re using it for free, OnShape makes all your documents public except for 10 you can choose at any time. It’s not a big limitation really, considering this is equivalent to keeping 10 whole projects private. Still, if you need more, you can pay for more, and that’s OnShape’s business model in a nutshell. Of course you can also create multiple free accounts. You do you.
Ignore the tutorials for now : you’ve got Nefastor holding you hand, that is more than enough.
Create a new document
Now, I said we’d be designing a wheel, so let’s get to it. Click on the blue “Create” button near the top left. Call your project something representative like “Wheel” so other people can search for it if you make it public. Unless you don’t like being popular, that is.
You’ll see this :
This is OnShape’s Part Studio, where you can design one or several individual parts. See those tabs at the bottom ? You can create as many Part Studios as you need, and they’ll all be stored as part of your wheel document.
On the left, you have a hierarchical tree that will eventually list all the features that define your part. Parametric CAD considers a part to be a solid defined by its features. A feature can be a hole or a protrusion, for example. Think about it, this is exactly how people naturally describe objects.
In the center, that big dot is the origin of part coordinates. The three planes are only a visual to help you orient the view as you design a part. There is no grid because this is CAD : you’re not going to draw by hand, you’re going to specify exact parameters for everything. Therefore a grid is useless.
Play around with the mouse and keyboard, get to know the terrain. I find the arrow keys are particularly nice for quickly orienting your view, especially if you’re on a laptop.
Reinvent the wheel
You must now design (not draw) your wheel. In an engineering process worth the name, by this point you’d have a specification document listing all the features your wheel needs to possess in order to fill its purpose, and you’d just have to enter them in your CAD file. But you can also free-hand it if you’re an amateur or if you just want to explore an idea.
However informal your process may be, choosing where to start a part is easy : you always start from its biggest, crudest and/or most defining feature and then add in the details. Exactly the same way you’d describe that part to someone else.
Here we want to create a wheel : a wheel is essentially a flat cylinder with a hole in the middle. So let’s create that feature.
Entering a feature in parametric CAD is a two-step process : first you make a 2D sketch of it, then you give it volume.
Select a plane (I prefer using the Top plane, more on that later) and start a sketch by, well, clicking Sketch. Your toolbar just changed to something familiar to MS Paint users. You should also see a small dialog box like this one :
Leave it alone for now and select the “Center point circle” tool (or hit “c” on your keyboard). Now click and drag from the big origin dot. Congratulations, you’ve just created a circle.
Do it again to create a second, concentric circle. Their respective size doesn’t matter.
Enter those famous parameters
While OnShape did display your circles’ diameter as you were drawing them, you clearly had no accuracy. But that’s OK because this is parametric CAD : you’ve just reached the point where you’ll enter your first parameters, namely the diameter of your wheel and that of the wheel’s axle hole.
First, you may want to tell OnShape which units you’re using. Because OnShape was designed by Americans and the USA remains one of only three countries still unaware of the fall of the British Empire, your document defaults to inches and pounds. No, seriously. To bring it into the modern age, open the main menu (the three horizontal bars icon near the OnShape logo) and select “Workspace Units…” then choose something practical like millimeters, degrees and kilograms.
Get back to your sketch and hit the “d” key, for “dimension”. You can now click on your each circle and enter its exact diameter. You can even specify units if, for instance, your part must include both metric and imperial units. The dimension tool is crucial and you’ll use it a lot. Once you’ve set a dimension, you can drag it to where it can be read easily and, most importantly, you can come back at any time to change its value.
Let’s say our wheel has an outer diameter of 55 mm and the axle is 10 mm. You should end-up with something like this :
Now that’s a fine-looking wheel, if I may say so.
Enter the third dimension
Your sketch is complete, or at least it’s in a usable state : click the green tick on the dialog box to save it and exit sketch mode.
Now all that’s missing is some thickness. Near the top left, you’ll notice the Extrude icon. That’s what it does. It’ll take your sketch and turn it into a 3D feature. Make sure nothing (even your sketch) is selected, and click it. You should get this dialog :
It’s a powerful tool but for now we’ll mostly be using its default settings. First you need to select what it is you want to extrude. OnShape is quite smart : you have drawn two concentric circles, so if you click somewhere in between them, it’ll understand you want that specific area to be extruded. If, for some reason, you have multiple contours you want to extrude as one feature, you can click as many as you want. OnShape gives you a preview of what your feature will look like before you OK it, so you should always be able to get what you want. Features are parametric too, of course, so you can always come back and edit them later if necessary.
Once you’ve selected what you want to extrude, you can set how far to extrude it. Let’s say 15mm. Now hit that green tick…
And that’s it, you’ve designed a wheel using parametric CAD :
Was that so hard ?
That wheel is kind of bland, though… let’s add a feature : some holes around the axle hole that could be used to bolt it.
Here’s a nice thing with parametric CAD : now that you have a feature, you can add new sketches and features onto its surfaces as long as they’re flat. To illustrate, select the side of your wheel and hit the Sketch button again.
We’re only going to draw a single hole and decide later how many we want. Let’s make it 4 mm in diameter and put it 15 mm off the wheel’s axis. You sketch should look something like this :
Hint : to create the distance dimension, click on the things that distance separates, like your circle and the origin.
Save that sketch and open the extrusion tool again.This time, however, we want to make a hole instead of adding volume. So select “Remove” instead of “New”. Now select your latest sketch. And to help you see the preview, rotate around the view. You should get this, or close enough :
Obviously you could tell OnShape to dig down 15 mm since that’s the thickness you’ve specified for the wheel… but if you come back and make it thicker, suddenly your hole won’t go all the way through… unless you modify it as well. Save yourself that trouble : see that “Blind” in the dialog ? Change it to “Through All“. Now the hole will simply go through the whole part, always.
Notice the arrows icon next to that drop list you just used ? That’s for reversing the direction of extrusion if necessary. You should never specify negative dimensions in a CAD file. Negative dimensions lead to anger, and anger leads to the Dark Side.
Validate this feature… and you now have a single bolt hole on your wheel.
Multiply the holes
We could have drawn all the holes we needed in that second sketch, but then we’d have had to specify, for each one, a diameter and distance to the wheel’s axis. Boring. And cumbersome, if you ever want to change those two parameters. So we only made a single hole. Now we tell OnShape we want more like it.
In the tool bar you should find a drop menu with this icon :
Expand it and select “Circular pattern” in the menu. You’ll get this dialog :
By now you should be able to guess what’s coming. Start by telling OnShape this is a feature pattern, in the top drop list. Then select “Extrusion 2” (your single bolt hole) from the features list, or click on the hole directly. Since you can pattern multiple features in one go, you’ll need to manually select the next parameter (“Axis of pattern”). For that one you can use any feature that’s on the same axis as the wheel, for example the inside of its axle hole : OnShape will deduce its axis and use it.
The pattern defaults to 4 evenly-spaced repetitions of your feature. Change that parameter to anything you like and witness the preview.
Note that OnShape will not always (not often, in fact) catch nonsensical parameters. Here’s what happens, for instance, if you ask for 30 holes :
I’m fairly certain that this wheel won’t work. It’s not even in one piece… in fact OnShape now considers it two separate parts.
CAD is for makers, unlike 3D modeling. Always remember that your part parameters must lead to a part that can actually be manufactured and used. In this case, you can settle for 9 holes, it seems more sensible.
Exporting to STL
So you have designed a wheel… what if you want to 3D-print it ? Well, you’ll need an STL file to feed your slicer. OnShape can make one for you very easily : right click your part and select “Export” in the context menu that pops up.
You’ll get a nice dialog where you can choose a file format. If you select STL you can then enter various parameters, notably the resolution. See, a CAD file maintains absolute accuracy whereas an STL file is only an approximation of your CAD file in the form of a triangle mesh. Think of it this way : STL is to CAD what MP3 is to audio CD’s.
Once you’ve set your export parameters, OnShape servers in the Cloud will do their magic and download your STL file to your computer, and now you can print. Simple as that !
I’m pretty sure you’ll agree that OnShape is both very easy to use and very powerful. And we’ve only scratched the surface today. In this series’ upcoming articles I’ll be covering, among other things :
- Best practices in designing a part
- How to avoid redesigning standard parts like stepper motors
- How to create and simulate assemblies of several parts
- Importing your OnShape parts into Unity as assets
Furthermore, OnShape is the official CAD software for Nefastor Online, and that’s for three reasons : I live what I preach, I think everyone can afford free software, and it gives you direct access to my CAD files.
So I hope you like it, because you’ll be seeing it around !