[Render 3D] Added options to control render aspects

- To disable some technical layers
- To control the silkscreen clipping

Closes #282
This commit is contained in:
Salvador E. Tropea 2022-09-12 08:25:32 -03:00
parent 877695378c
commit 70a2788df0
6 changed files with 63 additions and 15 deletions

View File

@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Sch Variant:
- Option to copy the project. Needed for text variables.
- Option to change the title (similar to PCB Variant)
- Render_3D: Options to disable some technical layers and control the
silkscreen clipping. (#282)
### Fixed
- Problems to compress netlists. (#287)

View File

@ -123,7 +123,7 @@ 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.0.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)
[**KiCad Automation tools**](https://github.com/INTI-CMNB/KiAuto) v2.0.4 [![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`
- Optional to:
- Compare schematics for `diff` (v2.0.0)
@ -2723,6 +2723,7 @@ Notes:
- `background1`: [string='#66667F'] First color for the background gradient.
- `background2`: [string='#CCCCE5'] Second color for the background gradient.
- `board`: [string='#332B16'] Color for the board without copper or solder mask.
- `clip_silk_on_via_annulus`: [boolean=true] Clip silkscreen at via annuli (KiCad 6).
- `copper`: [string='#8b898c'] Color for the copper.
- `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.
@ -2731,9 +2732,14 @@ Notes:
- `no_smd`: [boolean=false] Used to exclude 3D models for surface mount components.
- `no_tht`: [boolean=false] Used to exclude 3D models for through hole components.
- `orthographic`: [boolean=false] Enable the orthographic projection mode (top view looks flat).
- `show_silkscreen`: [boolean=true] Show the silkscreen layers (KiCad 6).
- `show_soldermask`: [boolean=true] Show the solder mask layers (KiCad 6).
- `show_solderpaste`: [boolean=true] Show the solder paste layers (KiCad 6).
- `show_zones`: [boolean=true] Show filled areas in zones (KiCad 6).
- `silk`: [string='#d5dce4'] Color for the silk screen.
- `solder_mask`: [string='#208b47'] Color for the solder mask.
- `solder_paste`: [string='#808080'] Color for the solder paste.
- `subtract_mask_from_silk`: [boolean=true] Clip silkscreen at solder mask edges (KiCad 6).
- `variant`: [string=''] Board variant to apply.
- *wait_ray_tracing*: Alias for wait_render.
- `wait_render`: [number=-600] How many seconds we must wait before capturing the render (ray tracing or normal).

View File

@ -1581,6 +1581,8 @@ outputs:
background2: '#CCCCE5'
# [string='#332B16'] Color for the board without copper or solder mask
board: '#332B16'
# [boolean=true] Clip silkscreen at via annuli (KiCad 6)
clip_silk_on_via_annulus: true
# [string='#8b898c'] Color for the copper
copper: '#8b898c'
# [string|list(string)='_none'] Name of the filter to mark components as not fitted.
@ -1619,12 +1621,22 @@ outputs:
# [number=0] Steps to rotate around the Z axis, positive is clockwise.
# Each step is currently 10 degrees. Only for KiCad 6
rotate_z: 0
# [boolean=true] Show the silkscreen layers (KiCad 6)
show_silkscreen: true
# [boolean=true] Show the solder mask layers (KiCad 6)
show_soldermask: true
# [boolean=true] Show the solder paste layers (KiCad 6)
show_solderpaste: true
# [boolean=true] Show filled areas in zones (KiCad 6)
show_zones: true
# [string='#d5dce4'] Color for the silk screen
silk: '#d5dce4'
# [string='#208b47'] Color for the solder mask
solder_mask: '#208b47'
# [string='#808080'] Color for the solder paste
solder_paste: '#808080'
# [boolean=true] Clip silkscreen at solder mask edges (KiCad 6)
subtract_mask_from_silk: true
# [string=''] Board variant to apply
variant: ''
# [string='top'] [top,bottom,front,rear,right,left,z,Z,y,Y,x,X] Point of view

View File

@ -8,7 +8,7 @@
Dependencies:
- from: KiAuto
role: mandatory
version: 1.6.13
version: 2.0.4
"""
import os
from shutil import rmtree
@ -91,6 +91,18 @@ class Render3DOptions(Base3DOptions):
""" Image height (aprox.) """
self.orthographic = False
""" Enable the orthographic projection mode (top view looks flat) """
self.show_silkscreen = True
""" Show the silkscreen layers (KiCad 6) """
self.show_soldermask = True
""" Show the solder mask layers (KiCad 6) """
self.show_solderpaste = True
""" Show the solder paste layers (KiCad 6) """
self.show_zones = True
""" Show filled areas in zones (KiCad 6) """
self.clip_silk_on_via_annulus = True
""" Clip silkscreen at via annuli (KiCad 6) """
self.subtract_mask_from_silk = True
""" Clip silkscreen at solder mask edges (KiCad 6) """
super().__init__()
self._expand_ext = 'png'
@ -141,16 +153,7 @@ class Render3DOptions(Base3DOptions):
if steps:
cmd.extend([ops, str(steps)])
def run(self, output):
super().run(output)
if GS.ki6 and GS.kicad_version_n < KICAD_VERSION_6_0_2:
logger.error("3D Viewer not supported for KiCad 6.0.0/1\n"
"Please upgrade KiCad to 6.0.2 or newer")
exit(MISSING_TOOL)
command = self.ensure_tool('KiAuto')
# Base command with overwrite
cmd = [command, '--rec_w', str(self.width+2), '--rec_h', str(self.height+85),
'3d_view', '--output_name', output]
def add_options(self, cmd):
# Add user options
if not self.no_virtual:
cmd.append('--virtual')
@ -178,6 +181,30 @@ class Render3DOptions(Base3DOptions):
cmd.append('--orthographic')
if self.view != 'z':
cmd.extend(['--view', self.view])
if not self.show_silkscreen:
cmd.append('--hide_silkscreen')
if not self.show_soldermask:
cmd.append('--hide_soldermask')
if not self.show_solderpaste:
cmd.append('--hide_solderpaste')
if not self.show_zones:
cmd.append('--hide_zones')
if not self.clip_silk_on_via_annulus:
cmd.append('--dont_clip_silk_on_via_annulus')
if not self.subtract_mask_from_silk:
cmd.append('--dont_substrack_mask_from_silk')
def run(self, output):
super().run(output)
if GS.ki6 and GS.kicad_version_n < KICAD_VERSION_6_0_2:
logger.error("3D Viewer not supported for KiCad 6.0.0/1\n"
"Please upgrade KiCad to 6.0.2 or newer")
exit(MISSING_TOOL)
command = self.ensure_tool('KiAuto')
# Base command with overwrite
cmd = [command, '--rec_w', str(self.width+2), '--rec_h', str(self.height+85),
'3d_view', '--output_name', output]
self.add_options(cmd)
# The board
board_name = self.filter_components()
cmd.extend([board_name, os.path.dirname(output)])

View File

@ -338,9 +338,9 @@ deps = '{\
"mandatory": true,\
"output": "render_3d",\
"version": [\
1,\
6,\
13\
2,\
0,\
4\
]\
},\
{\

View File

@ -26,3 +26,4 @@ outputs:
options:
variant: default
ray_tracing: true
# show_solderpaste: false