Views.py and plateup.py now define $cwd and $target.

This commit is contained in:
Chris Palmer 2021-02-06 15:12:21 +00:00
parent cb30f0c63d
commit 079168142b
2 changed files with 6 additions and 2 deletions

View File

@ -72,7 +72,9 @@ def plateup(target, part_type, usage = None):
changed = check_deps(part_file, dname) changed = check_deps(part_file, dname)
if changed: if changed:
print(changed) print(changed)
openscad.run("-D$bom=1", "-d", dname, "-o", part_file, src_file) target_def = ['-D$target="%s"' % target] if target else []
cwd_def = ['-D$cwd="%s"' % os.getcwd().replace('\\', '/')]
openscad.run_list(["-D$bom=1"] + target_def + cwd_def + ["-d", dname, "-o", part_file, src_file])
if part_type == 'stl': if part_type == 'stl':
c14n_stl.canonicalise(part_file) c14n_stl.canonicalise(part_file)
log_name = 'openscad.log' log_name = 'openscad.log'

View File

@ -215,7 +215,9 @@ def views(target, do_assemblies = None):
f.write("use <%s/%s>\n" % (dir, filename)) f.write("use <%s/%s>\n" % (dir, filename))
f.write("%s();\n" % module); f.write("%s();\n" % module);
t = time.time() t = time.time()
openscad.run_list(options.list() + ["-D$pose=1", "-D$explode=%d" % explode, colour_scheme, "--projection=p", "--imgsize=4096,4096", "--autocenter", "--viewall", "-d", dname, "-o", tmp_name, png_maker_name]); target_def = ['-D$target="%s"' % target] if target else []
cwd_def = ['-D$cwd="%s"' % os.getcwd().replace('\\', '/')]
openscad.run_list(options.list() + target_def + cwd_def + ["-D$pose=1", "-D$explode=%d" % explode, colour_scheme, "--projection=p", "--imgsize=4096,4096", "--autocenter", "--viewall", "-d", dname, "-o", tmp_name, png_maker_name]);
times.add_time(png_name, t) times.add_time(png_name, t)
do_cmd(["magick", tmp_name, "-trim", "-resize", "1004x1004", "-bordercolor", background, "-border", "10", tmp_name]) do_cmd(["magick", tmp_name, "-trim", "-resize", "1004x1004", "-bordercolor", background, "-border", "10", tmp_name])
update_image(tmp_name, png_name) update_image(tmp_name, png_name)