MustafaMulla29/rp2040-bldc-motor-controller

Hardware assembly metadata and PCB geometry for a controller board with a snap-off rotary-encoder section, plus four parallel 150 µF/50 V bulk electrolytic capacitors filtering the motor supply.

Version
2.0.40
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone MustafaMulla29/rp2040-bldc-motor-controller  # download the package files into ./rp2040-bldc-motor-controller
tsci add MustafaMulla29/rp2040-bldc-motor-controller    # add it to your project as @tsci/MustafaMulla29.rp2040-bldc-motor-controller

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

scripts/export-part-models.tsx

/** Export the hand-built JSCAD part models as coloured GLB files.
 * tscircuit's JSCAD path unions all pieces (one colour); a GLB keeps each piece's colour. */
import modeling from "@jscad/modeling"
import { executeJscadOperations } from "jscad-planner"
import { convertJscadModelToGltf } from "jscad-to-gltf"
import { writeFileSync } from "node:fs"
import { potModel } from "../imports/RK09D1130C2P"
import { switchModel } from "../imports/SK_22D03_G080"

for (const [file, plan] of [["rk09d1130c2p", potModel], ["sk-22d03-g080", switchModel]] as const) {
  const pieces = (plan as any).type === "union" ? (plan as any).shapes : [plan]
  const geometries = pieces.map((piece: any) => {
    const color = piece.type === "colorize" ? piece.color : [0.6, 0.6, 0.6]
    const geom = executeJscadOperations(modeling as any, piece.type === "colorize" ? piece.shape : piece)
    return { geom, color }
  })
  const glb = await convertJscadModelToGltf({ geometries }, { format: "glb", axisTransform: "none" })
  writeFileSync(`assets/models/${file}.glb`, Buffer.from(glb.data as ArrayBuffer))
  console.log(file, glb.byteLength, "bytes,", geometries.length, "coloured pieces")
}