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)

Importing data (Should know)


Sometimes it is desirable to use geometry that was created in other CAD or modeling programs. FreeCAD can import a wide variety of file types. DXF, STEP, STL, SVG, VRML, Collada, and IDF are just some of the file formats that it can use.

In this recipe, we will open a DXF file and use the geometry in it to form a 3D solid.

Getting ready

You should have a DXF file produced by a CAD program such as QCAD, LibreCAD, Draftsight, or AutoCAD available to produce a DXF file.

  1. In FreeCAD, open the Draft workbench and then select Preferences from the Edit menu.

  2. In the Preferences dialog, click on the Draft icon and then click on the Import/Export tab.

  3. Under DXF format options, change Import style to None (fastest).

  4. Uncheck all the other boxes in that same section. Click on Apply and then OK.

Create some geometry in another CAD program. For this example, we will use DraftSight to create a simple shape. The following is a polyline rectangle with four fillets and a circle:

The lines and arcs in this drawing are a polyline. These will translate nicely into FreeCAD and help us create a solid to subtract the circle from.

Save the file as an ASCII type dxf (don't save as Binary).

How to do it...

  1. In FreeCAD, select Import from the File menu.

  2. Select the dxf file that you want to import.

  3. In the Combo View, look at the Project tab and expand the icons.

  4. Switch to the Draft workbench so that we can Upgrade the Circle with the icon that looks like an arrow pointing upward.

  5. Select the geometry labeled as Polyline and use the Part workbench with the Extrude icon to extrude it into a solid.

  6. Extrude the geometry labeled Circle into a solid. Make sure that its height is the same as the solid made from Polyline.

  7. Select the solid that you created from Polyline and then the solid created by Circle.

  8. Use the Boolean Cut operation in Part workbench to subtract the Circle solid from the Polyline solid.

How it works...

DXF importing relies on code within the Draft workbench, so its settings are controlled from Draft preferences. The dxf polyline imported in as a face that could be extruded in the Part workbench. The Draft workbench has tools for changing other 2D geometry into faces, using the Upgrade tool, which allows the Part workbench to make solids from them. Faces will extrude as solids, whereas a closed shape without a face will just extrude into a thin object that looks like walls.