Skip to content
Snippets Groups Projects
Commit 715f0557 authored by fxk8y's avatar fxk8y :spider:
Browse files

Moar OpenSCAD wrapper development

parent 27d18e05
No related branches found
No related tags found
No related merge requests found
import shutil
import subprocess
......@@ -33,11 +34,32 @@ class SCADFile:
class OpenSCAD:
ProcessBinary = ['/usr/bin/env', 'openscad']
def __init__(self):
pass
self.__openscad = shutil.which('openscad')
def __call__(self, *args, outfile=None, csglimit=None, **kwargs):
'''args are added at the end, kwargs are used to od variable overrides'''
cmd = [self.__openscad]
# Can we do better instead of replicating this all over the place???
if csglimit is not None:
cmd += [f'--csglimit={csglimit}']
for k, v in kwargs.items():
cmd += ['-D', f'{k}={v}']
if outfile is not None:
cmd += ['-o', outfile]
cmd += args
print(f'Running OpenSCAD: {cmd}') # TODO: remove after debugging?!
return subprocess.Popen(cmd).communicate()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment