from os import listdir
from subprocess import call
files = listdir('.')
for f in files:
if f.find(".scad") >= 0: # get all .scad files in directory
of = f.replace('.scad', '.stl') # name of the outfile .stl
cmd = 'call (["openscad", "-o", "{}", "{}"])'.format(of, f) #create openscad command
exec(cmd)
您可以从命令行运行openscad,请参见documentation, 并用python编写每个命令(python3中的示例)
在python3.5及更高版本中,
subprocess.call
应该被subrocess.run()
代替相关问题 更多 >
编程相关推荐