Macro FlattenWire/sv

Platta ut tråd
Detta makro plattar ut ritlinjer som inte är parallella (i Z-axeln) till deras median Z koordinat.

import FreeCAD obj = FreeCAD.ActiveDocument.ActiveObject z = 0 for p in obj.Points: z += p.z z = z/len(obj.Points) newpoints = [] for p in obj.Points: newppoints.append(FreeCAD.Vector(p.x,p.y,z)) obj.Points = newppoints