Move API docs out into own file
This commit is contained in:
parent
4bc85b3be4
commit
36c2218065
116
README.txt
116
README.txt
|
@ -2,95 +2,49 @@ What is this?
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is a small python library for generating SVG drawings used for
|
This is a small python library for generating SVG drawings used for
|
||||||
cutting out boxes or other structures from plywood using a laser cutter.
|
cutting out boxes or other structures using a laser cutter.
|
||||||
|
|
||||||
While there are a couple of other box generators they are all very
|
It also comes with a set of ready-to-use, fully parametrized generators:
|
||||||
limited in what they can do. This library aims for supporting
|
* Various simple boxes
|
||||||
complicated shapes while offering easy way to do simple things. To
|
* Flex boxes with rounded corners and living hinges
|
||||||
achieve this there are several levels of abstactions.
|
* Type trays with and without walls and floors
|
||||||
|
* Book cover with flex spine
|
||||||
|
* Magazine file
|
||||||
|
|
||||||
Basic Concepts
|
And a few one trick ponies:
|
||||||
==============
|
* A drill stand
|
||||||
|
* A castle tower
|
||||||
|
* A housing for a special kind of lamp
|
||||||
|
* A cutlery stand
|
||||||
|
|
||||||
There is basically only one class that takes care of everything. You
|
Have a look into the examples/ directory to see how the results look like.
|
||||||
are supposed to sub class it and implement the render() method
|
|
||||||
(actually just any method that does anything). This Boxes class keeps
|
|
||||||
a cairo canvas object (self.ctx) that all drawing is made on. In
|
|
||||||
addition it keeps a couple of global settings used for various drawing
|
|
||||||
operations. See the __init__ method for the details.
|
|
||||||
|
|
||||||
Building blocks and coordinates
|
Features
|
||||||
-------------------------------
|
========
|
||||||
|
|
||||||
To avoid too much coordinate calculations the coordinate system is
|
Of course the library and the generators allow selecting the "thickness"
|
||||||
continuously moved to the current point. The most basic functions just
|
of the material used and automatically adjusts lengths and width of
|
||||||
do drawings relative to the current coordinate system - without
|
joining fingers and other elements.
|
||||||
changing the coordinate system. Those are found in the Builing Blocks section.
|
|
||||||
|
|
||||||
Turtle graphics commands
|
The "burn" parameter compensates for the material removed by the laser. This
|
||||||
------------------------
|
allows fine tuning the gaps between joins up to the point where plywood
|
||||||
|
can be press fitted even without any glue.
|
||||||
|
|
||||||
These start at the current positions and move the coordinate system to
|
Finger Joints are the work horse of the library. They allow 90° edges
|
||||||
their end. It is assumed that you are (roughly) drawing into the
|
and T connections. Their size is scaled up with the material
|
||||||
direction of the x axis, with the inside of the part being above the
|
"thickness" to maintain the same appearance. The libray also allows
|
||||||
line. You need to turn counter clockwise (mathematically positive) to
|
putting holes and slots for screws (bed bolts) into finger joints,
|
||||||
get a closed shape. These commands typically produce some sort of edges.
|
although this is currently not supported for the finished generators.
|
||||||
|
|
||||||
Finger joints
|
Dovetail joints can be used to join pieces in the same plane.
|
||||||
.............
|
|
||||||
|
|
||||||
Finger joints are a simple way of joining two sheets of plywood. They
|
Flex allows bending and streching the material in one direction. This
|
||||||
work best at an 90° angle. There are two different sides matching each
|
is used for rounded edges and living hinges.
|
||||||
other. As a third alternative there are holes that the fingers of one
|
|
||||||
sheet can plug into. This allows stable T connections especially
|
|
||||||
useful for inner walls.
|
|
||||||
|
|
||||||
Dovetail joints
|
Usage
|
||||||
...............
|
=====
|
||||||
|
|
||||||
Dovetails joints can only be used to join two pieces flatly. This
|
There are two ways to use the available generators:
|
||||||
limits their use to closing some round form created with flex areas or
|
* Execute the scripts/boxes tool and pass the name of the generator
|
||||||
for joining several parts to a bigger one. For this use case they are
|
together with the measurements on the command line
|
||||||
much stronger than simple finger joints and can also bare pulling forces.
|
* Run scripts/boxesserver which provides an web interface on port 8000
|
||||||
|
|
||||||
|
|
||||||
Whole parts
|
|
||||||
===========
|
|
||||||
|
|
||||||
A couple of command can create whole parts like walls. Typically the
|
|
||||||
sizes given are the inner dimmensions not including additional space
|
|
||||||
needed for burn compensation or joints.
|
|
||||||
|
|
||||||
|
|
||||||
Callback parameter
|
|
||||||
..................
|
|
||||||
|
|
||||||
The callback parameter can take on of the following forms:
|
|
||||||
|
|
||||||
* A function (or bound method) that expects one parameter: the number
|
|
||||||
of the side the callback is currently called for.
|
|
||||||
* A dict with some of the numbers of the sides as keys and functions
|
|
||||||
without parameters as values.
|
|
||||||
* A list of functions without parameters. The list may contain None
|
|
||||||
as place holder and be shorter than the number of sides.
|
|
||||||
|
|
||||||
The callback functions are called with the side of the part at the
|
|
||||||
positive x and y axis. If the edge uses up space this space is below
|
|
||||||
the x axis. You do not have to restore the coordinate settings in the
|
|
||||||
callback.
|
|
||||||
|
|
||||||
Instead of functions it can be handy to use a lambda expression
|
|
||||||
calling the one building block funtion you need (e.g. fingerHolesAt).
|
|
||||||
|
|
||||||
Edge description
|
|
||||||
................
|
|
||||||
|
|
||||||
Some part building functions take a edges param or have other params
|
|
||||||
describing some edges. These descriptions are one or several character
|
|
||||||
strings. With the following meanings:
|
|
||||||
|
|
||||||
e : straight edge
|
|
||||||
E : as above but extended outside by one thickness
|
|
||||||
f, F : finger joints
|
|
||||||
h : edge with holes for finger joints
|
|
||||||
d, D : dove tail joints
|
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
Basic Concepts
|
||||||
|
==============
|
||||||
|
|
||||||
|
There is basically only one class that takes care of everything. You
|
||||||
|
are supposed to sub class it and implement the render() method
|
||||||
|
(actually just any method that does anything). This Boxes class keeps
|
||||||
|
a cairo canvas object (self.ctx) that all drawing is made on. In
|
||||||
|
addition it keeps a couple of global settings used for various drawing
|
||||||
|
operations. See the __init__ method for the details.
|
||||||
|
|
||||||
|
Building blocks and coordinates
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
To avoid too much coordinate calculations the coordinate system is
|
||||||
|
continuously moved to the current point. The most basic functions just
|
||||||
|
do drawings relative to the current coordinate system - without
|
||||||
|
changing the coordinate system. Those are found in the Builing Blocks section.
|
||||||
|
|
||||||
|
Turtle graphics commands
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
These start at the current positions and move the coordinate system to
|
||||||
|
their end. It is assumed that you are (roughly) drawing into the
|
||||||
|
direction of the x axis, with the inside of the part being above the
|
||||||
|
line. You need to turn counter clockwise (mathematically positive) to
|
||||||
|
get a closed shape. These commands typically produce some sort of edges.
|
||||||
|
|
||||||
|
Finger joints
|
||||||
|
.............
|
||||||
|
|
||||||
|
Finger joints are a simple way of joining two sheets of plywood. They
|
||||||
|
work best at an 90° angle. There are two different sides matching each
|
||||||
|
other. As a third alternative there are holes that the fingers of one
|
||||||
|
sheet can plug into. This allows stable T connections especially
|
||||||
|
useful for inner walls.
|
||||||
|
|
||||||
|
Dovetail joints
|
||||||
|
...............
|
||||||
|
|
||||||
|
Dovetails joints can only be used to join two pieces flatly. This
|
||||||
|
limits their use to closing some round form created with flex areas or
|
||||||
|
for joining several parts to a bigger one. For this use case they are
|
||||||
|
much stronger than simple finger joints and can also bare pulling forces.
|
||||||
|
|
||||||
|
|
||||||
|
Whole parts
|
||||||
|
===========
|
||||||
|
|
||||||
|
A couple of command can create whole parts like walls. Typically the
|
||||||
|
sizes given are the inner dimmensions not including additional space
|
||||||
|
needed for burn compensation or joints.
|
||||||
|
|
||||||
|
Currently there are only three such parts:
|
||||||
|
|
||||||
|
Boxes.rectangularWall() for generic walls and
|
||||||
|
Boxes.roundedPlate() and Boxes.surroundingWall() for a wall with
|
||||||
|
rounded corners and fitting wall with flex for the rounded edges and
|
||||||
|
dove tail joints for closing the loop.
|
||||||
|
|
||||||
|
Callback parameter
|
||||||
|
..................
|
||||||
|
|
||||||
|
The callback parameter can take on of the following forms:
|
||||||
|
|
||||||
|
* A function (or bound method) that expects one parameter: the number
|
||||||
|
of the side the callback is currently called for.
|
||||||
|
* A dict with some of the numbers of the sides as keys and functions
|
||||||
|
without parameters as values.
|
||||||
|
* A list of functions without parameters. The list may contain None
|
||||||
|
as place holder and be shorter than the number of sides.
|
||||||
|
|
||||||
|
The callback functions are called with the side of the part at the
|
||||||
|
positive x and y axis. If the edge uses up space this space is below
|
||||||
|
the x axis. You do not have to restore the coordinate settings in the
|
||||||
|
callback.
|
||||||
|
|
||||||
|
Instead of functions it can be handy to use a lambda expression
|
||||||
|
calling the one building block funtion you need (e.g. fingerHolesAt).
|
||||||
|
|
||||||
|
Edge description
|
||||||
|
................
|
||||||
|
|
||||||
|
Some part building functions take a edges param or have other params
|
||||||
|
describing some edges. These descriptions are one or several character
|
||||||
|
strings. With the following meanings:
|
||||||
|
|
||||||
|
e : straight edge
|
||||||
|
E : as above but extended outside by one thickness
|
||||||
|
f, F : finger joints
|
||||||
|
h : edge with holes for finger joints
|
||||||
|
d, D : dove tail joints
|
Loading…
Reference in New Issue