diff --git a/kibot/__main__.py b/kibot/__main__.py index 81738b8c..27539d6a 100644 --- a/kibot/__main__.py +++ b/kibot/__main__.py @@ -208,6 +208,7 @@ def detect_kicad(): GS.ki8 = (GS.kicad_version_major == 7 and GS.kicad_version_minor >= 99) or GS.kicad_version_major >= 8 GS.footprint_gr_type = 'MGRAPHIC' if not GS.ki8 else 'PCB_SHAPE' GS.board_gr_type = 'DRAWSEGMENT' if GS.ki5 else 'PCB_SHAPE' + GS.footprint_update_local_coords = GS.dummy1 if GS.ki8 else GS.footprint_update_local_coords_ki7 logger.debug('Detected KiCad v{}.{}.{} ({} {})'.format(GS.kicad_version_major, GS.kicad_version_minor, GS.kicad_version_patch, GS.kicad_version, GS.kicad_version_n)) # Used to look for plug-ins. diff --git a/kibot/gs.py b/kibot/gs.py index 966b51cf..b96f60e1 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -364,6 +364,14 @@ class GS(object): def zone_get_first_layer(e): return e.GetFirstLayer() if GS.ki7 else e.GetLayer() + @staticmethod + def footprint_update_local_coords_ki7(fp): + fp.SetLocalCoord() # Update the local coordinates + + @staticmethod + def dummy1(fp): + """ KiCad 8 doesn't need footprint_update_local_coords """ + @staticmethod def expand_text_variables(text, extra_vars=None): vars = GS.load_pro_variables() diff --git a/kibot/out_base.py b/kibot/out_base.py index 470e8066..a6233fd1 100644 --- a/kibot/out_base.py +++ b/kibot/out_base.py @@ -288,14 +288,14 @@ class VariantOptions(BaseOptions): seg1.SetStart(GS.p2v_k7(wxPoint(rect.x1, rect.y1))) seg1.SetEnd(GS.p2v_k7(wxPoint(rect.x2, rect.y2))) seg1.SetLayer(layer) - seg1.SetLocalCoord() # Update the local coordinates + GS.footprint_update_local_coords(seg1) m.Add(seg1) seg2 = GS.create_module_element(m) seg2.SetWidth(120000) seg2.SetStart(GS.p2v_k7(wxPoint(rect.x1, rect.y2))) seg2.SetEnd(GS.p2v_k7(wxPoint(rect.x2, rect.y1))) seg2.SetLayer(layer) - seg2.SetLocalCoord() # Update the local coordinates + GS.footprint_update_local_coords(seg2) m.Add(seg2) return [seg1, seg2]