kcl-samples → router-template-slate

router-template-slate

router-template-slate

KCL

// Router template for a slate
// A guide for routing a slate for a cross bar.

// Define constants
routerDiameter = 12.7 
mmInInch = 25.4 
templateDiameter = mmInInch * 11 / 16 
templateGap = ((templateDiameter - routerDiameter) / 2) -0.5 
slateWidthHalf = 41.5 / 2 
minClampingDistance = 50 + 30 
templateThickness = 10 
radius = 10 
depth = 30 
length001 = slateWidthHalf - radius 
length002 = depth + minClampingDistance 

// Create the first sketch
sketch001 = startSketchOn('XZ')
  |> startProfileAt([0, depth - templateGap], %)
  |> xLine(length001, %, $seg01)
  |> arc({
       angleEnd: 0,
       angleStart: 90,
       radius: radius - templateGap
     }, %)
  |> yLineTo(-templateGap * 2 - (templateDiameter / 2), %, $seg05)
  |> xLineTo(slateWidthHalf + templateThickness, %, $seg04)
  |> yLine(-length002, %, $seg03)
  |> xLineTo(ZERO, %, $seg02)
  // |> line([7.78, 11.16], %)
  |> xLine(-segLen(seg02), %)
  |> yLine(segLen(seg03), %)
  |> xLine(segLen(seg04), %)
  |> yLine(segLen(seg05), %)
  |> arc({
       angleEnd: 90,
       angleStart: 180,
       radius: radius - templateGap
     }, %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

// Extrude the first sketch
extrude001 = extrude(5, sketch001)

// Create the second sketch
sketch002 = startSketchOn(extrude001, 'START')
  |> startProfileAt([
       -slateWidthHalf,
       -templateGap * 2 - (templateDiameter / 2)
     ], %)
  |> xLine(-7, %, $rectangleSegmentA001)
  |> angledLine([
       segAng(rectangleSegmentA001) + 90,
       minClampingDistance
     ], %, $rectangleSegmentB001)
  |> angledLine([
       segAng(rectangleSegmentA001),
       -segLen(rectangleSegmentA001)
     ], %, $rectangleSegmentC001)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

// Extrude the second sketch
extrude002 = extrude(7.5, sketch002)

// Create the third sketch
sketch003 = startSketchOn(extrude001, 'START')
  |> startProfileAt([
       slateWidthHalf,
       -templateGap * 2 - (templateDiameter / 2)
     ], %)
  |> xLine(7, %, $rectangleSegmentA002)
  |> angledLine([
       segAng(rectangleSegmentA002) - 90,
       minClampingDistance
     ], %)
  |> angledLine([
       segAng(rectangleSegmentA002),
       -segLen(rectangleSegmentA002)
     ], %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)

// Extrude the third Sketch
extrude003 = extrude(7.5, sketch003)