Skip to main content

Create ACOPOStrak resources for projects, training, meetings, mappView widgets, etc...

Project description

pyacptrak

What is it?

pyacptrak helps you to create ACOPOStrak resources for projects, training, meetings, mappView widgets, etc... It is a powerful tool when used together with Jupyter-Lab (Or Jupyter Notes) but could be used as stand alone module.

PyPI Latest Release PyPI License Python versions Twitter

Install

To install pyacptrak, run the following command:

pip install pyacptrak

Install with development dependencies

To install pyacptrak, along with the tools you need to develop and run tests, run the following command:

pip install pyacptrak[dev]

Main Features

Work with segments (Segment class)

The library support the 4 type of segments ('AA', 'AB', 'BA' and 'BB')

Obtain segment information:

from pyacptrak import *

print(Segment('aa').info)

Output:

{'length': 660,
 'type': '8F1I01.AA66.xxxx-1',
 'description': 'ACOPOStrak straight segment'}

Plot segment:

from pyacptrak import *

Segment('aa').plot()

image

<pyacptrak.pyacptrak.segment at 0x17d8f72d930>

The plot function supports rotation in degrees

from pyacptrak import *

Segment('ab').plot(-45)

image

<pyacptrak.pyacptrak.segment at 0x17daed042b0>

Work with tracks (Track class)

The library has 5 types of pre-built tracks (TRACK0, TRACK45, TRACK90, TRACK135 and TRACK180)

from pyacptrak import *

TRACK135.plot()

image

<pyacptrak.pyacptrak.track at 0x17daec2f250>

But you could also build your own tracks using individual segments

from pyacptrak import *
track1 = (Segment('aa') * 2) + Segment('ab') + (Segment('bb') * 2) + Segment('ba')
track1.plot()

image

<pyacptrak.pyacptrak.track at 0x17daf060700>

Or using the pre-configured tracks

from pyacptrak import *
track1 = (TRACK0 * 2) + TRACK135
track1.plot()

image

<pyacptrak.pyacptrak.track at 0x17daf060700>

The plot function supports rotation for tracks

from pyacptrak import *
track1 = (TRACK0 * 2) + TRACK135
track1.plot(15)

image

<pyacptrak.pyacptrak.track at 0x17daef17f10>

Work with loops (Loop class)

The library supports working with loops, the arguments for the loop are width and height, the unit is considering the 660mm grid so a loop(2,1) would draw the smallest possible loop

from pyacptrak import *
Loop(2,1).plot()

image

<pyacptrak.pyacptrak.track at 0x17daed040a0>

For loops wider than 1 it uses 90° tracks instead of 180°

from pyacptrak import *
Loop(3,2).plot()

image

<pyacptrak.pyacptrak.track at 0x17daf0b8880>

The plot function also support rotation for loops

from pyacptrak import *
Loop(3,2).plot(190)

image

<pyacptrak.pyacptrak.track at 0x17daf0ce020>

Save the SVG files

It is possible to save the SVG file of any of the classes by chaining the method save().

The save() accepts one argument to define the name of the output file, if no name is passed, the default filename will be the class name

from pyacptrak import *
Loop(3,2).plot(190).save()

Output: Saves a "Loop.svg" file


License

Copyright © Jorge Centeno

Licensed under the GNU GPLv3 license.


Changes

v0.0.3 (Latest release)

General changes:

  • License changed from MIT to GNU GPLv3.
  • Added TypeError for addition and multiplication operators.
  • Added typeguard and typing packages to typecheck the methods.
  • Added xmltodict package to create the xml configuration files for the AS project.
  • Added PARAM variable to configure the exported files.
  • Reduced the size of SVG files.

Segment class:

  • Change: Removed the info attribute.
  • New feature: The info() method was added to get the segment information.
  • Bug fix: Multiplying a segment object by an integer "n" would create a Track class object with "n" segments all pointing to the same segment object.

Track class:

  • New feature: The seg_prefix argument (Optional) was added to the Track class to create the segment variable. The default value is "gSeg_".
  • New feature: The seg_offset argument (Optional) was added to the Track class to configure an offset for the segment variable. The default value is "1".
  • New feature: The info() method was added to get the track information.
  • Bug fix: Adding or multiplying Track objects would create a Track class object with elements pointing to the same segment objects

Loop class:

  • New feature: Added addition and multiplication operators, the result will return an Assembly object.
  • Bug fix: The inherited length() method didn't work because the Loop class had a length attribute that was overwritting the method length() of the parent class Track.

Assembly class:

  • New feature: Class added to the package
  • New feature: The export() method was added.
    • The assembly configuration file (AsmCfg.assembly) will be generated.
    • The shuttle stereotype file (ShCfg.shuttlestereotype) will be generated.

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

pyacptrak-0.0.4.tar.gz (29.7 kB view hashes)

Uploaded Source

Built Distribution

pyacptrak-0.0.4-py3-none-any.whl (30.2 kB view hashes)

Uploaded Python 3

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