有没有办法在 illustrator 中将 svg <line> 转换为 svg <path> ?

is there a way to convert svg <line> to svg <path> in illustrator?

我有一个同事使用 Illustrator 合并 2 个 svg。 1 svg 使用了几个 <path> 元素,但这些元素被转换为 <line> 元素。我知道有一个将 svg <line> 转换为 svg <path> 的通用算法。例如,这是使用 D3.js:

执行此操作的示例

https://www.dashingd3js.com/svg-paths-and-d3js

但是,我想知道是否有更原生的方式直接在 Illustrator 中执行此操作,通过 Illustrator 插件或通过某种类型的第三方自动化工具?

你可以做到这一点,将线条变成复合路径(右键单击 + 制作复合路径)。那改变这个:

<line fill="none" stroke="#000000" stroke-miterlimit="10"
    x1="216.935" y1="158.508" x2="661.196" y2="166.705"/>

对此:

<path fill="none" stroke="#000000" stroke-miterlimit="10"
     d="M661.196,166.705l-444.262-8.197"/>

希望对您有所帮助。