Macro FlattenWire/ru

FlattenWire

Описание
This macro flattens draft wires that are not planar to their median Z coordinate

Макрос версии : 1.1
Дата последней модификации : 2021-10-27
FreeCAD версия : All
Скачать : ToolBar Icon
автор : Yorik
Автор
Yorik
Скачать
ToolBar Icon
Ссылки
Версия
1.1
Дата последней модификации
2021-10-27
Версии FreeCAD
All
Сочетание клавиш
None
Смотрите также
None

Description

This macro flattens draft wires that are not planar to their median Z coordinate.

Script

ToolBar Icon

Macro_FlattenWire.FCMacro

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: newpoints.append(FreeCAD.Vector(p.x, p.y, z))
obj.Points = newpoints