1- import { colorize , hexToRgb } from '@jscad/modeling/src/colors'
2- import { subtract , union } from '@jscad/modeling/src/operations/booleans'
31import {
2+ intersect ,
3+ subtract ,
4+ union ,
5+ } from '@jscad/modeling/src/operations/booleans'
6+ import {
7+ rotate ,
48 rotateX ,
59 rotateZ ,
610 translate ,
@@ -9,8 +13,8 @@ import {
913import { cuboid , cylinder } from '@jscad/modeling/src/primitives'
1014import { degToRad } from '@jscad/modeling/src/utils'
1115
12- const panelWidth = 120
13- const panelLength = 282
16+ const panelWidth = 100
17+ const panelLength = 279
1418const boxHeight = 150
1519const thickness = 4
1620
@@ -46,14 +50,63 @@ const side = ({
4650 const padding = 15
4751 const radius = 20
4852 const segments = 64
53+ const sideCutsLeft = [ ]
54+ const sideCutsRight = [ ]
55+ for ( let i = 0 ; i < height / ( radius + padding / 2 ) ; i ++ ) {
56+ sideCutsLeft . push (
57+ translate (
58+ [ length / 2 , 0 , i * ( radius + padding / 2 ) - height / 2 - 25 ] ,
59+ rotateX (
60+ degToRad ( 90 ) ,
61+ cylinder ( {
62+ segments,
63+ radius : radius / 2 ,
64+ height : padding ,
65+ } ) ,
66+ ) ,
67+ ) ,
68+ )
69+ sideCutsRight . push (
70+ translate (
71+ [ - length / 2 , 0 , i * ( radius + padding / 2 ) - height / 2 - 25 ] ,
72+ rotateX (
73+ degToRad ( 90 ) ,
74+ cylinder ( {
75+ segments,
76+ radius : radius / 2 ,
77+ height : padding ,
78+ } ) ,
79+ ) ,
80+ ) ,
81+ )
82+ }
4983 return union (
5084 // Plate
5185 subtract (
52- cuboid ( { size : [ length , thickness , height ] } ) ,
86+ union (
87+ // Base plate
88+ cuboid ( { size : [ length , thickness , height ] } ) ,
89+ // Inner support ridge
90+ subtract (
91+ cuboid ( {
92+ size : [ length - 2 * radius , 6 , 10 ] ,
93+ center : [ 0 , - 5 , height / 2 - 5 ] ,
94+ } ) ,
95+ rotate (
96+ [ degToRad ( 90 ) , 0 , degToRad ( 90 ) ] , // Ridge
97+ cylinder ( {
98+ segments : 32 ,
99+ height : length - 2 * radius ,
100+ radius : 15 ,
101+ center : [ - 15 , height / 2 - 17 , 0 ] ,
102+ } ) ,
103+ ) ,
104+ ) ,
105+ ) ,
53106 // ridge for LED panel
54107 cuboid ( {
55- size : [ length , thickness , thickness ] ,
56- center : [ 0 , - thickness / 2 , height / 2 ] ,
108+ size : [ length , 50 , thickness ] ,
109+ center : [ 0 , - 25 , height / 2 ] ,
57110 } ) ,
58111 // Cut out circle 1
59112 translate (
@@ -114,52 +167,74 @@ const side = ({
114167 } ) ,
115168 ) ,
116169 ) ,
170+ ...sideCutsLeft ,
171+ ...sideCutsRight ,
117172 ) ,
118173 )
119174}
120175
121176export const ledPanelBox = ( ) => [
177+ /*
122178 colorize(
123179 hexToRgb('#6a97bf'),
124180 translateZ(boxHeight, rotateX(degToRad(180), ledPanel())),
125181 ),
126- union (
127- translate (
128- [ 0 , panelWidth / 2 , boxHeight / 2 ] ,
129- side ( { height : boxHeight , length : panelLength + thickness , thickness } ) ,
130- ) ,
131- translate (
132- [ 0 , - panelWidth / 2 , boxHeight / 2 ] ,
133- rotateZ (
134- degToRad ( 180 ) ,
135- side ( {
136- height : boxHeight ,
137- length : panelLength + thickness ,
138- thickness,
139- } ) ,
140- ) ,
141- ) ,
142- translate (
143- [ - panelLength / 2 , 0 , boxHeight / 2 ] ,
144- rotateZ (
145- degToRad ( 90 ) ,
146- side ( {
147- height : boxHeight ,
148- length : panelWidth + thickness ,
149- thickness,
150- } ) ,
151- ) ,
152- ) ,
153- translate (
154- [ panelLength / 2 , 0 , boxHeight / 2 ] ,
155- rotateZ (
156- degToRad ( - 90 ) ,
157- side ( {
158- height : boxHeight ,
159- length : panelWidth + thickness ,
160- thickness,
161- } ) ,
182+ */
183+ // Only print sides
184+ intersect (
185+ subtract (
186+ union (
187+ translate (
188+ [ 0 , panelWidth / 2 , boxHeight / 2 ] ,
189+ side ( {
190+ height : boxHeight ,
191+ length : panelLength + thickness ,
192+ thickness,
193+ } ) ,
194+ ) ,
195+ translate (
196+ [ 0 , - panelWidth / 2 , boxHeight / 2 ] ,
197+ rotateZ (
198+ degToRad ( 180 ) ,
199+ side ( {
200+ height : boxHeight ,
201+ length : panelLength + thickness ,
202+ thickness,
203+ } ) ,
204+ ) ,
205+ ) ,
206+ translate (
207+ [ - panelLength / 2 , 0 , boxHeight / 2 ] ,
208+ rotateZ (
209+ degToRad ( 90 ) ,
210+ side ( {
211+ height : boxHeight ,
212+ length : panelWidth + thickness ,
213+ thickness,
214+ } ) ,
215+ ) ,
216+ ) ,
217+ translate (
218+ [ panelLength / 2 , 0 , boxHeight / 2 ] ,
219+ rotateZ (
220+ degToRad ( - 90 ) ,
221+ side ( {
222+ height : boxHeight ,
223+ length : panelWidth + thickness ,
224+ thickness,
225+ } ) ,
226+ ) ,
227+ ) ,
162228 ) ,
229+ // Cut-out for cable fastener
230+ cuboid ( {
231+ size : [ 10 , panelWidth * 1.1 , 2.5 ] ,
232+ center : [ panelLength / 2 - 40 , 0 , boxHeight - 10 ] ,
233+ } ) ,
163234 ) ,
235+ cuboid ( {
236+ size : [ 50 , 200 , boxHeight ] ,
237+ center : [ ( panelLength + thickness ) / 2 - 25 , 0 , boxHeight / 2 ] ,
238+ } ) ,
164239 ) ,
165240]
0 commit comments