1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-07-30 04:10:12 +02:00

Render.py not only updates images that have changed.

Added force build to gallery.py.
This commit is contained in:
Chris Palmer
2019-06-09 17:23:30 +01:00
parent 5af2302053
commit 50d3570be4
6 changed files with 10 additions and 5 deletions

View File

@@ -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__':