[KiCad 8] We no longer need to update local coordinates

This commit is contained in:
Salvador E. Tropea 2023-04-11 11:26:38 -03:00
parent 976e6af932
commit a9b91262ad
3 changed files with 11 additions and 2 deletions

View File

@ -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.

View File

@ -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()

View File

@ -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]