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-Icons_SVG_20200430) and unpack it.

Run script with options:

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

Output stencil will be created as AWS_2020_light.gstencil.

Development

Requires Python 3.8+ and Poetry.

Install dependencies in virtual env:

poetry shell
poetry install

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.0.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

omnigraffle_stencil-1.0.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: omnigraffle-stencil-1.0.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Darwin/19.4.0

File hashes

Hashes for omnigraffle-stencil-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ff7a534280137e8e160c60bf16e3afba567bd4f9859aaff2e140abc73fb9ad28
MD5 5e2a6e900fa028b839a3b04491f1f2b6
BLAKE2b-256 317bccc9bb27698318ba02fd37f472f6b7fbd9a7d1823c25aa4698dadc029d94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for omnigraffle_stencil-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b9dc6456aa605cc70c8c3692e93ae1e89001a0fd2e472461c33fa8b2bf2b5d1
MD5 24dff354417b7c55494f5d328a350430
BLAKE2b-256 c65d259e52211647de59349c111b60c2626f7ef7f73b4d4cfa7ce249657fecdf

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