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)

Preface

FreeCAD is a general purpose modeling tool aimed at the engineering world. Unlike other modeling tools such as Blender or Maya, which are designed for animators and artists, FreeCAD puts heavy emphasis on parametric, feature-based design.

Originally designed for Mechanical Engineering and Product Design, FreeCAD is now being developed to add functionality for a wide cross-section of engineering disciplines.

A great deal of foresight and planning has gone into the underlying technology of FreeCAD. The result is a tool that is powerful, easy to use, and easy to extend.

The pervasive use of the powerful scripting language Python is partly responsible for FreeCAD's flexibility and rapid development. End users have access to this power as well, in several different ways. From recording macros that automate simple tasks to directly creating and manipulating geometry, almost anything is possible.

Virtually every aspect of the FreeCAD application is accessible through the built-in Python interpreter. Even the user interface can be accessed and extended with Python code, permitting the user to create new dialog screens and entire modules that extend the core functionality. An example of how far this concept can be pushed is the Arch module. This workbench is being developed by Yorik van Havre to provide architectural design capabilities. It is written entirely in Python.

Its open architecture, extensible design, rapid development pace, and enthusiastic community make up for many of its limitations. It runs equally well on all three major platforms and has been translated into numerous languages. That, along with its free price tag, means anyone can experiment with FreeCAD now.

What this book covers

Getting and installing FreeCAD (Must know), will walk through the basics of getting FreeCAD working on your computer. Latest and greatest, or stable and easy? Mac, Windows, or Linux? We'll show you your options and talk about the trade-offs.

Understanding the FreeCAD interface (Must know), provides a broad look at FreeCAD's organization. This recipe will walk you through the user interface and get you comfortable customizing it for your own use.

CSG modeling in the Part workbench (Must know), shows you how to start with simple shapes and combine them to build complex objects. CSG modeling is one of several important techniques that FreeCAD makes possible, and an indispensable part of your modeling tool kit.

Recording and editing a macro (Should know), makes life easier by recording and playing back a sequence of frequently used commands. Create your own custom commands or automate a routine task.

Modeling a simple part with the Draft workbench (Must know), introduces another modeling technique available in FreeCAD. Many designs, even complex 3D objects, start out as 2D drawings. The Draft workbench provides tools for working with circles, arcs, lines, and other 2D elements.

Rotating and extruding to create parts (Should know), will show how 2D drawings can be turned into 3D models. Rotation and extrusion are two more tools that every FreeCAD user should know.

Creating 3D solids with Python (Become an expert), shows how to use Python to create custom 3D objects. Python is another powerful tool in your FreeCAD toolbox.

Creating a custom dialog to automate a task (Become an expert), will show you how to make your Python scripts easier to use by making a custom user interface. You can create a nice looking dialog box.

Modeling with constraints (Must know), covers one of the most powerful techniques available to the FreeCAD user. Need to change one aspect of your model without breaking the rest? Designing with constraints means building flexibility into the design. Now your designs can be easily adjusted with predictable results.

Using external constraints (Should know), will go beyond simple sketches by using some of the advanced sketching tools in FreeCAD. You can model additional features on the faces of existing objects and attach sketches to existing objects.

Adding or modifying constraints with Python (Become an expert), brings the power of Python to bear on constraint based modeling. You can dig deeper into the inner workings of sketch constraints with the Python scripting.

Creating a drawing of a part (Should know), teaches you to present your 3D design to the 2D world by creating a drawing that's ready for printing.

Exporting DXF files for other applications (Should know), will show you how to export your design to other applications using industry standard DXF files. The time will come when you need to do something with your project outside of FreeCAD and exporting is invaluable.

Importing data (Should know), will give you information on how to interact with designs made in other applications.

What you need for this book

FreeCAD is a standalone design tool. Once installed, nothing additional is needed to begin designing complex models. If you want to compile the latest version of FreeCAD, open source tools are available on the Internet, including the Git version control system necessary for downloading the source code.

Who this book is for

Written specifically for new users of CAD software with little or no experience, this book will also help users of other CAD applications get familiar with FreeCAD's unique concepts quickly.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Notice how it gives you a helpful tip on the makeBox class."

A block of code is set as follows:

import FreeCAD
import Part

App.ActiveDocument.addObject("Part::Box","Box")
FreeCAD.getDocument("Unnamed").getObject("Box").Width = 20.00

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

QtCore.QObject.connect \
(self.okButton, QtCore.SIGNAL("pressed()"),self.box)

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Select the wire and click on the Upgrade button to convert it to a face."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.