Macro Solid Sweep

Description
This macro creates a solid by sweeping a 2D profile along a trajectory previously selected in the 3D view. The 2D elements can be created through the regular tools in FreeCAD's GUI.

It should be noted that the resulting solid will not be parametric. If you decide to change your profile or trajectory, you'll need to run the macro again.



Usage
Result: A Sweep object will be created in the Project tree.
 * 1) Create two 2D elements, one for the section and one for the trajectory, of the types listed below.
 * 2) Select, either in the Tree view or in the 3D view (The order is important!):
 * 3) The trajectory
 * 4) Then the profile
 * 5) Open the Macro manager
 * 6) Select the Solid Sweep macro
 * 7) Click

Supported 2D elements

 * Wires
 * [[Image:Sketcher_NewSketch.svg|24px]] Sketches
 * [[Image:Draft_BSpline.svg|24px]] Draft BSpline
 * 2D primitives from the Part → [[Image:Part_Primitives.svg|24px]] Create Primitives ... menu (circle, helix)

Tips

 * The section has to be a closed profile or the result will not be a solid.
 * The section does not need to be located on the trajectory, but it's preferable that it be normal (perpendicular) to the trajectory.
 * The trajectory can either be an open or closed profile (circle, or line and arc segments) but all elements need to be tangent or the resulting shape will be unexpected. For example, a trajectory with straight corners like a rectangle will not produce a solid.
 * If the solid gets twisted, edit the macro to change the isFrenet value to 0 (zero) and try again.
 * Setting the makeSolid variable to 0 (zero) in the macro will produce a set of surfaces with open ends.

Script
ToolBar Icon

Macro_Solid_Sweep.FCMacro

Credits
Thanks to Wmayer for his help in writing this script.

Two examples of uses can be found in this forum topic, along with download links to the FCStd files. Using a helix as trajectory, a solid sweep can be used to create a bolt thread.