// Walkie Talkie Antenna
// Antenna for the walkie talkie assembly

// Set units
@settings(defaultLengthUnit = in, kclVersion = 1.0)

// Import parameters
import antennaLength, antennaBaseWidth, antennaBaseHeight, antennaTopWidth, antennaTopHeight from "parameters.kcl"

// Create the antenna base sketch
antennaBaseSketch = startSketchOn(XY)
  |> startProfile(at = [
       -antennaBaseWidth / 2,
       antennaBaseHeight / 2
     ])
  |> line(end = [antennaBaseWidth, 0])
  |> line(end = [0, -antennaBaseHeight])
  |> line(end = [-antennaBaseWidth, 0])
  |> close()

// Create the antenna top sketch
loftPlane = offsetPlane(XY, offset = antennaLength)
antennaTopSketch = startSketchOn(loftPlane)
  |> startProfile(at = [
       -(antennaBaseWidth - antennaTopWidth) / 2,
       (antennaBaseHeight - antennaTopHeight) / 2
     ])
  |> xLine(length = antennaTopWidth)
  |> yLine(length = -antennaTopHeight)
  |> xLine(length = -antennaTopWidth)
  |> close()

// Create the antenna using a loft
loft([antennaBaseSketch, antennaTopSketch])
  |> appearance(color = "#000000")
