include include include include include include include include include // wall and wall thickness $wawt = -$scannerBodyFrontWallOffsetMm + $scannerBodyWallThicknessMm; module cam_and_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(); } } module camera_hole() { // TODO: calc Y (scanner coords) offset instead of // hardcoding it y_offset = 100; translate([0, 0, y_offset]) // move to the front border of scanner body translate([0, $wawt, 0]) front_glass_hole(gw = 26.6, gh = 19.6, gt = 2, gcr = 1); } module laser_hole() { // TODO: calc Y (scanner coords) offset instead of // hardcoding it y_offset = 0; translate([0, 0, y_offset]) // move to the front border of scanner body translate([0, $wawt, 0]) front_glass_hole(gw = 14, gh = 6, gt = 2, gcr = 1); } module visualize_yz_range() { lenseY = $lenseYPosMm; zBase = $actualZBaseMm + $wawt; farZ = zBase + $actualZRangeMm; color("red", 0.3) rotate([0, -90, 0]) %polygon([ [lenseY, 0], [0, zBase], [0, farZ], ]); } module visualize_xz_range() { zBase = $actualZBaseMm + $wawt; farZ = zBase + $actualZRangeMm; color("red", 0.3) %polygon( [[$actualXStartMm / 2, zBase], [-$actualXStartMm / 2, zBase], [-$actualXEndMm / 2, farZ], [$actualXEndMm / 2, farZ],]); } cam_and_lense(); camera_hole(); laser_hole(); visualize_yz_range(); visualize_xz_range(); // laser translate([0, -$laserZOffsetMm, 0]) { %laser_body(); laser_holder(); } // radxa translate([0, 0, 20]) translate([ 0, -$scannerBodyFrontWallOffsetMm - 5, radxa_zero_3e_pcb_h - 10]) 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(); // 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 = 56; // inner height, width, depth and radius ih = main_frame_height_y; iw = main_frame_width_x; id = main_frame_depth_z; ir = wt; // now try to cut body with rounded corners to simplify // cnc manufacturing // TODO: move this shit to a module 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); } } } } // TODO: 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 // add outer m12 connectors translate([0, -wzo - id, 20 + m12_male_conn_body_thick_part_d + 5]) m12_female_connector(); translate([0, -wzo - id, 20]) m12_male_connector(); // chinese fan //translate([0, -$scannerBodyFrontWallOffsetMm, 40]) translate([0, ld3007ms_t - wzo - id, 80]) %ld3007ms(); } %scanner_main_frame();