FlowCad is the fast, free, and precise web app for 3D design and printing. Build professional parametric models with ease-no programming required, but it's there if you need it.
/*
* USB-C Breakout Board Blueprint
* Converted to Manifold-3D standard
*/
// 1. Define Defaults (Used for UI discovery)
const PARAMS = {
width: 25,
length: 40,
pcbThick: 1.6,
usbOffset: 0,
hasMountingHoles: false,
}
// 2. Extract parameters
const { width, length, pcbThick, usbOffset, hasMountingHoles } = PARAMS
// --- 3. Create PCB Body ---
// Create the main PCB board centered at origin
let board = Manifold.cube([width, length, pcbThick], true)
if (hasMountingHoles) {
// --- 4. Add Mounting Holes ---
const holeRadius = 1.2
// Use a generous height to ensure clean cut through PCB
const holeHeight = pcbThick + 5
const inset = 3
// Create the mounting hole cylinder centered so it cuts through Z=0
// Using 32 segments for a smooth circular hole
const hole = Manifold.cylinder(holeHeight, holeRadius, holeRadius, 32, true)
// Define corner positions for mounting holes
const positions = [
[width / 2 - inset, length / 2 - inset],
[-width / 2 + inset, length / 2 - inset],
[width / 2 - inset, -length / 2 + inset],
[-width / 2 + inset, -length / 2 + inset],
]
for (const p of positions) {
// Translate hole to corner position and subtract from board
const movedHole = hole.translate([p[0], p[1], 0])
board = board.subtract(movedHole)
}
}
// --- 5. Create USB-C Connector ---
// Simplified stadium shape for the port
const portWidth = 9.5
const portHeight = 3.2
const portDepth = 7.5
// Create the main body of the USB-C port centered at origin
const roundedCornerRadius = portHeight / 2
const portBody = Manifold.cube([portWidth - roundedCornerRadius * 2, portDepth, portHeight], true)
const lrDist = portWidth / 2 - roundedCornerRadius
const portLeftCorner = Manifold.cylinder(portDepth, roundedCornerRadius, roundedCornerRadius, 19)
.rotate(90, 0, 0)
.translate([lrDist, portDepth / 2, 0])
const portRightCorner = Manifold.cylinder(portDepth, roundedCornerRadius, roundedCornerRadius, 19)
.rotate(90, 0, 0)
.translate([-lrDist, portDepth / 2, 0])
const portComplete = portBody.add(portRightCorner.add(portLeftCorner))
// Position: Top Edge of the board
// Slightly overhangs the edge for realism
const yPos = length / 2 - 1.5
// Positioned to sit precisely on top of the PCB
const zPos = pcbThick / 2 + portHeight / 2
// Apply translation to move port to the edge and top of the board
const portFinal = portComplete.translate([usbOffset, yPos, zPos])
// --- 6. Final Result ---
// Boolean union of the PCB and the USB port
const result = board.add(portFinal)
// Return result and current parameters
return { result, PARAMS }