diff --git a/bom.py b/bom.py index 7c1d339..4a1ab94 100644 --- a/bom.py +++ b/bom.py @@ -1,7 +1,7 @@ import os -import subprocess import sys import shutil +import openscad class BOM(): def __init__(self): @@ -95,10 +95,8 @@ def boms(machine): f. write("include <%s_config.scad>\n" % machine); f.close() - log = open("openscad.log", "w") - subprocess.call(["openscad", "-o", "dummy.csg", "scad/bom.scad"], stdout = log, stderr = log) + openscad.run("-o", "dummy.csg", "scad/bom.scad") print "Generating bom ...", - log.close() main = BOM() stack = [] diff --git a/openscad.py b/openscad.py new file mode 100644 index 0000000..088c789 --- /dev/null +++ b/openscad.py @@ -0,0 +1,11 @@ +import subprocess +import os + +def run(*args): + if os.name == "nt": + subprocess.call(["openscad_cl"] + list(args)) + else: + log = open("openscad.log", "w") + subprocess.call(["openscad"] + list(args), stdout = log, stderr = log) + log.close() + diff --git a/sheets.py b/sheets.py index 9e02819..3bd7cbd 100644 --- a/sheets.py +++ b/sheets.py @@ -1,5 +1,5 @@ import os -import subprocess +import openscad import shutil import sys from dxf import * @@ -49,7 +49,7 @@ def sheets(machine): # Run openscad on the created file # dxf_name = target_dir + "/" + module[:-4] + ".dxf" - subprocess.call(["openscad", "-o", dxf_name, dxf_maker_name]) + openscad.run("-o", dxf_name, dxf_maker_name) dxf_to_svg(dxf_name) if __name__ == '__main__': diff --git a/stls.py b/stls.py index c5dc58f..5c2b372 100644 --- a/stls.py +++ b/stls.py @@ -1,5 +1,5 @@ import os -import subprocess +import openscad import shutil import sys @@ -58,7 +58,7 @@ def stls(machine): # Run openscad on the created file # stl_name = target_dir + "/" + module[:-4] + ".stl" - subprocess.call(["openscad", "-o", stl_name, stl_maker_name]) + openscad.run("-o", stl_name, stl_maker_name) targets.remove(module) #