Macro HealArcs

From FreeCAD Documentation
Jump to navigation Jump to search
Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎čeština

Macro HealArcs.png HealArcs

Description
Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf. Useful before exporting to dxf.

Macro version: 0.1
Last modified: 2011-09-24
FreeCAD version: All
Download: ToolBar Icon
Author
Yorik
Download
ToolBar Icon
Links
Macro Version
0.1
Date last modified
2011-09-24
FreeCAD Version(s)
All
Default shortcut
None
See also
None


Description

Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf

Script

ToolBar Icon Macro HealArcs.png

Macro_HealArcs.FCMacro

try:
    import DraftGeomUtils as fcgeo
except:
    from draftlibs import fcgeo
import FreeCAD,FreeCADGui,Part

sel = FreeCADGui.Selection.getSelection()
if not sel:
    FreeCAD.Console.PrintWarning("Select something first!")
else:
    removeList = []
    for obj in sel:
        ed = obj.Shape.Edges[0]
        arc = fcgeo.arcFromSpline(ed)
        if arc:
            Part.show(arc)
            removeList.append(obj.Name)
    FreeCAD.ActiveDocument.recompute()
    print "removing ",removeList
    for n in removeList:
        FreeCAD.ActiveDocument.removeObject(n)