Saturday, December 3, 2011

Engine: 9 - poly-v belt

In modern cars, engine equipment like alternator or air-conditioning compressor is driven by a poly-v belt. How create such belt model in FreeCAD? You have to create a section sweep along a trajectory.

Create a new closed sketch on the XY plane. You will use it as poly-v belt section. I've fixed corner point to (0,0) but in real application x=0 should be somewhere around half of the v-groove height. Close the sketch (Sketch).

Next create a trajectory. You have to draw it on the YZ plane. Trajecory for the v-belt should be closed but for other purposes it can be open. Set vertical line to x=0 and close the sketch (Sketch001).

Sketches should be perpendicular to each other (picture above). Now you need a python script. I've borrowed one from this forum topic.

import Part, FreeCAD, math, PartGui, FreeCADGui
from FreeCAD import Base

# get the selected objects, with first selection for the trajectory and second for the section
s = FreeCADGui.Selection.getSelection()
     print "Wrong selection"

traj = Part.Wire([shape1])
section = Part.Wire([shape2])

# create Part objec in the current document

# variable makeSolid = 1 to create solid, 0 to create surfaces
makeSolid = 1
isFrenet = 1

# create a 3D shape and assigh it to the current document
Sweep = Part.Wire(traj).makePipeShell([section],makeSolid,isFrenet)
myObject.Shape = Sweep

Save it as a macro (post about macros). Select the trajectory sketch (Sketch001) and then with [Ctrl] the section sketch (Sketch). After that execute the macro.

In the picture above you can see the effect. The sweep isn't parametric (a sketch change doesn't affect to the sweep) but script can be easily modified:)

Download file.

Download RAW Video.

FreeCAD 0.12 5211 SVN


  1. So that's what it was! I hadn't realized it was a belt when you posted your pic in the forum. :)

    By the way, I added an English page for this script in the FreeCAD wiki (Macro Recipes):

    I got help from Werner for this script, as I'm still a total Python n00b. If you modify it to be parametric, I'd be very interested. Even if I think a sweep feature will be added to the Part Design workbench (maybe for 0.13?), a parametric script would still be useful in the meantime. :)

  2. I can't make it work, does it have been updated?

  3. In current FreeCAD you don't need Python scripting any more. Just use Part->Sweep tool.