Tuesday, September 24, 2013

How to test the assembly module [updated]

While assembly tools are not available in the official packages, you can compile FreeCAD yourself  with the assembly module enabled.
Note: the module is unfinished, unstable and buggy. 

Instructions are similar to those provided in the older post. Alternatively you can use the dubstar-04's script.

Update 30.06.2014: This post is outdated now, the assembly module looks different, and there is no jriegel/dev-assembly branch anymore. As stated here:
* jriegel/dev-assembly-old is the old data model with the working solver of ickby and the new PartDesign of jreinlaender
* jriegel/dev-assembly2 is the new data model with the solver temporarelly switched of. Also this branch is at the moment not usably.....

Update: There is more up-to-date GitHub repository

Clone sources:

git clone

Change the directory and checkout the "assembly" branch:

cd FreeCAD_constraint
git checkout assembly

Repeat the normal steps:

mkdir Build && cd Build
cmake - DCMAKE_BUILD_TYPE=Debug ../
make -j8

Additional informations in that forum thread.

Old post:
Install development packages listed on the FreeCAD wiki. Then you can clone the sources from GitHub:

git clone git:// free-cad-code

Change the directory:

cd free-cad-code/

Now you can list available remote branches:

git branch -r
  origin/HEAD -> origin/master

Switch to the "jriegel/dev-assembly" branch:

git checkout jriegel/dev-assembly

Create a new directory for a build:

mkdir Build && cd Build

Run cmake and enable debug build (FreeCAD may be a little slower but easier for debugging):

cmake - DCMAKE_BUILD_TYPE=Debug ../

Compile, the number should be equivalent to the number of threads in your CPU:

make -j8

Run FreeCAD:


Example 1: an assembly created from external STEP files.

You have to download four STEP files:
All parts (piston, conrod, pin and pinring) was created in FreeCAD and then exported to the STEP files.

Open the Assembly module and create a new file. Double click on the Product in the Tree view to activate it. If the Product does not exist, you can create one choosing Add a new Component.
Next we have to add an part from an external file. Select Add a existing Component or File to the active Assembly and choose the piston.stp file.

Select a surface on the piston and use the Fix a part in its rotation and translation constraint. The piston cannot move now. Notice the new constraint in the Tree view.

In a exactly same way add the pin.stp file. You need two constraints between piston and pin.

Select a side face of pin and a corresponding face of piston (inside pin ring groove) using [Ctrl]. Then use the Align the selected entities constraint.
You have three options:
  • Equal - both faces normal vectors are equal,
  • Opposite - vectors are opposite,
  • Parallel - vectors are equal or opposite. 
In our case please select Equal.

In the next step select cylinder surfaces on pin and inside piston. Use the Make the selected entities coincident (Equal).

Please add conrod.stp selecting Add a existing Component or File to the active Assembly. As in earlier pair use the Align the selected entities (but this time select "Opposite) and the Make the selected entities coincident.

The conrod can be rotated in a specified angle relative to piston. To set the angle select the bottom conrod face.

Then, holding [Ctrl] key, select the top piston face and use the Set the angle between two selected entities. The angle will be 160.

Finally you have to insert pin rings. The procedure is similar to pin adding. You need an align constraint.

And a coincident constraint.

Repeat the procedure for the second pin ring.

Download file.

Download RAW Video. (Right click to save as...)

Example 2: an assembly created from the Part Design-created files.

In this example we will create an assembly containing fully parametric, Part Design parts. They will be created during assembly designing process - there is no graphical import tool for files containing feature tree yet.

Open the Assembly workbench and activate the Product object (double click in the Tree view). Add two new parts using Add a new Part into the active Assembly.

Add two new parts using Add a new Part into the active Assembly.

Expand the first part (click on the small triangle in the tree) and activate the Body. An active workbench should be changed to Part Design automatically. The Body is a container for all features.  

Select the XY plane and create a new sketch. Important: in the current implementation first sketch have to lie on XY. Subsequent sketches can be placed on other planes.

Draw a rectangle, constrain it and close the sketch.

Pad the sketch.

Select a face on the cuboid and place a second sketch.

Sketch a circle.

Use the Pocket tool to create an hole.

You finished the first part, let's try create another one. Expand Part001 and double click on the Body001 to activate it.

As before, select the XY plane and sketch a rectangle.

Revolve the rectangle on horizontal axis to create a cylinder.

You have two parts: a box with a hole and a cylinder. Try place the cylinder in the hole. Double click on the Product in the tree to activate. The Assembly workbench should be active now.

Select a surface on the box and use the Fix a part in its rotation and translation constraint.
Select cylinder surfaces on the both parts with [Ctrl] and use the Make the selected entities coincident (Parallel) tool.

Next use planar surfaces to align parts.

What if you want change something? Try translate the hole position. Activate the Body and then the Sketch001 inside the Pocket feature.

Edit the circle position and close the sketch.

Note: editing works fine only for features placed on the XY plane at this moment. This is a known issue.

Download file, download video.

More information

Assemebly Basic Tutorial - FreeCAD wiki
PartDesign Bearingholder Tutorial I (very useful!)
PartDesign Bearingholder Tutorial II

Used FreeCAD version:

Version: 0.14.2654 (Git)
Branch: jriegel/dev-assembly
Hash: 3d4dd4f64f24255dbaec25767cff7b74bb98fc6d

Trivia: today examples was created on fully open machine (except x86 microcode and some firmware;) - FreeCAD on Ubuntu x86-64 with R600g graphics driver.