1
0
Fork 0
mirror of https://github.com/Luzifer/3dmodels.git synced 2024-12-23 02:41:19 +00:00

Apply linter rules

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-01-04 05:05:10 +01:00
parent 4fe263c48b
commit 1452ae72f8
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -41,18 +41,18 @@ function addVents(obj) {
cube({ size: [ cube({ size: [
boardSize + innerSpace + wall + 10, boardSize + innerSpace + wall + 10,
ventSize * 3, ventSize * 3,
ventSize ventSize,
], center: true}), ], center: true }),
cube({ size: [ cube({ size: [
ventSize * 3, ventSize * 3,
boardSize + innerSpace + wall + 10, boardSize + innerSpace + wall + 10,
ventSize ventSize,
], center: true}) ], center: true })
) )
) )
const endZ = ((innerSpaceHeight + wall) / 2) * -1 + 1.5 * ventSize const endZ = (innerSpaceHeight + wall) / 2 * -1 + 1.5 * ventSize
const startZ = ((innerSpaceHeight + wall) / 2) - 2 * ventSize - wall const startZ = (innerSpaceHeight + wall) / 2 - 2 * ventSize - wall
for (let z = startZ; z >= endZ; z -= 3 * ventSize) { for (let z = startZ; z >= endZ; z -= 3 * ventSize) {
obj = difference( obj = difference(
obj, obj,
@ -63,6 +63,7 @@ function addVents(obj) {
return obj return obj
} }
/* exported main */
function main() { function main() {
const boardSupport = cylinder({ const boardSupport = cylinder({
h: boardSupportHeight + wall, h: boardSupportHeight + wall,
@ -92,58 +93,56 @@ function main() {
// Housing with holder // Housing with holder
difference( difference(
union( union(
addVents( addVents(difference(
difference( union(
union( // Main housing block
// Main housing block
cube({ size: [
boardSize + innerSpace + wall*2,
boardSize + innerSpace + wall*2,
innerSpaceHeight + wall,
], center: true }),
// Lamp post holder
difference(
cylinder({
h: boardSize + innerSpace + wall,
r: lampPostSupport,
center: true,
resolution: 100,
}),
cylinder({
h: boardSize + innerSpace + wall,
r: lampPostRadius,
center: true,
resolution: 100,
}).translate([lampPostRadius * -1, 0, 0])
)
.rotateY(90)
.translate([0, 0, (innerSpaceHeight + wall)/2])
),
// Inner housing
cube({ size: [ cube({ size: [
boardSize + innerSpace, boardSize + innerSpace + wall * 2,
boardSize + innerSpace, boardSize + innerSpace + wall * 2,
innerSpaceHeight, innerSpaceHeight + wall,
], center: true }).translate([0, 0, wall * -0.5]) ], center: true }),
)
), // Lamp post holder
difference(
cylinder({
h: boardSize + innerSpace + wall,
r: lampPostSupport,
center: true,
resolution: 100,
}),
cylinder({
h: boardSize + innerSpace + wall,
r: lampPostRadius,
center: true,
resolution: 100,
}).translate([lampPostRadius * -1, 0, 0])
)
.rotateY(90)
.translate([0, 0, (innerSpaceHeight + wall) / 2])
),
// Inner housing
cube({ size: [
boardSize + innerSpace,
boardSize + innerSpace,
innerSpaceHeight,
], center: true }).translate([0, 0, wall * -0.5])
)),
// Outer border of power inlet // Outer border of power inlet
cube({ size: [wall, powerInletWidth + wall * 2, powerInletHeight + wall * 2], center: true }) cube({ size: [wall, powerInletWidth + wall * 2, powerInletHeight + wall * 2], center: true })
.translate([
(boardSize + innerSpace + wall) / 2,
powerInletPosY,
(innerSpaceHeight + wall) / 2 - (wall + powerInletHeight / 2),
])
),
// Inner space of power inlet
cube({ size: [wall, powerInletWidth, powerInletHeight], center: true })
.translate([ .translate([
(boardSize + innerSpace + wall) / 2, (boardSize + innerSpace + wall) / 2,
powerInletPosY, powerInletPosY,
(innerSpaceHeight + wall) / 2 - (wall + powerInletHeight / 2) (innerSpaceHeight + wall) / 2 - (wall + powerInletHeight / 2),
]) ])
),
// Inner space of power inlet
cube({ size: [wall, powerInletWidth, powerInletHeight], center: true})
.translate([
(boardSize + innerSpace + wall) / 2,
powerInletPosY,
(innerSpaceHeight + wall) / 2 - (wall + powerInletHeight / 2)
])
), ),
// Board supports // Board supports
@ -189,7 +188,7 @@ function main() {
((boardSize + innerSpace) / 2 - screwBaseSize / 2) * -1, ((boardSize + innerSpace) / 2 - screwBaseSize / 2) * -1,
((innerSpaceHeight + wall) / 2 - screwBaseSize / 2) * -1, ((innerSpaceHeight + wall) / 2 - screwBaseSize / 2) * -1,
], screwBase) ], screwBase)
).translate([(boardSize + innerSpace + wall + 5) * -0.5, 0, (innerSpaceHeight + wall)/2]), ).translate([(boardSize + innerSpace + wall + 5) * -0.5, 0, (innerSpaceHeight + wall) / 2]),
// Lid // Lid
difference( difference(
@ -242,7 +241,7 @@ function main() {
((boardSize + innerSpace) / 2 - screwBaseSize / 2) * -1, ((boardSize + innerSpace) / 2 - screwBaseSize / 2) * -1,
screwHeadRadius - wall / 3, screwHeadRadius - wall / 3,
], screwHeadSink) ], screwHeadSink)
).translate([(boardSize + innerSpace + wall + 5) * 0.5, 0, wall/2]) ).translate([(boardSize + innerSpace + wall + 5) * 0.5, 0, wall / 2]),
] ]
} }