将SVG文件转换为KiCad示意图。
svg2mod的Python项目详细描述
svg2mod公司
@mtl不再处于活动状态。https://github.com/svg2mod/svg2mod现在是维护的分支。
这是一个小程序,用于将Inkscape SVG图形转换为KiCad示意图模块文件。它使用a fork of cjlano's python SVG parser and drawing module来解释图纸和使用直线段的近似曲线。模块文件可以KiCad的传统或s-expression(即pretty)格式输出。在
要求
Python3
安装
pip3 install svg2mod
示例
svg2mod -i input.svg -p 1.0
使用
usage: svg2mod [-h] -i FILENAME [-o FILENAME] [-c] [-pads] [-v] [-x] [-d DPI]
[-f FACTOR] [-p PRECISION] [--format FORMAT] [--name NAME]
[--units UNITS] [--value VALUE]
Convert Inkscape SVG drawings to KiCad footprint modules.
optional arguments:
-h, --help show this help message and exit
-i FILENAME, --input-file FILENAME
name of the SVG file
-o FILENAME, --output-file FILENAME
name of the module file
-c, --center Center the module to the center of the bounding box
-pads, --convert-pads
Convert any artwork on Cu layers to pads
-v, --verbose Print more verbose messages
-x, --exclude-hidden Do not export hidden layers
-d DPI, --dpi DPI DPI of the SVG file (int)
-f FACTOR, --factor FACTOR
scale paths by this factor
-p PRECISION, --precision PRECISION
smoothness for approximating curves with line segments
(float)
--format FORMAT output module file format (legacy|pretty)
--name NAME, --module-name NAME
base name of the module
--units UNITS output units, if output format is legacy (decimil|mm)
--value VALUE, --module-value VALUE
value of the module
SVG文件
svg2mod希望图像以未压缩的Inkscape SVG(即不是“普通SVG”)格式保存。在
- 图纸应按比例绘制(Inscape中的1 mm应为KiCad中的1 mm)。使用--factor选项从那里向上或向下调整生成的模块的大小。在
- 路径完全支持Rect,部分支持圆(椭圆)。
- 路径可以有轮廓和填充。(颜色将被忽略。)
- 路径可以有孔,由路径内的内部线段定义(请参见附带的示例)。在
- 在孔内填充区域的路径将无法正常工作。你必须把它们分成两条不同的路。在
- 透明填充和笔划被忽略。在
- Rect支持旋转,但不支持角半径。在
- 椭圆不支持旋转。在
- 可以使用组。但是,应用于组的样式(例如,笔划宽度)不会应用于包含的绘图元素。在这些情况下,可能需要对元素进行解组(或者重新组合)。在
- 图层必须命名以匹配kicad中的目标。下面列出了支持的层。在
- 不支持其他类型的元素,例如arc。
- 使用Inkscape的“路径->对象到路径”和“路径->笔划到路径”菜单选项将这些元素转换为有效的路径。在
层
这支持下面列出的层。它们在inkscape和kicad中是相同的:
KiCad layer(s) | KiCad legacy | KiCad pretty |
---|---|---|
F.Cu | Yes | Yes |
B.Cu | Yes | Yes |
F.Adhes | Yes | Yes |
B.Adhes | Yes | Yes |
F.Paste | Yes | Yes |
B.Paste | Yes | Yes |
F.SilkS | Yes | Yes |
B.SilkS | Yes | Yes |
F.Mask | Yes | Yes |
B.Mask | Yes | Yes |
Dwgs.User | Yes | Yes |
Cmts.User | Yes | Yes |
Eco1.User | Yes | Yes |
Eco2.User | Yes | Yes |
Edge.Cuts | Yes | Yes |
F.Fab | -- | Yes |
B.Fab | -- | Yes |
F.CrtYd | -- | Yes |
B.CrtYd | -- | Yes |
注意:如果你有一个图层“F.Cu”,那么它的所有子图层都将被视为“F.Cu”,而不管它们的名称是什么。在
- 项目
标签: