Merge branch 'dev' into kiri_integration
This commit is contained in:
commit
341dc9e6e9
|
|
@ -1,4 +1,4 @@
|
|||
# This workflow will install Python dependencies, run tests and lint with a single version of Python.
|
||||
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||
|
||||
name: Regression tests
|
||||
|
|
|
|||
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -26,8 +26,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
3DRender_bottom_straight: to generate simple and quick 3D renders.
|
||||
- _KIBOT_POS_DNF_FILTER option to JLCPCB. It now excludes components added
|
||||
by KiKit to create panels and can be customized.
|
||||
- _KIBOT_PLOT_FOOTPRINT_REFS and _KIBOT_PLOT_FOOTPRINT_VALUES to
|
||||
- _KIBOT_PLOT_FOOTPRINT_REFS and _KIBOT_PLOT_FOOTPRINT_VALUES to
|
||||
manufacturer templates. (#523)
|
||||
- _KIBOT_COMPRESS_MOVE to move gerber and drill files to the compressed
|
||||
output, enabled by default. (#537)
|
||||
- Filters:
|
||||
- New `_rot_footprint_jlcpcb` internal filter to fix the JLCPCB bottom
|
||||
rotations.
|
||||
|
|
@ -87,6 +89,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Footprints: now they are flagged with exclude from BoM and Pos, also
|
||||
with no court yard requirements for KiCad 7
|
||||
- Symbol: Excluded from simulation for KiCad 7
|
||||
- Elecrow, FusionPCB, JLCPCB, PCBWay and P-Ban templates now moves the files
|
||||
to the compressed output by default.
|
||||
- Note that JLCPCB BoM and Position files aren't included anymore, they are
|
||||
uploaded separately.
|
||||
|
||||
### Fixed
|
||||
- Schematics: problems with deep nested and recycled sheets (#520)
|
||||
|
|
@ -119,6 +125,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
temporal, generating problems with the plot outputs, like pcb_print
|
||||
- Project options not preserved, i.e. set_text_variables failing
|
||||
- Bottom QRs should be mirrored in the Y axis
|
||||
- Diff
|
||||
- `current`: didn't apply global variants
|
||||
- `current`: didn't honor KiCad native DNP flags, they need a filter
|
||||
- PCB Print:
|
||||
- Issues when forcing the board edge and using scaling (#532)
|
||||
|
||||
|
||||
## [1.6.3] - 2023-06-26
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
# Guide for using KiBot with GitHub Actions.
|
||||
Author: @sethkaz
|
||||
|
||||
This is a guide for getting started using KiBot with GitHub Actions.
|
||||
|
||||
## Basics
|
||||
|
||||
[GitHub Actions](https://github.com/actions) is a CI system that runs on GitHub. It uses [YAML files](https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html) to define what actions it will take. Unfortunately, some of the links between YAML lines and their associated actions are a bit cryptic. This guide will try to shed light on those cryptic portions.
|
||||
|
||||
### Basic GitHub file
|
||||
|
||||
Must be located at `{repo root}/.github/workflows/{meaningful_name}.yml`
|
||||
|
||||
```yaml
|
||||
name: KiBot_GitHub_Actions # This is a name. It can be anything you want.
|
||||
on: [push, pull_request] # GitHub triggers for running this. In this example it will run when anything is pushed to GitHub or a pull request is created.
|
||||
jobs: # List of jobs to be run. Can be used to better organize steps.
|
||||
KiBot-Generation: # This is a name. It can be anything you want.
|
||||
runs-on: ubuntu-latest # Don't change
|
||||
container: ghcr.io/inti-cmnb/kicad7_auto_full:latest # Don't Change, except if needing older version of KiCad.
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3 # GitHub built-in repo checkout step.
|
||||
|
||||
# Start of the KiBot steps
|
||||
- name: Run KiBot
|
||||
run: |
|
||||
kibot -e "project_name.kicad_sch"
|
||||
|
||||
# Post KiBot steps (Optional).
|
||||
- name: Optionally do other things
|
||||
run: |
|
||||
echo "Run bash commands to do things like committing the files or adding them as artifacts"
|
||||
```
|
||||
|
||||
|
||||
### Basic KiBot file
|
||||
|
||||
This file will match the syntax and keywords described in the [readme](https://kibot.readthedocs.io/en/latest/).
|
||||
|
||||
```yaml
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
preflight:
|
||||
run_erc: true
|
||||
run_drc: true
|
||||
check_zone_fills: true
|
||||
|
||||
outputs:
|
||||
- name: 'Print Schema as PDF'
|
||||
comment: "Print schematic (PDF)"
|
||||
type: pdf_sch_print
|
||||
dir: schematics
|
||||
options:
|
||||
output: '%p-Schematic.%x'
|
||||
```
|
||||
|
||||
## GitHub-specific details
|
||||
|
||||
The `uses: actions/checkout` refers to a specific repo, [GitHub Actions](https://github.com/actions).
|
||||
|
||||
## KiBot Specific details
|
||||
|
||||
|
||||
|
||||
## Caveats, Gotchyas, and Pitfalls
|
||||
|
||||
1. KiBot requires a `{meaningful_name}.kibot.yaml` file name scheme. While most places use `*.yml` and `*.yaml` interchangeably, it is specific here that `*.kibot.yml` won't work. This is especially odd since GitHub uses `*.yml` and kibot uses `*.yaml`.
|
||||
|
||||
## Different ways of doing things
|
||||
|
||||
This section will try to describe some different options for doing things within KiBot and GitHub, and hope to explain pros and cons.
|
||||
|
||||
- TODO: Fill this out.
|
||||
- TODO: (Topic) GitHub artifacts vs exports committed.
|
||||
- TODO: (Topic) When to run KiBot?? ERC/DRC only vs full outputs.
|
||||
|
|
@ -95,7 +95,7 @@ preflight:
|
|||
update_xml: true
|
||||
|
||||
outputs:
|
||||
# Blender Export **Experimental**:
|
||||
# Blender Export:
|
||||
# Also renders the PCB with high-quality.
|
||||
# Needs KiCad 6 or newer.
|
||||
# This output is complex to setup and needs very big dependencies.
|
||||
|
|
@ -762,6 +762,9 @@ outputs:
|
|||
# The `stats` mode is used to meassure the amount of difference. In this mode all
|
||||
# changes are red, but you can abort if the difference is bigger than certain threshold
|
||||
diff_mode: 'red_green'
|
||||
# [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=false] When `old_type` and/or `new_type` are `git` KiBot will checkout the indicated point.
|
||||
# Before doing it KiBot will stash any change. Under some circumstances git could fail
|
||||
# to do a checkout, even after stashing, this option can workaround the problem.
|
||||
|
|
@ -803,6 +806,9 @@ outputs:
|
|||
output: '%f-%i%I%v.%x'
|
||||
# [boolean=true] Compare the PCB, otherwise compare the schematic
|
||||
pcb: true
|
||||
# [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'
|
||||
# [number=0] [0,1000000] Error threshold for the `stats` mode, 0 is no error. When specified a
|
||||
# difference bigger than the indicated value will make the diff fail.
|
||||
# KiBot will return error level 29 and the diff generation will be aborted
|
||||
|
|
@ -810,6 +816,8 @@ outputs:
|
|||
# [boolean=false] When creating the link name of an output file related to a variant use the variant
|
||||
# `file_id` instead of its name
|
||||
use_file_id: false
|
||||
# [string=''] Board variant to apply
|
||||
variant: ''
|
||||
layers: all
|
||||
# Datasheets downloader:
|
||||
- name: 'download_datasheets_example'
|
||||
|
|
@ -2312,7 +2320,8 @@ outputs:
|
|||
# Order is important, the last goes on top.
|
||||
# You can reuse other layers lists, some options aren't used here, but they are valid
|
||||
layers:
|
||||
# [string=''] Color used for this layer
|
||||
# [string=''] Color used for this layer.
|
||||
# KiCad 6+: don't forget the alpha channel for layers like the solder mask
|
||||
- color: ''
|
||||
# [string=''] A description for the layer, for documentation purposes.
|
||||
# A default can be specified using the `layer_defaults` global option
|
||||
|
|
@ -2349,7 +2358,8 @@ outputs:
|
|||
# [list(dict)|list(string)|string] List of layers to replace `repeat_for_layer`.
|
||||
# This can be used to generate a page for each copper layer, here you put `copper`
|
||||
repeat_layers:
|
||||
# [string=''] Color used for this layer
|
||||
# [string=''] Color used for this layer.
|
||||
# KiCad 6+: don't forget the alpha channel for layers like the solder mask
|
||||
- color: ''
|
||||
# [string=''] A description for the layer, for documentation purposes.
|
||||
# A default can be specified using the `layer_defaults` global option
|
||||
|
|
|
|||
|
|
@ -323,6 +323,7 @@ The manufacturer templates (Elecrow, FusionPCB, JLCPCB, P-Ban and PCBWay) suppor
|
|||
- **_KIBOT_GERBER_LAYERS**: List of layers to use for the gerbers (default: a specially crafted list of layers)
|
||||
- **_KIBOT_PLOT_FOOTPRINT_REFS**: Include the footprint references in the gerbers (default: true)
|
||||
- **_KIBOT_PLOT_FOOTPRINT_VALUES**: Include the footprint values in the gerbers (default: true, except for JLCPCB)
|
||||
- **_KIBOT_COMPRESS_MOVE**: Move the generated files to the compressed archive (default: true)
|
||||
|
||||
|
||||
The JLCPCB case is a little bit more complex and also supports:
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
.. Automatically generated by KiBot, please don't edit this file
|
||||
|
||||
.. index::
|
||||
pair: Blender Export **Experimental**; blender_export
|
||||
pair: Blender Export; blender_export
|
||||
|
||||
Blender Export **Experimental**
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Blender Export
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Exports the PCB in various 3D file formats.
|
||||
Also renders the PCB with high-quality. |br|
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ Parameters:
|
|||
- ``diff_mode`` :index:`: <pair: output - diff - options; diff_mode>` [string='red_green'] [red_green,stats] In the `red_green` mode added stuff is green and red when removed.
|
||||
The `stats` mode is used to meassure the amount of difference. In this mode all
|
||||
changes are red, but you can abort if the difference is bigger than certain threshold.
|
||||
- ``dnf_filter`` :index:`: <pair: output - diff - options; 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.
|
||||
|
||||
- ``force_checkout`` :index:`: <pair: output - diff - options; force_checkout>` [boolean=false] When `old_type` and/or `new_type` are `git` KiBot will checkout the indicated point.
|
||||
Before doing it KiBot will stash any change. Under some circumstances git could fail
|
||||
to do a checkout, even after stashing, this option can workaround the problem.
|
||||
|
|
@ -79,11 +82,15 @@ Parameters:
|
|||
Note that when no differeces are found we get a page saying *No diff*.
|
||||
- ``only_first_sch_page`` :index:`: <pair: output - diff - options; only_first_sch_page>` [boolean=false] Compare only the main schematic page (root page).
|
||||
- ``pcb`` :index:`: <pair: output - diff - options; pcb>` [boolean=true] Compare the PCB, otherwise compare the schematic.
|
||||
- ``pre_transform`` :index:`: <pair: output - diff - 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.
|
||||
|
||||
- ``threshold`` :index:`: <pair: output - diff - options; threshold>` [number=0] [0,1000000] Error threshold for the `stats` mode, 0 is no error. When specified a
|
||||
difference bigger than the indicated value will make the diff fail.
|
||||
KiBot will return error level 29 and the diff generation will be aborted.
|
||||
- ``use_file_id`` :index:`: <pair: output - diff - options; use_file_id>` [boolean=false] When creating the link name of an output file related to a variant use the variant
|
||||
`file_id` instead of its name.
|
||||
- ``variant`` :index:`: <pair: output - diff - options; variant>` [string=''] Board variant to apply.
|
||||
|
||||
- **type** :index:`: <pair: output - diff; type>` [string=''] Type of output.
|
||||
- ``category`` :index:`: <pair: output - diff; category>` [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ Parameters:
|
|||
- Valid keys:
|
||||
|
||||
- ``color`` :index:`: <pair: output - pcb_print - options - pages - layers; color>` [string=''] Color used for this layer.
|
||||
KiCad 6+: don't forget the alpha channel for layers like the solder mask.
|
||||
- ``description`` :index:`: <pair: output - pcb_print - options - pages - layers; description>` [string=''] A description for the layer, for documentation purposes.
|
||||
A default can be specified using the `layer_defaults` global option.
|
||||
- ``force_plot_invisible_refs_vals`` :index:`: <pair: output - pcb_print - options - pages - layers; force_plot_invisible_refs_vals>` [boolean=false] Include references and values even when they are marked as invisible.
|
||||
|
|
@ -79,6 +80,7 @@ Parameters:
|
|||
- Valid keys:
|
||||
|
||||
- ``color`` :index:`: <pair: output - pcb_print - options - pages - repeat_layers; color>` [string=''] Color used for this layer.
|
||||
KiCad 6+: don't forget the alpha channel for layers like the solder mask.
|
||||
- ``description`` :index:`: <pair: output - pcb_print - options - pages - repeat_layers; description>` [string=''] A description for the layer, for documentation purposes.
|
||||
A default can be specified using the `layer_defaults` global option.
|
||||
- ``force_plot_invisible_refs_vals`` :index:`: <pair: output - pcb_print - options - pages - repeat_layers; force_plot_invisible_refs_vals>` [boolean=false] Include references and values even when they are marked as invisible.
|
||||
|
|
|
|||
|
|
@ -99,6 +99,14 @@ For more information about the docker images visit
|
|||
`kicad_debian <https://github.com/INTI-CMNB/kicad_debian>`__ and
|
||||
`kicad_auto <https://github.com/INTI-CMNB/kicad_auto>`__.
|
||||
|
||||
.. index::
|
||||
pair: usage; GitHub
|
||||
|
||||
GitHub workflows
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
A work-in-progress guide can be found `here <https://github.com/INTI-CMNB/KiBot/blob/dev/docs/GITHUB-ACTIONS-README.md>`__.
|
||||
|
||||
|
||||
.. index::
|
||||
pair: usage; GitHub Actions
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class EasyedaApi:
|
|||
logger.warning(W_EEDA3D+"Failed to download STEP 3D model data found for EasyEDA uuid: "+uuid)
|
||||
step = None
|
||||
else:
|
||||
step = r.content.decode()
|
||||
step = r.content
|
||||
return obj, step
|
||||
|
||||
|
||||
|
|
@ -340,7 +340,7 @@ class Exporter3dModelKicad:
|
|||
else:
|
||||
name_step = os.path.splitext(name_step)[0]+'.step'
|
||||
name_step = os.path.join(lib_path, name_step)
|
||||
with open(name_step, "w", encoding="utf-8") as my_lib:
|
||||
with open(name_step, "wb") as my_lib:
|
||||
my_lib.write(self.output_step)
|
||||
return name_wrl or name_step
|
||||
|
||||
|
|
|
|||
|
|
@ -50,8 +50,9 @@ from .. import log
|
|||
|
||||
logger = log.get_logger()
|
||||
setup = None
|
||||
# The version of "kicad_wks" used for all tests
|
||||
SUP_VERSION = 20210606
|
||||
# The version of "kicad_wks" used for all tests is 20210606
|
||||
# 20220228 seems to be fully supported
|
||||
SUP_VERSION = 20220228
|
||||
# Hash to convert KiCad 5 "%X" markers to KiCad 6 "${XXX}" text variables
|
||||
KI5_2_KI6 = {'K': 'KICAD_VERSION', 'S': '#', 'N': '##', 'C0': 'COMMENT1', 'C1': 'COMMENT2', 'C2': 'COMMENT3',
|
||||
'C3': 'COMMENT4', 'C4': 'COMMENT5', 'C5': 'COMMENT6', 'C6': 'COMMENT7', 'C7': 'COMMENT8',
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ W_EXTRAINVAL = '(W133) '
|
|||
W_BADANGLE = '(W134) '
|
||||
W_VALMISMATCH = '(W135) '
|
||||
W_BADOFFSET = '(W136) '
|
||||
W_BUG16418 = '(W137) '
|
||||
# Somehow arbitrary, the colors are real, but can be different
|
||||
PCB_MAT_COLORS = {'fr1': "937042", 'fr2': "949d70", 'fr3': "adacb4", 'fr4': "332B16", 'fr5': "6cc290"}
|
||||
PCB_FINISH_COLORS = {'hal': "8b898c", 'hasl': "8b898c", 'imag': "8b898c", 'enig': "cfb96e", 'enepig': "cfb96e",
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ class Blender_ExportOptions(BaseOptions):
|
|||
|
||||
@output_class
|
||||
class Blender_Export(Base3D):
|
||||
""" Blender Export **Experimental**
|
||||
""" Blender Export
|
||||
Exports the PCB in various 3D file formats.
|
||||
Also renders the PCB with high-quality.
|
||||
Needs KiCad 6 or newer.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ from .gs import GS
|
|||
from .kiplot import load_any_sch, run_command, config_output, get_output_dir, run_output
|
||||
from .layer import Layer
|
||||
from .misc import DIFF_TOO_BIG, FAILED_EXECUTE
|
||||
from .optionable import BaseOptions
|
||||
from .out_base import VariantOptions
|
||||
from .registrable import RegOutput
|
||||
from .macros import macros, document, output_class # noqa: F401
|
||||
|
|
@ -41,7 +40,7 @@ logger = log.get_logger()
|
|||
STASH_MSG = 'KiBot_Changes_Entry'
|
||||
|
||||
|
||||
class DiffOptions(BaseOptions):
|
||||
class DiffOptions(VariantOptions):
|
||||
def __init__(self):
|
||||
with document:
|
||||
self.output = GS.def_global_output
|
||||
|
|
@ -458,12 +457,20 @@ class DiffOptions(BaseOptions):
|
|||
def cache_current(self):
|
||||
""" The file as we interpreted it """
|
||||
if self.pcb:
|
||||
fname, dir_name = VariantOptions.save_tmp_dir_board('diff')
|
||||
fname, dir_name = self.save_tmp_dir_board('diff')
|
||||
self.dirs_to_remove.append(dir_name)
|
||||
else:
|
||||
dir_name = mkdtemp()
|
||||
fname = GS.sch.save_variant(dir_name)
|
||||
GS.copy_project_sch(dir_name)
|
||||
self.dirs_to_remove.append(dir_name)
|
||||
if self._comps:
|
||||
# We have a variant/filter applied
|
||||
dir_name = mkdtemp()
|
||||
fname = GS.sch.save_variant(dir_name)
|
||||
GS.copy_project_sch(dir_name)
|
||||
self.dirs_to_remove.append(dir_name)
|
||||
else:
|
||||
# Just use the current file
|
||||
# Note: The KiCad 7 DNP field needs some filter to be honored
|
||||
dir_name = GS.sch_dir
|
||||
fname = os.path.basename(GS.sch_file)
|
||||
res = self.cache_file(os.path.join(dir_name, fname))
|
||||
self.git_hash = 'Current'
|
||||
return res
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ from .kicad.config import KiConf
|
|||
from .kicad.v5_sch import SchError
|
||||
from .kicad.pcb import PCB
|
||||
from .misc import (PDF_PCB_PRINT, W_PDMASKFAIL, W_MISSTOOL, PCBDRAW_ERR, W_PCBDRAW, VIATYPE_THROUGH, VIATYPE_BLIND_BURIED,
|
||||
VIATYPE_MICROVIA, FONT_HELP_TEXT)
|
||||
VIATYPE_MICROVIA, FONT_HELP_TEXT, W_BUG16418)
|
||||
from .create_pdf import create_pdf_from_pages
|
||||
from .macros import macros, document, output_class # noqa: F401
|
||||
from .drill_marks import DRILL_MARKS_MAP, add_drill_marks
|
||||
|
|
@ -138,7 +138,8 @@ class LayerOptions(Layer):
|
|||
self._unknown_is_error = True
|
||||
with document:
|
||||
self.color = ""
|
||||
""" Color used for this layer """
|
||||
""" Color used for this layer.
|
||||
KiCad 6+: don't forget the alpha channel for layers like the solder mask """
|
||||
self.plot_footprint_refs = True
|
||||
""" Include the footprint references """
|
||||
self.plot_footprint_values = True
|
||||
|
|
@ -489,6 +490,7 @@ class PCB_PrintOptions(VariantOptions):
|
|||
vars['TITLE'] = tb.GetTitle()
|
||||
vars['FILENAME'] = GS.pcb_basename+'.kicad_pcb'
|
||||
vars['SHEETNAME'] = p.sheet
|
||||
vars['SHEETPATH'] = '' # Only relevant for an schematic
|
||||
layer = ''
|
||||
for la in p.layers:
|
||||
if len(layer):
|
||||
|
|
@ -887,6 +889,33 @@ class PCB_PrintOptions(VariantOptions):
|
|||
from lxml.etree import tostring
|
||||
return tostring(image).decode()
|
||||
|
||||
# def kicad7_scale_workaround(self, id, temp_dir, out_file, color, mirror, scale):
|
||||
# logger.error(f'Fix {out_file}')
|
||||
# svg = svgutils.fromfile(out_file)
|
||||
# logger.error(self.get_view_box(svg))
|
||||
# bbox = GS.board.GetBoundingBox()
|
||||
# logger.error(bbox.GetSize())
|
||||
# for f in GS.board.Footprints():
|
||||
# logger.error('Pads')
|
||||
# for p in f.Pads():
|
||||
# bbox = p.GetBoundingBox()
|
||||
# logger.error(bbox.GetSize())
|
||||
# logger.error('Graphics')
|
||||
# for gi in f.GraphicalItems():
|
||||
# bbox = gi.GetBoundingBox()
|
||||
# logger.error(bbox.GetSize())
|
||||
# logger.error('Drawings')
|
||||
# for d in GS.board.Drawings():
|
||||
# bbox = d.GetBoundingBox()
|
||||
# logger.error(bbox.GetSize())
|
||||
# logger.error('Tracks')
|
||||
# for t in GS.board.Tracks():
|
||||
# bbox = t.GetBoundingBox()
|
||||
# logger.error(bbox.GetSize())
|
||||
#
|
||||
# def get_view_box(self, svg):
|
||||
# return tuple(map(lambda x: float(x), svg.root.get('viewBox').split(' ')))
|
||||
|
||||
def plot_realistic_solder_mask(self, id, temp_dir, out_file, color, mirror, scale):
|
||||
""" Plot the solder mask closer to reality, not the apertures """
|
||||
if not self.realistic_solder_mask or (id != F_Mask and id != B_Mask):
|
||||
|
|
@ -1046,6 +1075,19 @@ class PCB_PrintOptions(VariantOptions):
|
|||
if cur_name != user_name and os.path.isfile(cur_name):
|
||||
os.replace(cur_name, user_name)
|
||||
|
||||
def check_ki7_scale_issue(self):
|
||||
""" Check if all visible layers has scaling problems """
|
||||
if not GS.ki7:
|
||||
return False
|
||||
cur_vis = GS.board.GetVisibleLayers()
|
||||
# Copper layers are OK
|
||||
if len(cur_vis.CuStack()):
|
||||
return False
|
||||
for la in ['Edge.Cuts', 'F.SilkS', 'B.SilkS']:
|
||||
if cur_vis.Contains(Layer.DEFAULT_LAYER_NAMES[la]):
|
||||
return False
|
||||
return True
|
||||
|
||||
def generate_output(self, output):
|
||||
self.check_tools()
|
||||
# Avoid KiCad 5 complaining about fake vias diameter == drill == 0
|
||||
|
|
@ -1092,10 +1134,13 @@ class PCB_PrintOptions(VariantOptions):
|
|||
# Make visible only the layers we need
|
||||
# This is very important when scaling, otherwise the results are controlled by the .kicad_prl (See #407)
|
||||
if not self.individual_page_scaling:
|
||||
# Make all the layers in all the pages visible
|
||||
vis_layers = LSET()
|
||||
for p in self.pages:
|
||||
for la in p.layers:
|
||||
vis_layers.addLayer(la._id)
|
||||
if self.force_edge_cuts:
|
||||
vis_layers.addLayer(edge_id)
|
||||
GS.board.SetVisibleLayers(vis_layers)
|
||||
# Generate the output, page by page
|
||||
pages = []
|
||||
|
|
@ -1106,7 +1151,14 @@ class PCB_PrintOptions(VariantOptions):
|
|||
vis_layers = LSET()
|
||||
for la in p.layers:
|
||||
vis_layers.addLayer(la._id)
|
||||
if self.force_edge_cuts:
|
||||
vis_layers.addLayer(edge_id)
|
||||
GS.board.SetVisibleLayers(vis_layers)
|
||||
needs_ki7_scale_workaround = p.scaling != 1.0 and self.check_ki7_scale_issue()
|
||||
if needs_ki7_scale_workaround:
|
||||
logger.warning(f"{W_BUG16418}In output `{self._parent.name}` page {n+1}: "
|
||||
"KiCad 7 bug #16418 prevents correct page view. "
|
||||
"Add some copper, silk or edge layer")
|
||||
# Use a dir for each page, avoid overwriting files, just for debug purposes
|
||||
page_str = "%02d" % (n+1)
|
||||
temp_dir = os.path.join(temp_dir_base, page_str)
|
||||
|
|
@ -1144,6 +1196,8 @@ class PCB_PrintOptions(VariantOptions):
|
|||
filelist.append((pc.GetPlotFileName(), la.color))
|
||||
self.plot_extra_cu(id, la, pc, p, filelist)
|
||||
self.plot_realistic_solder_mask(id, temp_dir, filelist[-1][0], filelist[-1][1], p.mirror, p.scaling)
|
||||
# if needs_ki7_scale_workaround:
|
||||
# self.kicad7_scale_workaround(id, temp_dir, filelist[-1][0], filelist[-1][1], p.mirror, p.scaling)
|
||||
# 2) Plot the frame using an empty layer and 1.0 scale
|
||||
po.SetMirror(False)
|
||||
if self.plot_sheet_reference:
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ Dependencies:
|
|||
version: 2.2.1
|
||||
"""
|
||||
import os
|
||||
from shutil import move
|
||||
from sys import exit
|
||||
from tempfile import NamedTemporaryFile
|
||||
from .macros import macros, pre_class # noqa: F401
|
||||
from .gs import GS
|
||||
from .optionable import Optionable
|
||||
|
|
@ -52,8 +54,12 @@ class Run_ERC(BasePreFlight): # noqa: F821
|
|||
# But here we need data from it.
|
||||
output = self.get_targets()[0]
|
||||
os.makedirs(os.path.dirname(output), exist_ok=True)
|
||||
logger.debug('ERC report: '+output)
|
||||
cmd = [command, 'run_erc', '-o', output, '-g', str(GS.global_erc_grid)]
|
||||
# Workaround for KiCad 7 odd behavior: it forces a file extension
|
||||
# Note: One thing is adding the extension before you enter a name, other is add something you removed on purpose
|
||||
with NamedTemporaryFile(mode='w', delete=False, suffix='.rpt', prefix='erc_report') as f:
|
||||
tmp_name = f.name
|
||||
logger.debug('ERC report: '+tmp_name)
|
||||
cmd = [command, 'run_erc', '-o', tmp_name, '-g', str(GS.global_erc_grid)]
|
||||
if BasePreFlight.get_option('erc_warnings'): # noqa: F821
|
||||
cmd.append('-w')
|
||||
if GS.filter_file:
|
||||
|
|
@ -63,6 +69,10 @@ class Run_ERC(BasePreFlight): # noqa: F821
|
|||
cmd = self.add_extra_options(cmd)
|
||||
logger.info('- Running the ERC')
|
||||
ret = self.exec_with_retry(cmd)
|
||||
try:
|
||||
move(tmp_name, output)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
if ret:
|
||||
if ret > 127:
|
||||
ret = -(256-ret)
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ outputs:
|
|||
type: compress
|
||||
dir: @_KIBOT_MANF_DIR_COMP@
|
||||
options:
|
||||
move_files: @_KIBOT_COMPRESS_MOVE@
|
||||
files:
|
||||
- from_output: _Elecrow_gerbers@_KIBOT_IMPORT_ID@
|
||||
dest: /
|
||||
|
|
@ -71,6 +72,7 @@ definitions:
|
|||
_KIBOT_MANF_DIR_COMP: '@_KIBOT_IMPORT_DIR@'
|
||||
_KIBOT_PLOT_FOOTPRINT_REFS: true
|
||||
_KIBOT_PLOT_FOOTPRINT_VALUES: true
|
||||
_KIBOT_COMPRESS_MOVE: true
|
||||
_KIBOT_GERBER_LAYERS: |
|
||||
- copper
|
||||
- F.SilkS
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ outputs:
|
|||
type: compress
|
||||
dir: @_KIBOT_MANF_DIR_COMP@
|
||||
options:
|
||||
move_files: @_KIBOT_COMPRESS_MOVE@
|
||||
files:
|
||||
- from_output: _FusionPCB_gerbers@_KIBOT_IMPORT_ID@
|
||||
dest: /
|
||||
|
|
@ -71,6 +72,7 @@ definitions:
|
|||
_KIBOT_MANF_DIR_COMP: '@_KIBOT_IMPORT_DIR@'
|
||||
_KIBOT_PLOT_FOOTPRINT_REFS: true
|
||||
_KIBOT_PLOT_FOOTPRINT_VALUES: true
|
||||
_KIBOT_COMPRESS_MOVE: true
|
||||
_KIBOT_GERBER_LAYERS: |
|
||||
- copper
|
||||
- F.SilkS
|
||||
|
|
|
|||
|
|
@ -131,15 +131,12 @@ outputs:
|
|||
options:
|
||||
# Position and BoM can be disabled
|
||||
skip_not_run: true
|
||||
move_files: @_KIBOT_COMPRESS_MOVE@
|
||||
files:
|
||||
- from_output: _JLCPCB_gerbers@_KIBOT_IMPORT_ID@
|
||||
dest: /
|
||||
- from_output: _JLCPCB_drill@_KIBOT_IMPORT_ID@
|
||||
dest: /
|
||||
- from_output: _JLCPCB_position@_KIBOT_IMPORT_ID@
|
||||
dest: /
|
||||
- from_output: _JLCPCB_bom@_KIBOT_IMPORT_ID@
|
||||
dest: /
|
||||
|
||||
...
|
||||
definitions:
|
||||
|
|
@ -156,6 +153,7 @@ definitions:
|
|||
_KIBOT_BOM_ENABLED: true
|
||||
_KIBOT_PLOT_FOOTPRINT_REFS: true
|
||||
_KIBOT_PLOT_FOOTPRINT_VALUES: false
|
||||
_KIBOT_COMPRESS_MOVE: true
|
||||
_KIBOT_GERBER_LAYERS: |
|
||||
- copper
|
||||
- F.SilkS
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ outputs:
|
|||
type: compress
|
||||
dir: @_KIBOT_MANF_DIR_COMP@
|
||||
options:
|
||||
move_files: @_KIBOT_COMPRESS_MOVE@
|
||||
files:
|
||||
- from_output: _P-Ban_gerbers@_KIBOT_IMPORT_ID@
|
||||
dest: /
|
||||
|
|
@ -77,6 +78,7 @@ definitions:
|
|||
_KIBOT_MANF_DIR_COMP: '@_KIBOT_IMPORT_DIR@'
|
||||
_KIBOT_PLOT_FOOTPRINT_REFS: true
|
||||
_KIBOT_PLOT_FOOTPRINT_VALUES: true
|
||||
_KIBOT_COMPRESS_MOVE: true
|
||||
_KIBOT_GERBER_LAYERS: |
|
||||
- F.Cu
|
||||
- B.Cu
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ outputs:
|
|||
dir: @_KIBOT_MANF_DIR_COMP@
|
||||
options:
|
||||
format: ZIP
|
||||
move_files: @_KIBOT_COMPRESS_MOVE@
|
||||
files:
|
||||
- from_output: _PCBWay_gerbers@_KIBOT_IMPORT_ID@
|
||||
dest: /
|
||||
|
|
@ -79,6 +80,7 @@ definitions:
|
|||
_KIBOT_MANF_DIR_COMP: '@_KIBOT_IMPORT_DIR@'
|
||||
_KIBOT_PLOT_FOOTPRINT_REFS: true
|
||||
_KIBOT_PLOT_FOOTPRINT_VALUES: true
|
||||
_KIBOT_COMPRESS_MOVE: true
|
||||
_KIBOT_GERBER_LAYERS: |
|
||||
- copper
|
||||
- F.SilkS
|
||||
|
|
|
|||
Loading…
Reference in New Issue