leaf.kcl raw

   1  // Modular Recurve Bow — Base Leaf
   2  // Gaussian bell taper profile, parametric dimensions
   3  // Paste into Zoo Design Studio code editor
   4  
   5  @settings(defaultLengthUnit = mm)
   6  
   7  // === Parameters ===
   8  leafLength = 800        // tip to tip
   9  leafGauge = 0.9         // sheet thickness
  10  centerWidth = 40        // width at center
  11  tipWidth = 8            // width at tips
  12  nSegs = 40              // curve smoothness (segments per edge)
  13  
  14  // === Derived ===
  15  halfLen = leafLength / 2
  16  sigma = leafLength / 6
  17  wDelta = centerWidth - tipWidth
  18  step = leafLength / nSegs
  19  
  20  // Gaussian half-width at position x from center
  21  fn hw(@x) {
  22    return (tipWidth + wDelta * pow(E, exp = -(x * x) / (2 * sigma * sigma))) / 2
  23  }
  24  
  25  // === Build profile ===
  26  
  27  // Start at left tip, top edge
  28  sketch0 = startSketchOn(XY)
  29    |> startProfile(at = [-halfLen, hw(-halfLen)])
  30  
  31  // Top edge: left tip to right tip
  32  sketch1 = reduce([1..nSegs], initial = sketch0, f = fn(i, sk) {
  33    x = -halfLen + step * i
  34    return line(sk, endAbsolute = [x, hw(x)])
  35  })
  36  
  37  // Drop to bottom of right tip
  38  sketch2 = line(sketch1, endAbsolute = [halfLen, -hw(halfLen)])
  39  
  40  // Bottom edge: right tip back to left tip
  41  sketch3 = reduce([1..nSegs], initial = sketch2, f = fn(i, sk) {
  42    x = halfLen - step * i
  43    return line(sk, endAbsolute = [x, -hw(x)])
  44  })
  45  
  46  // Close and extrude to sheet thickness
  47  leaf = sketch3
  48    |> close()
  49    |> extrude(length = leafGauge)
  50