diff --git a/CHANGELOG.md b/CHANGELOG.md index 94e392de..9d3d8bc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Problems to detect the schematic name when the path to the config contained a dot that isn't used for an extension and some particular conditions were met. +- PCB Print: KiCad crashing on some complex filled zones (#396) ## [1.6.0] - 2023-02-06 ### Added diff --git a/kibot/gs.py b/kibot/gs.py index d267dea8..555ddf53 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -583,6 +583,13 @@ class GS(object): s.SetWidth(width) return bbox + @staticmethod + def fill_zones(board, zones=None): + if zones is None: + zones = board.Zones() + pcbnew.ZONE_FILLER(board).Fill(zones) + board.BuildConnectivity() + @staticmethod def get_kiauto_video_name(cmd): """ Compute the name for the video captured by KiAuto """ diff --git a/kibot/kiplot.py b/kibot/kiplot.py index 5a419bf0..b7bd61a0 100644 --- a/kibot/kiplot.py +++ b/kibot/kiplot.py @@ -215,7 +215,7 @@ def load_board(pcb_file=None, forced=False): with hide_stderr(): board = pcbnew.LoadBoard(pcb_file) if BasePreFlight.get_option('check_zone_fills'): - pcbnew.ZONE_FILLER(board).Fill(board.Zones()) + GS.fill_zones(board) if GS.global_units and GS.ki6: # In KiCad 6 "dimensions" has units. # The default value is DIM_UNITS_MODE_AUTOMATIC. diff --git a/kibot/out_pcb_print.py b/kibot/out_pcb_print.py index dd2e834f..af11d3f2 100644 --- a/kibot/out_pcb_print.py +++ b/kibot/out_pcb_print.py @@ -33,7 +33,7 @@ import re import os import subprocess import importlib -from pcbnew import B_Cu, F_Cu, FromMM, IsCopperLayer, PLOT_CONTROLLER, PLOT_FORMAT_SVG, F_Mask, B_Mask, ZONE_FILLER +from pcbnew import B_Cu, F_Cu, FromMM, IsCopperLayer, PLOT_CONTROLLER, PLOT_FORMAT_SVG, F_Mask, B_Mask import shlex from shutil import rmtree from tempfile import NamedTemporaryFile, mkdtemp @@ -614,7 +614,7 @@ class PCB_PrintOptions(VariantOptions): via.SetDrill(drill) via.SetWidth(width) if len(zones): - ZONE_FILLER(GS.board).Fill(zones) + GS.fill_zones(GS.board, zones) # Add it to the list filelist.append((pc.GetPlotFileName(), self.pad_color)) @@ -704,7 +704,7 @@ class PCB_PrintOptions(VariantOptions): via.SetTopLayer(top) via.SetBottomLayer(bottom) if len(zones): - ZONE_FILLER(GS.board).Fill(zones) + GS.fill_zones(GS.board, zones) # Add it to the list filelist.append((pc.GetPlotFileName(), via_c))