1
对于一个项目,我需要将大量.svg
文件转换为.dxf
文件的自动转换以供进一步处理。.svg到.dxf(使用Inkscape?)
情况:用大量.svg
-files一个目录应转化为.dxf
(无论是否.dxf
文件是在同一diretory或子文件夹,DXF名称应该是SVG名)
我可以做与Inkscape GUI同样适用于在CAD程序中导入.dxf
文件,但如前所述,我需要将其自动化。 (到目前为止,我只用Python编写过)。
我的想法:我通过命令行在Inkscape中打开文件。在png
-format出口将通过命令可以与下面的代码:
from subprocess import call
import os
svg_dir = "C:\\temp\\layers\\"
files = [svg_dir + i for i in os.listdir(svg_dir) if ".svg" in i]
dir = r"C:\Program Files\Inkscape"
for i in files:
cmdline = "Inkscape -z -f "+ i +" -e "+ i + ".png"
rc = call("start cmd /K " + cmdline, cwd=dir, shell=True)
但我真的不unterstand Inkscape的扩展。我只知道在扩展目录中需要dxf_outlines.py/.inx
。我总是需要相同的导出选项,所以我可以重写Python代码并在Inkscape中通过命令运行它?
还是会有没有任何额外的软件,如Python中的Inkscape的解决方案?据我所见,没有。