Rail catch

primlib/primitives/rail_catch.py · class RailCatch · all primitives

A catch for a fitting that must come off, such as a shoulder strap or a handle: rail_count dovetail rails rail_width wide and length long on one plate screwed to a panel, a housing with a slot for each that slides on until its end wall meets the rails' ends, and two leaf springs that hold it there. The fitting is fixed to the housing's back (strap_anchor is this catch with a plate for a strap's webbing there). Not yet printed.

Frame: the rails' own: x along the rails from 0 to length, y across, the rails centred on y = 0, pitch apart; the rails' root at z = 0, their tip faces at z = -rail_depth, and the plate's mounting face, on the panel, at z = rail_base. The housing's open end is at x = 0 and its end wall past x = length: it goes on over the rails' x = length end and slides towards x = 0 until the end wall meets them. The parts are built locked, clearance off the end wall. Mounted on a side, x = 0 is at the top: the housing comes on from below, and its end wall, at the bottom, takes the fitting's pull upwards.

Rail: rail_dovetails on a plate rail_base thick and block_w wide, one piece, so they stay parallel. Each rail has screws_per_end countersunk holes in from each end, evenly spaced and mirrored about its middle, driven from the tip face into the panel (ply thick): the plastic is clamped, the thread is in the wood. rail_base follows from the screw (screw_l) so that its tip stops tip_min short of the panel's far face. Beside the outer rails the plate's face has a recess for each leaf at detent_x, its ends 45 deg ramps, and a 45 deg lead-in at x = length for the leaf's bump.

Housing: one block block_w wide with a rail_dovetail_housing slot per rail at clearance, wall between them, skin behind their floors, closed by end_wall at x = length, its outside edges chamfered chamfer. Outside each outer slot, past catch_wall, a chamber for a leaf opens into the face through a window over the plate's strip: in section a trapezoid, its back (the seat) longer than the window, its ends 45 deg walls, so each end of the window is a ledge the leaf's end lies under. Every gap round a leaf is leaf_clearance.

Leaves: spring_l long, spring_w wide, spring_t thick, an arch rising rise0 as printed, with a 45 deg bump at its apex and 45 deg chamfers at its ends. Pressed into the window, the ends pass the ledges and spring out beneath them; riding the plate they lie flat on the seat; at detent_x the bump drops into the recess, still pressing by preload.

Parts: four objects in the result compound: {name}_rail, _housing, and the leaves twice, _leaf as printed and _leaf_locked as they lie in the recesses.

Print: the rail plate on its mounting face; the housing standing on its end wall, the slots' flanks and the chambers' walls at 45 deg or steeper; the leaves on their edges.

Isometric View

lengthBCxyz
Isometric view at the defaults, from the front, left and below, dimensioned with the first order parameters: the origin ringed, the local x, y and z axes beside it.

Isometric View, Rail

xyz
Isometric view of the rail alone, at the defaults, from the front, right and below: the origin ringed, the local x, y and z axes beside it.

Isometric View, Housing

xyz
Isometric view of the housing alone, at the defaults, from the front, right and above: the origin ringed, the local x, y and z axes beside it.

3rd Angle View

lengthFRONT VIEWTOP VIEWBCRIGHT SIDE VIEWRAIL CATCHrail_catchDIMENSIONS IN mmNOT APPROVED3rd ANGLE PROJECTION

Parameter reference

namedefaultnote
First order
rail_width (B) 8  each rail's width, between the tangents to its tip radii (rail_dovetail)
rail_count 4  rails side by side, each with its own slot (rebuild after changing)
length31  rail length, x: the housing's open end at x = 0, its end wall past x = length
Fit
clearance 0.3every gap between the rails and the housing, normal to the faces
leaf_clearance 0.3every gap round the leaves (chamber, window, recess)
preload 0.3the leaf still pressing in the recess, locked
Rail
rail_depth 4  rail depth, root to tip
lead 0.845 deg lead-ins at the rails' ends
slot_lead 0.945 deg lead-ins at the slots' ends, a wider mouth for entry
detent_x=length / 2the recesses and the leaves' middles, x
recess_depth 1  recess depth into the plate's face beside the outer rails (the leaves' notches)
screws_per_end 2  screws in from each end of each rail, up its centre, mirrored about its middle (rebuild after changing)
screw_edge 3.8the end screws' centres, x in from the rail's ends
screw_l12  countersunk wood screws, from the rail's tip face into the panel
tip_min 1  the screw's tip short of the panel's far face, at least
ply 6.5the panel the plate is screwed to
clear_d 3  the clearance hole through the rail (the screw clamps, its thread is in the panel)
head_d 5.6the countersink at the tip face, 90 deg
head_sink 0.3the head's top below the tip face, so the housing and the leaf slide over
rail_base=max(1; screw_l + head_sink - rail_depth - ply + tip_min)the plate joining the rails, root to the mounting face: thick enough that the screw stops tip_min short of the panel's far face, at least 1
Housing
end_wall 4  the end wall closing the housing at x = length
wall 4.7housing walls between the slots
catch_wall 2  housing wall between the outer slot and its leaf's chamber
side_wall 2  housing wall outside each leaf's chamber
chamfer 1  45 deg chamfer on the housing's outside edges
skin 3  housing behind the slots' floors
Leaf spring
spring_l22  leaf length along it (flat), x
spring_w 4.4leaf width, y
spring_t 1  leaf thickness, z
end_lead=spring_t / 2the 45 deg chamfer under each end: it leads the end in past the window's edge
bump_flat 2  the bump's flat top, x

Section

xyz
Isometric view at the defaults, from the front, right and above, enlarged, the front right quarter (x > 15.5, y < 28.75) cut away: each part in its own colour (rail blue, housing orange, leaf as printed red, leaf locked green), the cut faces hatched, the origin marked, the local x, y and z axes beside it.

Derived values

Expanded inline into the object expressions; values shown at the defaults.

nameexpressionvaluenote
tip_flatrail_width - 2  6    each rail's tip face between its radii (tip radius 1)
neck_wrail_width + 2 * (1 / tan(30) - 1) - 2 * rail_depth / tan(60)  4.845each rail's root, sharp, where the screw passes
neck_wall(neck_w - clear_d) / 2  0.923rail left each side of a screw hole at the root
pitch (C)rail_width + 2 * clearance + wall 13.3  rail to rail, y
y0-(rail_count - 1) / 2 * pitch-19.95 the first rail's centre line, y
catch_wcatch_wall + spring_w + 2 * leaf_clearance + side_wall  9    each leaf's share of the width, y
block_wrail_count * (rail_width + 2 * clearance) + (rail_count - 1) * wall + 2 * catch_w 66.5  the housing's and the plate's width, y
catch_y(rail_count - 1) / 2 * pitch + rail_width / 2 + clearance + catch_wall + spring_w / 2 + leaf_clearance 28.75 each leaf's centre line, +-y
face_z-clearance -0.3  the housing's face over the plate, z: the windows open in it
rise0recess_depth + preload  1.3  the leaf's arch rise as printed
chord0spring_l - pi * pi * rise0 * rise0 / (4 * spring_l) 21.81 the arch's chord as printed
slot_halfspring_l / 2 + end_lead + leaf_clearance * sqrt(2) 11.924the seat's ends from detent_x: the flat leaf's ends in the corners
underrecess_depth + spring_t + leaf_clearance  2.3  the chamber's depth below the face
window_halfslot_half - under  9.624the window, half its length
engagechord0 / 2 - window_half  1.281how far each end lies under its ledge, as printed
seat_zface_z - under -2.6  the seat, z
back-rail_depth - clearance - skin -7.3  the housing's back, z
block_d-back - clearance  7    the housing's depth below its face
bump_hface_z + clearance - seat_z - spring_t  1.6  the bump's height off the leaf
recess_floorbump_flat + 2 * leaf_clearance  2.6  the recess's flat floor, x
flat_strainpi * pi * rise0 * spring_t / (2 * spring_l * spring_l) * 100  1.325the leaf's strain pressed flat, %
insert_chordsqrt((slot_half + window_half - leaf_clearance) * (slot_half + window_half - leaf_clearance) + under * under) 21.373going in one end first: that end in its corner, the other passing the far window edge
insert_risesqrt(4 * spring_l * max(0; spring_l - insert_chord) / (pi * pi))  2.365the arch's rise squeezed to pass the window
insert_strainpi * pi * insert_rise * spring_t / (2 * spring_l * spring_l) * 100  2.411the leaf's strain going in, %
screw_pitch(length - 2 * screw_edge) / (2 * screws_per_end - 1)  7.8  screw to screw along a rail
screw_bitescrew_l - (rail_depth + rail_base - head_sink)  5.5  each screw's length in the panel
tip_shortply - screw_bite  1    the screw's tip short of the panel's far face
screws2 * screws_per_end * rail_count 16    screws through the rails, all
toplength + clearance + end_wall 35.3  the end wall's outer face, x

Valid range

Checked when the primitive is built; later edits to the sheet are not checked.

must be > 0otherwise
rail_count - 1 + 0.000001rail_count must be at least 1
screws_per_end - 1 + 0.000001screws_per_end must be at least 1
1.5 - flat_strainthe leaf is over 1.5 % strain pressed flat
3 - insert_strainthe leaf is over 3 % strain going in
spring_t - 0.3 - end_lead + 0.000001the end chamfers leave under 0.3 of leaf
engage - 0.5 + 0.000001the leaf's ends are less than 0.5 under the ledges
detent_x - slot_half - 1 - slot_lead - chamferthe chamber reaches the housing's open end
length - detent_x - slot_halfthe chamber reaches the end wall
tip_short - tip_min + 0.001the screws reach within tip_min of the panel's far face
screw_bite - 4 + 0.000001the screws have under 4 of thread in the panel
screw_edge - head_d / 2 - lead - 0.2 + 0.000001a countersink isn't 0.2 inside the rails' lead-ins
tip_flat - head_d + 0.000001the countersink is wider than the rail's tip face
neck_wall - 0.9 + 0.000001under 0.9 of rail each side of a screw hole at the root
wall - 2 + 0.000001under 2 of housing wall between the slots
catch_wall - 2 + 0.000001under 2 of housing wall beside the outer slots
side_wall - 1.5 + 0.000001under 1.5 of housing wall outside the leaves
rail_base - recess_depth - preload - 0.2 - 1 + 0.000001the plate keeps under 1 below the leaves' lead-in
spring_w - 3 + 0.000001the leaf is under 3 wide
(length)dovetail rail: length must be positive
expression0.000001 - abs((2 * (((rail_width) / 2 + ((1) / tan((60) / 2)) - (1)) - ((1) / tan((60) / 2)) + (1))) - (rail_width))
dovetail rail: the tip radii don't come to the width
expression(((rail_width) / 2 + ((1) / tan((60) / 2)) - (1)) - (rail_depth) / tan((60))) + (0) / 2
dovetail rail: depth leaves no root
(lead) >= (lead) * 0 ? 1 : 0dovetail rail: end_taper can't be negative
(1) - (lead)dovetail rail: end_taper must be less than the tip radius
(length) - 2 * (lead)dovetail rail: length is too short for its two tapered ends
expression((rail_depth) - (lead)) / sin((60)) - ((1) - (lead)) / tan((60) / 2) - ((0.2) / tan((60) / 2))
dovetail rail: depth is too small for end_taper: the flanks are too short for their radii
expression(rail_depth) / sin((60)) - ((1) / tan((60) / 2)) - ((0.2) / tan((60) / 2))
dovetail rail: depth is too small: the flanks are too short for their radii
(rail_base)dovetail rail: base_depth must be more than 0: the root radius needs the support
expression(-1) < (-1) * 0 ? 1 : (-1) / 2 - (((rail_width) / 2 + ((1) / tan((60) / 2)) - (1)) - (rail_depth) / tan((60))) - ((0.2) / tan((60) / 2))
dovetail rail: base_width is narrower than the root and its radius
(length + clearance)dovetail rail housing: length must be positive
expression0.000001 - abs((2 * (((rail_width) / 2 + ((1) / tan((60) / 2)) - (1)) - ((1) / tan((60) / 2)) + (1))) - (rail_width))
dovetail rail housing: the tip radii don't come to the width
expression(((rail_width) / 2 + ((1) / tan((60) / 2)) - (1)) - (rail_depth) / tan((60))) + (0) / 2
dovetail rail housing: depth leaves no root
(slot_lead) >= (slot_lead) * 0 ? 1 : 0dovetail rail housing: end_taper can't be negative
(1) - (slot_lead)dovetail rail housing: end_taper must be less than the tip radius
(length + clearance) - 2 * (slot_lead)dovetail rail housing: length is too short for its two tapered ends
(clearance)dovetail rail housing: clearance must be positive
(block_d) - (rail_depth) - (slot_lead)dovetail rail housing: block_depth leaves no floor under the lead-ins
expression(rail_depth) / sin((60)) - ((1) / tan((60) / 2)) - ((0.2) / tan((60) / 2))
dovetail rail housing: depth is too small: the flanks are too short for their radii
expression(block_w + (rail_count - 1) * pitch) / 2 - (((rail_width) / 2 + ((1) / tan((60) / 2)) - (1)) + ((clearance) / tan((60) / 2))) - (slot_lead) / tan((60) / 2) - (0) / 2
dovetail rail housing: block_width leaves no wall beside the slot
(block_d) - (rail_depth)dovetail rail housing: block_depth leaves no floor under the slot

FreeCAD

import primlib
# appended to the document's Params sheet under "RailCatch: Rail catch",
# aliases RailCatch_rail_width, RailCatch_rail_count, ...
obj = primlib.make("rail_catch", doc, "RailCatch")
obj = primlib.make("rail_catch", doc, "RailCatch", rail_width='8', rail_count='4')   # starting values

# into another sheet, or with plain shared aliases (rail_width, ...)
obj = primlib.make("rail_catch", doc, "RailCatch", sheet=sheet)
obj = primlib.make("rail_catch", doc, "RailCatch", prefix="")

# or drive params from expressions you already have
obj = primlib.make("rail_catch", doc, "RailCatch", sheet=sheet,
                 bind={"rail_width": "MyAlias * 2"})

In the FreeCAD GUI: the primlib workbench has a button for Rail catch. Its parameters are appended to the document's Params sheet under a title row, or to the selected spreadsheet if one is selected.

Objects created: the spreadsheet rows, the hidden helper objects described above, and the result <name>, tagged PrimlibPrimitive = "rail_catch". They are plain FreeCAD objects: the saved file does not need primlib.

prim format

{
  "format": "primlib.prim",
  "version": "0.1",
  "primitive": "rail_catch",
  "title": "Rail catch",
  "params": {
    "rail_width": 8,
    "rail_count": 4,
    "length": 31,
    "clearance": 0.3,
    "leaf_clearance": 0.3,
    "preload": 0.3,
    "rail_depth": 4,
    "lead": 0.8,
    "slot_lead": 0.9,
    "detent_x": 15.5,
    "recess_depth": 1,
    "screws_per_end": 2,
    "screw_edge": 3.8,
    "screw_l": 12,
    "tip_min": 1,
    "ply": 6.5,
    "clear_d": 3,
    "head_d": 5.6,
    "head_sink": 0.3,
    "rail_base": 2.8,
    "end_wall": 4,
    "wall": 4.7,
    "catch_wall": 2,
    "side_wall": 2,
    "chamfer": 1,
    "skin": 3,
    "spring_l": 22,
    "spring_w": 4.4,
    "spring_t": 1,
    "end_lead": 0.5,
    "bump_flat": 2
  }
}

In a recipe

{
  "format": "primlib.prim",
  "version": "0.1",
  "kind": "assembly",
  "primitive": "rail_catch_pair",
  "title": "Two rail catches",
  "params": {
    "rail_width": 8,
    "rail_count": 4,
    "length": 31,
    "clearance": 0.3,
    "leaf_clearance": 0.3,
    "preload": 0.3,
    "rail_depth": 4,
    "lead": 0.8,
    "slot_lead": 0.9,
    "detent_x": 15.5,
    "recess_depth": 1,
    "screws_per_end": 2,
    "screw_edge": 3.8,
    "screw_l": 12,
    "tip_min": 1,
    "ply": 6.5,
    "clear_d": 3,
    "head_d": 5.6,
    "head_sink": 0.3,
    "rail_base": 2.8,
    "end_wall": 4,
    "wall": 4.7,
    "catch_wall": 2,
    "side_wall": 2,
    "chamfer": 1,
    "skin": 3,
    "spring_l": 22,
    "spring_w": 4.4,
    "spring_t": 1,
    "end_lead": 0.5,
    "bump_flat": 2,
    "spacing": 50
  },
  "parts": [
    {"name": "rail_catch", "primitive": "rail_catch"}
  ],
  "place": [
    {"id": 0, "op": "instance", "name": "First", "part": "rail_catch", "at": ["0", "0", "0"], "turn": []},
    {"id": 1, "op": "instance", "name": "Second", "part": "rail_catch", "at": ["spacing", "0", "0"], "turn": []},
    {"id": 2, "op": "group", "name": "pair", "of": [0, 1]}
  ]
}

Sign-off

signed off
Documentnot signed off
Drawingnot signed off