Skip to main content

Tool to create OmniGraffle stencils from SVG icons

Project description

OmniGraffle Stencil generator

Tool to create OmniGraffle stencils from SVG icons.

Features:

  • create multiple sheets by directory
  • parametrize object magnets
  • filter images and format icon names

Idea based on script from AWS-OmniGraffle-Stencils

Usage

Requires Python 3.8+.

Install:

pip3 install omnigraffle-stencil

Run:

omnigraffle-stencil --help

to see all options:

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

Input files are taken from the given location (./svg by default) and should be grouped into directories. Every directory will be parsed to a separate canvas in output stencil.

SVG directories structure example:

svg/
├── Group 1/
│   ├── icon1.svg
│   ├── icon2.svg
│   ├── icon3.svg
└── Group 2/
    ├── icon4.svg
    └── icon5.svg

AWS Architecture Icons example

To generate icons from AWS Architecture Icons download SVG zip file (example: AWS-Architecture-Assets-For-Light-and-Dark-BG_20200911) and unpack it.

Run script with options:

omnigraffle-stencil \
    --svg-dir "AWS-Architecture-Assets-For-Light-and-Dark-BG_20200911/AWS-Architecture-Service-Icons_20200911" \
    --stencil-file AWS_20200911_Services.gstencil \
    --filename-includes _48 \
    --stencil-name-remove Arch_ _48 . - _ \
    --group-name-remove Arch_ . - _

Output stencil will be created as AWS_20200911_Services.gstencil.

Check out the AWS stencil in Stenciltown - it contains all Service and Resource icons.

Development

Requires Python 3.8+ and Poetry.

Install dependencies in virtual env:

poetry shell
poetry install

Troubleshooting installing pillow library on MacOS: https://akrabat.com/installing-pillow-on-macos-10-15-calatalina/

Get virtual env path for the IDE:

poetry env info -p

Run script:

poetry run omnigraffle-stencil

Publishing

Build and publish package:

poetry build
poetry publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omnigraffle-stencil-1.1.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

omnigraffle_stencil-1.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file omnigraffle-stencil-1.1.0.tar.gz.

File metadata

  • Download URL: omnigraffle-stencil-1.1.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Darwin/19.6.0

File hashes

Hashes for omnigraffle-stencil-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7666d8117b47834956b99a302eab15e85eda707e758947384c5ec32e1e310a39
MD5 e25dfaeed5b128cd39aa1e12a657df75
BLAKE2b-256 ae7b16cdde415c9d2e102ae945b590fc7aeac3d6f13920d29cd7cfec068454ab

See more details on using hashes here.

File details

Details for the file omnigraffle_stencil-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for omnigraffle_stencil-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7af519a27f74aa836ae69a0f82d5f741cc65d3ceece5ccfd1563dfd0c49825e
MD5 5bbb849878f74e04736110690ed3804a
BLAKE2b-256 faa4f008d4fd7e94be83dfb939fa96bca14d6b750a6ac3de8942b2a7bcb7d5a0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page