79375980

Date: 2025-01-21 21:30:06
Score: 0.5
Natty:
Report link

With the help of ChatGPT (it can write Openscad code!), I got the following using the code below: Octagon

$fn = 150; // Smoothness for round parts
outer_diameter = 103; // Outer diameter of the hose connection
inner_diameter = 100; // Inner diameter (to fit hose)
adapter_height = 50;  // Height of the adapter
lip_height = 25;      // Height of the lip for magnetic connection
lip_width = 40;       // Thickness of the lip

hole_diameter = 12.5;   // Diameter of the holes
hole_depth = 4;       // Depth of the holes
num_holes = 8;        // Number of holes

// Octagonal Magnetic Lip
module magnetic_lip() {
    difference() {
        // Outer lip with octagonal shape
        linear_extrude(height=lip_height)
            offset(delta=lip_width, chamfer=false)
                circle(d=inner_diameter, $fn=8); // Octagon shape
        
        // Inner lip hole
        translate([0, 0, -1])
            cylinder(h=lip_height + 2, d=outer_diameter);
        
        // Drill holes on the top horizontal surface, centered between inner circle and outer edge
        for (i = [0 : 360 / num_holes : 360 - (360 / num_holes)]) {
            rotate([0, 0, i]) {
                // Calculate midpoint radius between inner circle and outer edge of the octagon
                radius_midpoint = (inner_diameter / 2 + (inner_diameter / 2 + lip_width)) / 2;

                translate([radius_midpoint, 0, lip_height]) {
                    cylinder(h=hole_depth, d=hole_diameter, center=true);
                }
            }
        }
    }
}

// Complete Assembly
module hose_adapter() {
    union() {
        magnetic_lip();
    }
}

// Render the adapter
hose_adapter();
Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: M Becker