我试图在Windows7中通过命令提示符运行OpenScad。但是我没能成功。
我在路径中添加了以下目录

"C:\Program Files\OpenSCAD\"

并尝试运行以下脚本:
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.com",  "-o", "{}",  "{}"])'.format(of, f)   #create openscad command
        exec(cmd)

我也尝试过openscad,openscad.exe,openscad.com,到目前为止还没有成功。
我得到的错误是:
Traceback (most recent call last):
  File "C:\Users\Desktop\scad2stl.py", line 9, in <module>
    exec(cmd)
  File "<string>", line 1, in <module>
  File "C:\Users\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 247, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Users\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "C:\Users\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 955, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The specified file could not be found

有什么建议吗?

最佳答案

我刚看到这个线程,我已经让它工作在windows power shell,无法使它工作在命令到期。例如,在cmd>
openscad-o render.png--imgsize=20482048 assembly.scad
但它确实在power shell上起作用(请注意在biging中的./):
./openscad-o render.png--imgsize=20482048汇编.scad
希望有帮助。
致意

09-28 03:29