Moved the KiCad 5 SVG scale constant to misc.py
This commit is contained in:
parent
857b8b974e
commit
0554742e86
|
|
@ -32,7 +32,7 @@ from .sexpdata import load, SExpData
|
|||
from .v6_sch import (_check_is_symbol_list, _check_float, _check_integer, _check_symbol_value, _check_str, _check_symbol,
|
||||
_check_relaxed, _get_points, _check_symbol_str)
|
||||
from ..svgutils.transform import ImageElement, GroupElement
|
||||
from ..misc import W_WKSVERSION
|
||||
from ..misc import W_WKSVERSION, KICAD5_SVG_SCALE
|
||||
from .. import log
|
||||
|
||||
logger = log.get_logger()
|
||||
|
|
@ -420,7 +420,7 @@ class WksBitmap(WksDrawing):
|
|||
img.moveto(x, y)
|
||||
if GS.ki5():
|
||||
# KiCad 5 uses Inches and with less resolution
|
||||
img.scale(0.0003937007874)
|
||||
img.scale(KICAD5_SVG_SCALE)
|
||||
# Put the image in a group
|
||||
g = GroupElement([img])
|
||||
# Add the group to the SVG
|
||||
|
|
|
|||
|
|
@ -251,6 +251,8 @@ SOLDER_COLORS = {'green': ("#285e3a", "#208b47"),
|
|||
'yellow': ("#73823d", "#f2a756"),
|
||||
'purple': ("#30234a", "#451d70")}
|
||||
SILK_COLORS = {'black': "0b1013", 'white': "d5dce4"}
|
||||
# KiCad 6 uses IUs for SVGs, but KiCad 5 uses a very different scale based on inches
|
||||
KICAD5_SVG_SCALE = 116930/297002200
|
||||
|
||||
|
||||
class Rect(object):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ from .kicad.worksheet import Worksheet, WksError
|
|||
from .kicad.config import KiConf
|
||||
from .kicad.v5_sch import SchError
|
||||
from .kicad.pcb import PCB
|
||||
from .misc import CMD_PCBNEW_PRINT_LAYERS, URL_PCBNEW_PRINT_LAYERS, PDF_PCB_PRINT, MISSING_TOOL, W_PDMASKFAIL
|
||||
from .misc import (CMD_PCBNEW_PRINT_LAYERS, URL_PCBNEW_PRINT_LAYERS, PDF_PCB_PRINT, MISSING_TOOL, W_PDMASKFAIL,
|
||||
KICAD5_SVG_SCALE)
|
||||
from .kiplot import check_script, exec_with_retry, add_extra_options
|
||||
from .macros import macros, document, output_class # noqa: F401
|
||||
from .layer import Layer, get_priority
|
||||
|
|
@ -790,8 +791,8 @@ class PCB_PrintOptions(VariantOptions):
|
|||
board_center = GS.board.GetBoundingBox().GetCenter()
|
||||
if GS.ki5():
|
||||
# KiCad 5 uses a different precision, we must adjust
|
||||
board_center.x = round(board_center.x*116930/297002200)
|
||||
board_center.y = round(board_center.y*116930/297002200)
|
||||
board_center.x = round(board_center.x*KICAD5_SVG_SCALE)
|
||||
board_center.y = round(board_center.y*KICAD5_SVG_SCALE)
|
||||
offset_x = round((board_center.x*scale-(paper_size_x/2.0))/scale)
|
||||
offset_y = round((board_center.y*scale-(paper_size_y/2.0))/scale)
|
||||
if mirror:
|
||||
|
|
|
|||
Loading…
Reference in New Issue