def walk_components(board, export):
module = board.GetModules()
while True:
if not module:
return
# Top is for Eagle boards imported to KiCAD
if str(module.GetLayerName()) not in ["Top", "F.Cu"]:
module = module.Next()
continue
lib = str(module.GetFPID().GetLibNickname()).strip()
try:
name = str(module.GetFPID().GetFootprintName()).strip()
except AttributeError:
# it seems we are working on Kicad >4.0.6, which has a changed method name
name = str(module.GetFPID().GetLibItemName()).strip()
value = unicode(module.GetValue()).strip()
ref = unicode(module.GetReference()).strip()
center = module.GetCenter()
orient = math.radians(module.GetOrientation() / 10)
pos = (center.x, center.y, orient)
export(lib, name, value, ref, pos)
module = module.Next()
评论列表
文章目录