ShiboSoftwareDev/linux-gameboy-advance
A four-layer Linux handheld game-console carrier PCB built around an F1C100S SoC, USB-C and 2×AA power, LCD/microSD interfaces, flash, audio amplifier/speaker, controls, service headers, and RGB status LED.
- Version
- 1.0.124
- License
- unset
- Stars
- 0
scripts/generate-sod123fl-model.mjs
import { writeFile } from "node:fs/promises"
import { dirname, resolve } from "node:path"
import { fileURLToPath } from "node:url"
import jscad from "@jscad/modeling"
import { convertJscadModelToGltf } from "jscad-to-gltf"
const { primitives } = jscad
const { cuboid } = primitives
// Nominal SOD-123FL envelope used by the selected SS14. The model origin is
// the package center on the PCB surface, so tscircuit can place it directly.
const geometries = [
{
geom: cuboid({ size: [2.75, 1.8, 1.0], center: [0, 0, 0.5] }),
color: [0.035, 0.035, 0.04],
},
{
geom: cuboid({ size: [1.0, 0.9, 0.2], center: [-1.3, 0, 0.1] }),
color: [0.72, 0.74, 0.76],
},
{
geom: cuboid({ size: [1.0, 0.9, 0.2], center: [1.3, 0, 0.1] }),
color: [0.72, 0.74, 0.76],
},
{
geom: cuboid({ size: [0.18, 1.4, 0.015], center: [-0.68, 0, 1.0075] }),
color: [0.78, 0.78, 0.8],
},
]
const result = await convertJscadModelToGltf(
{ geometries },
{ format: "glb", meshName: "SOD-123FL", axisTransform: "none" },
)
const scriptDirectory = dirname(fileURLToPath(import.meta.url))
const outputPath = resolve(scriptDirectory, "../assets/sod-123fl.glb")
await writeFile(outputPath, new Uint8Array(result.data))
console.log(`wrote ${outputPath} (${result.byteLength} bytes)`)