From f8eb0210985073299ab3a63e885824d34a6d5011 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 12 Jan 2023 00:30:38 -0300 Subject: [PATCH] [SCH_Print] Added PS, DXF and HPGL formats --- CHANGELOG.md | 4 +- README.md | 130 +++++++++++++++++++++++++-- docs/samples/generic_plot.kibot.yaml | 102 +++++++++++++++++++-- kibot/misc.py | 3 + kibot/out_any_sch_print.py | 7 +- kibot/out_dxf_sch_print.py | 47 ++++++++++ kibot/out_hpgl_sch_print.py | 55 ++++++++++++ kibot/out_pdf_sch_print.py | 4 +- kibot/out_ps_sch_print.py | 47 ++++++++++ kibot/out_svg_sch_print.py | 2 +- 10 files changed, 382 insertions(+), 19 deletions(-) create mode 100644 kibot/out_dxf_sch_print.py create mode 100644 kibot/out_hpgl_sch_print.py create mode 100644 kibot/out_ps_sch_print.py diff --git a/CHANGELOG.md b/CHANGELOG.md index c5beb746..8501d418 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support for `groups` of `outputs` - Internal templates import - Better support for wrong pre-flight options (#360) -- New output: +- New outputs: - `vrml` export the 3D model in Virtual Reality Modeling Language (#349) + - `ps_sch_print`, `dxf_sch_print` and `hpgl_sch_print` variants of + `pdf_sch_print` - New internal filters: - `_only_smd` used to get only SMD parts - `_only_tht` used to get only THT parts diff --git a/README.md b/README.md index 877bd8e8..3db12403 100644 --- a/README.md +++ b/README.md @@ -140,8 +140,8 @@ Notes: [**Requests**](https://pypi.org/project/Requests/) [![Python module](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/Python-logo-notext-22x22.png)](https://pypi.org/project/Requests/) [![PyPi dependency](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/PyPI_logo_simplified-22x22.png)](https://pypi.org/project/Requests/) [![Debian](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/debian-openlogo-22x22.png)](https://packages.debian.org/bullseye/python3-requests) - Mandatory -[**KiCad Automation tools**](https://github.com/INTI-CMNB/KiAuto) v2.1.0 [![Tool](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/llave-inglesa-22x22.png)](https://github.com/INTI-CMNB/KiAuto)![PyPi dependency](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/PyPI_logo_simplified-22x22.png) ![Auto-download](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/auto_download-22x22.png) -- Mandatory for: `gencad`, `netlist`, `pdf_pcb_print`, `pdf_sch_print`, `render_3d`, `run_drc`, `run_erc`, `step`, `svg_pcb_print`, `svg_sch_print`, `update_xml`, `vrml` +[**KiCad Automation tools**](https://github.com/INTI-CMNB/KiAuto) v2.1.1 [![Tool](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/llave-inglesa-22x22.png)](https://github.com/INTI-CMNB/KiAuto)![PyPi dependency](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/PyPI_logo_simplified-22x22.png) ![Auto-download](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/auto_download-22x22.png) +- Mandatory for: `dxf_sch_print`, `gencad`, `hpgl_sch_print`, `netlist`, `pdf_pcb_print`, `pdf_sch_print`, `ps_sch_print`, `render_3d`, `run_drc`, `run_erc`, `step`, `svg_pcb_print`, `svg_sch_print`, `update_xml`, `vrml` - Optional to: - Compare schematics for `diff` (v2.0.0) - Show KiAuto installation information for `info` (v2.0.0) @@ -1374,6 +1374,9 @@ The available values for *type* are: - Documentation - `pdf_sch_print` schematic in PDF format - `svg_sch_print` schematic in SVG format + - `ps_sch_print` schematic in PS format + - `dxf_sch_print` schematic in DXF format + - `hpgl_sch_print` schematic in HPGL format - `pdf_pcb_print` PDF file containing one or more layer and the page frame - `svg_pcb_print` SVG file containing one or more layer and the page frame - `pcb_print` PDF/SVG/PNG/EPS/PS, similar to `pdf_pcb_print` and `svg_pcb_print`, with more flexibility @@ -2082,6 +2085,43 @@ Notes: Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. - `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested. +* DXF Schematic Print (Drawing Exchange Format) + * Type: `dxf_sch_print` + * Description: Exports the schematic to a format commonly used for CAD software. + This output is what you get from the 'File/Plot' menu in eeschema. + * Valid keys: + - **`comment`**: [string=''] A comment for documentation purposes. It helps to identify the output. + - **`dir`**: [string='./'] Output directory for the generated files. + If it starts with `+` the rest is concatenated to the default dir. + - **`name`**: [string=''] Used to identify this particular output definition. + Avoid using `_` as first character. These names are reserved for KiBot. + - **`options`**: [dict] Options for the `dxf_sch_print` output. + * Valid keys: + - **`frame`**: [boolean=true] Include the frame and title block. + - `all_pages`: [boolean=true] Generate with all hierarchical sheets. + - `background_color`: [boolean=false] Use the background color from the `color_theme` (KiCad 6). + - `color_theme`: [string=''] Color theme used, this must exist in the KiCad config (KiCad 6). + - `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted. + A short-cut to use for simple cases where a variant is an overkill. + - `monochrome`: [boolean=false] Generate a monochromatic output. + - `output`: [string='%f-%i%I%v.%x'] Filename for the output DXF (%i=schematic, %x=dxf). Affected by global options. + - `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. + A short-cut to use for simple cases where a variant is an overkill. + - `variant`: [string=''] Board variant to apply. + Not fitted components are crossed. + - `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used. + Categories looks like file system paths, i.e. **PCB/fabrication/gerber**. + The categories are currently used for `navigate_results`. + - `disable_run_by_default`: [string|boolean] Use it to disable the `run_by_default` status of other output. + Useful when this output extends another and you don't want to generate the original. + Use the boolean true value to disable the output you are extending. + - `extends`: [string=''] Copy the `options` section from the indicated output. + Used to inherit options from another output of the same type. + - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. + - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. + Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. + - `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested. + * Excellon drill format * Type: `excellon` * Description: This is the main format for the drilling machine. @@ -2360,6 +2400,45 @@ Notes: Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. - `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested. +* HPGL Schematic Print (Hewlett & Packard Graphics Language) + * Type: `hpgl_sch_print` + * Description: Exports the schematic to the most common plotter format. + This output is what you get from the 'File/Plot' menu in eeschema. + * Valid keys: + - **`comment`**: [string=''] A comment for documentation purposes. It helps to identify the output. + - **`dir`**: [string='./'] Output directory for the generated files. + If it starts with `+` the rest is concatenated to the default dir. + - **`name`**: [string=''] Used to identify this particular output definition. + Avoid using `_` as first character. These names are reserved for KiBot. + - **`options`**: [dict] Options for the `hpgl_sch_print` output. + * Valid keys: + - **`frame`**: [boolean=true] Include the frame and title block. + - `all_pages`: [boolean=true] Generate with all hierarchical sheets. + - `background_color`: [boolean=false] Use the background color from the `color_theme` (KiCad 6). + - `color_theme`: [string=''] Color theme used, this must exist in the KiCad config (KiCad 6). + - `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted. + A short-cut to use for simple cases where a variant is an overkill. + - `monochrome`: [boolean=false] Generate a monochromatic output. + - `origin`: [string='bottom_left'] [bottom_left,centered,page_fit,content_fit] Origin and scale. + - `output`: [string='%f-%i%I%v.%x'] Filename for the output HPGL (%i=schematic, %x=plt). Affected by global options. + - `pen_size`: [number=0.4826] Pen size (diameter) [mm]. + - `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. + A short-cut to use for simple cases where a variant is an overkill. + - `variant`: [string=''] Board variant to apply. + Not fitted components are crossed. + - `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used. + Categories looks like file system paths, i.e. **PCB/fabrication/gerber**. + The categories are currently used for `navigate_results`. + - `disable_run_by_default`: [string|boolean] Use it to disable the `run_by_default` status of other output. + Useful when this output extends another and you don't want to generate the original. + Use the boolean true value to disable the output you are extending. + - `extends`: [string=''] Copy the `options` section from the indicated output. + Used to inherit options from another output of the same type. + - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. + - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. + Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. + - `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested. + * IBoM (Interactive HTML BoM) * Type: `ibom` * Description: Generates an interactive web page useful to identify the position of the components in the PCB. @@ -3584,9 +3663,9 @@ Notes: * PDF Schematic Print (Portable Document Format) * Type: `pdf_sch_print` - * Description: Exports the PCB to the most common exchange format. Suitable for printing. + * Description: Exports the schematic to the most common exchange format. Suitable for printing. This is the main format to document your schematic. - This output is what you get from the 'File/Print' menu in eeschema. + This output is what you get from the 'File/Plot' menu in eeschema. * Valid keys: - **`comment`**: [string=''] A comment for documentation purposes. It helps to identify the output. - **`dir`**: [string='./'] Output directory for the generated files. @@ -3598,7 +3677,7 @@ Notes: - **`frame`**: [boolean=true] Include the frame and title block. - `all_pages`: [boolean=true] Generate with all hierarchical sheets. - `background_color`: [boolean=false] Use the background color from the `color_theme` (KiCad 6). - - `color_theme`: [string='_builtin_default'] Color theme used, this must exist in the KiCad config (KiCad 6). + - `color_theme`: [string=''] Color theme used, this must exist in the KiCad config (KiCad 6). - `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted. A short-cut to use for simple cases where a variant is an overkill. - `monochrome`: [boolean=false] Generate a monochromatic output. @@ -3820,6 +3899,43 @@ Notes: Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. - `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested. +* PS Schematic Print (Postscript) + * Type: `ps_sch_print` + * Description: Exports the schematic in postscript. Suitable for printing. + This output is what you get from the 'File/Plot' menu in eeschema. + * Valid keys: + - **`comment`**: [string=''] A comment for documentation purposes. It helps to identify the output. + - **`dir`**: [string='./'] Output directory for the generated files. + If it starts with `+` the rest is concatenated to the default dir. + - **`name`**: [string=''] Used to identify this particular output definition. + Avoid using `_` as first character. These names are reserved for KiBot. + - **`options`**: [dict] Options for the `ps_sch_print` output. + * Valid keys: + - **`frame`**: [boolean=true] Include the frame and title block. + - `all_pages`: [boolean=true] Generate with all hierarchical sheets. + - `background_color`: [boolean=false] Use the background color from the `color_theme` (KiCad 6). + - `color_theme`: [string=''] Color theme used, this must exist in the KiCad config (KiCad 6). + - `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted. + A short-cut to use for simple cases where a variant is an overkill. + - `monochrome`: [boolean=false] Generate a monochromatic output. + - `output`: [string='%f-%i%I%v.%x'] Filename for the output postscript (%i=schematic, %x=ps). Affected by global options. + - `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. + A short-cut to use for simple cases where a variant is an overkill. + - `variant`: [string=''] Board variant to apply. + Not fitted components are crossed. + - `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used. + Categories looks like file system paths, i.e. **PCB/fabrication/gerber**. + The categories are currently used for `navigate_results`. + - `disable_run_by_default`: [string|boolean] Use it to disable the `run_by_default` status of other output. + Useful when this output extends another and you don't want to generate the original. + Use the boolean true value to disable the output you are extending. + - `extends`: [string=''] Copy the `options` section from the indicated output. + Used to inherit options from another output of the same type. + - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. + - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. + Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. + - `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested. + * QR_Lib * Type: `qr_lib` * Description: Generates a QR code symbol and footprint. @@ -4318,7 +4434,7 @@ Notes: * SVG Schematic Print * Type: `svg_sch_print` - * Description: Exports the PCB. Suitable for printing. + * Description: Exports the schematic in a vectorized graphics format. This is a format to document your schematic. * Valid keys: - **`comment`**: [string=''] A comment for documentation purposes. It helps to identify the output. @@ -4331,7 +4447,7 @@ Notes: - **`frame`**: [boolean=true] Include the frame and title block. - `all_pages`: [boolean=true] Generate with all hierarchical sheets. - `background_color`: [boolean=false] Use the background color from the `color_theme` (KiCad 6). - - `color_theme`: [string='_builtin_default'] Color theme used, this must exist in the KiCad config (KiCad 6). + - `color_theme`: [string=''] Color theme used, this must exist in the KiCad config (KiCad 6). - `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted. A short-cut to use for simple cases where a variant is an overkill. - `monochrome`: [boolean=false] Generate a monochromatic output. diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index ce7ce772..a49a42e2 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -682,6 +682,34 @@ outputs: # [string=''] Board variant to apply variant: '' layers: all + # DXF Schematic Print (Drawing Exchange Format): + # This output is what you get from the 'File/Plot' menu in eeschema. + - name: 'dxf_sch_print_example' + comment: 'Exports the schematic to a format commonly used for CAD software.' + type: 'dxf_sch_print' + dir: 'Example/dxf_sch_print_dir' + options: + # [boolean=true] Generate with all hierarchical sheets + all_pages: true + # [boolean=false] Use the background color from the `color_theme` (KiCad 6) + background_color: false + # [string=''] Color theme used, this must exist in the KiCad config (KiCad 6) + color_theme: '' + # [string|list(string)='_none'] Name of the filter to mark components as not fitted. + # A short-cut to use for simple cases where a variant is an overkill + dnf_filter: '_none' + # [boolean=true] Include the frame and title block + frame: true + # [boolean=false] Generate a monochromatic output + monochrome: false + # [string='%f-%i%I%v.%x'] Filename for the output DXF (%i=schematic, %x=dxf). Affected by global options + output: '%f-%i%I%v.%x' + # [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. + # A short-cut to use for simple cases where a variant is an overkill + pre_transform: '_none' + # [string=''] Board variant to apply. + # Not fitted components are crossed + variant: '' # Excellon drill format: # You can create a map file for documentation purposes. # This output is what you get from the 'File/Fabrication output/Drill Files' menu in pcbnew. @@ -950,6 +978,38 @@ outputs: # [string=''] Board variant to apply variant: '' layers: all + # HPGL Schematic Print (Hewlett & Packard Graphics Language): + # This output is what you get from the 'File/Plot' menu in eeschema. + - name: 'hpgl_sch_print_example' + comment: 'Exports the schematic to the most common plotter format.' + type: 'hpgl_sch_print' + dir: 'Example/hpgl_sch_print_dir' + options: + # [boolean=true] Generate with all hierarchical sheets + all_pages: true + # [boolean=false] Use the background color from the `color_theme` (KiCad 6) + background_color: false + # [string=''] Color theme used, this must exist in the KiCad config (KiCad 6) + color_theme: '' + # [string|list(string)='_none'] Name of the filter to mark components as not fitted. + # A short-cut to use for simple cases where a variant is an overkill + dnf_filter: '_none' + # [boolean=true] Include the frame and title block + frame: true + # [boolean=false] Generate a monochromatic output + monochrome: false + # [string='bottom_left'] [bottom_left,centered,page_fit,content_fit] Origin and scale + origin: 'bottom_left' + # [string='%f-%i%I%v.%x'] Filename for the output HPGL (%i=schematic, %x=plt). Affected by global options + output: '%f-%i%I%v.%x' + # [number=0.4826] Pen size (diameter) [mm] + pen_size: 0.4826 + # [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. + # A short-cut to use for simple cases where a variant is an overkill + pre_transform: '_none' + # [string=''] Board variant to apply. + # Not fitted components are crossed + variant: '' # IBoM (Interactive HTML BoM): # For more information: https://github.com/INTI-CMNB/InteractiveHtmlBom # This output is what you get from the InteractiveHtmlBom plug-in (pcbnew). @@ -2305,9 +2365,9 @@ outputs: layers: all # PDF Schematic Print (Portable Document Format): # This is the main format to document your schematic. - # This output is what you get from the 'File/Print' menu in eeschema. + # This output is what you get from the 'File/Plot' menu in eeschema. - name: 'pdf_sch_print_example' - comment: 'Exports the PCB to the most common exchange format. Suitable for printing.' + comment: 'Exports the schematic to the most common exchange format. Suitable for printing.' type: 'pdf_sch_print' dir: 'Example/pdf_sch_print_dir' options: @@ -2315,8 +2375,8 @@ outputs: all_pages: true # [boolean=false] Use the background color from the `color_theme` (KiCad 6) background_color: false - # [string='_builtin_default'] Color theme used, this must exist in the KiCad config (KiCad 6) - color_theme: '_builtin_default' + # [string=''] Color theme used, this must exist in the KiCad config (KiCad 6) + color_theme: '' # [string|list(string)='_none'] Name of the filter to mark components as not fitted. # A short-cut to use for simple cases where a variant is an overkill dnf_filter: '_none' @@ -2512,6 +2572,34 @@ outputs: # Only used to plot pads and tracks width_adjust: 0 layers: all + # PS Schematic Print (Postscript): + # This output is what you get from the 'File/Plot' menu in eeschema. + - name: 'ps_sch_print_example' + comment: 'Exports the schematic in postscript. Suitable for printing.' + type: 'ps_sch_print' + dir: 'Example/ps_sch_print_dir' + options: + # [boolean=true] Generate with all hierarchical sheets + all_pages: true + # [boolean=false] Use the background color from the `color_theme` (KiCad 6) + background_color: false + # [string=''] Color theme used, this must exist in the KiCad config (KiCad 6) + color_theme: '' + # [string|list(string)='_none'] Name of the filter to mark components as not fitted. + # A short-cut to use for simple cases where a variant is an overkill + dnf_filter: '_none' + # [boolean=true] Include the frame and title block + frame: true + # [boolean=false] Generate a monochromatic output + monochrome: false + # [string='%f-%i%I%v.%x'] Filename for the output postscript (%i=schematic, %x=ps). Affected by global options + output: '%f-%i%I%v.%x' + # [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. + # A short-cut to use for simple cases where a variant is an overkill + pre_transform: '_none' + # [string=''] Board variant to apply. + # Not fitted components are crossed + variant: '' # QR_Lib: # This output creates a library containing a symbol and footprint for a QR code. # To refresh the generated symbols and footprints use the `update_qr` preflight. @@ -2990,7 +3078,7 @@ outputs: # SVG Schematic Print: # This is a format to document your schematic. - name: 'svg_sch_print_example' - comment: 'Exports the PCB. Suitable for printing.' + comment: 'Exports the schematic in a vectorized graphics format.' type: 'svg_sch_print' dir: 'Example/svg_sch_print_dir' options: @@ -2998,8 +3086,8 @@ outputs: all_pages: true # [boolean=false] Use the background color from the `color_theme` (KiCad 6) background_color: false - # [string='_builtin_default'] Color theme used, this must exist in the KiCad config (KiCad 6) - color_theme: '_builtin_default' + # [string=''] Color theme used, this must exist in the KiCad config (KiCad 6) + color_theme: '' # [string|list(string)='_none'] Name of the filter to mark components as not fitted. # A short-cut to use for simple cases where a variant is an overkill dnf_filter: '_none' diff --git a/kibot/misc.py b/kibot/misc.py index 300030b7..92ec83c3 100644 --- a/kibot/misc.py +++ b/kibot/misc.py @@ -41,6 +41,9 @@ MISSING_WKS = 27 MISSING_FILES = 28 DIFF_TOO_BIG = 29 NETLIST_DIFF = 30 +PS_SCH_PRINT = 31 +DXF_SCH_PRINT = 32 +HPGL_SCH_PRINT = 33 error_level_to_name = ['NONE', 'INTERNAL_ERROR', 'WRONG_ARGUMENTS', diff --git a/kibot/out_any_sch_print.py b/kibot/out_any_sch_print.py index 2fccf144..84d52f6c 100644 --- a/kibot/out_any_sch_print.py +++ b/kibot/out_any_sch_print.py @@ -63,7 +63,8 @@ class Any_SCH_PrintOptions(VariantOptions): self._files_to_remove.append(sch_dir) else: sch_file = GS.sch_file - cmd = [command, 'export', '--file_format', self._expand_ext, '-o', name] + fmt = 'hpgl' if self._expand_ext == 'plt' else self._expand_ext + cmd = [command, 'export', '--file_format', fmt, '-o', name] if self.monochrome: cmd.append('--monochrome') if not self.frame: @@ -74,5 +75,9 @@ class Any_SCH_PrintOptions(VariantOptions): cmd.extend(['--color_theme', self.color_theme]) if self.background_color: cmd.append('--background_color') + if hasattr(self, '_origin'): + cmd.extend(['--hpgl_origin', str(self._origin)]) + if hasattr(self, 'pen_size'): + cmd.extend(['--hpgl_pen_size', str(self.pen_size)]) cmd.extend([sch_file, os.path.dirname(name)]) self.exec_with_retry(self.add_extra_options(cmd), self._exit_error) diff --git a/kibot/out_dxf_sch_print.py b/kibot/out_dxf_sch_print.py new file mode 100644 index 00000000..9a80a1de --- /dev/null +++ b/kibot/out_dxf_sch_print.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020-2023 Salvador E. Tropea +# Copyright (c) 2020-2023 Instituto Nacional de Tecnología Industrial +# License: GPL-3.0 +# Project: KiBot (formerly KiPlot) +""" +Dependencies: + - from: KiAuto + role: mandatory + command: eeschema_do + version: 2.1.1 +""" +from .gs import GS +from .out_any_sch_print import Any_SCH_PrintOptions +from .misc import DXF_SCH_PRINT +from .macros import macros, document, output_class # noqa: F401 +from . import log + +logger = log.get_logger() + + +class DXF_SCH_PrintOptions(Any_SCH_PrintOptions): + def __init__(self): + with document: + self.output = GS.def_global_output + """ Filename for the output DXF (%i=schematic, %x=dxf)""" + super().__init__() + self._expand_ext = 'dxf' + self._exit_error = DXF_SCH_PRINT + + +@output_class +class DXF_SCH_Print(BaseOutput): # noqa: F821 + """ DXF Schematic Print (Drawing Exchange Format) + Exports the schematic to a format commonly used for CAD software. + This output is what you get from the 'File/Plot' menu in eeschema. """ + def __init__(self): + super().__init__() + with document: + self.options = DXF_SCH_PrintOptions + """ *[dict] Options for the `dxf_sch_print` output """ + self._sch_related = True + self._category = 'Schematic/docs' + + @staticmethod + def get_conf_examples(name, layers, templates): + return BaseOutput.simple_conf_examples(name, 'Schematic in DXF format', 'Schematic') # noqa: F821 diff --git a/kibot/out_hpgl_sch_print.py b/kibot/out_hpgl_sch_print.py new file mode 100644 index 00000000..a4675df8 --- /dev/null +++ b/kibot/out_hpgl_sch_print.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020-2023 Salvador E. Tropea +# Copyright (c) 2020-2023 Instituto Nacional de Tecnología Industrial +# License: GPL-3.0 +# Project: KiBot (formerly KiPlot) +""" +Dependencies: + - from: KiAuto + role: mandatory + command: eeschema_do + version: 2.1.1 +""" +from .gs import GS +from .out_any_sch_print import Any_SCH_PrintOptions +from .misc import HPGL_SCH_PRINT +from .macros import macros, document, output_class # noqa: F401 +from . import log + +logger = log.get_logger() + + +class HPGL_SCH_PrintOptions(Any_SCH_PrintOptions): + def __init__(self): + with document: + self.output = GS.def_global_output + """ Filename for the output HPGL (%i=schematic, %x=plt)""" + self.origin = 'bottom_left' + """ [bottom_left,centered,page_fit,content_fit] Origin and scale """ + self.pen_size = 0.4826 + """ Pen size (diameter) [mm] """ + super().__init__() + self._expand_ext = 'plt' + self._exit_error = HPGL_SCH_PRINT + + def config(self, parent): + super().config(parent) + self._origin = ['bottom_left', 'centered', 'page_fit', 'content_fit'].index(self.origin) + + +@output_class +class HPGL_SCH_Print(BaseOutput): # noqa: F821 + """ HPGL Schematic Print (Hewlett & Packard Graphics Language) + Exports the schematic to the most common plotter format. + This output is what you get from the 'File/Plot' menu in eeschema. """ + def __init__(self): + super().__init__() + with document: + self.options = HPGL_SCH_PrintOptions + """ *[dict] Options for the `hpgl_sch_print` output """ + self._sch_related = True + self._category = 'Schematic/docs' + + @staticmethod + def get_conf_examples(name, layers, templates): + return BaseOutput.simple_conf_examples(name, 'Schematic in HPGL format', 'Schematic') # noqa: F821 diff --git a/kibot/out_pdf_sch_print.py b/kibot/out_pdf_sch_print.py index 2baa1fc8..fa36dce6 100644 --- a/kibot/out_pdf_sch_print.py +++ b/kibot/out_pdf_sch_print.py @@ -32,9 +32,9 @@ class PDF_SCH_PrintOptions(Any_SCH_PrintOptions): @output_class class PDF_SCH_Print(BaseOutput): # noqa: F821 """ PDF Schematic Print (Portable Document Format) - Exports the PCB to the most common exchange format. Suitable for printing. + Exports the schematic to the most common exchange format. Suitable for printing. This is the main format to document your schematic. - This output is what you get from the 'File/Print' menu in eeschema. """ + This output is what you get from the 'File/Plot' menu in eeschema. """ def __init__(self): super().__init__() with document: diff --git a/kibot/out_ps_sch_print.py b/kibot/out_ps_sch_print.py new file mode 100644 index 00000000..5f8cd2a3 --- /dev/null +++ b/kibot/out_ps_sch_print.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020-2023 Salvador E. Tropea +# Copyright (c) 2020-2023 Instituto Nacional de Tecnología Industrial +# License: GPL-3.0 +# Project: KiBot (formerly KiPlot) +""" +Dependencies: + - from: KiAuto + role: mandatory + command: eeschema_do + version: 2.1.1 +""" +from .gs import GS +from .out_any_sch_print import Any_SCH_PrintOptions +from .misc import PS_SCH_PRINT +from .macros import macros, document, output_class # noqa: F401 +from . import log + +logger = log.get_logger() + + +class PS_SCH_PrintOptions(Any_SCH_PrintOptions): + def __init__(self): + with document: + self.output = GS.def_global_output + """ Filename for the output postscript (%i=schematic, %x=ps)""" + super().__init__() + self._expand_ext = 'ps' + self._exit_error = PS_SCH_PRINT + + +@output_class +class PS_SCH_Print(BaseOutput): # noqa: F821 + """ PS Schematic Print (Postscript) + Exports the schematic in postscript. Suitable for printing. + This output is what you get from the 'File/Plot' menu in eeschema. """ + def __init__(self): + super().__init__() + with document: + self.options = PS_SCH_PrintOptions + """ *[dict] Options for the `ps_sch_print` output """ + self._sch_related = True + self._category = 'Schematic/docs' + + @staticmethod + def get_conf_examples(name, layers, templates): + return BaseOutput.simple_conf_examples(name, 'Schematic in PS format', 'Schematic') # noqa: F821 diff --git a/kibot/out_svg_sch_print.py b/kibot/out_svg_sch_print.py index 02fa0561..a6c4f2d2 100644 --- a/kibot/out_svg_sch_print.py +++ b/kibot/out_svg_sch_print.py @@ -33,7 +33,7 @@ class SVG_SCH_PrintOptions(Any_SCH_PrintOptions): @output_class class SVG_SCH_Print(BaseOutput): # noqa: F821 """ SVG Schematic Print - Exports the PCB. Suitable for printing. + Exports the schematic in a vectorized graphics format. This is a format to document your schematic. """ def __init__(self): super().__init__()