Macro FlattenWire: Difference between revisions
m (date) |
m (DATE ISO 8601 YYYY-MM-DD) |
||
Line 1: | Line 1: | ||
<translate> |
<translate> |
||
<!--T:1--> |
<!--T:1--> |
||
{{Macro|Icon=Text-x-python|Name=FlattenWire|Description=This macro flattens draft wires that are not plane to their median Z coordinate|Author=Yorik|Version=1.0|Date= |
{{Macro|Icon=Text-x-python|Name=FlattenWire|Description=This macro flattens draft wires that are not plane to their median Z coordinate|Author=Yorik|Version=1.0|Date=2011-08-01}} |
||
<!--T:2--> |
<!--T:2--> |
Revision as of 13:39, 30 September 2017
File:Text-x-python FlattenWire |
Description |
---|
This macro flattens draft wires that are not plane to their median Z coordinate Macro version: 1.0 Last modified: 2011-08-01 Author: Yorik |
Author |
Yorik |
Download |
None |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
1.0 |
Date last modified |
2011-08-01 |
FreeCAD Version(s) |
None |
Default shortcut |
None |
See also |
None |
This macro flattens draft wires that are not plane to their median Z coordinate
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