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.
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()
<pyacptrak.pyacptrak.segment at 0x17d8f72d930>
The plot function supports rotation in degrees
from pyacptrak import *
Segment('ab').plot(-45)
<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()
<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()
<pyacptrak.pyacptrak.track at 0x17daf060700>
Or using the pre-configured tracks
from pyacptrak import *
track1 = (TRACK0 * 2) + TRACK135
track1.plot()
<pyacptrak.pyacptrak.track at 0x17daf060700>
The plot function supports rotation for tracks
from pyacptrak import *
track1 = (TRACK0 * 2) + TRACK135
track1.plot(15)
<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()
<pyacptrak.pyacptrak.track at 0x17daed040a0>
For loops wider than 1 it uses 90° tracks instead of 180°
from pyacptrak import *
Loop(3,2).plot()
<pyacptrak.pyacptrak.track at 0x17daf0b8880>
The plot function also support rotation for loops
from pyacptrak import *
Loop(3,2).plot(190)
<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
andtyping
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 theTrack
class to create the segment variable. The default value is "gSeg_".- New feature: The
seg_offset
argument (Optional) was added to theTrack
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 theLoop
class had alength
attribute that was overwritting the methodlength()
of the parent classTrack
.
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
Built Distribution
Hashes for pyacptrak-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f9cb7f3daff4e8527e35ddd568f01f80347a319bdfd8cf1a6ce41595e9d43be |
|
MD5 | 914e18d7ee0701cfe7660d890a2c9b07 |
|
BLAKE2b-256 | 2d8229ba834d9caccc5170ce4f98f1dd00ed3d32bab092192b768ef0ac37886f |