Code: Select all
import FreeCAD as App
def name(Sketch):
return Sketch.Name
Sketches = Gui.Selection.getCompleteSelection()
Sketches.sort(key=name)
App.activeDocument().Body.newObject("PartDesign::AdditiveLoft","AdditiveLoft")
Loft = App.ActiveDocument.Objects[-1]
Loft.Profile = [Sketches.pop(0),[]]
Loft.Sections = Sketches
App.ActiveDocument.recompute()
1. Create some sketches, containing regular sections for an AdditiveLoft.
2. Select all these sketches in the model tree.
3. Start the macro.
An AdditiveLoft using the sketches will be generated.
The order of the sketches is the same as in the model tree.
The macro will save much time if you have many (automatic generated) sketches.
Attention: The macro does not check anything. Please select only sketches (no other elements) containing regalar sections.