Description |
---|
Creates a solid by sweeping a profile from a trajectory. Macro version: 1.0 Last modified: 2011-12-03 FreeCAD version: All Download: ToolBar Icon Author: Normandc |
Author |
Normandc |
Download |
ToolBar Icon |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
1.0 |
Date last modified |
2011-12-03 |
FreeCAD Version(s) |
All |
Default shortcut |
None |
See also |
None |
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.
Result: A Sweep object will be created in the Project tree.
Macro_Solid_Sweep.FCMacro
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() try: shape1=s[0].Shape shape2=s[1].Shape except: print "Wrong selection" traj = Part.Wire([shape1]) section = Part.Wire([shape2]) # create Part objec in the current document myObject=App.ActiveDocument.addObject("Part::Feature","Sweep") # variable makeSolid = 1 to create solid, 0 to create surfaces makeSolid = True #1 isFrenet = True #1 # create a 3D shape and assigh it to the current document Sweep = Part.Wire(traj).makePipeShell([section],makeSolid,isFrenet) myObject.Shape = Sweep
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.