Added errors and warnings about KiCad 7 bugs

This commit is contained in:
Salvador E. Tropea 2023-03-16 07:19:59 -03:00
parent 6eb631d5bd
commit 2ebaea16ab
6 changed files with 32 additions and 11 deletions

View File

@ -183,14 +183,16 @@ def detect_kicad():
except ValueError:
pass
m = re.search(r'(\d+)\.(\d+)\.(\d+)', GS.kicad_version)
m = re.search(r'(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?', GS.kicad_version)
if m is None:
logger.error("Unable to detect KiCad version, got: `{}`".format(GS.kicad_version))
sys.exit(NO_PCBNEW_MODULE)
GS.kicad_version_major = int(m.group(1))
GS.kicad_version_minor = int(m.group(2))
GS.kicad_version_patch = int(m.group(3))
GS.kicad_version_n = GS.kicad_version_major*1000000+GS.kicad_version_minor*1000+GS.kicad_version_patch
GS.kicad_version_subpatch = 0 if m.group(4) is None else int(m.group(4))
GS.kicad_version_n = (GS.kicad_version_major*10000000+GS.kicad_version_minor*10000+GS.kicad_version_patch*10 +
GS.kicad_version_subpatch)
GS.ki5 = GS.kicad_version_major < 6
GS.ki6 = GS.kicad_version_major >= 6
GS.ki6_only = GS.kicad_version_major == 6

View File

@ -79,9 +79,11 @@ error_level_to_name = ['NONE',
KICOST_SUBMODULE = '../submodules/KiCost/src/kicost'
EXAMPLE_CFG = 'example_template.kibot.yaml'
AUTO_SCALE = 0
KICAD_VERSION_5_99 = 5099000
KICAD_VERSION_6_0_0 = 6000000
KICAD_VERSION_6_0_2 = 6000002
KICAD_VERSION_5_99 = 50990000
KICAD_VERSION_6_0_0 = 60000000
KICAD_VERSION_6_0_2 = 60000020
KICAD_VERSION_7_0_1 = 70000010
KICAD_VERSION_7_0_1_1 = 70000011
TRY_INSTALL_CHECK = 'Try running the installation checker: kibot-check'
# Internal filter names
@ -264,6 +266,7 @@ W_MICROVIAS = '(W117) '
W_BLINDVIAS = '(W118) '
W_LIBTVERSION = '(W119) '
W_LIBTUNK = '(W120) '
W_DRC7BUG = '(W121) '
# Somehow arbitrary, the colors are real, but can be different
PCB_MAT_COLORS = {'fr1': "937042", 'fr2': "949d70", 'fr3': "adacb4", 'fr4': "332B16", 'fr5': "6cc290"}
PCB_FINISH_COLORS = {'hal': "8b898c", 'hasl': "8b898c", 'imag': "8b898c", 'enig': "cfb96e", 'enepig': "cfb96e",

View File

@ -14,7 +14,7 @@ from .out_base import BaseOutput, VariantOptions
from .error import PlotError, KiPlotConfigurationError
from .layer import Layer
from .gs import GS
from .misc import W_NOLAYER
from .misc import W_NOLAYER, KICAD_VERSION_7_0_1, MISSING_TOOL
from .macros import macros, document # noqa: F401
from . import log
@ -49,7 +49,7 @@ class AnyLayerOptions(VariantOptions):
self.exclude_pads_from_silkscreen = False
""" Do not plot the component pads in the silk screen (KiCad 5.x only) """
self.plot_sheet_reference = False
""" *Include the frame and title block. Only available for KiCad 6 and you get a poor result
""" *Include the frame and title block. Only available for KiCad 6+ and you get a poor result
(i.e. always the default worksheet style, also problems expanding text variables).
The `pcb_print` output can do a better job for PDF, SVG, PS, EPS and PNG outputs """
self.plot_footprint_refs = True
@ -137,6 +137,10 @@ class AnyLayerOptions(VariantOptions):
def run(self, output_dir, layers):
super().run(output_dir)
if GS.ki7 and GS.kicad_version_n < KICAD_VERSION_7_0_1 and not self.exclude_edge_layer:
logger.error("Plotting the edge layer is not supported by KiCad 7.0.0\n"
"Please upgrade KiCad to 7.0.1 or newer")
exit(MISSING_TOOL)
# Apply the variants and filters
exclude = self.filter_pcb_components()
# fresh plot controller

View File

@ -6,7 +6,7 @@
import os
from .pre_base import BasePreFlight
from .gs import GS
from .misc import PDF_PCB_PRINT
from .misc import PDF_PCB_PRINT, KICAD_VERSION_7_0_1, MISSING_TOOL
from .out_base import VariantOptions
from .macros import macros, document, output_class # noqa: F401
from .drill_marks import add_drill_marks, DRILL_MARKS_MAP
@ -69,6 +69,10 @@ class Any_PCB_PrintOptions(VariantOptions):
def run(self, output, svg=False):
super().run(self._layers)
if GS.ki7 and GS.kicad_version_n < KICAD_VERSION_7_0_1 and self.scaling != 0 and self.scaling != 1.0:
logger.error("Scaled printing is broken in KiCad 7.0.0\n"
"Please upgrade KiCad to 7.0.1 or newer")
exit(MISSING_TOOL)
command = self.ensure_tool('KiAuto')
# Output file name
cmd = [command, 'export', '--output_name', output]

View File

@ -17,7 +17,7 @@ from .gs import GS
from .optionable import Optionable
from .kicad.config import KiConf
from .kiplot import load_board
from .misc import DRC_ERROR
from .misc import DRC_ERROR, KICAD_VERSION_7_0_1_1, W_DRC7BUG
from .log import get_logger
logger = get_logger(__name__)
@ -27,7 +27,7 @@ logger = get_logger(__name__)
class Run_DRC(BasePreFlight): # noqa: F821
""" [boolean=false] Runs the DRC (Distance Rules Check). To ensure we have a valid PCB.
The report file name is controlled by the global output pattern (%i=drc %x=txt).
Note that the KiCad 6 *Test for parity between PCB and schematic* option is not supported.
Note that the KiCad 6+ *Test for parity between PCB and schematic* option is not supported.
If you need to check the parity use the `update_xml` preflight.
KiCad 6 introduced `warnings` they are currently counted be the `unconnected` counter of KiBot.
This will change in the future """
@ -55,6 +55,10 @@ class Run_DRC(BasePreFlight): # noqa: F821
if GS.ki7:
# KiCad 7 can do some library parity checks, but we need to be sure that the KICAD7* vars are defined
KiConf.init(GS.pcb_file)
if GS.kicad_version_n < KICAD_VERSION_7_0_1_1:
logger.warning(W_DRC7BUG+"KiCad 7.0.0/1 fails to load the global footprints table. "
"You may get a lot of `lib_footprint_issues` reports. "
"Try enabling the global `drc_exclusions_workaround` option.")
output = self.get_targets()[0]
os.makedirs(os.path.dirname(output), exist_ok=True)
logger.debug('DRC report: '+output)

View File

@ -17,7 +17,7 @@ from .macros import macros, document, pre_class # noqa: F401
from .error import KiPlotConfigurationError
from .gs import GS
from .kiplot import load_board
from .misc import BOM_ERROR, NETLIST_DIFF, W_PARITY, MISSING_TOOL
from .misc import BOM_ERROR, NETLIST_DIFF, W_PARITY, MISSING_TOOL, KICAD_VERSION_7_0_1
from .log import get_logger
from .optionable import Optionable
import pcbnew
@ -121,6 +121,10 @@ class Update_XML(BasePreFlight): # noqa: F821
if GS.ki5:
logger.error('PCB vs schematic parity only available for KiCad 6')
exit(MISSING_TOOL)
if GS.ki7 and GS.kicad_version_n < KICAD_VERSION_7_0_1:
logger.error("Connectivity API is broken on KiCad 7.0.0\n"
"Please upgrade KiCad to 7.0.1 or newer")
exit(MISSING_TOOL)
fname = GS.sch_no_ext+'.xml'
logger.debug('Loading XML: '+fname)
try: