k8ik-stm/Mechanical/extract_magnets.py

9 lines
244 B
Python

import FreeCAD
doc = FreeCAD.open("STM-Frame.FCStd")
magnets = doc.findObjects(Label="Magnet.*")
for m in magnets:
if m.TypeId != "App::Link":
continue
pos = m.Placement.Base
print(f"{pos.x:.5f}, {pos.y:.5f}, {pos.z:.5f}")