/[qspeakers]/branches/qtcharts/sealedbox_cutting_template.scad
ViewVC logotype

Contents of /branches/qtcharts/sealedbox_cutting_template.scad

Parent Directory Parent Directory | Revision Log Revision Log


Revision 293 - (show annotations)
Mon Nov 23 17:37:05 2020 UTC (6 months, 3 weeks ago) by ben
File size: 2368 byte(s)
Implement 2D OpenSCAD export
1 loudspeaker_number = __NUMBER__;
2 margin = __MARGIN__; /* cm */
3 loudspeaker_diameter = __DIAMETER__; /* cm */
4 internal_closed_box_volume = __SEALEDBOXVOLUME__; /* dmĀ³ (Liter) */
5
6 internal_closed_box_width = loudspeaker_diameter + margin; /* cm (x)*/
7 internal_closed_box_height = max((loudspeaker_diameter + margin) * loudspeaker_number, 1.618 * internal_closed_box_width); /* cm (z)*/
8 internal_closed_box_depth = internal_closed_box_volume * 1000 / (internal_closed_box_width * internal_closed_box_height); /* cm (y)*/
9
10 saw_thick = __SAWTHICK__; /* saw cut thick in cm */
11 wood_thick = __WOODTHICK__; /* board thick in cm */
12
13 vertical_center = (internal_closed_box_height + (2 * wood_thick)) / 2;
14 horizontal_center = (internal_closed_box_width + (2 * wood_thick)) / 2;
15
16 module board(width, height) {
17 square(size = [width, height], center = false);
18 }
19
20 module speaker(diam, x, y){
21 translate([x, y, 0])
22 circle($fn=360, d=diam, true);
23 }
24
25 module board_speaker(width, height, diam){
26 difference() {
27 board(width, height);
28 for (i = [0:loudspeaker_number-1]) {
29 speaker(diam, width / 2, margin + (diam / 2) + i * (diam + margin));
30 }
31 }
32 }
33
34 /* boards */
35 front_width = internal_closed_box_width + (2 * wood_thick); /* cm */
36 front_height = internal_closed_box_height + (2 * wood_thick); /* cm */
37 side_depth = internal_closed_box_depth; /* cm */
38 side_height = internal_closed_box_height; /* cm */
39 top_width = front_width; /* cm */
40 top_depth = side_depth; /* cm */
41
42 /* two times */
43 for (i = [0:1]) {
44 translate([0, i*(max(front_height,front_width,side_depth,side_height) + saw_thick), 0]) {
45 /* one board with speaker */
46 translate([0, 0, 0])
47 board_speaker(front_width, front_height, loudspeaker_diameter);
48
49 /* one back board */
50 translate([1 * (front_width + saw_thick), 0, 0])
51 board(front_width, front_height);
52
53 /* two side boards */
54 for (j = [0:1]) {
55 translate([2 * (front_width + saw_thick) + j * (side_depth + saw_thick), 0, 0])
56 board(side_depth, side_height);
57 }
58
59 /* two top/bottom boards */
60 for (j = [0:1]) {
61 translate([j * (top_width + saw_thick) + (2 * (side_depth + saw_thick)) + (2 * (front_width + saw_thick)), 0, 0])
62 board(top_width, top_depth);
63 }
64 }
65 }

  ViewVC Help
Powered by ViewVC 1.1.26