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.

Tuesday, April 30, 2013

How to run FreeCAD with the new drawing workbench

Luke Parry is working hard on the new Drawing module. Finally, parametric dimensioning tools has arrived!

If you want test (still in very early development) the workbench, you have to compile FreeCAD yourself. You can find a short how-to below (based on Luke's tips).

First of all, you need tools and development packages listed on the FreeCAD wiki.
Then you can clone the sources from github:

git clone

Next go to the downloaded directory:

cd FreeCAD_sf_master/

Switch to the "drawing" branch:

git checkout drawing

Create a new directory for a build (not necessary but recommended):

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

An finally run FreeCAD:


Open or create a solid part. Switch to the drawing workbench and create a new page.

Double click (in tree) to open the page view.

Select a solid from the tree and create a new view. Views (dimensions too) dragging using mouse is now possible - as opposition to the old drawing workbench.

Select an edge and add a new dimension. Tip: enable the Selection view in the View menu to see what is selected.

In the Data tab you can change the radius to a diameter.

Add some other dimensions: line length, distance between points (use Ctrl to select two points), radius and diameter are available.

Back to the 3D model and change something.

The drawing should change as well.

Any good ideas? Share your opinion!

Wednesday, February 13, 2013

FreeCAD 0.13 stable released

Great news, FreeCAD 0.13 stable has been released! There are many improvements in Sketcher, Part Design and and Arch modules. New modules Ship and OpenSCAD have been introduced. Check release notes for more information.


Windows users: download a MSI file or download and extract a 7z file from this location.

Ubuntu users: add a PPA repository. You can do it using a simple command:
sudo add-apt-repository ppa:freecad-maintainers/freecad-stable
And then:
sudo apt-get update  
sudo apt-get install freecad 

If you are using a different operating system check additional installation notes.

Sunday, January 6, 2013

Engine: 11 - conrod and Z88 FEM

An year ago I posted a (part of) engine conrod example. In past I used Part Loft feature. Finally, I think the conrod should be created in a other way. I am going to describe modelling using the latest Part Design features. In the further part of text, the conrod will be calculated with a FEM software (freeware Z88 Aurora).

Let's begin in the Part Design workbench. The conrod is a symmetric part, so it can be modelled as a half and mirrored by the XY plane. Please sketch the bottom part on the XY plane.   

Pad the Sketch, then select a face as the below picture.

Sketch the middle part. Use the external constraints to place it precisely.

Pad the sketch as in the below image. You probably should select the reverse direction.

In the similar way select a plane and start sketching the top part of the conrod.

Then pad the sketch.

You have to create holes for a crankshaft and a piston pin. You can to this sketching circles on selected faces and using the pocket feature.

Use the Through all option.

In the same way remove material from the middle of the conrod. But this time the pocket feature should be driven by the Dimension option.

The latest FreeCAD introduces the draft feature. The draft is useful for cast and forged parts. Select all side faces with [Ctrl] key. Then activate the draft feature.

In the task view you can see two important text fields: Neutral plane and Pull direction. Activate the Neutral plane field and select the back (parallel to XY) face.

For the Pull direction you should select an edge. The edge should be normal to neutral plane, and in our case parallel to Z axis. At the end increase the Draft angle.

The below image shows the draft feature effects.

In the next step create a draft feature for the pocket in the middle part.

The neutral plane:

And the pull direction edge:

You should also check the Reverse pull direction checkbox.

Optionally round (fillet) some edges. Round works also for edges tangent to the selected edge. Plan a filleting sequence carefully.

There are missing holes for bolts. Select the bottom face for sketching.

If there is not enough material for holes, you can return to the first pad and resize the sketch.

Create a second hole using the Part Design mirror feature. The mirror plane is YZ.

Now you need some Part workbench tools. Use the Part mirror to create mirrored (to the XY plane) solid. I explained Part and Part Design differences in an older post.

Fuse both solids using the boolean union tool.

The final shape looks pretty nice, doesn't it?

FEM analysis

Z88 Aurora is a multiplatform, freeware finite element method tools. You can download Z88 for Windows, OS X or Linux from this page. Only 64-bit Linux distributions are supported.

First of all you need an simplified model. Small fillets are very problematic for FEA meshers. I disabled the final solid and created a new fusion repeating last two steps (Part mirror and then fusion) for latest pre-filleted feature (Draft001).
Select a solid and export it as a STEP file.

In the Z88 you should use the Linear mechanical analysis. Start a new project creating a new directory.

Import the STEP file.

The 3 shape can be rotated using RMB. You have 3 visibility presets: Shaded, Surface Mesh, Mesh and Picking.

Most of FEM tools is divided to three parts:
  • pre-processor - create a mesh, add constraints,
  • solver - calculate displacements and stresses,
  • post-processor - display results.
Open the pre-processor (tetrahedrons) tab to create a mesh. I selected linear tetrahedrons, difference between linear and quadratic tetrahedrons explains Z88 manual:
Tetrahedron No. 17
- Linear shape functions
- Quality of displacements bad
- Stresses in the Gauss points inaccurate
- Stresses in corner nodes very inaccurate
- Computing effort: medium
- Size of element stiffness matrix: 12  12

Tetrahedron No. 16
- Quadratic Isoparametric Serendipity element
- Quality of displacements very good
- Stresses in the Gauss points very good
- Stresses in corner nodes good
- Computing effort: very high
- Size of element stiffness matrix: 30  30
Next I clicked Add to add a rule and Create to create a mesh. Then click Mesh info to test if the mesh is computable.

In the next step you have to check surfaces for constraints. Select a node with [Ctrl] and the click Surface and Add set. You can change name for the created set. The Angle parameter can change selected area (check the Z88 manual for more information).

Create a second set for the pin hole.

Upper nodes are unnecessary, you can deselect them with [Shift] and rectangle selection.

Next add constraints. For the bearing set X, Y and Z displacements to 0. Then add a new constraint.

For the pin set projected surface load to -28000 along Y direction. The difference between projected surface load and surface load explains on of the Z88 tutorials.
Note: exported STEP is in [mm]. Internal material Z88 library uses [mm] and [N]. So, surface load is in [N] and stresses will be in [MPa] ([N]/[mm^2]).

Open the Material database tab and define a material.

Finally, you can run one of the 4 solvers. Check Z88 manual for more information. I used SICCG.

After successful calculation open the post-processor and check result.

You can use a clipping plane to see internal points.

FreeCAD 1 file.
FreeCAD 2 file.
Z88 project.

Used in the tutorial:FreeCAD 0.13.1806 (Git)
Z88 Aurora 2