Book Image

FreeCAD

By : Brad Collette, Daniel Falck
Book Image

FreeCAD

By: Brad Collette, Daniel Falck

Overview of this book

FreeCAD is a general purpose platform for CAD development. It can be extended to use different workbenches to solve different problems. Targeted squarely at the engineering community, FreeCAD is an open source design application built to be extended. Python, the powerful scripting language, is woven deeply into FreeCAD's DNA and gives users unprecedented power to automate and invent. "FreeCAD [How-to]" is a lean, fast tour of FreeCAD's major workbenches and design philosophy. The reader will get a hands-on introduction to several modeling techniques and learn how Python makes macro automation and design possible. FreeCAD allows users to design in a variety of ways; from drawing 2D designs as lines and circles to combining primitive solids into complex 3D shapes. Objects can even be created or modified by code you write in Python. FreeCAD even allows power users to extend the application itself with new dialogs, panels, and scripts. This book will not only show you how to get started using FreeCAD in a traditional GUI mode, but will teach you how to harness its powerful scripting language for more power.
Table of Contents (9 chapters)

CSG modeling in the Part workbench (Must know)


Constructive Solid Geometry (CSG) is a modeling technique that combines primitive solids with Boolean operations to create more complex shapes. FreeCAD's CSG tools are found on the Part workbench.

This recipe will use the Part workbench to model a simple part—an offset mounting bracket for a NEMA 17 stepping motor.

Getting ready

Create a new empty document and orient the view to the top using the Set to top view top-view icon or by pressing the number 2. Use the Workbench Changer to switch to the Part workbench.

How to do it...

  1. Model the bent metal plate by adding and positioning three box solids. Add the first box to the drawing, and select its node in the project tree. Switch to the Data tab and edit the properties to make it 2.5 x 50 x 50 mm (height, length, width).

  2. Create a second box with the same dimensions but edit the placement to move the box 50 mm in the X direction and 10 mm in the Z direction. This will place the second cube next to the first and shifted upward.

  3. Add a third cube to connect them. Make its dimensions 10 x 2.5 x 50 mm and shift its placement 50 mm in the X direction.

  4. If you rotate your view slightly, your three solids should look like the following figure:

  5. Next we'll create the slots. FreeCAD doesn't have a slot feature so we'll make a solid in the shape of the hole we want. Later, we'll subtract it from the plate to create the hole.

  6. Add another box and set its dimensions to 10 x 10 x 3 mm.

  7. We want the slot to have rounded ends so we will fillet the box. Select the box and press the menu Part | Fillet.

  8. The combo view will switch to the Tasks panel and show the fillet options. You can use this to refine your edge selection and set the radius of the fillet. For our example, select Edge1, Edge3, Edge5, and Edge7. We used a value of 1 for the radius. Clicking on the OK button will apply the change. If you make a mistake, double-click the fillet object in the tree to change the properties and try again.

  9. Once the cube looks right, select it and duplicate it with the menu item Edit | Duplicate selection. Repeat this twice more so that we have a total of four fillet objects. Select each one and change its placement properties to move it into position on the raised part of the plate. The position is up to you. Just make sure the fillet objects completely penetrate the plate.

  10. Now add five cylinders for the holes. Change their placement and radius properties. The center hole is 22.5 mm and the small screw holes are 2.5 mm.

  11. With all the solids added to the project, it should like the following image:

  12. We're almost ready to subtract the cylinders and slots from our base plate, but we first need to clean things up a bit. In the project tree, select all of the cylinders and fillet objects. With all of them selected, click on the Make a union of several shapes icon:

  13. Now select the three boxes for our base plate and repeat the operation, fusing them into a single object.

  14. You should now have two fusion objects in the tree, one for the base plate and one for the holes that will be cut from it. First select the base plate fusion, and then with Ctrl held down, select the other. Click on the Make a cut of two shapes icon:

  15. The order in which you select the objects is important. The first object will be cut by the second. If all goes well, you will have an object that looks almost like the image at the beginning of the recipe.

  16. To finish it off, we've applied another round of fillets to the corners of the plate and to the corners of the bend. The complete object should look like the image at the beginning of this recipe.

How it works....

Union operations add objects together. The solids don't have to be touching or overlapping. After a union, they will have a single location and orientation.

A difference Boolean cuts the first object with the second. If the two objects don't overlap, the original object will be unaffected.

An intersection eliminates everything except the area where the original two objects overlapped.

After any of these operations, a new object is created and the original items become its hidden children. You can delete the parent node and toggle the original object visible to get back to where you were. Objects such as fillet and chamfer can be double-clicked to reopen the dialog that created them and adjust the options.

There's more...

There's often more than one way to do the same thing and the Part workbench has a few hidden extras.

Create primitives

FreeCAD can create many more primitive types than those in the toolbar. Use the Create primitives tool to create many other. For example, a spring-like parametric helix.

Why doesn't my part look right?

If your part doesn't look like the example at the beginning of this recipe, try playing with the View properties of the final object. Change the Display Mode to shaded.