From c6f2cbb8e56973756375c9e26af6056d86c284a9 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 12 Jun 2023 09:10:00 -0300 Subject: [PATCH] [Render_3D][Added] More options to control what we see - realistic: can be used to disable the realistic colors and get the GUI ones - show_board_body: can be used to make the PCB core transparent (see inner) - show_comments: to see the content of the User.Comments layer. - show_eco: to see the content of the Eco1.User/Eco2.User layers. - show_adhesive : to see the content of the *.Adhesive layers. See #445 --- CHANGELOG.md | 6 +++++ README.md | 23 ++++++++++------- docs/samples/generic_plot.kibot.yaml | 28 +++++++++++++------- kibot/out_render_3d.py | 38 +++++++++++++++++++++------- 4 files changed, 68 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7c953c5..65fce0ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Internal templates: - CheckZoneFill: Used to check if a zone fill operation makes the PCB quite different (#431) +- Render_3D: + - realistic: can be used to disable the realistic colors and get the GUI ones + - show_board_body: can be used to make the PCB core transparent (see inner) + - show_comments: to see the content of the User.Comments layer. + - show_eco: to see the content of the Eco1.User/Eco2.User layers. + - show_adhesive : to see the content of the *.Adhesive layers. ### Changed - Command line: diff --git a/README.md b/README.md index e9d0c05b..727574f6 100644 --- a/README.md +++ b/README.md @@ -4444,11 +4444,11 @@ Notes: - **`output`**: [string='%f-%i%I%v.%x'] Name for the generated image file (%i='3D_$VIEW' %x='png'). Affected by global options. - **`ray_tracing`**: [boolean=false] Enable the ray tracing. Much better result, but slow, and you'll need to adjust `wait_rt`. - **`rotate_x`**: [number=0] Steps to rotate around the X axis, positive is clockwise. - Each step is currently 10 degrees. Only for KiCad 6. + Each step is currently 10 degrees. Only for KiCad 6 or newer. - **`rotate_y`**: [number=0] Steps to rotate around the Y axis, positive is clockwise. - Each step is currently 10 degrees. Only for KiCad 6. + Each step is currently 10 degrees. Only for KiCad 6 or newer. - **`rotate_z`**: [number=0] Steps to rotate around the Z axis, positive is clockwise. - Each step is currently 10 degrees. Only for KiCad 6. + Each step is currently 10 degrees. Only for KiCad 6 or newer. - **`show_components`**: [list(string)|string=all] [none,all] List of components to draw, can be also a string for `none` or `all`. Unlike the `pcbdraw` output, the default is `all`. - **`view`**: [string='top'] [top,bottom,front,rear,right,left,z,Z,y,Y,x,X] Point of view. @@ -4459,7 +4459,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). + - `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. @@ -4475,14 +4475,19 @@ Notes: - `orthographic`: [boolean=false] Enable the orthographic projection mode (top view looks flat). - `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. - - `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). + - `realistic`: [boolean=true] When disabled we use the colors of the layers used by the GUI. KiCad 6 or newer. + - `show_adhesive`: [boolean=false] Show the content of F.Adhesive/B.Adhesive layers. KiCad 6 or newer. + - `show_board_body`: [boolean=true] Show the PCB core material. KiCad 6 or newer. + - `show_comments`: [boolean=false] Show the content of the User.Comments layer. KiCad 6 or newer and ray tracing disabled. + - `show_eco`: [boolean=false] Show the content of the Eco1.User/Eco2.User layers. KiCad 6 or newer and ray tracing disabled. + - `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). + - `subtract_mask_from_silk`: [boolean=true] Clip silkscreen at solder mask edges (KiCad 6+). - `transparent_background`: [boolean=false] When enabled the image will be post-processed to make the background transparent. In this mode the `background1` and `background2` colors are ignored. - `transparent_background_color`: [string='#00ff00'] Color used for the chroma key. Adjust it if some regions of the board becomes transparent. diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index 422390e8..9c0d2c45 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -2903,7 +2903,7 @@ 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) + # [boolean=true] Clip silkscreen at via annuli (KiCad 6+) clip_silk_on_via_annulus: true # [string='#8b898c'] Color for the copper copper: '#8b898c' @@ -2950,25 +2950,35 @@ outputs: pre_transform: '_none' # [boolean=false] Enable the ray tracing. Much better result, but slow, and you'll need to adjust `wait_rt` ray_tracing: false + # [boolean=true] When disabled we use the colors of the layers used by the GUI. KiCad 6 or newer + realistic: true # [number=0] Steps to rotate around the X axis, positive is clockwise. - # Each step is currently 10 degrees. Only for KiCad 6 + # Each step is currently 10 degrees. Only for KiCad 6 or newer rotate_x: 0 # [number=0] Steps to rotate around the Y axis, positive is clockwise. - # Each step is currently 10 degrees. Only for KiCad 6 + # Each step is currently 10 degrees. Only for KiCad 6 or newer rotate_y: 0 # [number=0] Steps to rotate around the Z axis, positive is clockwise. - # Each step is currently 10 degrees. Only for KiCad 6 + # Each step is currently 10 degrees. Only for KiCad 6 or newer rotate_z: 0 + # [boolean=false] Show the content of F.Adhesive/B.Adhesive layers. KiCad 6 or newer + show_adhesive: false + # [boolean=true] Show the PCB core material. KiCad 6 or newer + show_board_body: true + # [boolean=false] Show the content of the User.Comments layer. KiCad 6 or newer and ray tracing disabled + show_comments: false # [list(string)|string=all] [none,all] List of components to draw, can be also a string for `none` or `all`. # Unlike the `pcbdraw` output, the default is `all` show_components: all - # [boolean=true] Show the silkscreen layers (KiCad 6) + # [boolean=false] Show the content of the Eco1.User/Eco2.User layers. KiCad 6 or newer and ray tracing disabled + show_eco: false + # [boolean=true] Show the silkscreen layers (KiCad 6+) show_silkscreen: true - # [boolean=true] Show the solder mask layers (KiCad 6) + # [boolean=true] Show the solder mask layers (KiCad 6+) show_soldermask: true - # [boolean=true] Show the solder paste layers (KiCad 6) + # [boolean=true] Show the solder paste layers (KiCad 6+) show_solderpaste: true - # [boolean=true] Show filled areas in zones (KiCad 6) + # [boolean=true] Show filled areas in zones (KiCad 6+) show_zones: true # [string='#d5dce4'] Color for the silk screen silk: '#d5dce4' @@ -2976,7 +2986,7 @@ outputs: solder_mask: '#208b47' # [string='#808080'] Color for the solder paste solder_paste: '#808080' - # [boolean=true] Clip silkscreen at solder mask edges (KiCad 6) + # [boolean=true] Clip silkscreen at solder mask edges (KiCad 6+) subtract_mask_from_silk: true # [boolean=false] When enabled the image will be post-processed to make the background transparent. # In this mode the `background1` and `background2` colors are ignored diff --git a/kibot/out_render_3d.py b/kibot/out_render_3d.py index 7e028436..03f22c75 100644 --- a/kibot/out_render_3d.py +++ b/kibot/out_render_3d.py @@ -79,13 +79,13 @@ class Render3DOptions(Base3DOptionsWithHL): Just like pressing the up arrow in the 3D viewer """ self.rotate_x = 0 """ *Steps to rotate around the X axis, positive is clockwise. - Each step is currently 10 degrees. Only for KiCad 6 """ + Each step is currently 10 degrees. Only for KiCad 6 or newer """ self.rotate_y = 0 """ *Steps to rotate around the Y axis, positive is clockwise. - Each step is currently 10 degrees. Only for KiCad 6 """ + Each step is currently 10 degrees. Only for KiCad 6 or newer """ self.rotate_z = 0 """ *Steps to rotate around the Z axis, positive is clockwise. - Each step is currently 10 degrees. Only for KiCad 6 """ + Each step is currently 10 degrees. Only for KiCad 6 or newer """ self.ray_tracing = False """ *Enable the ray tracing. Much better result, but slow, and you'll need to adjust `wait_rt` """ self.wait_render = -600 @@ -107,17 +107,17 @@ class Render3DOptions(Base3DOptionsWithHL): self.orthographic = False """ Enable the orthographic projection mode (top view looks flat) """ self.show_silkscreen = True - """ Show the silkscreen layers (KiCad 6) """ + """ Show the silkscreen layers (KiCad 6+) """ self.show_soldermask = True - """ Show the solder mask layers (KiCad 6) """ + """ Show the solder mask layers (KiCad 6+) """ self.show_solderpaste = True - """ Show the solder paste layers (KiCad 6) """ + """ Show the solder paste layers (KiCad 6+) """ self.show_zones = True - """ Show filled areas in zones (KiCad 6) """ + """ Show filled areas in zones (KiCad 6+) """ self.clip_silk_on_via_annulus = True - """ Clip silkscreen at via annuli (KiCad 6) """ + """ Clip silkscreen at via annuli (KiCad 6+) """ self.subtract_mask_from_silk = True - """ Clip silkscreen at solder mask edges (KiCad 6) """ + """ Clip silkscreen at solder mask edges (KiCad 6+) """ self.auto_crop = False """ When enabled the image will be post-processed to remove the empty space around the image. In this mode the `background2` is changed to be the same as `background1` """ @@ -128,6 +128,16 @@ class Render3DOptions(Base3DOptionsWithHL): """ Color used for the chroma key. Adjust it if some regions of the board becomes transparent """ self.transparent_background_fuzz = 15 """ [0,100] Chroma key tolerance (percent). Bigger values will remove more pixels """ + self.realistic = True + """ When disabled we use the colors of the layers used by the GUI. KiCad 6 or newer """ + self.show_board_body = True + """ Show the PCB core material. KiCad 6 or newer """ + self.show_comments = False + """ Show the content of the User.Comments layer. KiCad 6 or newer and ray tracing disabled """ + self.show_eco = False + """ Show the content of the Eco1.User/Eco2.User layers. KiCad 6 or newer and ray tracing disabled """ + self.show_adhesive = False + """ Show the content of F.Adhesive/B.Adhesive layers. KiCad 6 or newer """ super().__init__() self._expand_ext = 'png' @@ -240,6 +250,16 @@ class Render3DOptions(Base3DOptionsWithHL): cmd.append('--dont_clip_silk_on_via_annulus') if not self.subtract_mask_from_silk: cmd.append('--dont_substrack_mask_from_silk') + if not self.realistic: + cmd.append('--use_layer_colors') + if not self.show_board_body: + cmd.append('--hide_board_body') + if self.show_comments: + cmd.append('--show_comments') + if self.show_eco: + cmd.append('--show_eco') + if self.show_adhesive: + cmd.append('--show_adhesive') def run(self, output): super().run(output)