1 | // Drill Mount |
---|
2 | // - all numbers are in mm |
---|
3 | |
---|
4 | // Default direction reference: |
---|
5 | // X - right |
---|
6 | // Y - forward/away |
---|
7 | // Z - up |
---|
8 | |
---|
9 | // Direction Switch |
---|
10 | // - all measurements are looking down from switch with movable piece pointed foward/away (y) |
---|
11 | switch_base_x = 17; |
---|
12 | switch_base_y = 28; |
---|
13 | switch_base_z = 10; |
---|
14 | |
---|
15 | // Quick reference |
---|
16 | // translate() - Translates (moves) its child elements along the specified vector. The argument name is optional. |
---|
17 | // difference() - |
---|
18 | |
---|
19 | // Cube |
---|
20 | // Creates a cube at the origin of the coordinate system. When center is true the cube will be centered on the origin, otherwise it is created in the first octant. The argument names are optional if the arguments are given in the same order as specified in the parameters |
---|
21 | // |
---|
22 | // Parameters |
---|
23 | // |
---|
24 | // size |
---|
25 | // v=Decimal or 3 value array. If a single number is given, the result will be a cube with sides of that length. If a 3 value array is given, then the values will correspond to the lengths of the X, Y, and Z sides. Default value is 1. |
---|
26 | // |
---|
27 | // center |
---|
28 | // Boolean. This determines the positioning of the object. If true, object is centered at (0,0,0). Otherwise, the cube is placed in the positive quadrant with one corner at (0,0,0). Defaults to false |
---|
29 | |
---|
30 | wall_thickness = 10; |
---|
31 | |
---|
32 | // Left Wall |
---|
33 | left_wall_x = wall_thickness; // 10 |
---|
34 | left_wall_y = switch_base_y + (wall_thickness * 2); // 48 |
---|
35 | left_wall_z = switch_base_z; // 10 |
---|
36 | |
---|
37 | // Right Wall |
---|
38 | right_wall_x = left_wall_x; |
---|
39 | right_wall_y = left_wall_y; |
---|
40 | right_wall_z = left_wall_z; |
---|
41 | |
---|
42 | // Rear Wall |
---|
43 | rear_wall_x = switch_base_x; // 17 |
---|
44 | rear_wall_y = wall_thickness; // 10 |
---|
45 | rear_wall_z = 13; // 13 |
---|
46 | |
---|
47 | // Front Wall |
---|
48 | front_wall_x = switch_base_x; // 17 |
---|
49 | front_wall_y = wall_thickness; // 10 |
---|
50 | front_wall_z = 5; // 5 |
---|
51 | |
---|
52 | |
---|
53 | module switch_mount(switch_base_x, switch_base_y, switch_base_z) { |
---|
54 | difference() { |
---|
55 | union() { |
---|
56 | |
---|
57 | // Direction Switch |
---|
58 | // translate(v=[0,0,0]){ |
---|
59 | // cube([switch_base_x, switch_base_y, switch_base_z], center=true); |
---|
60 | // } |
---|
61 | |
---|
62 | // Left Wall |
---|
63 | translate(v=[(-switch_base_x/2)-(left_wall_x/2), 0, 0]){ |
---|
64 | cube([left_wall_x, left_wall_y, left_wall_z], center=true); |
---|
65 | } |
---|
66 | |
---|
67 | // Right Wall |
---|
68 | translate(v=[(switch_base_x/2)+(right_wall_x/2), 0, 0]){ |
---|
69 | cube([right_wall_x, right_wall_y, right_wall_z], center=true); |
---|
70 | } |
---|
71 | |
---|
72 | // Rear Wall |
---|
73 | translate(v=[0, (-switch_base_y/2)-(wall_thickness/2), (rear_wall_z-switch_base_z)/2]){ |
---|
74 | cube([rear_wall_x, rear_wall_y, rear_wall_z], center=true); |
---|
75 | } |
---|
76 | |
---|
77 | // Front Wall |
---|
78 | translate(v=[0, (switch_base_y/2)+(wall_thickness/2), (front_wall_z-switch_base_z)/2]){ |
---|
79 | cube([front_wall_x, front_wall_y, front_wall_z], center=true); |
---|
80 | } |
---|
81 | |
---|
82 | } |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | switch_mount(switch_base_x, switch_base_y, switch_base_z); |
---|
87 | |
---|