Skip to content

Instantly share code, notes, and snippets.

@t1u1
Created February 17, 2022 04:21
Show Gist options
  • Save t1u1/6c6a4664b08ff6d4a9e9c6f3a87e7d31 to your computer and use it in GitHub Desktop.
Save t1u1/6c6a4664b08ff6d4a9e9c6f3a87e7d31 to your computer and use it in GitHub Desktop.
list of all extrude glitches
const jscad = require('@jscad/modeling')
const { union } = jscad.booleans
const { extrudeLinear } = jscad.extrusions
const { hullChain } = jscad.hulls
const { circle } = jscad.primitives
const { vectorText } = jscad.text
const { translate } = jscad.transforms
// Build text by creating the font strokes (2D), then extruding up (3D).
const text = (message, extrusionHeight, characterLineWidth, segments) => {
const lineRadius = characterLineWidth / 2
const lineCorner = circle({ radius: lineRadius, segments: segments })
const lineSegmentPointArrays = vectorText({ x: 0, y: 0, input: message }) // line segments for each character
const lineSegments = []
lineSegmentPointArrays.forEach((segmentPoints) => { // process the line segment
const corners = segmentPoints.map((point) => translate(point, lineCorner))
lineSegments.push(hullChain(corners))
})
const message2D = union(lineSegments)
const message3D = extrudeLinear({ height: extrusionHeight }, message2D)
return message3D;
}
const main = (params) => {
let objs = [];
function push(obj) {
const x = objs.length / 4
const y = objs.length % 4
objs.push(translate([x*80, y*80, 0], obj));
}
push(text("4", 2, 1, 26))
push(text("B", 2, 2, 27))
push(text("R", 2, 2, 27))
push(text("L", 2, 1, 21))
push(text("AA", 2, 2, 4))
push(text("AQ", 2, 2, 4))
push(text("CO", 2, 2, 4))
push(text("OQ", 2, 2, 4))
push(text("GO", 2, 2, 6))
push(text("GQ", 2, 2, 6))
push(text("4", 2, 2, 20))
push(text("7", 2, 2, 32))
push(text("F", 2, 1, 25))
push(text("N", 2, 2, 13))
return objs;
}
module.exports = { main }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment