Adapted to last KiCad 5.99 Python interface.

- SKETCH and FILLED are defined again.
- SetDXFPlotUnits type is now exported.
This commit is contained in:
Salvador E. Tropea 2020-10-22 13:03:31 -03:00
parent 1a77b2d007
commit a623d9168c
3 changed files with 11 additions and 31 deletions

View File

@ -3,19 +3,17 @@
# Copyright (c) 2020 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
from pcbnew import (PLOT_FORMAT_DXF) # , SKETCH, FILLED Bug: https://gitlab.com/kicad/code/kicad/-/issues/6070
from pcbnew import PLOT_FORMAT_DXF, SKETCH, FILLED
from .out_any_layer import AnyLayer
from .drill_marks import DrillMarks
from .gs import GS
from .misc import KICAD_VERSION_5_99
from .macros import macros, document, output_class # noqa: F401
# From kicad/include/outline_mode.h KiCad 5.99 is missing:
# enum OUTLINE_MODE
# {
# SKETCH = 0, // sketch mode: draw segments outlines only
# FILLED = 1 // normal mode: solid segments
# };
SKETCH = 0
FILLED = 1
if GS.kicad_version_n >= KICAD_VERSION_5_99:
from pcbnew import DXF_UNITS_MILLIMETERS, DXF_UNITS_INCHES
else:
DXF_UNITS_MILLIMETERS = 1
DXF_UNITS_INCHES = 0
class DXFOptions(DrillMarks):
@ -37,7 +35,7 @@ class DXFOptions(DrillMarks):
po.SetDXFPlotPolygonMode(self.polygon_mode)
# DXF_PLOTTER::DXF_UNITS isn't available
# According to https://docs.kicad-pcb.org/doxygen/classDXF__PLOTTER.html 1 is mm
po.SetDXFPlotUnits(1 if self.metric_units else 0)
po.SetDXFPlotUnits(DXF_UNITS_MILLIMETERS if self.metric_units else DXF_UNITS_INCHES)
po.SetPlotMode(SKETCH if self.sketch_plot else FILLED)
po.SetUseAuxOrigin(self.use_aux_axis_as_origin)

View File

@ -3,21 +3,12 @@
# Copyright (c) 2020 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
from pcbnew import (PLOT_FORMAT_HPGL) # , SKETCH, FILLED Bug: https://gitlab.com/kicad/code/kicad/-/issues/6070
from pcbnew import PLOT_FORMAT_HPGL, SKETCH, FILLED
from .misc import AUTO_SCALE
from .out_any_layer import AnyLayer
from .drill_marks import DrillMarks
from .macros import macros, document, output_class # noqa: F401
# From kicad/include/outline_mode.h KiCad 5.99 is missing:
# enum OUTLINE_MODE
# {
# SKETCH = 0, // sketch mode: draw segments outlines only
# FILLED = 1 // normal mode: solid segments
# };
SKETCH = 0
FILLED = 1
class HPGLOptions(DrillMarks):
def __init__(self):

View File

@ -5,7 +5,7 @@
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
# Adapted from: https://github.com/johnbeard/kiplot
from pcbnew import (PLOT_FORMAT_POST, FromMM, ToMM) # , SKETCH, FILLED Bug: https://gitlab.com/kicad/code/kicad/-/issues/6070
from pcbnew import PLOT_FORMAT_POST, FromMM, ToMM, SKETCH, FILLED
from .misc import AUTO_SCALE
from .out_any_layer import AnyLayer
from .drill_marks import DrillMarks
@ -13,15 +13,6 @@ from .gs import GS
from .misc import KICAD_VERSION_5_99
from .macros import macros, document, output_class # noqa: F401
# From kicad/include/outline_mode.h KiCad 5.99 is missing:
# enum OUTLINE_MODE
# {
# SKETCH = 0, // sketch mode: draw segments outlines only
# FILLED = 1 // normal mode: solid segments
# };
SKETCH = 0
FILLED = 1
class PSOptions(DrillMarks):
def __init__(self):