diff --git a/README.md b/README.md index b177412..ef2c5c6 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,14 @@ Model files: * home-assistant-voice-wall-mount.scad +## ig-ornament + +![ig_ornament.png](ig-ornament/ig_ornament.png) + +Model files: + +* ig_ornament.scad + ## korg-piano-volume-knob ![korg-piano-volume-knob.png](korg-piano-volume-knob/korg-piano-volume-knob.png) diff --git a/ig-ornament/ig_ornament-40-10.3mf b/ig-ornament/ig_ornament-40-10.3mf new file mode 100644 index 0000000..1ef6833 Binary files /dev/null and b/ig-ornament/ig_ornament-40-10.3mf differ diff --git a/ig-ornament/ig_ornament.3mf b/ig-ornament/ig_ornament.3mf new file mode 100644 index 0000000..958e7eb Binary files /dev/null and b/ig-ornament/ig_ornament.3mf differ diff --git a/ig-ornament/ig_ornament.png b/ig-ornament/ig_ornament.png new file mode 100644 index 0000000..f2170ac Binary files /dev/null and b/ig-ornament/ig_ornament.png differ diff --git a/ig-ornament/ig_ornament.scad b/ig-ornament/ig_ornament.scad new file mode 100644 index 0000000..c97b2d3 --- /dev/null +++ b/ig-ornament/ig_ornament.scad @@ -0,0 +1,205 @@ +// ig_ornament.scad +// --------------------------------------------------------------------------- +// Instagram camera logo ornament: frame, lens and dot, with optional +// diagonal support rods (tying the three into one piece) and a small +// hanging hook at the top. +// Proportions measured from the official camera logo ("Instagram logo +// 2016.svg" on Wikimedia Commons, 96x96 icon); the official squircle +// corners are approximated with constant-radius rounded corners. +// +// Library: BOSL2 (https://github.com/BelfrySCAD/BOSL2) +// rect() + offset() : 2D cross-sections (rounded squares, exact offsets) +// skin() : 3D loft of the cross-sections (frame) +// +// The three shapes are separate components (ig_frame, ig_lens, ig_dot) so +// each can be colored individually or printed on its own. +// +// Chamfer style: every top/bottom edge (outer rims and hole edges alike) +// carries the same 45-degree chamfer of size `chamfer`. Each face +// cross-section is the middle cross-section offset inward by `chamfer` +// (outer boundaries shrink, holes open outward), i.e. the bevels slope +// inward toward the faces (widest at mid-height). +// +// The whole model is centered on all axes: +// x/y centered on the logo center (the dot keeps its designed offset), +// z spanning -height/2 .. +height/2. +// (To print with the bottom at z=0, wrap the assembly in translate([0,0,height/2]).) +// --------------------------------------------------------------------------- + +include + +// ===================== User configuration ===================== +width = 40; // Overall width of the logo (frame outer edge), mm +height = 10; // Height of every component, mm +chamfer = 0.5; // 45-degree chamfer on all top/bottom edges of all components, mm +rod_ratio = 0.5; // Support rod diameter as a fraction of the dot diameter +hook_hole_d = 3; // Hanging hook hole diameter, mm +hook_tube_d = 2; // Hanging hook ring thickness (torus tube diameter), mm +hook_sink = 0.4; // Fraction of the hook loop buried in the frame (0..1) + +// Rendering resolution +$fs = 0.1; +$rt = 0.01; +$fn = 100; + +// ============ Geometry from the official logo (96x96 icon units) ========= +// The official icon spans 96x96 units, so `width` maps to 96 units. +scale = width / 96; + +frame_thickness = 8.65 * scale; // frame stroke width +frame_inner = width - 2 * frame_thickness; +lens_R = 24.65 * scale; // lens ring outer radius +lens_r = 16.0 * scale; // lens ring inner radius +dot_r = 5.76 * scale; // dot radius +dot_pos = [25.62 * scale, 25.62 * scale]; // dot center, on the 45-degree diagonal +// Corner radii: the official logo uses a smooth squircle, we keep constant- +// radius rounded corners (chosen to approximate its look). +frame_outer_r = 29.2 * scale; // frame outer corner radius +frame_inner_r = 20.0 * scale; // frame inner corner radius + +// Sanity checks +dummy = assert(chamfer >= 0, "chamfer must be >= 0") + assert(height > 2 * chamfer, "height must be greater than 2*chamfer") + assert(chamfer < frame_thickness / 2, "chamfer must be smaller than half the frame thickness") + assert(chamfer < frame_inner / 2, "chamfer must be smaller than half the frame inner size") + assert(chamfer < (lens_R - lens_r) / 2, "chamfer must be smaller than half the lens ring width") + assert(chamfer < dot_r, "chamfer must be smaller than the dot radius"); + +// ===================== Chamfer helpers ===================== +// Inward chamfer: faces inset, widest at mid-height (see header). + +// Solid disk of radius r and global `height`, 45-degree chamfered at the faces. +module chamfered_disk(r, c) { + cylinder(h=height - 2*c, d=2*r, center=true); + if (c > 0) { + translate([0, 0, -height/2]) + cylinder(h=c, d1=2*(r-c), d2=2*r); + translate([0, 0, height/2 - c]) + cylinder(h=c, d1=2*r, d2=2*(r-c)); + } +} + +// Hole of radius r: the hole opens to r+c at the top/bottom faces, giving a +// 45-degree chamfer on the inner edges (matching the outer style: the +// cross-section is widest at mid-height). Extended a hair past the faces +// (eps) to keep the boolean faces non-coplanar. +module chamfered_hole(r, c) { + eps = 0.05; + // Straight middle section at the hole's full radius + cylinder(h=height - 2*c + 2*eps, d=2*r, center=true); + if (c > 0) { + // 45-degree flares: full radius at depth c, opening to r+c at the faces + translate([0, 0, -height/2 - eps]) + cylinder(h=c + eps, d1=2*(r+c+eps), d2=2*r); + translate([0, 0, height/2 - c]) + cylinder(h=c + eps, d1=2*r, d2=2*(r+c+eps)); + } +} + +// ===================== Components ===================== +// Every component is centered on z (-height/2 .. +height/2). + +// --- 1. Rounded-square frame (the camera body) ----------------------------- +// Loft of 4 cross-sections with skin(): at the faces the outer boundary is +// inset and the inner hole is opened by `chamfer`, full-size in between -> +// 45-degree chamfer on every top/bottom edge (outer rims and hole edge). +module ig_frame() { + f_out = rect(size=width, rounding=frame_outer_r); + f_in = rect(size=frame_inner, rounding=frame_inner_r); + f_out_face = offset(f_out, delta=-chamfer, same_length=true); // shrink outer boundary + f_in_face = offset(f_in, delta=+chamfer, same_length=true); // open the hole + z4 = [-height/2, -height/2 + chamfer, height/2 - chamfer, height/2]; + if (chamfer > 0) { + difference() { + skin([f_out_face, f_out, f_out, f_out_face], slices=0, z=z4); + skin([f_in_face, f_in, f_in, f_in_face], slices=0, z=z4); + } + } else { + difference() { + skin([f_out, f_out], slices=0, z=[-height/2, height/2]); + skin([f_in, f_in], slices=0, z=[-height/2, height/2]); + } + } +} + +// --- 2. Lens ring (the camera lens) ---------------------------------------- +module ig_lens() { + difference() { + chamfered_disk(lens_R, chamfer); + chamfered_hole(lens_r, chamfer); + } +} + +// --- 3. Dot (the camera flash) --------------------------------------------- +module ig_dot() { + translate(dot_pos) + chamfered_disk(dot_r, chamfer); +} + +// --- 4. Support rods -------------------------------------------------------- +// Two horizontal rods at mid-height along the 45-degree diagonal that tie +// the three elements into one piece: one runs from the frame through the +// dot to the lens ring, the other is its mirror from the lens ring to the +// frame on the far side. The lens center is left clear. +// Each rod's end is buried in the middle of the frame arm / lens ring band, +// and the existing elements are cut out of the rods (difference) so the rods +// fill the gaps exactly and never overlap the frame, lens, or dot. +module ig_support_rod() { + rod_d = 2 * dot_r * rod_ratio; + // Distances from the logo center along the 45-degree diagonal + lens_mid = (lens_R + lens_r) / 2; // middle of the lens ring band + frame_in = (frame_inner/2 - frame_inner_r) * sqrt(2) + frame_inner_r; + frame_out = (width/2 - frame_outer_r) * sqrt(2) + frame_outer_r; + frame_mid = (frame_in + frame_out) / 2; // middle of the frame arm + dummy = assert(rod_ratio > 0, "rod_ratio must be > 0") + assert(rod_d < 2 * (lens_R - lens_r), "rod must be smaller than the lens ring width") + assert(rod_d < frame_out - frame_in, "rod must be smaller than the frame arm width"); + rod_len = frame_mid - lens_mid; + rod_center = (lens_mid + frame_mid) / 2; + diag_dir = [1, 1, 0] / sqrt(2); + difference() { + for (side = [1, -1]) { + translate(side * rod_center * diag_dir) + rotate(45) rotate(90, v=[0,1,0]) + cylinder(h=rod_len, d=rod_d, center=true); + } + ig_frame(); + ig_lens(); + ig_dot(); + } +} + +// --- 5. Hanging hook ------------------------------------------------------ +// A partially embedded torus loop at the top of the frame for hanging the +// ornament. The loop is positioned so that a fraction hook_sink of its +// outer diameter is buried in the top frame arm (cut away by ig_frame(), +// same difference pattern as the support rods) and the rest sticks out. +// The hole axis is along X, so it hangs on a horizontal nail or hook. +// Note: if the sink is large, the frame edge clips the bottom of the hole. +module ig_hook() { + hole_r = hook_hole_d / 2; + r_tube = hook_tube_d / 2; + R_hook = hole_r + r_tube; // major radius (hole diameter = hook_hole_d) + loop_r = R_hook + r_tube; // loop outer radius + dummy = assert(hook_hole_d > 0, "hook_hole_d must be > 0") + assert(hook_tube_d > 0, "hook_tube_d must be > 0") + assert(0 <= hook_sink && hook_sink < 1, "hook_sink must be >= 0 and < 1") + assert(2 * hook_sink * loop_r <= frame_thickness, "hook's buried part must fit in the frame arm") + assert(loop_r <= height / 2, "hook loop must fit within the model height"); + translate([0, width/2 + (1 - 2*hook_sink) * loop_r, 0]) + rotate([0, 90, 0]) + difference() { + torus(R_hook, r_tube); + ig_frame(); + } +} + +// ===================== Assembly ===================== +// All components are separate and individually colorable. +// Remove the color() lines (or change them) to suit your printer. +color("#7638FA") ig_frame(); // purple +color("#7638FA") ig_lens(); // purple +color("#7638FA") ig_dot(); // purple +// Optional extras: delete a line (and its module) to remove it. +color("#000000") ig_support_rod(); // black +color("#000000") ig_hook(); // black