Skip to content
Jeremy Wright edited this page Feb 9, 2015 · 38 revisions

The CadQuery Module for FreeCAD

This module for FreeCAD is the fastest and easiest way to get started with CadQuery.

If you're a user, please read on below to get started. If you're a developer, you might want to have a look at the Developer Documentation.

Contents

Requires FreeCAD 0.14 or newer

Click the Download ZIP button for this project, extract the zip file, and copy the CadQuery directory to FreeCAD's Mod directory on your system. The module is implemented completely in Python so it should just work the next time you start FreeCAD. Some typical Mod directory locations are as follows.

Linux

  • /usr/lib/freecad/Mod
  • /usr/local/lib/freecad/Mod

Windows

  • C:\Program Files\FreeCAD 0.14\Mod
  • C:\Program Files (x86)\FreeCAD 0.14\Mod

Mac

  • /Applications/FreeCAD.app/Contents/Mod
  • /Applications/FreeCAD.app/Mod

Once you have installed the module and started FreeCAD, you should see a CadQuery entry in the Workbenches pull down list.

Once you have selected the CadQuery workbench, a CadQuery menu will appear in the menu bar.

The menu items are as follows, and many of the items have associated shortcut keys listed.

  • New Script (Alt+N) - Starts a new CadQuery script, using a template to help get you started.
  • Open Script (Alt+O) - Allows you to open a CadQuery script that was previously created.
  • Save Script (Alt+S) - Saves the current CadQuery script to disk. Presents you with a Save-As dialog if this is the first time saving the file.
  • Save Script As - Allows you to save a copy of your script with a different name.
  • Close Script - Closes the current CadQuery script and removes it from the code and 3D views.
  • Examples (sub-menu) - Holds a list of all the CadQuery examples that are bundled with this module. They're a great tool for learning CadQuery.
  • Execute Script (F2) - Takes the code in your script and executes it to generate geometry in the 3D view.
  • Clear Output - Clears all output from the Report View. This comes in handy during a heavy script debugging session.

There are three main sections to the CadQuery workbench.

  1. CadQuery Code View - This is the full-featured editor where you enter your CadQuery code to be executed. It has features such as auto-complete, syntax highlighting and checking, line numbers, and code folding. This is all thanks to the PyQode project.
  2. 3D View - This is the standard FreeCAD 3D view. It displays the geometry generated by the script in the CadQuery Code View when the script is executed.
  3. Report View - This is also the standard FreeCAD report view, but it is used to display output and errors from the script in the CadQuery Code View. If your script doesn't execute properly, this is the first place to look.

Now that you're familiar with the environment, you can start looking at examples. You can choose any of the included examples from the Examples sub-menu, and then press F2 or select the Execute Script menu item to execute the example. Complete documentation for CadQuery is available on the ParametricParts.com documentation page.

If you have any questions, please feel free to use the issue tracker on this project to ask.

You may get a No module named QtNetwork error on Ubuntu based systems when you select the module in FreeCAD. If you do, run the following command line from a terminal to fix this issue.

sudo apt-get install python-pyside.qtnetwork
Clone this wiki locally