【问题标题】:Convert DXF to SVG in Inkscape CLI while keeping layers在 Inkscape CLI 中将 DXF 转换为 SVG,同时保留图层
【发布时间】:2016-04-19 13:25:12
【问题描述】:

在 Inkscape GUI 中,有一个很棒的功能,它让我 “另存为 -> 文件类型 -> 图层作为单独的 SVG”(底部的最后一个)。有没有办法从 CLI 做同样的事情?

到目前为止我所拥有的:

inkscape -z -l output.svg input.dxf

这会将“input.dxf”转换为“output.svg”,但我在这个 SVG 中找不到图层。

【问题讨论】:

    标签: svg inkscape dxf


    【解决方案1】:

    在 Inkscape 社区的帮助下(特别感谢 @rindolf),我可以想出一个解决方案。

    先决条件

    • Python 2.7(不适用于新版本)
    • lxml ("pip install lxml")

    调整 Inkscape

    将 "Inkscape\share\extensions" 中 "tar_layers.py" 第 36 行的 'GROUP = "{http://www.w3.org/2000/svg}g"' 更改为 'GROUP = "g"'。必须这样做,因为您的图层将没有该命名空间。

    将 DXF 转换为多个 SVG(每层一个)

    1. 从 DXF 创建 Inkscape SVG:

      python 共享/扩展/dxf_input.py input.dxf > output.svg

    2. 将图层导出为 tar 中的单个 SVG:

      python 共享/扩展/tar_layers.py output.svg > output.tar

    现在,您应该有一个包含 Inkscape SVG 的“output.tar”文件。如果你需要普通的 SVG,你必须像这样导出它们:

    inkscape -z -l output.svg input.svg
    

    更多关于the Inkscape CLI的信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-09
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      • 2018-01-09
      • 1970-01-01
      • 1970-01-01
      • 2022-11-21
      相关资源
      最近更新 更多