[PCB Print][Fixed] Vias with different center
- The patch to make the centering more coherent when scaling had a side effect: vias could get a different center. Now we force the bounding box of the plot with them.
This commit is contained in:
parent
9ea2f45983
commit
0f7c8f6cf9
22
kibot/gs.py
22
kibot/gs.py
|
|
@ -591,6 +591,28 @@ class GS(object):
|
|||
s.SetWidth(width)
|
||||
return bbox
|
||||
|
||||
@staticmethod
|
||||
def create_module_element(m):
|
||||
if GS.ki6:
|
||||
return pcbnew.FP_SHAPE(m)
|
||||
return pcbnew.EDGE_MODULE(m)
|
||||
|
||||
@staticmethod
|
||||
def create_track(parent):
|
||||
if GS.ki6:
|
||||
return pcbnew.PCB_TRACK(parent)
|
||||
return pcbnew.TRACK(parent)
|
||||
|
||||
@staticmethod
|
||||
def create_puntual_track(parent, position, layer):
|
||||
track = GS.create_track(parent)
|
||||
track.SetStart(position)
|
||||
track.SetEnd(position)
|
||||
track.SetLayer(layer)
|
||||
track.SetWidth(0)
|
||||
parent.Add(track)
|
||||
return track
|
||||
|
||||
@staticmethod
|
||||
def fill_zones(board, zones=None):
|
||||
if zones is None:
|
||||
|
|
|
|||
|
|
@ -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, LSET
|
||||
from pcbnew import B_Cu, B_Mask, F_Cu, F_Mask, FromMM, IsCopperLayer, LSET, PLOT_CONTROLLER, PLOT_FORMAT_SVG
|
||||
import shlex
|
||||
from shutil import rmtree
|
||||
from tempfile import NamedTemporaryFile, mkdtemp
|
||||
|
|
@ -587,8 +587,9 @@ class PCB_PrintOptions(VariantOptions):
|
|||
e.SetDrill(0)
|
||||
e.SetWidth(self.min_w)
|
||||
elif e.GetLayer() == id:
|
||||
e.SetLayer(tmp_layer)
|
||||
moved.append(e)
|
||||
if e.GetWidth():
|
||||
e.SetLayer(tmp_layer)
|
||||
moved.append(e)
|
||||
# Plot the layer
|
||||
# pc.SetLayer(id) already selected
|
||||
suffix = la.suffix+'_pads'
|
||||
|
|
@ -665,8 +666,9 @@ class PCB_PrintOptions(VariantOptions):
|
|||
vias.append((e, d, w, top, bottom))
|
||||
e.SetWidth(self.min_w)
|
||||
elif e.GetLayer() == id:
|
||||
e.SetLayer(tmp_layer)
|
||||
moved.append(e)
|
||||
if e.GetWidth():
|
||||
e.SetLayer(tmp_layer)
|
||||
moved.append(e)
|
||||
# Plot the layer
|
||||
suffix = la.suffix+'_vias_'+str(via_t)
|
||||
pc.OpenPlotfile(suffix, PLOT_FORMAT_SVG, p.sheet)
|
||||
|
|
@ -845,6 +847,13 @@ class PCB_PrintOptions(VariantOptions):
|
|||
def plot_extra_cu(self, id, la, pc, p, filelist):
|
||||
""" Plot pads and vias to make them different """
|
||||
if id >= F_Cu and id <= B_Cu:
|
||||
# Here we force the same bounding box
|
||||
# Problem: we will remove items, so the bbox can be affected
|
||||
# Solution: we add a couple of points at the edges of the bbox
|
||||
bbox = GS.board.GetBoundingBox()
|
||||
track1 = GS.create_puntual_track(GS.board, bbox.GetOrigin(), id)
|
||||
track2 = GS.create_puntual_track(GS.board, bbox.GetEnd(), id)
|
||||
|
||||
if self.colored_pads:
|
||||
self.plot_pads(la, pc, p, filelist)
|
||||
if self.colored_vias:
|
||||
|
|
@ -852,6 +861,9 @@ class PCB_PrintOptions(VariantOptions):
|
|||
self.plot_vias(la, pc, p, filelist, VIATYPE_BLIND_BURIED, self.blind_via_color)
|
||||
self.plot_vias(la, pc, p, filelist, VIATYPE_MICROVIA, self.micro_via_color)
|
||||
|
||||
GS.board.Remove(track1)
|
||||
GS.board.Remove(track2)
|
||||
|
||||
def pcbdraw_by_module(self, pcbdraw_file, back):
|
||||
self.ensure_tool('LXML')
|
||||
from .PcbDraw.plot import PcbPlotter, PlotSubstrate
|
||||
|
|
|
|||
Loading…
Reference in New Issue