pcbdraw.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:PcbDraw 作者: yaqwsx 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号