kopia lustrzana https://gitlab.com/gerbolyze/gerbonara
rodzic
71e996e874
commit
7bdbe66dc7
|
@ -267,6 +267,8 @@ class CamFile:
|
|||
|
||||
# setup viewport transform flipping y axis
|
||||
(content_min_x, content_min_y), (content_max_x, content_max_y) = bounds
|
||||
content_min_x, content_min_y = float(content_min_x), float(content_min_y)
|
||||
content_max_x, content_max_y = float(content_max_x), float(content_max_y)
|
||||
content_w, content_h = content_max_x - content_min_x, content_max_y - content_min_y
|
||||
xform = f'translate({content_min_x:.6} {content_min_y+content_h:.6}) scale(1 -1) translate({-content_min_x:.6} {-content_min_y:.6})'
|
||||
tags = [tag('g', tags, transform=xform)]
|
||||
|
|
|
@ -27,6 +27,7 @@ import itertools
|
|||
from collections import namedtuple
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile, is_zipfile
|
||||
import tempfile
|
||||
|
||||
from .excellon import ExcellonFile, parse_allegro_ncparam, parse_allegro_logfile
|
||||
from .rs274x import GerberFile
|
||||
|
@ -249,13 +250,13 @@ class LayerStack:
|
|||
@classmethod
|
||||
def open_zip(kls, file, original_path=None, board_name=None, lazy=False):
|
||||
tmpdir = tempfile.TemporaryDirectory()
|
||||
tmp_indir = Path(tmpdir) / 'input'
|
||||
tmp_indir = Path(tmpdir.name) / 'input'
|
||||
tmp_indir.mkdir()
|
||||
|
||||
with ZipFile(file) as f:
|
||||
f.extractall(path=tmp_indir)
|
||||
|
||||
inst = kls.from_directory(tmp_indir, board_name=board_name, lazy=lazy)
|
||||
inst = kls.open_dir(tmp_indir, board_name=board_name, lazy=lazy)
|
||||
inst.tmpdir = tmpdir
|
||||
inst.original_path = Path(original_path or file)
|
||||
inst.was_zipped = True
|
||||
|
@ -486,7 +487,7 @@ class LayerStack:
|
|||
if force_bounds:
|
||||
bounds = svg_unit.convert_bounds_from(arg_unit, force_bounds)
|
||||
else:
|
||||
bounds = selfboard_bounds(unit=svg_unit, default=((0, 0), (0, 0)))
|
||||
bounds = self.board_bounds(unit=svg_unit, default=((0, 0), (0, 0)))
|
||||
|
||||
tags = []
|
||||
inkscape_attrs = lambda label: dict(inkscape__groupmode='layer', inkscape__label=label) if inkscape else {}
|
||||
|
|
|
@ -269,7 +269,7 @@ def sum_bounds(bounds, *, default=None):
|
|||
:rtype: tuple
|
||||
"""
|
||||
|
||||
bounds = iter(bounds)
|
||||
bounds = iter([ b for b in bounds if b is not None ])
|
||||
|
||||
for (min_x, min_y), (max_x, max_y) in bounds:
|
||||
break
|
||||
|
|
Ładowanie…
Reference in New Issue