summaryrefslogtreecommitdiff
path: root/body/body.scad
blob: 2863d99e0f4215c8e2e05fb398d89712ad4e3585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
include <design.scad>
include <helpers.scad>
include <m12_lense_holder.scad>
include <m12_lense_holder_adapter.scad>
include <noctua_nf_a4x20.scad>
include <radxa_zero_3e.scad>
include <veye_imx287.scad>

// cam + lense
translate([0, 0, $lenseYPosMm])
rotate([-$opticalAxisAngleDegrees, 0, 0])
{
    m12_lense_holder();
    %m12_lense();

    translate([0, -$lenseSensorDistanceMm, 0])
    rotate([$sensorLenseAngleDegrees, 0, 0])
    veye_imx287_natural();
}

// laser
translate([0, -$laserZOffsetMm, 0])
{
    %laser_body();
    laser_holder();
}

// radxa
translate([0, 0, 20])
translate([0, 10, radxa_zero_3e_pcb_h - 5])
rotate([90, 0, 0])
//radxa_zero_3e_with_protoboard();
radxa_zero_3e_with_protoboard_and_connectors();

// noctua fan
//translate([0, -$laserBodyLengthMm, $lenseYPosMm + 20])
translate([0, -$scannerBodyFrontWallOffsetMm, 40])
*noctua_nf_a4x20();

// chinese fan
translate([0, -$scannerBodyFrontWallOffsetMm, 40])
%ld3007ms();

// main frame
module scanner_main_frame()
{
    lhs = laser_holder_size();
    wt = $scannerBodyWallThicknessMm;
    wzo = $scannerBodyFrontWallOffsetMm;
    
    // in scanner coords
    // inner height is a bit random
    // TODO: choose constant size to use one frame for
    // many similar ranges
    main_frame_height_y = 150;
    main_frame_width_x = 34;
    main_frame_depth_z = 65;
    
    // inner height, width, depth and radius
    ih = main_frame_height_y;
    iw = main_frame_width_x;
    id = main_frame_depth_z;
    ir = wt;
    
    // front wall
    translate([-iw / 2, -wzo, -lhs[2] / 2])
    cube([iw, wt, ih]);
    
    // back wall
    translate([0, -wzo - id, 0])
    // initial positioning
    translate([-iw / 2, -wt, -lhs[2] / 2])
    cube([iw, wt, ih]);
    
    // bottom wall
    // apply body sizes
    translate([0, -wzo, -lhs[2] / 2])
    // initial positioning
    translate([0, -id / 2, -wt / 2])
    cube([iw, id, wt], center = true);
    
    // top wall
    // apply body sizes
    translate([0, -wzo, -lhs[2] / 2 + ih])
    // initial positioning
    translate([0, -id / 2, wt / 2])
    cube([iw, id, wt], center = true);
    
    // now try to cut body with rounded corners to simplify
    // cnc manufacturing

    difference()
    {
        hull()
        {
            // outer cylinders
            union()
            {
                for (yd = [0, -id], zd = [0, ih])
                {
                    translate([0, -wzo + yd, -lhs[2] / 2 + zd])
                    rotate([0, 90, 0])
                    cylinder($fn = dToFn(ir * 2), r = ir, h = iw, center = true);
                }
            }
        }
        // inner cylinders
        hull()
        {
            union()
            {
                for (yd = [0 - ir, -id + ir], zd = [0 + ir, ih - ir])
                {
                    translate([0, -wzo + yd, -lhs[2] / 2 + zd])
                    rotate([0, 90, 0])
                    // scale by x a bit to fully cut
                    cylinder($fn = dToFn(ir * 2), r = ir, h = iw * 1.1, center = true);
                }
            }
        }
    }
    
    // and now add some stands for screwing left/right covers
    // TODO: simplify inner cut cube after implementing this:
    // rounded corners won't be needed anymore
}

%scanner_main_frame();