Fixed KiCad 5 uses ZONE_CONTAINERS and not ZONES

Note: The previous commit included fixes for out_report
- Zones unfilled after output generation
- Pads unconditionally gained rpinted copper layers
This commit is contained in:
Salvador E. Tropea 2022-04-26 10:21:14 -03:00
parent 56030c5dc9
commit 9b18c5300a
3 changed files with 9 additions and 5 deletions

View File

@ -269,6 +269,10 @@ class GS(object):
def ki5(): def ki5():
return GS.kicad_version_n < KICAD_VERSION_5_99 return GS.kicad_version_n < KICAD_VERSION_5_99
@staticmethod
def zones():
return pcbnew.ZONES() if GS.ki6() else pcbnew.ZONE_CONTAINERS()
@staticmethod @staticmethod
def expand_text_variables(text, extra_vars=None): def expand_text_variables(text, extra_vars=None):
vars = GS.load_pro_variables() vars = GS.load_pro_variables()

View File

@ -8,8 +8,7 @@
import re import re
import os import os
import subprocess import subprocess
from pcbnew import (B_Cu, F_Cu, FromMM, IsCopperLayer, PLOT_CONTROLLER, PLOT_FORMAT_SVG, wxSize, F_Mask, B_Mask, ZONE_FILLER, from pcbnew import B_Cu, F_Cu, FromMM, IsCopperLayer, PLOT_CONTROLLER, PLOT_FORMAT_SVG, wxSize, F_Mask, B_Mask, ZONE_FILLER
ZONES)
from shutil import rmtree, which from shutil import rmtree, which
from tempfile import NamedTemporaryFile, mkdtemp from tempfile import NamedTemporaryFile, mkdtemp
from .svgutils.transform import fromstring, RectElement, fromfile from .svgutils.transform import fromstring, RectElement, fromfile
@ -521,7 +520,7 @@ class PCB_PrintOptions(VariantOptions):
moved = [] moved = []
removed = [] removed = []
vias = [] vias = []
zones = ZONES() zones = GS.zones()
wxSize(0, 0) wxSize(0, 0)
for m in GS.get_modules(): for m in GS.get_modules():
for gi in m.GraphicalItems(): for gi in m.GraphicalItems():
@ -584,7 +583,7 @@ class PCB_PrintOptions(VariantOptions):
moved = [] moved = []
removed = [] removed = []
vias = [] vias = []
zones = ZONES() zones = GS.zones()
wxSize(0, 0) wxSize(0, 0)
for m in GS.get_modules(): for m in GS.get_modules():
for gi in m.GraphicalItems(): for gi in m.GraphicalItems():

View File

@ -765,10 +765,11 @@ class ReportOptions(BaseOptions):
else: else:
continue continue
out_files = o.get_targets(o.expand_dirname(os.path.join(GS.out_dir, o.dir))) out_files = o.get_targets(o.expand_dirname(os.path.join(GS.out_dir, o.dir)))
is_pcb_print_svg = o.type == 'pcb_print' and o.options.format == 'SVG'
for n, of in enumerate(out_files): for n, of in enumerate(out_files):
rel_path = os.path.relpath(of, base_dir) rel_path = os.path.relpath(of, base_dir)
comment = o.comment comment = o.comment
if o.type == 'pcb_print' and o.options.pages[n].sheet: if is_pcb_print_svg and o.options.pages[n].sheet:
comment += ' '+o.options.pages[n].sheet comment += ' '+o.options.pages[n].sheet
dest.append((rel_path, comment, o.name)) dest.append((rel_path, comment, o.name))
self.layer_pdfs = len(self._layer_pdfs) > 0 self.layer_pdfs = len(self._layer_pdfs) > 0