从SVG图标创建OmniGraffle模具的工具
omnigraffle-stencil的Python项目详细描述
OmniGraffle模板生成器
创建OmniGraffle的工具 来自SVG图标的模具。在
特点:
- 按目录创建多张图纸
- 对象磁铁参数化
- 过滤图像和格式图标名称
基于脚本的创意 AWS-OmniGraffle-Stencils
使用
需要Python 3.8+。在
安装:
pip3 install omnigraffle-stencil
运行:
^{pr2}$要查看所有选项:
usage: omnigraffle-stencil [-h] [--svg-dir SVG_DIR] [--stencil-file STENCIL_FILE] [--filename-includes [FILENAME_INCLUDES [FILENAME_INCLUDES ...]]] [--filename-excludes [FILENAME_EXCLUDES [FILENAME_EXCLUDES ...]]]
[--stencil-name-remove [STENCIL_NAME_REMOVE [STENCIL_NAME_REMOVE ...]]] [--no-vertex-magnets] [--side-magnets SIDE_MAGNETS] [--text-output]
Convert SVG files into OmniGraffle stencil
optional arguments:
-h, --help show this help message and exit
--svg-dir SVG_DIR svg files directory path (default: ./svg)
--stencil-file STENCIL_FILE
name of output stencil file (default: output.gstencil)
--filename-includes [FILENAME_INCLUDES [FILENAME_INCLUDES ...]]
strings to filter image file name by, taking only those which contains them all
--filename-excludes [FILENAME_EXCLUDES [FILENAME_EXCLUDES ...]]
strings to filter image file name by, taking only those which do not contain any of them
--stencil-name-remove [STENCIL_NAME_REMOVE [STENCIL_NAME_REMOVE ...]]
strings to be removed from image file name when creating stencil name (default: . - _)
--no-vertex-magnets don't create magnets on vertices (NE, NW, SE, SW)
--side-magnets SIDE_MAGNETS
number of magnets for each side (default: 5)
--text-output write OmniGraffle data file as text instead of binary
输入文件从给定位置获取(默认情况下,./svg
)
并应分组到目录中。
在输出模具中,每个目录都将被解析为一个单独的画布。在
SVG目录结构示例:
svg/
├── Group 1/
│ ├── icon1.svg
│ ├── icon2.svg
│ ├── icon3.svg
└── Group 2/
├── icon4.svg
└── icon5.svg
AWS架构图标示例
从中生成图标 AWS Architecture Icons 下载SVG zip文件 (示例:AWS-Architecture-Icons_SVG_20200430) 把它打开。在
使用以下选项运行脚本:
omnigraffle-stencil \ --svg-dir "AWS-Architecture-Icons_SVG_20200430/SVG Light"\ --stencil-file AWS_2020_light.gstencil \ --filename-includes light-bg \ --stencil-name-remove . - _ light-bg
输出模具将创建为AWS_2020_light.gstencil
。在
发展
需要Python3.8+和Poetry。在
在虚拟环境中安装依赖项:
poetry shell poetry install
获取IDE的虚拟环境路径:
poetry env info -p
运行脚本:
poetry run omnigraffle-stencil
出版
生成和发布包:
poetry build poetry publish
- 项目
标签: