# No. 381 (Brown 1868): "Bowery's joiner's clamp, plan and transverse section. Oblong bed has, at one end, two wedge-formed cheeks, adjacent sides of which lie at an angle to each other, and are dovetailed inward from upper edge to receive two wedges for clamping the piece or pieces of wood to be planed."
#
# Model (cm), in Brown's plan (the bed lies flat, so the plan is drawn in the x-z plane with gravity off): the bed's end carries two
# cheeks whose faces close toward the end at 0.22 across per unit along (12.4 deg). In each cheek's dovetail a wedge
# slides (a slide joint along the face: the dovetail), its inner face parallel to the board. The board, laid between them, is
# thrust endwise toward the cheeks as the plane pushes it (the one driven joint: a steady 30 N, the board's drag on the bed
# as a damper, so it goes in at 0.8 cm/s while free). At 1.6 s the
# joiner sets the wedges with a light push (a spring of 60 N/m on each, its free end stepped in over 0.8 s by hand); they slide in until they meet the
# board, and its thrust then drags them further in by friction, so they jam between cheek and board and the board stops.
# Generator: opencode-runs/batch13/gen381.py.
number: 381
slug: joiners-clamp
name: Bowery's joiner's clamp
brown: "Bowery's joiner's clamp, plan and transverse section. Oblong bed has, at one end, two wedge-formed cheeks, adjacent sides of which lie at an angle to each other, and are dovetailed inward from upper edge to receive two wedges for clamping the piece or pieces of wood to be planed."
units: cm
sim:
  timestep: 0.0005
  integrator: implicitfast
  iterations: 60
  duration_s: 6
  floor: false
  gravity: 0
contact: {solref: [0.001, 1], solimp: [0.95, 0.99, 0.001]}
bodies:
  - id: bed
    shape: part
    pos: [0, 0, 0]
    fixed: true
    density: 600
    color: "#d8c8a4"
    pieces:
      - {kind: poly, points: [[-26, -9], [22, -9], [22, 9], [-26, 9]], y: [0.0, 3.0], collide: 0}   # the oblong bed, under everything
      - {kind: poly, points: [[-26, -9], [-23.6, -9], [-23.6, 9], [-26, 9]], y: [-2.6, 0.0], collide: 0, color: "#a88c5e"}   # its end, joining the cheeks
      - {kind: poly, points: [[-23.6, 2.008], [-4.0, 6.32], [-4.0, 9.0], [-23.6, 9.0]], y: [-2.6, 0.0], collide: 0, color: "#a88c5e"}   # the upper cheek
      - {kind: poly, points: [[-23.6, -9.0], [-4.0, -9.0], [-4.0, -6.32], [-23.6, -2.008]], y: [-2.6, 0.0], collide: 0, color: "#a88c5e"}   # and the lower
      - {kind: rod, from: [-23.6, -2.65, 2.008], to: [-4.0, -2.65, 6.32], radius: 0.06, collide: 0, color: "#6f5a3c"}   # the dovetail's edge
      - {kind: rod, from: [-23.6, -2.65, -2.008], to: [-4.0, -2.65, -6.32], radius: 0.06, collide: 0, color: "#6f5a3c"}
  - id: board
    shape: part
    pos: [0, 0, 0]
    density: 600
    friction: 0.5
    color: "#efd9a8"
    pieces:
      - {kind: poly, points: [[-17.0, -2.0], [25, -2.0], [25, 2.0], [-17.0, 2.0]], y: [-2.4, 0.0], collide: 1}   # the board, edge up, to be planed
      - {kind: rod, from: [-14, -2.42, 0.9], to: [-5, -2.42, 0.9], radius: 0.03, collide: 0, color: "#a07a4a"}
      - {kind: rod, from: [-3, -2.42, -0.6], to: [6, -2.42, -0.6], radius: 0.03, collide: 0, color: "#a07a4a"}
      - {kind: rod, from: [8, -2.42, 1.1], to: [17, -2.42, 1.1], radius: 0.03, collide: 0, color: "#a07a4a"}
      - {kind: rod, from: [12, -2.42, -1.2], to: [21, -2.42, -1.2], radius: 0.03, collide: 0, color: "#a07a4a"}
      - {kind: rod, from: [-9, -2.42, -1.3], to: [0, -2.42, -1.3], radius: 0.03, collide: 0, color: "#a07a4a"}
      - {kind: rod, from: [2, -2.42, 0.4], to: [11, -2.42, 0.4], radius: 0.03, collide: 0, color: "#a07a4a"}
  - id: wedge_a
    shape: part
    pos: [-20.0, 0, 2.3]
    density: 700
    friction: 0.5
    color: "#8a6440"
    pieces:
      - {kind: poly, points: [[-20.0, 2.3], [-4.0, 2.3], [-4.0, 6.32], [-20.0, 2.8]], y: [-2.2, 0.0], collide: 2}   # the upper wedge
  - id: wedge_b
    shape: part
    pos: [-20.0, 0, -2.3]
    density: 700
    friction: 0.5
    color: "#8a6440"
    pieces:
      - {kind: poly, points: [[-20.0, -2.8], [-4.0, -6.32], [-4.0, -2.3], [-20.0, -2.3]], y: [-2.2, 0.0], collide: 2}   # the lower wedge
joints:
  - {id: j_b, type: slide, body: board, axis: [1, 0, 0], range: [-6.0, 0.5], damping: 3750.0}   # the board, endwise: - : toward the cheeks
  - {id: j_wa, type: slide, body: wedge_a, axis: [-0.9766, 0, -0.2149], range: [-0.5, 6.0], stiffness: 60.0, damping: 1.0}   # the upper wedge in its dovetail; + : in
  - {id: j_wb, type: slide, body: wedge_b, axis: [-0.9766, 0, 0.2149], range: [-0.5, 6.0], stiffness: 60.0, damping: 1.0}   # the lower wedge
driver: {joint: j_b, kind: torque, torque: -30.0, max_torque: 30.0}
hand:
  - {t: 1.6, springref: {j_wa: 0.3, j_wb: 0.3}}
  - {t: 1.68, springref: {j_wa: 0.6, j_wb: 0.6}}
  - {t: 1.76, springref: {j_wa: 0.9, j_wb: 0.9}}
  - {t: 1.84, springref: {j_wa: 1.2, j_wb: 1.2}}
  - {t: 1.92, springref: {j_wa: 1.5, j_wb: 1.5}}
  - {t: 2.0, springref: {j_wa: 1.8, j_wb: 1.8}}
  - {t: 2.08, springref: {j_wa: 2.1, j_wb: 2.1}}
  - {t: 2.16, springref: {j_wa: 2.4, j_wb: 2.4}}
  - {t: 2.24, springref: {j_wa: 2.7, j_wb: 2.7}}
  - {t: 2.32, springref: {j_wa: 3.0, j_wb: 3.0}}
checks:
  - {type: position, joint: j_wa, min: 1.2566, max: 2.8962, settle_s: 3.5, window_s: 2.4}   # the wedge has come in to the board, and been drawn in by it
  - {type: position, joint: j_wb, min: 1.2566, max: 2.8962, settle_s: 3.5, window_s: 2.4}
  - {type: still, joint: j_b, max: 0.0005, settle_s: 3.5, window_s: 2.4}   # and the board is held against the thrust
  - {type: position, joint: j_b, min: -4.5, max: -0.64, settle_s: 3.5, window_s: 2.4}   # after it had gone in freely
camera: {target: [-2.0, 0, -1.5], position: [-2.0, -62.0, 3.5], fov: 34}
display:
  output: j_wa
  labels: {j_b: "Board (planing thrust)", j_wa: "Upper wedge, in", j_wb: "Lower wedge, in"}
  proof: {label: "Wedges out of contact", sub: "the board is pushed on through the cheeks"}

