cam.joinery#

BlenderCAM ‘joinery.py’ © 2021 Alain Pelletier

Functions to create various woodworking joints - mortise, finger etc.

Functions#

finger_amount(space, size)

Calculates the amount of fingers needed from the available space vs the size of the finger

mortise(length, thickness, finger_play[, cx, cy, rotation])

Generates a mortise of length, thickness and finger_play tolerance

interlock_groove(length, thickness, finger_play[, cx, ...])

Generates an interlocking groove.

interlock_twist(length, thickness, finger_play[, cx, ...])

Generates an interlocking twist.

twist_line(length, thickness, finger_play, percentage, ...)

Generates a multiple interlocking twist.

twist_separator_slot(length, thickness[, finger_play, ...])

Generates a slot for interlocking twist separator.

interlock_twist_separator(length, thickness, amount, ...)

Generates a interlocking twist separator.

horizontal_finger(length, thickness, finger_play, amount)

Generates an interlocking horizontal finger pair _wfa and _wfb.

vertical_finger(length, thickness, finger_play, amount)

Generates an interlocking horizontal finger pair _vfa and _vfb.

finger_pair(name[, dx, dy])

Creates a duplicate set of fingers.

create_base_plate(height, width, depth)

Creates blank plates for a box.

make_flex_pocket(length, height, finger_thick, ...)

creates pockets using mortise function for kerf bending

make_variable_flex_pocket(height, finger_thick, ...)

creates pockets pocket using mortise function for kerf bending

create_flex_side(length, height, finger_thick[, ...])

crates a flex side for mortise on curve. Assumes the base fingers were created and exist

angle(a, b)

returns angle of a vector

angle_difference(a, b, c)

returns the difference between two lines with three points

fixed_finger(loop, loop_length, finger_size, ...[, base])

distributes mortises of a fixed distance. Dynamically changes the finger tolerance with the angle differences

find_slope(p1, p2)

returns slope of a vector

slope_array(loop)

Returns an array of slopes from loop coordinates.

dslope_array(loop[, resolution])

Returns a double derivative array or slope of the slope

variable_finger(loop, loop_length, min_finger, ...[, ...])

Distributes mortises of a fixed distance. Dynamically changes the finger tolerance with the angle differences

single_interlock(finger_depth, finger_thick, ...[, ...])

Generates a single interlock at coodinate x,y.

distributed_interlock(loop, loop_length, finger_depth, ...)

Distributes interlocking joints of a fixed amount.

Module Contents#

finger_amount(space, size)[source]#

Calculates the amount of fingers needed from the available space vs the size of the finger

Parameters:
  • space (float) – available distance to cover

  • size (float) – size of the finger

mortise(length, thickness, finger_play, cx=0, cy=0, rotation=0)[source]#

Generates a mortise of length, thickness and finger_play tolerance cx and cy are the center position and rotation is the angle

Parameters:
  • length (float) – length of the mortise

  • thickness (float) – thickness of material

  • finger_play (float) – tolerance for good fit

  • cx (float) – coordinate for x center of the finger

  • cy (float) – coordinate for y center of the finger

  • rotation (float) – angle of rotation

interlock_groove(length, thickness, finger_play, cx=0, cy=0, rotation=0)[source]#

Generates an interlocking groove.

Parameters:
  • length (float) – Length of groove

  • thickness (float) – thickness of groove

  • finger_play (float) – tolerance for proper fit

  • cx (float) – center offset x

  • cy (float) – center offset y

  • rotation (float) – angle of rotation

interlock_twist(length, thickness, finger_play, cx=0, cy=0, rotation=0, percentage=0.5)[source]#

Generates an interlocking twist.

Parameters:
  • length (float) – Length of groove

  • thickness (float) – thickness of groove

  • finger_play (float) – tolerance for proper fit

  • cx (float) – center offset x

  • cy (float) – center offset y

  • rotation (float) – angle of rotation

  • percentage (float) – percentage amount the twist will take (between 0 and 1)

twist_line(length, thickness, finger_play, percentage, amount, distance, center=True)[source]#

Generates a multiple interlocking twist.

Parameters:
  • length (float) – Length of groove

  • thickness (float) – thickness of groove

  • finger_play (float) – tolerance for proper fit

  • percentage (float) – percentage amount the twist will take (between 0 and 1)

  • amount (int) – amount of twists generated

  • distance (float) – distance between twists

  • center (bool) – center or not from origin

twist_separator_slot(length, thickness, finger_play=5e-05, percentage=0.5)[source]#

Generates a slot for interlocking twist separator.

Parameters:
  • length (float) – Length of slot

  • thickness (float) – thickness of slot

  • finger_play (float) – tolerance for proper fit

  • percentage (float) – percentage amount the twist will take (between 0 and 1)

interlock_twist_separator(length, thickness, amount, spacing, edge_distance, finger_play=5e-05, percentage=0.5, start='rounded', end='rounded')[source]#

Generates a interlocking twist separator.

Parameters:
  • length (float) – Length of separator

  • thickness (float) – thickness of separator

  • amount (int) – quantity of separation grooves

  • spacing (float) – distance between slots

  • edge_distance (float) – distance of the first slots close to the edge

  • finger_play (float) – tolerance for proper fit

  • percentage (float) – percentage amount the twist will take (between 0 and 1)

  • start (string) – type of start wanted (rounded, flat or other) not implemented

  • start – type of end wanted (rounded, flat or other) not implemented

horizontal_finger(length, thickness, finger_play, amount, center=True)[source]#

Generates an interlocking horizontal finger pair _wfa and _wfb.

_wfa is centered at 0,0 _wfb is _wfa offset by one length

Parameters:
  • length (float) – Length of mortise

  • thickness (float) – thickness of material

  • amount (int) – quantity of fingers

  • finger_play (float) – tolerance for proper fit

  • center (bool) – centered of not

vertical_finger(length, thickness, finger_play, amount)[source]#

Generates an interlocking horizontal finger pair _vfa and _vfb.

_vfa is starts at 0,0 _vfb is _vfa offset by one length

Parameters:
  • length (float) – Length of mortise

  • thickness (float) – thickness of material

  • amount (int) – quantity of fingers

  • finger_play (float) – tolerance for proper fit

finger_pair(name, dx=0, dy=0)[source]#

Creates a duplicate set of fingers.

Parameters:
  • name (str) – name of original finger

  • dx (float) – x offset

  • dy (float) – y offset

create_base_plate(height, width, depth)[source]#

Creates blank plates for a box.

Parameters:
  • height (float) – height size for box

  • width (float) – width size for box

  • depth (float) – depth size for box

make_flex_pocket(length, height, finger_thick, finger_width, pocket_width)[source]#

creates pockets using mortise function for kerf bending

Parameters:
  • length (float) – Length of pocket

  • height (float) – height of pocket

  • finger_thick (float) – thickness of finger

  • finger_width (float) – width of finger

  • pocket_width (float) – width of pocket

make_variable_flex_pocket(height, finger_thick, pocket_width, locations)[source]#

creates pockets pocket using mortise function for kerf bending

Parameters:
  • height (float) – height of the side

  • finger_thick (float) – thickness of the finger

  • pocket_width (float) – width of pocket

  • locations (tuple) – coordinates for pocket

create_flex_side(length, height, finger_thick, top_bottom=False)[source]#

crates a flex side for mortise on curve. Assumes the base fingers were created and exist

Parameters:
  • length (float) – length of curve

  • height (float) – height of side

  • finger_thick (float) – finger thickness or thickness of material

  • top_bottom (bool) – fingers on top and bottom if true, just on bottom if false

angle(a, b)[source]#

returns angle of a vector

Parameters:
  • a (tuple) – point a x,y coordinates

  • b (tuple) – point b x,y coordinates

angle_difference(a, b, c)[source]#

returns the difference between two lines with three points

Parameters:
  • a (tuple) – point a x,y coordinates

  • b (tuple) – point b x,y coordinates

  • c (tuple) – point c x,y coordinates

fixed_finger(loop, loop_length, finger_size, finger_thick, finger_tolerance, base=False)[source]#

distributes mortises of a fixed distance. Dynamically changes the finger tolerance with the angle differences

Parameters:
  • loop (list of tuples) – takes in a shapely shape

  • loop_length (float) – length of loop

  • finger_size (float) – size of the mortise

  • finger_thick (float) – thickness of the material

  • finger_tolerance (float) – minimum finger tolerance

  • base (bool) – if base exists, it will join with it

find_slope(p1, p2)[source]#

returns slope of a vector

Parameters:
  • p1 (tuple) – point 1 x,y coordinates

  • p2 (tuple) – point 2 x,y coordinates

slope_array(loop)[source]#

Returns an array of slopes from loop coordinates.

Parameters:

loop (list of tuples) – list of coordinates for a curve

dslope_array(loop, resolution=0.001)[source]#

Returns a double derivative array or slope of the slope

Parameters:
  • loop (list of tuples) – list of coordinates for a curve

  • resolution (float) – granular resolution of the array

variable_finger(loop, loop_length, min_finger, finger_size, finger_thick, finger_tolerance, adaptive, base=False, double_adaptive=False)[source]#

Distributes mortises of a fixed distance. Dynamically changes the finger tolerance with the angle differences

Parameters:
  • loop (list of tuples) – takes in a shapely shape

  • loop_length (float) – length of loop

  • finger_size (float) – size of the mortise

  • finger_thick (float) – thickness of the material

  • min_finger (float) – minimum finger size

  • finger_tolerance (float) – minimum finger tolerance

  • adaptive (float) – angle threshold to reduce finger size

  • base (bool) – join with base if true

  • double_adaptive (bool) – uses double adaptive algorithm if true

single_interlock(finger_depth, finger_thick, finger_tolerance, x, y, groove_angle, type, amount=1, twist_percentage=0.5)[source]#

Generates a single interlock at coodinate x,y.

Parameters:
  • finger_depth (float) – depth of finger

  • finger_thick (float) – thickness of finger

  • finger_tolerance (float) – tolerance for proper fit

  • x (float) – offset x

  • y (float) – offset y

  • groove_angle (float) – angle of rotation

  • type (str) – GROOVE, TWIST, PUZZLE are the valid choices

  • twist_percentage – percentage of thickness for twist (not used in puzzle or groove)

distributed_interlock(loop, loop_length, finger_depth, finger_thick, finger_tolerance, finger_amount, tangent=0, fixed_angle=0, start=0.01, end=0.01, closed=True, type='GROOVE', twist_percentage=0.5)[source]#
Distributes interlocking joints of a fixed amount.

Dynamically changes the finger tolerance with the angle differences

Parameters:
  • loop (list of tuples) – coordinates curve

  • loop_length (float) – length of the curve

  • finger_depth (float) – depth of the mortise

  • finger_thick (float)

  • finger_tolerance (float) – minimum finger tolerance

  • finger_amount (int) – quantity of fingers

  • tangent (int)

  • fixed_angle (float) – 0 will be variable, desired angle for the finger

  • closed (bool) – False:open curve - True:closed curved

  • stem (twist_percentage = portion of twist finger which is the)

  • type (str) – GROOVE, TWIST, PUZZLE are the valid choices

  • start (float) – start distance from first point

  • end (float) – end distance from last point