Drawing commands

Turtle Graphics commands

These commands all move the coordinate system with them.

Boxes.edge(length, tabs=0)[source]

Simple line :param length: length in mm

Boxes.corner(degrees, radius=0, tabs=0)[source]

Draw a corner

This is what does the burn corrections

  • degrees – angle

  • radius – (Default value = 0)

Boxes.curveTo(x1, y1, x2, y2, x3, y3)[source]

control point 1, control point 2, end point

  • x1

  • y1

  • x2

  • y2

  • x3

  • y3


Draw multiple connected lines


*args – Alternating length in mm and angle in degrees.

lengths may be a tuple (length, #tabs) angles may be tuple (angle, radius)

Special Functions

Boxes.bedBoltHole(length, bedBoltSettings=None, tabs=0)[source]

Draw an edge with slot for a bed bolt

  • length – length of the edge in mm

  • bedBoltSettings – (Default value = None) Dimmensions of the slot

Latch and Grip

These should probably be Edge classes. But right now they are still functions.

Boxes.grip(length, depth)[source]

Corrugated edge useful as an gipping area

  • length – length

  • depth – depth of the grooves

Boxes.latch(length, positive=True, reverse=False)[source]

Latch to fix a flex box door to the box

  • length – length in mm

  • positive – (Default value = True) False: Door side; True: Box side

  • reverse – (Default value = False) True when running away from the latch

Boxes.handle(x, h, hl, r=30)[source]

Creates an Edge with a handle

  • x – width in mm

  • h – height in mm

  • hl – height if th grip hole

  • r – (Default value = 30) radius of the corners

Tab support

Tabs are small interuptions in the border of a part to keep it in place. They are enabled with the tabs parameter. All Edges automatically create about two tabs. So parts like boxes.Boxes.rectangularWall() will have 8 tabs holding them in place. Because of this developers often don’t need to be concerned about tabs. But some part may be completely drawn by low level Turtle Graphics commands. For those both boxes.Boxes.edge() and boxes.Boxes.corner() do support a tabs parameter. In addition the length of the line segments in boxes.Boxes.polyline() can be given as a tuple (length, tabs).

Draw Commands

These commands do not change the coordinate system but get the coordinates passed as parameters. All of them are either som sort of hole or text. These artifacts are placed somewhere independently of some continuous outline of the part their on.

Boxes.hole(x, y, r=0.0, d=0.0, tabs=0)[source]

Draw a round hole

  • x – position

  • y – postion

  • r – radius

Boxes.rectangularHole(x, y, dx, dy, r=0)[source]

Draw an rectangulat hole

  • x – position

  • y – position

  • dx – width

  • dy – height

  • r – (Default value = 0) radius of the corners

Boxes.dHole(x, y, r=None, d=None, w=None, rel_w=0.75, angle=0)[source]
Boxes.flatHole(x, y, r=None, d=None, w=None, rel_w=0.75, angle=0)[source]
Boxes.text(text, x=0, y=0, angle=0, align='', fontsize=10, color=[0.0, 0.0, 0.0])[source]

Draw text

  • text – text to render

  • x – (Default value = 0)

  • y – (Default value = 0)

  • angle – (Default value = 0)

  • align – (Default value = “”) string with combinations of (top|middle|bottom) and (left|center|right) separated by a space

Boxes.NEMA(size, x=0, y=0, angle=0)[source]

Draw holes for mounting a NEMA stepper motor

  • size – Nominal size in tenths of inches

  • x – (Default value = 0)

  • y – (Default value = 0)

  • angle – (Default value = 0)

Boxes.TX(size, x=0, y=0, angle=0)[source]

Draw a star pattern

  • size – 1 to 100

  • x – (Default value = 0)

  • y – (Default value = 0)

  • angle – (Default value = 0)

Boxes.flex2D(x, y, width=1)[source]

Fill a rectangle with a pattern allowing bending in both axis

  • x – width

  • y – height

  • width – width between the lines of the pattern in multiples of thickness

class NutHole

An instance is available as boxes.Boxes.nutHole()

An instance of

class boxes.edges.FingerHoles(boxes, settings)[source]

Hole matching a finger joint edge

is accessible as Boxes.fingerHolesAt.

Hexagonal Hole patterns

Hexagonal hole patterns are one way to have some ventilation for housings made with Boxes.py. Right now both .rectangularWall() and .roundedPlate() do supports this pattern directly by passing the parameters to the calls. For other use cases these more low level methods can be used.

For now this is the only supported pattern for ventilation slots. More may be added in the future.

There is a global Boxes.hexHolesSettings object that is used if no settings are passed. It currently is just a tuple of (r, dist, style) defaulting to (5, 3, ‘circle’) but might be replace by a Settings instance in the future.

Boxes.hexHolesRectangle(x, y, settings=None, skip=None)[source]

Fills a rectangle with holes in a hex pattern.

Settings have: r : radius of holes b : space between holes style : what types of holes (not yet implemented)

  • x – width

  • y – height

  • settings – (Default value = None)

  • skip – (Default value = None) function to check if hole should be present gets x, y, r, b, posx, posy

Boxes.hexHolesCircle(d, settings=None)[source]

Fill circle with holes in a hex pattern

  • d – diameter of the circle

  • settings – (Default value = None)

Boxes.hexHolesPlate(x, y, rc, settings=None)[source]

Fill a plate with holes in a hex pattern

  • x – width

  • y – height

  • rc – radius of the corners

  • settings – (Default value = None)

Boxes.hexHolesHex(h, settings=None, grow=None)[source]

Fill a hexagon with holes in a hex pattern

  • h – height

  • settings – (Default value = None)

  • grow – (Default value = None)