[Stencil_For_Jig] New output
- Just the other type of stencil supported by KiKit.
This commit is contained in:
parent
2a46ab1cff
commit
a9000716a7
|
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
With support for `pcbdraw` and `render_3d`.
|
||||
- `panelize` to create a PCB panel containing N copies of the PCB.
|
||||
- `stencil_3d` to create 3D self-registering printable stencils.
|
||||
- `stencil_for_jig` to create steel stencils and 3D register.
|
||||
- generic filters: options to filter by PCB side
|
||||
- BoM:
|
||||
- Option to link to Mouser site.
|
||||
|
|
|
|||
61
README.md
61
README.md
|
|
@ -145,11 +145,14 @@ Notes:
|
|||
- Print the page frame in GUI mode for `pcb_print` (v1.6.7)
|
||||
|
||||
[**KiKit**](https://github.com/yaqwsx/KiKit) [](https://github.com/yaqwsx/KiKit) 
|
||||
- Mandatory for: `panelize`, `stencil_3d`
|
||||
- Mandatory for: `panelize`, `stencil_3d`, `stencil_for_jig`
|
||||
|
||||
[**LXML**](https://pypi.org/project/LXML/) [](https://pypi.org/project/LXML/) [](https://packages.debian.org/bullseye/python3-lxml) 
|
||||
- Mandatory for: `pcb_print`, `pcbdraw`
|
||||
|
||||
[**OpenSCAD**](https://openscad.org/) [](https://openscad.org/) [](https://packages.debian.org/bullseye/openscad)
|
||||
- Mandatory for: `stencil_3d`, `stencil_for_jig`
|
||||
|
||||
[**KiCost**](https://github.com/hildogjr/KiCost) v1.1.8 [](https://github.com/hildogjr/KiCost) 
|
||||
- Mandatory for `kicost`
|
||||
- Optional to find components costs and specs for `bom`
|
||||
|
|
@ -166,9 +169,6 @@ Notes:
|
|||
[**mistune**](https://pypi.org/project/mistune/) [](https://pypi.org/project/mistune/) [](https://packages.debian.org/bullseye/python3-mistune)
|
||||
- Mandatory for `populate`
|
||||
|
||||
[**OpenSCAD**](https://openscad.org/) [](https://openscad.org/) [](https://packages.debian.org/bullseye/openscad)
|
||||
- Mandatory for `stencil_3d`
|
||||
|
||||
[**QRCodeGen**](https://pypi.org/project/QRCodeGen/) [](https://pypi.org/project/QRCodeGen/) [](https://pypi.org/project/QRCodeGen/) [](https://packages.debian.org/bullseye/python3-qrcodegen) 
|
||||
- Mandatory for `qr_lib`
|
||||
|
||||
|
|
@ -3574,7 +3574,7 @@ Notes:
|
|||
- **`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.
|
||||
- **`options`**: [dict] Options for the `Stencil_3D` output.
|
||||
- **`options`**: [dict] Options for the `stencil_3d` output.
|
||||
* Valid keys:
|
||||
- **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i='stencil_3d_top'|'stencil_3d_bottom'|'stencil_3d_edge',
|
||||
%x='stl'|'scad'|'dxf'). Affected by global options.
|
||||
|
|
@ -3609,6 +3609,57 @@ 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.
|
||||
|
||||
* Steel Stencils for Alignment Jig
|
||||
* Type: `stencil_for_jig`
|
||||
* Description: Creates the gerber files needed to create steel stencils.
|
||||
These stencils are designed to be used with an acrilic alignment jig and a 3D
|
||||
printable support, that is also generated.
|
||||
[KiKit docs](https://github.com/yaqwsx/KiKit/blob/master/doc/stencil.md).
|
||||
Note that we don't implement `--ignore` option, you should use a variant for this
|
||||
* Valid keys:
|
||||
- **`comment`**: [string=''] A comment for documentation purposes.
|
||||
- **`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.
|
||||
- **`options`**: [dict] Options for the `stencil_for_jig` output.
|
||||
* Valid keys:
|
||||
- *jig_height*: Alias for jigheight.
|
||||
- *jig_thickness*: Alias for jigthickness.
|
||||
- *jig_width*: Alias for jigwidth.
|
||||
- **`jigheight`**: [number=100] Jig frame height [mm].
|
||||
- **`jigthickness`**: [number=3] Jig thickness [mm].
|
||||
- **`jigwidth`**: [number=100] Jig frame width [mm].
|
||||
- **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i='stencil_for_jig_top'|'stencil_for_jig_bottom',
|
||||
%x='stl'|'scad'|'gbp'|'gtp'|'gbrjob'). Affected by global options.
|
||||
- `cutout`: [string|list(string)] List of components to add a cutout based on the component courtyard.
|
||||
This is useful when you have already pre-populated board and you want to populate more
|
||||
components.
|
||||
- `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.
|
||||
- `include_scad`: [boolean=true] Include the generated OpenSCAD files.
|
||||
- *pcb_thickness*: Alias for pcbthickness.
|
||||
- `pcbthickness`: [number=0] PCB thickness [mm]. If 0 we will ask KiCad.
|
||||
- `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.
|
||||
- *register_border_inner*: Alias for registerborderinner.
|
||||
- *register_border_outer*: Alias for registerborderouter.
|
||||
- `registerborderinner`: [number=1] Inner register border [mm].
|
||||
- `registerborderouter`: [number=3] Outer register border [mm].
|
||||
- `side`: [string='auto'] [top,bottom,auto,both] Which side of the PCB we want. Using `auto` will detect which
|
||||
side contains solder paste.
|
||||
- `tolerance`: [number=0.05] Enlarges the register by the tolerance value [mm].
|
||||
- `variant`: [string=''] Board variant to apply.
|
||||
- `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.
|
||||
- `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.
|
||||
- `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.
|
||||
|
||||
* STEP (ISO 10303-21 Clear Text Encoding of the Exchange Structure)
|
||||
* Type: `step`
|
||||
* Description: Exports the PCB as a 3D model.
|
||||
|
|
|
|||
|
|
@ -2506,6 +2506,56 @@ outputs:
|
|||
thickness: 0.15
|
||||
# [string=''] Board variant to apply
|
||||
variant: ''
|
||||
# Steel Stencils for Alignment Jig:
|
||||
# These stencils are designed to be used with an acrilic alignment jig and a 3D
|
||||
# printable support, that is also generated.
|
||||
# [KiKit docs](https://github.com/yaqwsx/KiKit/blob/master/doc/stencil.md).
|
||||
# Note that we don't implement `--ignore` option, you should use a variant for this
|
||||
- name: 'stencil_for_jig_example'
|
||||
comment: 'Creates the gerber files needed to create steel stencils.'
|
||||
type: 'stencil_for_jig'
|
||||
dir: 'Example/stencil_for_jig_dir'
|
||||
options:
|
||||
# [string|list(string)] List of components to add a cutout based on the component courtyard.
|
||||
# This is useful when you have already pre-populated board and you want to populate more
|
||||
# components
|
||||
cutout: ''
|
||||
# [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 generated OpenSCAD files
|
||||
include_scad: true
|
||||
# `jig_height` is an alias for `jigheight`
|
||||
# `jig_thickness` is an alias for `jigthickness`
|
||||
# `jig_width` is an alias for `jigwidth`
|
||||
# [number=100] Jig frame height [mm]
|
||||
jigheight: 100
|
||||
# [number=3] Jig thickness [mm]
|
||||
jigthickness: 3
|
||||
# [number=100] Jig frame width [mm]
|
||||
jigwidth: 100
|
||||
# [string='%f-%i%I%v.%x'] Filename for the output (%i='stencil_for_jig_top'|'stencil_for_jig_bottom',
|
||||
# %x='stl'|'scad'|'gbp'|'gtp'|'gbrjob'). Affected by global options
|
||||
output: '%f-%i%I%v.%x'
|
||||
# `pcb_thickness` is an alias for `pcbthickness`
|
||||
# [number=0] PCB thickness [mm]. If 0 we will ask KiCad
|
||||
pcbthickness: 0
|
||||
# [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'
|
||||
# `register_border_inner` is an alias for `registerborderinner`
|
||||
# `register_border_outer` is an alias for `registerborderouter`
|
||||
# [number=1] Inner register border [mm]
|
||||
registerborderinner: 1
|
||||
# [number=3] Outer register border [mm]
|
||||
registerborderouter: 3
|
||||
# [string='auto'] [top,bottom,auto,both] Which side of the PCB we want. Using `auto` will detect which
|
||||
# side contains solder paste
|
||||
side: 'auto'
|
||||
# [number=0.05] Enlarges the register by the tolerance value [mm]
|
||||
tolerance: 0.05
|
||||
# [string=''] Board variant to apply
|
||||
variant: ''
|
||||
# STEP (ISO 10303-21 Clear Text Encoding of the Exchange Structure):
|
||||
# This is the most common 3D format for exchange purposes.
|
||||
# This output is what you get from the 'File/Export/STEP' menu in pcbnew.
|
||||
|
|
|
|||
|
|
@ -92,6 +92,36 @@ class Stencil_3D_Options(VariantOptions):
|
|||
# TODO: auto side is tricky, needs variants applied
|
||||
return [self._parent.expand_filename(out_dir, self.output)]
|
||||
|
||||
def create_cmd(self, cmd_kikit):
|
||||
cmd = [cmd_kikit, 'stencil', 'createprinted',
|
||||
'--thickness', str(self.thickness),
|
||||
'--framewidth', str(self.framewidth),
|
||||
'--pcbthickness', str(self.pcbthickness)]
|
||||
if self.cutout:
|
||||
cmd.extend(['--coutout', self.cutout])
|
||||
if self.frameclearance:
|
||||
cmd.extend(['--frameclearance', str(self.frameclearance)])
|
||||
if self.enlargeholes:
|
||||
cmd.extend(['--enlargeholes', str(self.enlargeholes)])
|
||||
|
||||
def move_outputs(self, tmp, prj_name, do_top, do_bottom):
|
||||
replacements = {}
|
||||
# The edge is needed by any of the OpenSCAD files
|
||||
if (do_top or do_bottom) and self.include_scad:
|
||||
self.move_output(tmp, prj_name+'-EdgeCuts.dxf', 'Stencil_For_Jig_edge', 'dxf', replacements)
|
||||
# Top side
|
||||
if do_top:
|
||||
self.move_output(tmp, 'topStencil.stl', 'Stencil_For_Jig_top', 'stl')
|
||||
if self.include_scad:
|
||||
self.move_output(tmp, prj_name+'-PasteTop.dxf', 'Stencil_For_Jig_top', 'dxf', replacements)
|
||||
self.move_output(tmp, 'topStencil.scad', 'Stencil_For_Jig_top', 'scad', replacements, patch=True)
|
||||
# Bottom side
|
||||
if do_bottom:
|
||||
self.move_output(tmp, 'bottomStencil.stl', 'Stencil_For_Jig_bottom', 'stl')
|
||||
if self.include_scad:
|
||||
self.move_output(tmp, prj_name+'-PasteBottom.dxf', 'Stencil_For_Jig_bottom', 'dxf', replacements)
|
||||
self.move_output(tmp, 'bottomStencil.scad', 'Stencil_For_Jig_bottom', 'scad', replacements, patch=True)
|
||||
|
||||
def run(self, output):
|
||||
cmd_kikit = self.ensure_tool('KiKit')
|
||||
self.ensure_tool('OpenSCAD')
|
||||
|
|
@ -105,23 +135,15 @@ class Stencil_3D_Options(VariantOptions):
|
|||
self.unfilter_pcb_components(GS.board)
|
||||
# Avoid running the tool if we will generate useless models
|
||||
if self.side == 'auto' and not detected_top and not detected_bottom:
|
||||
logger.warning(W_AUTONONE+'No solder paste detected, skipping 3D stencil generation')
|
||||
logger.warning(W_AUTONONE+'No solder paste detected, skipping stencil generation')
|
||||
return
|
||||
# If no PCB thickness indicated ask KiCad
|
||||
if not self.pcbthickness:
|
||||
ds = GS.board.GetDesignSettings()
|
||||
self.pcbthickness = self.to_mm(ds.GetBoardThickness())
|
||||
# Create the command line
|
||||
cmd = [cmd_kikit, 'stencil', 'createprinted',
|
||||
'--thickness', str(self.thickness),
|
||||
'--framewidth', str(self.framewidth),
|
||||
'--pcbthickness', str(self.pcbthickness)]
|
||||
if self.cutout:
|
||||
cmd.extend(['--coutout', self.cutout])
|
||||
if self.frameclearance:
|
||||
cmd.extend(['--frameclearance', str(self.frameclearance)])
|
||||
if self.enlargeholes:
|
||||
cmd.extend(['--enlargeholes', str(self.enlargeholes)])
|
||||
cmd = self.create_cmd(cmd_kikit)
|
||||
# Create the outputs
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
cmd.append(fname)
|
||||
cmd.append(tmp)
|
||||
|
|
@ -145,22 +167,7 @@ class Stencil_3D_Options(VariantOptions):
|
|||
do_top = detected_top
|
||||
do_bottom = detected_bottom
|
||||
prj_name = os.path.splitext(os.path.basename(fname))[0]
|
||||
replacements = {}
|
||||
# The edge is needed by any of the OpenSCAD files
|
||||
if (do_top or do_bottom) and self.include_scad:
|
||||
self.move_output(tmp, prj_name+'-EdgeCuts.dxf', 'stencil_3d_edge', 'dxf', replacements)
|
||||
# Top side
|
||||
if do_top:
|
||||
self.move_output(tmp, 'topStencil.stl', 'stencil_3d_top', 'stl')
|
||||
if self.include_scad:
|
||||
self.move_output(tmp, prj_name+'-PasteTop.dxf', 'stencil_3d_top', 'dxf', replacements)
|
||||
self.move_output(tmp, 'topStencil.scad', 'stencil_3d_top', 'scad', replacements, patch=True)
|
||||
# Bottom side
|
||||
if do_bottom:
|
||||
self.move_output(tmp, 'bottomStencil.stl', 'stencil_3d_bottom', 'stl')
|
||||
if self.include_scad:
|
||||
self.move_output(tmp, prj_name+'-PasteBottom.dxf', 'stencil_3d_bottom', 'dxf', replacements)
|
||||
self.move_output(tmp, 'bottomStencil.scad', 'stencil_3d_bottom', 'scad', replacements, patch=True)
|
||||
self.move_outputs(tmp, prj_name, do_top, do_bottom)
|
||||
|
||||
|
||||
@output_class
|
||||
|
|
@ -177,4 +184,4 @@ class Stencil_3D(BaseOutput): # noqa: F821
|
|||
super().__init__()
|
||||
with document:
|
||||
self.options = Stencil_3D_Options
|
||||
""" *[dict] Options for the `Stencil_3D` output """
|
||||
""" *[dict] Options for the `stencil_3d` output """
|
||||
|
|
|
|||
|
|
@ -0,0 +1,194 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2022 Salvador E. Tropea
|
||||
# Copyright (c) 2022 Instituto Nacional de Tecnología Industrial
|
||||
# License: GPL-3.0
|
||||
# Project: KiBot (formerly KiPlot)
|
||||
"""
|
||||
Dependencies:
|
||||
- from: KiKit
|
||||
role: mandatory
|
||||
- name: OpenSCAD
|
||||
url: https://openscad.org/
|
||||
url_down: https://openscad.org/downloads.html
|
||||
command: openscad
|
||||
debian: openscad
|
||||
arch: openscad
|
||||
role: mandatory
|
||||
"""
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
from .error import PlotError
|
||||
from .gs import GS
|
||||
from .kiplot import run_command
|
||||
from .out_base import VariantOptions
|
||||
from .misc import W_AUTONONE
|
||||
from .macros import macros, document, output_class # noqa: F401
|
||||
from . import log
|
||||
|
||||
logger = log.get_logger()
|
||||
|
||||
|
||||
class Stencil_For_Jig_Options(VariantOptions):
|
||||
def __init__(self):
|
||||
with document:
|
||||
self.output = GS.def_global_output
|
||||
""" *Filename for the output (%i='stencil_for_jig_top'|'stencil_for_jig_bottom',
|
||||
%x='stl'|'scad'|'gbp'|'gtp'|'gbrjob') """
|
||||
self.side = 'auto'
|
||||
""" [top,bottom,auto,both] Which side of the PCB we want. Using `auto` will detect which
|
||||
side contains solder paste """
|
||||
self.include_scad = True
|
||||
""" Include the generated OpenSCAD files """
|
||||
self.cutout = ''
|
||||
""" [string|list(string)] List of components to add a cutout based on the component courtyard.
|
||||
This is useful when you have already pre-populated board and you want to populate more
|
||||
components """
|
||||
self.pcbthickness = 0
|
||||
""" PCB thickness [mm]. If 0 we will ask KiCad """
|
||||
self.pcb_thickness = None
|
||||
""" {pcbthickness} """
|
||||
self.jigthickness = 3
|
||||
""" *Jig thickness [mm] """
|
||||
self.jig_thickness = None
|
||||
""" {jigthickness} """
|
||||
self.registerborderouter = 3
|
||||
""" Outer register border [mm] """
|
||||
self.register_border_outer = None
|
||||
""" {registerborderouter} """
|
||||
self.registerborderinner = 1
|
||||
""" Inner register border [mm] """
|
||||
self.register_border_inner = None
|
||||
""" {registerborderinner} """
|
||||
self.tolerance = 0.05
|
||||
""" Enlarges the register by the tolerance value [mm] """
|
||||
self.jigwidth = 100
|
||||
""" *Jig frame width [mm] """
|
||||
self.jig_width = None
|
||||
""" {jigwidth} """
|
||||
self.jigheight = 100
|
||||
""" *Jig frame height [mm] """
|
||||
self.jig_height = None
|
||||
""" {jigheight} """
|
||||
super().__init__()
|
||||
|
||||
def config(self, parent):
|
||||
super().config(parent)
|
||||
self.cutout = ','.join(self.force_list(self.cutout))
|
||||
|
||||
def move_output(self, src_dir, src_file, id, ext, replacement=None, patch=False, relative=False):
|
||||
self._expand_id = id
|
||||
self._expand_ext = ext
|
||||
dst_name = self._parent.expand_filename(self._parent.output_dir, self.output)
|
||||
src_name = os.path.join(src_dir, src_file)
|
||||
if not os.path.isfile(src_name):
|
||||
raise PlotError('Missing output file {}'.format(src_name))
|
||||
if patch:
|
||||
# Adjust the names of the DXF files
|
||||
with open(src_name, 'r') as f:
|
||||
content = f.read()
|
||||
for k, v in replacement.items():
|
||||
content = content.replace(k, v)
|
||||
with open(dst_name, 'w') as f:
|
||||
f.write(content)
|
||||
else:
|
||||
shutil.move(src_name, dst_name)
|
||||
if replacement is not None:
|
||||
if relative:
|
||||
src_name = os.path.basename(src_name)
|
||||
replacement[src_name] = os.path.basename(dst_name)
|
||||
|
||||
def get_targets(self, out_dir):
|
||||
# TODO: auto side is tricky, needs variants applied
|
||||
return [self._parent.expand_filename(out_dir, self.output)]
|
||||
|
||||
def create_cmd(self, cmd_kikit):
|
||||
cmd = [cmd_kikit, 'stencil', 'create',
|
||||
'--jigsize', str(self.jigwidth), str(self.jigheight),
|
||||
'--jigthickness', str(self.jigthickness),
|
||||
'--pcbthickness', str(self.pcbthickness),
|
||||
'--registerborder', str(self.registerborderouter), str(self.registerborderinner),
|
||||
'--tolerance', str(self.tolerance)]
|
||||
if self.cutout:
|
||||
cmd.extend(['--coutout', self.cutout])
|
||||
return cmd
|
||||
|
||||
def move_outputs(self, tmp, prj_name, do_top, do_bottom):
|
||||
replacements = {}
|
||||
# Top side
|
||||
if do_top:
|
||||
self.move_output(tmp, 'gerber/stencil-PasteTop.gtp', 'stencil_for_jig_top', 'gtp', replacements, relative=True)
|
||||
self.move_output(tmp, 'topRegister.stl', 'stencil_for_jig_top', 'stl')
|
||||
if self.include_scad:
|
||||
self.move_output(tmp, 'topRegister.scad', 'stencil_for_jig_top', 'scad')
|
||||
# Bottom side
|
||||
if do_bottom:
|
||||
self.move_output(tmp, 'gerber/stencil-PasteBottom.gbp', 'stencil_for_jig_bottom', 'gbp', replacements,
|
||||
relative=True)
|
||||
self.move_output(tmp, 'bottomRegister.stl', 'stencil_for_jig_bottom', 'stl')
|
||||
if self.include_scad:
|
||||
self.move_output(tmp, 'bottomRegister.scad', 'stencil_for_jig_bottom', 'scad')
|
||||
if do_top and do_bottom:
|
||||
self.move_output(tmp, 'gerber/stencil.gbrjob', 'stencil_for_jig', 'gbrjob', replacements, patch=True)
|
||||
|
||||
def run(self, output):
|
||||
cmd_kikit = self.ensure_tool('KiKit')
|
||||
self.ensure_tool('OpenSCAD')
|
||||
super().run(output)
|
||||
# Apply variants and filters
|
||||
filtered = self.filter_pcb_components(GS.board)
|
||||
if self.side == 'auto':
|
||||
detected_top, detected_bottom = self.detect_solder_paste(GS.board)
|
||||
fname = self.save_tmp_board() if filtered else GS.pcb_file
|
||||
if filtered:
|
||||
self.unfilter_pcb_components(GS.board)
|
||||
# Avoid running the tool if we will generate useless models
|
||||
if self.side == 'auto' and not detected_top and not detected_bottom:
|
||||
logger.warning(W_AUTONONE+'No solder paste detected, skipping stencil generation')
|
||||
return
|
||||
# If no PCB thickness indicated ask KiCad
|
||||
if not self.pcbthickness:
|
||||
ds = GS.board.GetDesignSettings()
|
||||
self.pcbthickness = self.to_mm(ds.GetBoardThickness())
|
||||
# Create the command line
|
||||
cmd = self.create_cmd(cmd_kikit)
|
||||
# Create the outputs
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
cmd.append(fname)
|
||||
cmd.append(tmp)
|
||||
try:
|
||||
run_command(cmd)
|
||||
finally:
|
||||
# Remove temporal variant
|
||||
if filtered:
|
||||
GS.remove_pcb_and_pro(fname)
|
||||
# Now copy the files we want
|
||||
# - Which side?
|
||||
do_top = do_bottom = False
|
||||
if self.side == 'top':
|
||||
do_top = True
|
||||
elif self.side == 'bottom':
|
||||
do_bottom = True
|
||||
elif self.side == 'both':
|
||||
do_top = True
|
||||
do_bottom = True
|
||||
else: # auto
|
||||
do_top = detected_top
|
||||
do_bottom = detected_bottom
|
||||
prj_name = os.path.splitext(os.path.basename(fname))[0]
|
||||
self.move_outputs(tmp, prj_name, do_top, do_bottom)
|
||||
|
||||
|
||||
@output_class
|
||||
class Stencil_For_Jig(BaseOutput): # noqa: F821
|
||||
""" Steel Stencils for Alignment Jig
|
||||
Creates the gerber files needed to create steel stencils.
|
||||
These stencils are designed to be used with an acrilic alignment jig and a 3D
|
||||
printable support, that is also generated.
|
||||
[KiKit docs](https://github.com/yaqwsx/KiKit/blob/master/doc/stencil.md).
|
||||
Note that we don't implement `--ignore` option, you should use a variant for this """
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
with document:
|
||||
self.options = Stencil_For_Jig_Options
|
||||
""" *[dict] Options for the `stencil_for_jig` output """
|
||||
|
|
@ -558,7 +558,7 @@ deps = '{\
|
|||
"extra_arch": null,\
|
||||
"extra_deb": null,\
|
||||
"help_option": "--version",\
|
||||
"importance": 20000,\
|
||||
"importance": 30000,\
|
||||
"in_debian": false,\
|
||||
"is_kicad_plugin": false,\
|
||||
"is_python": false,\
|
||||
|
|
@ -582,6 +582,13 @@ deps = '{\
|
|||
"max_version": null,\
|
||||
"output": "stencil_3d",\
|
||||
"version": null\
|
||||
},\
|
||||
{\
|
||||
"desc": null,\
|
||||
"mandatory": true,\
|
||||
"max_version": null,\
|
||||
"output": "stencil_for_jig",\
|
||||
"version": null\
|
||||
}\
|
||||
],\
|
||||
"tests": [],\
|
||||
|
|
@ -639,7 +646,7 @@ deps = '{\
|
|||
"extra_arch": null,\
|
||||
"extra_deb": null,\
|
||||
"help_option": "--version",\
|
||||
"importance": 10000,\
|
||||
"importance": 20000,\
|
||||
"in_debian": true,\
|
||||
"is_kicad_plugin": false,\
|
||||
"is_python": false,\
|
||||
|
|
@ -656,6 +663,13 @@ deps = '{\
|
|||
"max_version": null,\
|
||||
"output": "stencil_3d",\
|
||||
"version": null\
|
||||
},\
|
||||
{\
|
||||
"desc": null,\
|
||||
"mandatory": true,\
|
||||
"max_version": null,\
|
||||
"output": "stencil_for_jig",\
|
||||
"version": null\
|
||||
}\
|
||||
],\
|
||||
"tests": [],\
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
# Example KiBot config file for a basic 3D stencil
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
outputs:
|
||||
- name: 'stencil'
|
||||
comment: "Creates a steel stencil and 3D register"
|
||||
type: stencil_for_jig
|
||||
dir: stencil/Jig
|
||||
Loading…
Reference in New Issue