Skip to main content

No project description provided

Project description

Overview

This is a simple API wrapper that allows interaction with a PackaideServer instance.

The API allows for passing multiple SVG files to the server, which are then nested into one or more SVG files. The resulting SVG files are then returned to the client.

Installation

pip install packaide_client

Usage

The main class is a PackaideClient which exposes a single method pack. This method takes a list of SVG strings, height and width (in inches) and returns a list of SVG strings. The resulting SVG strings will have the nested shapes.

As a side note, the original size (ie: viewBox) of the input SVG files has no influence on the size of the output SVG files. The output SVG will always conform to the height and width parameters. However, if any shape or path in the input SVG files is too large to fit in the output SVG, a ValueError will be always be raised.

Example

from packaide_client import PackaideClient

# URL is the address of the server instance, usually operating on port 8000
URL = "http://localhost:8000"

client = PackaideClient(URL)

svg1 = "<svg>...</svg>"
svg2 = "<svg>...</svg>"

results = client.pack([svg1, svg2], height=60, width=40,
                      tolerance=.1,
                      offset=5,
                      rotations=4)  # Returns a list of SVGs

# results can be passed to other functions
for sheet in results:
    print(sheet)

# Or written to a files
for i, sheet in enumerate(results):
    with open(f"sheet_{i}.svg", "w") as f:
        f.write(sheet)

Parameters

The pack method takes the following parameters:

  • svgs: A list of SVG strings to be nested
  • height: The height of the output SVG in inches
  • width: The width of the output SVG in inches
  • tolerance: The tolerance used when quantizing curves (Discretization tolerance)
  • offset: The offset distance around each shape (dilation)
  • rotations: The number of rotations to attempt when nesting shapes.

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

packaide_client-1.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

packaide_client-1.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file packaide_client-1.0.1.tar.gz.

File metadata

  • Download URL: packaide_client-1.0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for packaide_client-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5f652d99cb3a1d42442fb7d09f264673b79d0b8327c8a12cbfacf46e1ee6228a
MD5 b1ecd2051d57d9457897c411d4b305c8
BLAKE2b-256 082ce8855f984b23807fd5f5c9a754b35fb98f99a333965c95f588df4c5ff220

See more details on using hashes here.

File details

Details for the file packaide_client-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for packaide_client-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99c2166159d9722e6d1b5d4b9741a3d17515b98fbfcbbabfeed8f5f535d57e67
MD5 9bd769a002f540390e7058df9c31233b
BLAKE2b-256 21a7158e2ec71fed46da0cbd33cecb6d1afee745aaefaa4d139122e315f9bc73

See more details on using hashes here.

Supported by

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