mightyscape-1.2/extensions/fablabchemnitz/cutcraft/cutcraft
2022-09-02 18:19:57 +02:00
..
core Another set of reintegrated extensions 2022-09-02 18:19:57 +02:00
platforms Another set of reintegrated extensions 2022-09-02 18:19:57 +02:00
shapes Another set of reintegrated extensions 2022-09-02 18:19:57 +02:00
supports Another set of reintegrated extensions 2022-09-02 18:19:57 +02:00
__init__.py Another set of reintegrated extensions 2022-09-02 18:19:57 +02:00
README.md Another set of reintegrated extensions 2022-09-02 18:19:57 +02:00
util.py Another set of reintegrated extensions 2022-09-02 18:19:57 +02:00

cut-craft

Python package

Note that this package is written for Python 3, however requires Python 2 compatibility for Inkscape integration.

The cutcraft package contains components in the following categories:

Folder Description
core Core components (point, line etc).
platforms Platforms used to construct shapes (circular etc).
shapes Fundamental 3D shapes (cylinder, cone, sphere etc).
supports Vertical supports to hold the shape levels apart.

Core

Module Description
point A 2D point with x and y coordinates.
rectangle Two points defining topleft and bottom right for a rectangle.
trace An ordered collection of points.
part A collection of one or more traces.
line A type of trace with two points defining the start and end of the line.
circle A type of trace with points defining a circle.
neopixel A type of trace with the points defining a cutout suitable to fit a variety of NeoPixels.

Shapes

Module Description
shape The core 3D functionality for a shape.
cone A cone shape.
cylinder A cylinder shape.
sphere A 3D spherical shape.

Note that the fundamental shapes listed above can be used flexibly considering the number of circle segments can be specified. For example a cone with 4 segments becomes a pyramid, and a cylinder with 4 segments becomes a cube.

Supports

Module Description
support The core support structure functionality.
pier A pier like support to hold shape levels apart.
face A solid face to support shape levels.

Python 2 vs 3 Compatibility

The initial aim was to develop only for Python 3, however Inkscape currently uses Python 2 as the default interpreter for extensions. As a result, the following should be noted while reviewing the code:

  1. The calls to super() are written in a way that works with both versions of Python.
  2. The math.isclose() function is not available in Python 2 so a local version has been created in util.py.