// CPU Cooler
// A CPU cooler is a device designed to dissipate heat generated by the CPU of a computer. They consist of a brazed heat sink made from aluminum or copper alloys, and one or two axial fans to move airflow across the heat sink.

// Set units
@settings(defaultLengthUnit = mm)

// Import all parts and parameters into assembly file
import * from "parameters.kcl"
import "fan-housing.kcl" as fanHousing
import "motor.kcl" as motor
import "fan.kcl" as fan
import "heat-sink.kcl" as heatSink
import "mounting-wire.kcl" as mountingWire
import "removable-sticker.kcl" as removableSticker

// Produce the model for each imported part
heatSink

fn translatePart(part) {
  part
    |> translate(x = heatSinkDepth / 2, z = 40 + fanSize / 2)
    |> patternLinear3d(
         %,
         instances = 2,
         distance = heatSinkDepth + fanHeight,
         axis = [-1, 0, 0],
       )
  return {  }
}
translatePart(part = fanHousing)
translatePart(part = motor)
translatePart(part = fan)

mountingWire
  |> patternCircular3d(
       %,
       instances = 2,
       axis = [0, 1, 0],
       center = [0, 0, 40 + fanSize / 2],
       arcDegrees = 360,
       rotateDuplicates = true,
     )
  |> patternCircular3d(
       %,
       instances = 2,
       axis = [0, 0, 1],
       center = [0, 0, 0],
       arcDegrees = 360,
       rotateDuplicates = true,
     )
removableSticker
