include <../config/camera_mount.scad> module camera_mount_monitor_base() { thickness = camera_mount_thickness; diameter = camera_mount_diameter; monitor_base = camera_mount_monitor_base; rounding = camera_mount_rounding; module corner(x = 0, y = 0, rounded = true) { translate([x, y]) { if (rounded) { circle(r = rounding); } else { square([rounding * 2, rounding * 2], center = true); } } } monitor_base_outside = [ monitor_base.x, monitor_base.y + thickness * 2, monitor_base.z + thickness ]; module top_shape() { move_x = monitor_base_outside.x / 2 - rounding; move_y = monitor_base_outside.y / 2 - rounding; move_x_right = monitor_base_outside.x / 2 + thickness + diameter; difference() { hull() { corner(-move_x, move_y); corner(-move_x, -move_y); corner(move_x, move_y, false); corner(move_x, -move_y, false); translate([move_x_right, 0]) { circle(r = monitor_base_outside.y / 2); } } translate([move_x_right, 0]) { circle(d = diameter); } } } module top_base_object() { linear_extrude(height = monitor_base_outside.z, center = true) { top_shape(); } } module top_object() { render() { difference() { top_base_object(); translate([0, 0, -thickness / 2] ){ cube(monitor_base, center = true); } } } } color("#61C9A8") { top_object(); } } module camera_mount_connector() { monitor_base = camera_mount_monitor_base; thickness = camera_mount_thickness; diameter = camera_mount_diameter; rounding = camera_mount_rounding / 5; nut_diameter = camera_mount_nut_diameter; nut_thickness = camera_mount_nut_thickness; screw_diameter = camera_mount_screw_diameter; connector_size = [ thickness * 4 + camera_mount_monitor_base.z, nut_diameter + thickness * 2, nut_diameter + thickness * 2 ]; module z_rotator_object() { height = monitor_base.z + thickness; diameter_tolerance = diameter - camera_mount_tolerance; translate([0, 0, -height / 2 - connector_size.z / 2]) { cylinder(d = diameter_tolerance, h = height, center = true); } } module connector_base() { move_x = connector_size.x / 2 - rounding; move_y = connector_size.y / 2 - rounding; height = connector_size.z; rotate([90, 0, 0]) { hull() { translate([-move_x, move_y]) { cylinder(r = rounding, h = height, center = true); } translate([-move_x, -move_y]) { cylinder(r = rounding, h = height, center = true); } translate([move_x, -move_y]) { cylinder(r = rounding, h = height, center = true); } translate([move_x, move_y]) { cylinder(r = rounding, h = height, center = true); } } } translate([connector_size.x / 2, 0, 0]) { rotate([0, 90, 0]) { cylinder( d = screw_diameter * 2, h = thickness, center = true ); } } } module connector() { render() { difference() { connector_base(); translate([thickness, 0, 0]) { rotate([0, 90, 0]) { cylinder( d = screw_diameter, h = connector_size.x, center = true ); } } nut_cutoff = [ nut_thickness, nut_diameter, connector_size.z / 2 + nut_diameter / 2 ]; nut_cutoff_move_z = ( connector_size.z / 4 + nut_diameter / 4 - nut_diameter / 2 ); translate([0, 0, nut_cutoff_move_z]) { cube(nut_cutoff, center = true); } } } } color("#A53860") { render() { union() { z_rotator_object(); connector(); } } } } module camera_mount_camera() { camera = camera_mount_camera; camera_shape = [camera.x, camera.z]; thickness = camera_mount_thickness; first_height = camera_mount_first_height; outside = [ camera.x + thickness * 2, camera.z + thickness * 2 ]; inside = [ camera.x - thickness * 2, camera.z - thickness * 2 ]; module frame_shape() { difference() { square(outside, center = true); square(inside, center = true); } } module first_frame_shape() { difference() { square(outside, center = true); square(camera_shape, center = true); } } module second_frame_shape() { difference() { first_frame_shape(); union() { square([outside.x, inside.y], center = true); translate([-inside.x / 4, thickness]) { square([inside.x / 2, camera_shape.y], center = true); } } } } module object() { union() { linear_extrude(height = thickness) { frame_shape(); } linear_extrude(height = thickness + first_height) { first_frame_shape(); } linear_extrude(height = outside.y) { second_frame_shape(); } } } screw_diameter = camera_mount_screw_diameter; tolerance = camera_mount_tolerance; in = screw_diameter * 2 + tolerance; out = screw_diameter * 2 + thickness * 2; module rotator() { module outer() { union() { circle(d = out); translate([0, -out / 4]) { square([out, out / 2], center = true); } } } module first() { difference() { outer(); circle(d = in); } } module second() { difference() { outer(); circle(d = screw_diameter); } } union() { linear_extrude(height = thickness) { second(); } linear_extrude(height = thickness * 2) { first(); } } } color("#ADA8B6") { render() { union() { object(); translate([ -outside.x / 2 + thickness * 2, outside.y / 2 + out / 2, out / 2 ]) { rotate([0, 270, 0]) { rotator(); } } } } } }