3d-printing/tapo-ceiling-mount/tapo_ceiling_mount_assembly.scad

96 lines
3.3 KiB
OpenSCAD

// ============================================
// Tapo Ceiling Mount - Assembly Preview
// ============================================
// Non-printing preview of the whole system:
// ceiling, upper clamps, exterior plate, connector collar, camera adapter,
// approximate camera, Ethernet cable, DC cable.
//
// Modes:
// assembly_mode = "assembled" full stack in place
// = "exploded" parts spread along z
// = "section" assembled, cut on the y=0 plane for the cables
//
// Colors show only in the interactive preview ($preview). Printable parts do
// not depend on color.
parameters_only = false;
include <tapo_ceiling_mount_parameters.scad>;
use <tapo_ceiling_outer_plate.scad>;
use <tapo_ceiling_inner_clamp.scad>;
use <tapo_ceiling_camera_connector.scad>;
use <tapo_ceiling_camera_adapter_tapo_original_base.scad>;
/* [Assembly Preview] */
// Preview layout.
assembly_mode = "assembled"; // [assembled, exploded, section]
// Spread distance for the exploded view (mm).
explode_gap = 26; // [10:1:60]
// Structural, connector, adapter and camera colors for the preview.
col_struct = [0.82, 0.82, 0.85];
col_connect = [0.20, 0.45, 0.90];
col_adapter = [0.95, 0.55, 0.15];
col_camera = [0.96, 0.96, 0.96];
e = (assembly_mode == "exploded") ? explode_gap : 0;
clamp_z = plate_thickness + ceiling_thickness;
module paint(c) { if ($preview) color(c) children(); else children(); }
// Translucent false-ceiling panel with the existing hole.
module ceiling_mock() {
color([0.85, 0.85, 0.80, 0.30])
translate([0, 0, plate_thickness])
difference() {
cylinder(d = outer_diameter + 40, h = ceiling_thickness);
translate([0, 0, -1])
cylinder(d = ceiling_hole_diameter, h = ceiling_thickness + 2);
}
}
// One M4 screw, head recess to captive nut.
module m4_screw_model(len) {
color("silver") {
cylinder(d = screw_head_recess_d - 0.6, h = head_recess_depth);
translate([0, 0, head_recess_depth]) cylinder(d = 4, h = len);
}
}
// Approximate Tapo camera below the adapter.
module camera_model(z_top) {
paint(col_camera)
translate([0, 0, z_top]) {
translate([0, 0, -9]) cylinder(d = camera_base_diameter, h = 9);
translate([0, 0, -9]) sphere(d = camera_base_diameter * 0.8);
}
}
// Ethernet and DC cables through the open center.
module cables() {
color([0.15, 0.35, 0.85]) translate([0, 9, -40]) cylinder(d = 7, h = 90);
color([0.10, 0.10, 0.10]) translate([0, -9, -40]) cylinder(d = 4, h = 90);
}
module full_assembly() {
// Structural ceiling system (stays in place).
paint(col_struct) tapo_outer_plate();
paint(col_struct) translate([0, 0, clamp_z + e]) tapo_inner_clamp_pair();
for (p = screw_positions)
translate([p[0], p[1], 0]) m4_screw_model(recommended_screw_length);
// Modular camera interface (spreads down when exploded).
paint(col_connect) translate([0, 0, -e]) camera_connector();
paint(col_adapter) translate([0, 0, -2 * e]) tapo_camera_adapter_original_base();
camera_model(adapter_bot_z - 2 * e);
if (assembly_mode != "exploded") cables();
ceiling_mock();
}
if (assembly_mode == "section")
difference() {
full_assembly();
translate([-200, 0, -200]) cube([400, 200, 400]);
}
else
full_assembly();