kcl-samples

constrained-y

constrained-y

KCL

// Constrained Y Demo
// This is a simple example of a 3D model that is created using the constrained Y feature.

// Define Constants
const topAng = 25
const bottomAng = 35
const baseLen = 3.5
const baseHeight = 1
const totalHeightHalf = 2
const armThick = 0.5
const totalLen = 9.5

// Create the Sketch with constraining Y
const part001 = startSketchOn('-XZ')
  |> startProfileAt([0, 0], %)
  |> yLine(baseHeight, %)
  |> xLine(baseLen, %)
  |> angledLineToY({
       angle: topAng,
       to: totalHeightHalf,
     }, %, 'seg04')
  |> xLineTo(totalLen, %, 'seg03')
  |> yLine(-armThick, %, 'seg01')
  |> xLine(-1.5, %)
  |> angledLineToY([segAng('seg04', %) + 180, 0], %)
  |> angledLineToY({
       angle: -bottomAng,
       to: -totalHeightHalf - armThick,
     }, %, 'seg02')
  |> xLineTo(segEndX('seg03', %) + 0, %)
  |> yLine(-segLen('seg01', %), %)
  |> angledLineThatIntersects({
       angle: 180,
       offset: -armThick,
       intersectTag: 'seg02'
     }, %)
  |> angledLineToY([segAng('seg02', %) + 180, -baseHeight], %)
  |> xLineTo(0, %)
  |> close(%) 
  |> extrude(4, %)