Saturday, October 1, 2011

Engine: 5 - camshaft gear

Timing wheel (camshaft gear) which works with toothed belt is quite simple part. However it needs radial pattern tool - I will use short python script.

Open a new sketch in Part Design workbench. First of all sketch a trapezoid on the plane XY. Use dimensions as in the picture. Trapezoid should be connected with point (0,0) by two construction (blue, length = 47) lines.

Pad the sketch. The pad should be 30. You can add fillets to edges.

Make a new sketch on the plane YZ. Draw a wheel section.

Dimension and constraints are shown above.

Revolve the sketch around Z axis (Data tab in Property view). Next hide the revolution by selecting it and pressing [Space].

Use a python script

FreeCAD has a python console (at the bottom). Select Pad in Tree view and copy this script to python console:

teeth= 36
sel = FreeCADGui.Selection.getSelection()
sel = sel[0]
name = sel.Name
shape = sel.Shape
for i in range(1,
     newshape = sel.Shape.copy()
     newshape.Placement=App.Placement(App.Vector(0,0,0),App.Vector(0,0,1),       (i*(float(360)/float(
     newobject = FreeCAD.ActiveDocument.addObject("Part::Feature",name)
     newobject.Shape = newshape

35 new pads should appear as in the image above. You made radial pattern!

Short explanation:
teeth= 36 number of pads

sel = FreeCADGui.Selection.getSelection()
sel = sel[0]
name = sel.Name
shape = sel.Shape
get information from part selected in Tree view

for i in range(1,teeth): loop from 1 to 35 (python count from 0)

newshape = sel.Shape.copy() make a copy

newshape.Placement=App.Placement(App.Vector(0,0,0),App.Vector(0,0,1),       (i*(float(360)/float(teeth)))) move the copy, syntax App.Placement(Base, Axis, Angle in deg)

Open Part workbench and select all pads (or fillets if made they) in Tree View - use [Shift] and click first and last. You can deselect revolve with [Ctrl]. Now make a fusion (two blue balls icon) of the all pads. Unhide [Space] the revolution.
Select with [Ctrl] revolution and fusion and do cut of them (icon with blue and white ball).

Now we have a crankshaft gear.

You can also open Part Design and add some fillets and chamfers.

More info:
Download file.

Download RAW Video.

FreeCAD 0.12 4983 SVN


  1. Normand ChamberlandOctober 1, 2011 at 9:26 PM


    When I change the revolution axis from the default Y to Z axis, nothing happens, the shape does not recompute. How do you do it? I'm on the latest FreeCAD PPA version.

  2. It's a bug. I forgot submit it to Mantis.
    As workaround change revolution angle (eg. for 359 and back to 360).

  3. Normand ChamberlandOctober 1, 2011 at 10:08 PM

    Thanks, I should have checked back your blog sooner. I managed to discover this workaround by myself a few minutes ago. I posted a topic on the FreeCAD forum:

  4. Normand ChamberlandOctober 1, 2011 at 10:14 PM

    When I pasted the script into the console and hit enter, nothing happened. I had to save the script as a text file and run it through the Macros toolbar.

  5. You have to hit enter 2 times:) Python interpreter needs two enters when you use a loop.

  6. Fine tutorial but only when using along with the video bellow.

  7. Fine tutorial but I have success only when using it along with the provided video bellow.

  8. Hiya! How do you think, have your writting skills improved lately?

  9. Im good until the cut operation. I get a garbage looking gear with pieces missing.