diff --git a/README.md b/README.md index c77c6eb0..856e9667 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![KiBot Logo](https://raw.githubusercontent.com/INTI-CMNB/KiBot/master/docs/images/kibot_740x400_logo.png) -[![Python application](https://img.shields.io/github/actions/workflow/status/INTI-CMNB/KiBot/pythonapp.yml?branch=subpcb&style=plastic)](https://github.com/INTI-CMNB/KiBot/actions) +[![Python application](https://img.shields.io/github/actions/workflow/status/INTI-CMNB/KiBot/pythonapp.yml?branch=dev&style=plastic)](https://github.com/INTI-CMNB/KiBot/actions) [![Coverage Status](https://img.shields.io/coveralls/github/INTI-CMNB/KiBot?style=plastic)](https://coveralls.io/github/INTI-CMNB/KiBot?branch=master) [![PyPI version](https://img.shields.io/pypi/v/kibot?style=plastic)](https://pypi.org/project/kibot/) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg?style=plastic)](https://www.paypal.com/donate/?hosted_button_id=K2T86GDTTMRPL) @@ -1072,6 +1072,7 @@ Note that the **_kibom_...** filters uses a field named `Config`, but you can cu - `tlx`: [number|string] The X position of the top left corner for the rectangle that contains the sub-PCB. - `tly`: [number|string] The Y position of the top left corner for the rectangle that contains the sub-PCB. - `tolerance`: [number|string] Used to enlarge the selected rectangle to include elements outside the board. + KiCad 5: To avoid rounding issues this value is set to 0.000002 mm when 0 is specified. - `tool`: [string='internal'] [internal,kikit] Tool used to extract the sub-PCB.. - *top_left_x*: Alias for tlx. - *top_left_y*: Alias for tly. @@ -1125,6 +1126,7 @@ Note that the **_kibom_...** filters uses a field named `Config`, but you can cu - `tlx`: [number|string] The X position of the top left corner for the rectangle that contains the sub-PCB. - `tly`: [number|string] The Y position of the top left corner for the rectangle that contains the sub-PCB. - `tolerance`: [number|string] Used to enlarge the selected rectangle to include elements outside the board. + KiCad 5: To avoid rounding issues this value is set to 0.000002 mm when 0 is specified. - `tool`: [string='internal'] [internal,kikit] Tool used to extract the sub-PCB.. - *top_left_x*: Alias for tlx. - *top_left_y*: Alias for tly. @@ -1180,6 +1182,7 @@ Note that the **_kibom_...** filters uses a field named `Config`, but you can cu - `tlx`: [number|string] The X position of the top left corner for the rectangle that contains the sub-PCB. - `tly`: [number|string] The Y position of the top left corner for the rectangle that contains the sub-PCB. - `tolerance`: [number|string] Used to enlarge the selected rectangle to include elements outside the board. + KiCad 5: To avoid rounding issues this value is set to 0.000002 mm when 0 is specified. - `tool`: [string='internal'] [internal,kikit] Tool used to extract the sub-PCB.. - *top_left_x*: Alias for tlx. - *top_left_y*: Alias for tly. diff --git a/kibot/var_base.py b/kibot/var_base.py index 2d997343..02d73bb4 100644 --- a/kibot/var_base.py +++ b/kibot/var_base.py @@ -103,7 +103,8 @@ class SubPCBOptions(PanelOptions): self.tool = 'internal' """ [internal,kikit] Tool used to extract the sub-PCB. """ self.tolerance = 0 - """ [number|string] Used to enlarge the selected rectangle to include elements outside the board """ + """ [number|string] Used to enlarge the selected rectangle to include elements outside the board. + KiCad 5: To avoid rounding issues this value is set to 0.000002 mm when 0 is specified """ self.strip_annotation = False """ Remove the annotation footprint. Note that KiKit will remove all annotations, but the internal implementation just the one indicated by `ref`. @@ -125,6 +126,9 @@ class SubPCBOptions(PanelOptions): raise KiPlotConfigurationError('No reference or rectangle specified for {} sub-PCB'.format(self.name)) self.add_units(('tlx', 'tly', 'brx', 'bry', 'tolerance'), self.units, convert=True) self.board_rect = GS.create_eda_rect(self._tlx, self._tly, self._brx, self._bry) + if not self._tolerance and GS.ki5: + # KiCad 5 workaround: rounding issues generate 1 fm of error. So we change to 2 fm tolerance. + self._tolerance = 2 self.board_rect.Inflate(int(self._tolerance)) def get_separate_source(self): diff --git a/tests/yaml_samples/pcb_variant_sub_pcb_bp.kibot.yaml b/tests/yaml_samples/pcb_variant_sub_pcb_bp.kibot.yaml index 68944b04..5210912c 100644 --- a/tests/yaml_samples/pcb_variant_sub_pcb_bp.kibot.yaml +++ b/tests/yaml_samples/pcb_variant_sub_pcb_bp.kibot.yaml @@ -29,7 +29,7 @@ variants: tly: 52 brx: 146 bry: 88 - tolerance: 1 + # tolerance: 1 outputs: - name: 'pcb_charger' diff --git a/tests/yaml_samples/pcbdraw_sub_pcb_bp.kibot.yaml b/tests/yaml_samples/pcbdraw_sub_pcb_bp.kibot.yaml index 13dd33e1..85b430e0 100644 --- a/tests/yaml_samples/pcbdraw_sub_pcb_bp.kibot.yaml +++ b/tests/yaml_samples/pcbdraw_sub_pcb_bp.kibot.yaml @@ -27,7 +27,7 @@ variants: tly: 52 brx: 146 bry: 88 - tolerance: 1 + # tolerance: 1 outputs: - name: draw_charger