From 3de2c8de2a0da3ac2af280256c939b7433867b7b Mon Sep 17 00:00:00 2001 From: Diego Capusotto Date: Tue, 7 Dec 2021 19:38:02 -0300 Subject: [PATCH] Added support for auto-detect of ray tracing end - Needs KiAuto 1.5.14 - Enabled by default --- README.md | 4 +++- docs/samples/generic_plot.kibot.yaml | 8 +++++--- kibot/out_render_3d.py | 11 ++++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 60bb082e..e723e08e 100644 --- a/README.md +++ b/README.md @@ -1598,8 +1598,10 @@ Next time you need this list just use an alias, like this: - `solder_paste`: [string='#808080'] Color for the solder paste. - `variant`: [string=''] Board variant to apply. - `view`: [string='top'] [top,bottom,front,rear,right,left,z,Z,y,Y,x,X] Point of view. - - `wait_ray_tracing`: [number=5] How many seconds we must wait before capturing the ray tracing render. + - `wait_ray_tracing`: [number=-600] How many seconds we must wait before capturing the ray tracing render. Lamentably KiCad can save an unfinished image. Enlarge it if your image looks partially rendered. + Use negative values to enable the auto-detect using CPU load. + In this case the value is interpreted as a time-out.. - `width`: [number=1280] Image width (aprox.). - `zoom`: [number=0] Zoom steps. Use positive to enlarge, get closer, and negative to reduce. Same result as using the mouse wheel in the 3D viewer. diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index 37b355c6..5ddda18a 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -1119,9 +1119,11 @@ outputs: variant: '' # [string='top'] [top,bottom,front,rear,right,left,z,Z,y,Y,x,X] Point of view view: 'top' - # [number=5] How many seconds we must wait before capturing the ray tracing render. - # Lamentably KiCad can save an unfinished image. Enlarge it if your image looks partially rendered - wait_ray_tracing: 5 + # [number=-600] How many seconds we must wait before capturing the ray tracing render. + # Lamentably KiCad can save an unfinished image. Enlarge it if your image looks partially rendered. + # Use negative values to enable the auto-detect using CPU load. + # In this case the value is interpreted as a time-out. + wait_ray_tracing: -600 # [number=1280] Image width (aprox.) width: 1280 # [number=0] Zoom steps. Use positive to enlarge, get closer, and negative to reduce. diff --git a/kibot/out_render_3d.py b/kibot/out_render_3d.py index 441baa44..e5a79894 100644 --- a/kibot/out_render_3d.py +++ b/kibot/out_render_3d.py @@ -57,9 +57,11 @@ class Render3DOptions(Base3DOptions): Just like pressing the up arrow in the 3D viewer """ self.ray_tracing = False """ Enable the ray tracing. Much better result, but slow, and you'll need to adjust `wait_rt` """ - self.wait_ray_tracing = 5 + self.wait_ray_tracing = -600 """ How many seconds we must wait before capturing the ray tracing render. - Lamentably KiCad can save an unfinished image. Enlarge it if your image looks partially rendered """ + Lamentably KiCad can save an unfinished image. Enlarge it if your image looks partially rendered. + Use negative values to enable the auto-detect using CPU load. + In this case the value is interpreted as a time-out. """ self.view = 'top' """ [top,bottom,front,rear,right,left,z,Z,y,Y,x,X] Point of view """ self.zoom = 0 @@ -86,7 +88,7 @@ class Render3DOptions(Base3DOptions): def run(self, output): super().run(output) - check_script(CMD_PCBNEW_3D, URL_PCBNEW_3D, '1.5.11') + check_script(CMD_PCBNEW_3D, URL_PCBNEW_3D, '1.5.14') # Base command with overwrite cmd = [CMD_PCBNEW_3D, '--rec_w', str(self.width+2), '--rec_h', str(self.height+85), '3d_view', '--output_name', output] @@ -106,6 +108,9 @@ class Render3DOptions(Base3DOptions): if self.zoom: cmd.extend(['--zoom', str(self.zoom)]) if self.wait_ray_tracing != 5: + if self.wait_ray_tracing < 0: + self.wait_ray_tracing = -self.wait_ray_tracing + cmd.append('--detect_rt') cmd.extend(['--wait_rt', str(self.wait_ray_tracing)]) if self.ray_tracing: cmd.append('--ray_tracing')