57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
![]() |
// Lego Brick
|
||
|
|
||
|
const lbumps = 10 // number of bumps long
|
||
|
const wbumps = 6 // number of bumps wide
|
||
|
|
||
|
const pitch = 8.0
|
||
|
const clearance = 0.1
|
||
|
const bumpDiam = 4.8
|
||
|
const bumpHeight = 1.8
|
||
|
const height = 3.2
|
||
|
|
||
|
|
||
|
const t = (pitch - (2 * clearance) - bumpDiam) / 2.0
|
||
|
const postDiam = pitch - t // works out to 6.5
|
||
|
const total_length = lbumps * pitch - (2.0 * clearance)
|
||
|
const total_width = wbumps * pitch - (2.0 * clearance)
|
||
|
|
||
|
const lSegments = total_length / (lbumps + 1)
|
||
|
const wSegments = total_width / (wbumps + 1)
|
||
|
|
||
|
// make the base
|
||
|
const s = startSketchOn('XY')
|
||
|
|> startProfileAt([-total_width / 2, -total_length / 2], %)
|
||
|
|> line([total_width, 0], %)
|
||
|
|> line([0, total_length], %)
|
||
|
|> line([-total_width, 0], %)
|
||
|
|> close(%)
|
||
|
|> extrude(height, %)
|
||
|
|
||
|
const shellExtrude = startSketchOn(s, "start")
|
||
|
|> startProfileAt([
|
||
|
-(total_width / 2 - t),
|
||
|
-(total_length / 2 - t)
|
||
|
], %)
|
||
|
|> line([total_width - (2 * t), 0], %)
|
||
|
|> line([0, total_length - (2 * t)], %)
|
||
|
|> line([-(total_width - (2 * t)), 0], %)
|
||
|
|> close(%)
|
||
|
|> extrude(-(height - t), %)
|
||
|
|
||
|
const peg = startSketchOn(s, "end")
|
||
|
|> circle([
|
||
|
-(total_width / 2 - wSegments),
|
||
|
-(total_length / 2 - lSegments)
|
||
|
], bumpDiam / 2, %)
|
||
|
|> patternLinear2d({
|
||
|
axis: [1, 0],
|
||
|
repetitions: 5,
|
||
|
distance: 7
|
||
|
}, %)
|
||
|
|> patternLinear2d({
|
||
|
axis: [0, 1],
|
||
|
repetitions: 9,
|
||
|
distance: 7
|
||
|
}, %)
|
||
|
|> extrude(bumpHeight, %)
|