diff --git a/gallery/ArduinoThermostat.png b/gallery/ArduinoThermostat.png index aabd9e5..67578ad 100644 Binary files a/gallery/ArduinoThermostat.png and b/gallery/ArduinoThermostat.png differ diff --git a/gallery/Laser_load.png b/gallery/Laser_load.png index ad6f0a7..1278f15 100644 Binary files a/gallery/Laser_load.png and b/gallery/Laser_load.png differ diff --git a/gallery/Mains_Box.png b/gallery/Mains_Box.png index d6d9300..b35686b 100644 Binary files a/gallery/Mains_Box.png and b/gallery/Mains_Box.png differ diff --git a/gallery/Variac.png b/gallery/Variac.png index dd073a9..473ad29 100644 Binary files a/gallery/Variac.png and b/gallery/Variac.png differ diff --git a/scripts/gallery.py b/scripts/gallery.py index 96faadb..b3b1cec 100644 --- a/scripts/gallery.py +++ b/scripts/gallery.py @@ -29,12 +29,13 @@ from tests import do_cmd import re from shutil import copyfile from tests import update_image +import sys project_dir = '../..' target_dir = 'gallery' output_name = target_dir + '/readme.md' -def gallery(): +def gallery(force): if not os.path.isdir(target_dir): os.makedirs(target_dir) @@ -45,6 +46,8 @@ def gallery(): path = project_dir + '/' + project print(project) document = path + '/readme.md' + if force: + os.system('cd %s && make_all' % path) if os.path.isfile(document): with open(document, 'rt') as readme: for line in readme.readlines(): @@ -74,4 +77,4 @@ def gallery(): if __name__ == '__main__': init() - gallery() + gallery(force = len(sys.argv) > 1 and sys.argv[1] == '-f') diff --git a/scripts/render.py b/scripts/render.py index 6b065d1..236957f 100644 --- a/scripts/render.py +++ b/scripts/render.py @@ -24,7 +24,7 @@ from set_config import * from exports import bom_to_parts import os import openscad -from tests import do_cmd +from tests import do_cmd, update_image from deps import mtime def render(target, type): @@ -59,8 +59,10 @@ def render(target, type): f.write('color("lime") import("%s");\n' % part_file) cam = "--camera=0,0,0,70,0,315,500" if type == 'stl' else "--camera=0,0,0,0,0,0,500" render = "--preview" if type == 'stl' else "--render" - openscad.run("--projection=p", "--imgsize=4096,4096", cam, render, "--autocenter", "--viewall", "-o", png_name, png_maker_name); - do_cmd(("magick "+ png_name + " -trim -resize 280x280 -background #ffffe5 -gravity Center -extent 280x280 -bordercolor #ffffe5 -border 10 " + png_name).split()) + tmp_name = 'tmp.png' + openscad.run("--projection=p", "--imgsize=4096,4096", cam, render, "--autocenter", "--viewall", "-o", tmp_name, png_maker_name); + do_cmd(("magick "+ tmp_name + " -trim -resize 280x280 -background #ffffe5 -gravity Center -extent 280x280 -bordercolor #ffffe5 -border 10 " + tmp_name).split()) + update_image(tmp_name, png_name) os.remove(png_maker_name) if __name__ == '__main__':