[PCB Print][Fixed] KiCad crashing on some complex filled zones

- We must rebuild the conectivity data after a zone fill

Fixes #396
This commit is contained in:
Salvador E. Tropea 2023-02-27 10:27:58 -03:00
parent 09f845240a
commit 6fd97254ad
4 changed files with 12 additions and 4 deletions

View File

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Problems to detect the schematic name when the path to the config contained a - 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. 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 ## [1.6.0] - 2023-02-06
### Added ### Added

View File

@ -583,6 +583,13 @@ class GS(object):
s.SetWidth(width) s.SetWidth(width)
return bbox 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 @staticmethod
def get_kiauto_video_name(cmd): def get_kiauto_video_name(cmd):
""" Compute the name for the video captured by KiAuto """ """ Compute the name for the video captured by KiAuto """

View File

@ -215,7 +215,7 @@ def load_board(pcb_file=None, forced=False):
with hide_stderr(): with hide_stderr():
board = pcbnew.LoadBoard(pcb_file) board = pcbnew.LoadBoard(pcb_file)
if BasePreFlight.get_option('check_zone_fills'): 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: if GS.global_units and GS.ki6:
# In KiCad 6 "dimensions" has units. # In KiCad 6 "dimensions" has units.
# The default value is DIM_UNITS_MODE_AUTOMATIC. # The default value is DIM_UNITS_MODE_AUTOMATIC.

View File

@ -33,7 +33,7 @@ import re
import os import os
import subprocess import subprocess
import importlib 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 import shlex
from shutil import rmtree from shutil import rmtree
from tempfile import NamedTemporaryFile, mkdtemp from tempfile import NamedTemporaryFile, mkdtemp
@ -614,7 +614,7 @@ class PCB_PrintOptions(VariantOptions):
via.SetDrill(drill) via.SetDrill(drill)
via.SetWidth(width) via.SetWidth(width)
if len(zones): if len(zones):
ZONE_FILLER(GS.board).Fill(zones) GS.fill_zones(GS.board, zones)
# Add it to the list # Add it to the list
filelist.append((pc.GetPlotFileName(), self.pad_color)) filelist.append((pc.GetPlotFileName(), self.pad_color))
@ -704,7 +704,7 @@ class PCB_PrintOptions(VariantOptions):
via.SetTopLayer(top) via.SetTopLayer(top)
via.SetBottomLayer(bottom) via.SetBottomLayer(bottom)
if len(zones): if len(zones):
ZONE_FILLER(GS.board).Fill(zones) GS.fill_zones(GS.board, zones)
# Add it to the list # Add it to the list
filelist.append((pc.GetPlotFileName(), via_c)) filelist.append((pc.GetPlotFileName(), via_c))