The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Tag: Improvements

Making the world a better place, one piece at a time

  • Solid Modeling: Support Puzzle

    Solid Modeling: Support Puzzle

    I’ve been putting this type of support structure inside screw holes & suchlike for years:

    Browning Hi-Power Magazine Block - solid model - Generic 1 - support detail
    Browning Hi-Power Magazine Block – solid model – Generic 1 – support detail

    It’s basically a group of small rectangles rotated around the hole’s axis and about one thread thickness shorter than the overhanging interior.

    I’ve found that incorporating exactly the right support structure eliminates Slic3r’s weird growths, eases removal, and generally works better all around.

    So doing this for the baseplate of the Glass Tile frame came naturally:

    Glass Tile Frame - octagonal support
    Glass Tile Frame – octagonal support

    This OpenSCAD snippet plunks one of those asterisks in each of four screw holes:

      if (Support)
        color("Yellow")
          for (i=[-1,1], j=[-1,1])
            translate([i*InsertOC.x/2,j*InsertOC.y/2,0])
              for (a=[0:45:135])
                  rotate(a)
                    translate([0,0,(Screw[LENGTH] - ThreadThick)/2])
                      cube([Screw[OD] - 2*ThreadWidth,2*ThreadWidth,Screw[LENGTH] - ThreadThick],center=true);

    The “cubes” overlap in the middle, with no completely coincident faces or common edges, so it’s 2-manifold. Slic3r, however, produces a weird time estimate whenever the model includes those structures:

    Slic3r - NaN time estimate
    Slic3r – NaN time estimate

    NaN stands for Not A Number and means something horrible has happened in the G-Code generation. Fortunately, the G-Code worked perfectly and produced the desired result, but I’m always uneasy when Something Seems Wrong.

    Messing around with the code produced a slightly different support structure:

    Glass Tile Frame - quad support
    Glass Tile Frame – quad support

    The one thread thick square on the bottom helps glue the structure to the platform and four ribs work just as well as eight in the octagonal hole:

      Fin = [Screw[OD]/2 - 1.5*ThreadWidth,2*ThreadWidth,ScrewRecess - ThreadThick];
      if (Inserts && SupportInserts)
        color("Yellow")
          for (i=[-1,1], j=[-1,1])
            translate([i*InsertOC.x/2,j*InsertOC.y/2,0]) {
              rotate(180/8)
                cylinder(d=6*ThreadWidth,h=ThreadThick,$fn=8);
              for (a=[0:90:360])
                  rotate(a)
                    translate([Fin.x/2 + ThreadWidth/2,0,(ScrewRecess - ThreadThick)/2])
                      cube(Fin,center=true);
            }

    Which changed the NaN time estimates into actual numbers.

    One key difference may be the small hole in the middle. The four ribs (not two!) now overlap by one thread width around the hole, so they’re not quite coincident and Slic3r produces a tidy model:

    Glass Tile Frame - quad support - Slic3r
    Glass Tile Frame – quad support – Slic3r

    The hole eliminates a smear of infill from the center, which may have something to do with the improvement.

    In any event, I have an improved copypasta recipe for the next screw holes in need of support, even if I don’t understand why it’s better.

  • Glass Tiles: Matrix for SK6812 PCBs

    Glass Tiles: Matrix for SK6812 PCBs

    Tweaking the glass tile frame for press-fit SK6812 PCBs in the bottom of the array cells:

    Glass Tile Frame - cell array - openscad
    Glass Tile Frame – cell array – openscad

    Which looks like this with the LEDs and brass inserts installed:

    Glass Tile - 2x2 array - interior
    Glass Tile – 2×2 array – interior

    The base holds an Arduino Nano with room for wiring under the cell array:

    Glass Tile Frame - base - openscad
    Glass Tile Frame – base – openscad

    Which looks like this after it’s all wired up:

    Glass Tile - 2x2 array - wiring
    Glass Tile – 2×2 array – wiring

    The weird colors showing through the inserts are from the LEDs. The red thing in the upper left is a silicone insulation snippet. Yes, that’s hot-melt glue holding the Arduino Nano in place and preventing the PCBs from getting frisky.

    Soak a handful of glass tiles overnight in paint stripper:

    Glass Tiles - paint stripper soak
    Glass Tiles – paint stripper soak

    Whereupon the adhesive slides right off with the gentle application of a razor scraper. Rinse carefully, dry thoroughly, and snap into place.

    Tighten the four M3 SHCS and it’s all good:

    Glass Tile - 2x2 array - operating
    Glass Tile – 2×2 array – operating

    So far, I’ve had two people tell me they don’t know what it is, but they want one:

    Glass Tile - various versions
    Glass Tile – various versions

    The OpenSCAD Customizer lets you set the array size:

    Glass Tile Frame - 3x3 - press-fit SK6812 LEDs
    Glass Tile Frame – 3×3 – press-fit SK6812 LEDs

    However, just because you can do something doesn’t mean you should:

    Glass Tile Frame - 6x6 cell array - openscad
    Glass Tile Frame – 6×6 cell array – openscad

    Something like this might be interesting:

    Glass Tile Frame - 2x6 cell array - openscad
    Glass Tile Frame – 2×6 cell array – openscad

    In round numbers, printing the frame takes about an hour per cell, so a 2×2 array takes three hours and 3×3 array runs around seven hours. A 6×6 frame is just not happening.

    The OpenSCAD source code as a GitHub Gist:

    // Illuminated Tile Grid
    // Ed Nisley – KE4ZNU
    // 2020-05
    /* [Configuration] */
    Layout = "Build"; // [Cell,CellArray,MCU,Base,Show,Build]
    Shape = "Square"; // [Square, Pyramid, Cone]
    Cells = [2,2];
    CellDepth = 15.0;
    Inserts = true;
    SupportInserts = true;
    /* [Hidden] */
    ThreadThick = 0.25;
    ThreadWidth = 0.40;
    HoleWindage = 0.2;
    function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
    Protrusion = 0.1; // make holes end cleanly
    ID = 0;
    OD = 1;
    LENGTH = 2;
    Tile = [25.0 + 0.1,25.0 + 0.1,4.0];
    WallThick = 4*ThreadWidth;
    FloorThick = 3.0;
    Flange = [2*ThreadWidth,2*ThreadWidth,0]; // ridge supporting tile
    Separator = [3*ThreadWidth,3*ThreadWidth,Tile.z – 1]; // between tiles
    Screw = [3.0,6.0,3.5]; // M3 SHCS, OD=head, LENGTH=head
    Insert = [3.0,4.2,8.0]; // threaded brass insert
    ScrewRecess = Screw[LENGTH] + 4*ThreadThick;
    LEDPCB = [9.6,9.6,2.9]; // round SK6812, squared-off sides
    LED = [5.0 + 2*HoleWindage,5.0 + 2*HoleWindage,1.3];
    LEDOffset = [0.0,0.0,0.0]; // if offset from PCB center
    CellOAL = [Tile.x,Tile.y,0] + Separator + [0,0,CellDepth] + [0,0,FloorThick];
    ArrayOAL = [Cells.x*CellOAL.x,Cells.y*CellOAL.y,CellOAL.z]; // just the LED cells
    BlockOAL = ArrayOAL + [2*WallThick,2*WallThick,0]; // LED cells + exterior wall
    echo(str("Block OAL: ",BlockOAL));
    InsertOC = ArrayOAL – [Insert[OD],Insert[OD],0] – [WallThick,WallThick,0];
    echo(str("Insert OC: ",InsertOC));
    TapeThick = 1.0;
    Arduino = [44.0,18.0,8.0 + TapeThick]; // Arduino Nano to top of USB Mini-B plug
    USBPlug = [15.0,11.0,9.0]; // USB Mini-B plug insulator
    USBOffset = [0,0,5.0]; // offset from PCB base
    WiringSpace = 3.5;
    WiringBay = [(Cells.x – 1)*CellOAL.x + LEDPCB.x,(Cells.y – 1)*CellOAL.y + LEDPCB.x,WiringSpace];
    PlateOAL = [BlockOAL.x,BlockOAL.y,FloorThick + Arduino.z + WiringSpace]; // allow wiring above Arduino
    echo(str("Base Plate: ",PlateOAL));
    echo(str("Screw length: ",(PlateOAL.z – ScrewRecess) + Insert.z/2," to ",(PlateOAL.z – ScrewRecess) + Insert.z));
    LegendRecess = 1*ThreadThick;
    //————————
    module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
    Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
    FixDia = Dia / cos(180/Sides);
    cylinder(d=(FixDia + HoleWindage),h=Height,$fn=Sides);
    }
    //———————–
    // Base and optics in single tile
    module LEDCone() {
    hull() {
    translate([0,0,CellDepth + Tile.z/2])
    cube(Tile – 2*[Flange.x,Flange.y,0],center=true);
    if (Shape == "Square") {
    translate([0,0,LEDPCB.z/2])
    cube([Tile.x,Tile.y,LEDPCB.z] – 2*[Flange.x,Flange.y,0],center=true);
    }
    else if (Shape == "Pyramid") {
    translate([0,0,LEDPCB.z/2])
    cube(LEDPCB,center=true);
    }
    else if (Shape == "Cone") {
    translate([0,0,LEDPCB.z/2])
    cylinder(d=1.0*LEDPCB.x,h=LED.z,center=true);
    }
    else {
    echo(str("Whoopsie! Invalid Shape: ",Shape));
    cube(5);
    }
    }
    }
    // One complete LED cell
    module LEDCell() {
    difference() {
    translate([0,0,CellOAL.z/2])
    cube(CellOAL + [Protrusion,Protrusion,0],center=true); // force overlapping adjacent sides!
    translate([0,0,CellOAL.z – Separator.z + Tile.z/2])
    cube(Tile,center=true);
    translate([0,0,LEDPCB.z])
    LEDCone();
    // cube([LED.x,LED.y,CellOAL.z],center=true);
    translate(-LEDOffset + [0,0,-CellOAL.z/2])
    rotate(180/8)
    PolyCyl(LEDPCB.x,CellOAL.z,8);
    }
    }
    // The whole array of cells
    module CellArray() {
    difference() {
    union() {
    translate([CellOAL.x/2 – Cells.x*CellOAL.x/2,CellOAL.y/2 – Cells.y*CellOAL.y/2,0])
    for (i=[0:Cells.x – 1], j=[0:Cells.y – 1])
    translate([i*CellOAL.x,j*CellOAL.y,0])
    LEDCell();
    if (Inserts) // bosses
    for (i=[-1,1], j=[-1,1])
    translate([i*InsertOC.x/2,j*InsertOC.y/2,0])
    rotate(180/8)
    cylinder(d=Insert[OD] + 2*WallThick,h=Insert[LENGTH],$fn=8);
    }
    if (Inserts) // holes
    for (i=[-1,1], j=[-1,1])
    translate([i*InsertOC.x/2,j*InsertOC.y/2,-Protrusion])
    rotate(180/8)
    PolyCyl(Insert[OD],Insert[LENGTH] + FloorThick + Protrusion,8);
    }
    difference() {
    translate([0,0,CellOAL.z/2])
    cube(BlockOAL,center=true);
    translate([0,0,CellOAL.z])
    cube(ArrayOAL + [0,0,2*CellOAL.z],center=true);
    }
    }
    // Arduino bounding box
    // Origin at center bottom of PCB
    module Controller() {
    union() {
    translate([0,0,Arduino.z/2])
    cube(Arduino,center=true);
    translate([Arduino.x/2 – Protrusion,-USBPlug.y/2,USBOffset.z + TapeThick – USBPlug.z/2])
    cube(USBPlug + [Protrusion,0,0],center=false);
    }
    }
    // Baseplate
    module BasePlate() {
    difference() {
    translate([0,0,PlateOAL.z/2])
    cube(PlateOAL,center=true);
    translate([PlateOAL.x/2 – Arduino.x/2 – 2*WallThick,0,FloorThick])
    Controller();
    translate([PlateOAL.x/2 – Arduino.x/2 – 2*WallThick,0,FloorThick + PlateOAL.z/2])
    cube([Arduino.x – 2*2.0,WiringBay.y,PlateOAL.z],center=true); // cutouts beside MCU
    translate([0,0,PlateOAL.z – WiringBay.z + PlateOAL.z/2 – Protrusion])
    cube([PlateOAL.x – 2*WallThick,WiringBay.y,PlateOAL.z],center=true); // cutout above MCU
    translate([0,0,PlateOAL.z – WiringBay.z + PlateOAL.z/2 – Protrusion])
    cube([WiringBay.x,PlateOAL.y – 2*WallThick,PlateOAL.z],center=true); // cutout above MCU
    if (Inserts)
    for (i=[-1,1], j=[-1,1])
    translate([i*InsertOC.x/2,j*InsertOC.y/2,-Protrusion])
    rotate(180/8) {
    PolyCyl(Screw[ID],2*PlateOAL.z,8);
    PolyCyl(Screw[OD],ScrewRecess + Protrusion,8);
    }
    cube([45,17.0,2*LegendRecess],center=true);
    }
    linear_extrude(height=2*LegendRecess) {
    translate([0,1])
    rotate(-0*90) mirror([1,0,0])
    text(text="Ed Nisley",size=6,font="Arial:style:Bold",halign="center");
    translate([0,-6.5])
    rotate(-0*90) mirror([1,0,0])
    text(text="softsolder.com",size=4.5,font="Arial:style:Bold",halign="center");
    }
    Fin = [Screw[OD]/2 – 1.5*ThreadWidth,2*ThreadWidth,ScrewRecess – ThreadThick];
    if (Inserts && SupportInserts)
    color("Yellow")
    for (i=[-1,1], j=[-1,1])
    translate([i*InsertOC.x/2,j*InsertOC.y/2,0]) {
    rotate(180/8)
    cylinder(d=6*ThreadWidth,h=ThreadThick,$fn=8);
    for (a=[0:90:360])
    rotate(a)
    translate([Fin.x/2 + ThreadWidth/2,0,(ScrewRecess – ThreadThick)/2])
    cube(Fin,center=true);
    }
    }
    //———————–
    // Build things
    if (Layout == "Cell")
    LEDCell();
    else if (Layout == "CellArray")
    CellArray();
    else if (Layout == "MCU")
    Controller();
    else if (Layout == "Base")
    BasePlate();
    else if (Layout == "Show") {
    translate([0,0,3*PlateOAL.z])
    CellArray();
    BasePlate();
    translate([PlateOAL.x/2 – Arduino.x/2 – 2*WallThick,0,FloorThick])
    color("Orange",0.3)
    Controller();
    }
    else if (Layout == "Build") union() {
    translate([0,0.6*BlockOAL.y,0])
    CellArray();
    translate([0,-0.6*BlockOAL.x,0])
    rotate(90)
    BasePlate();
    }

  • No-Knead Bread

    No-Knead Bread

    Although it’s not particularly keto-friendly, I made a loaf of NY Times No-Knead Bread (fine-tuned versions):

    No-knead bread - loaf
    No-knead bread – loaf

    Wow, that tasted good and definitely added a bit more pep to my morning bike rides!

    The receipe produces a rather wet lump of dough in the mixing bowl:

    No-knead bread - mixed
    No-knead bread – mixed

    It looks much more promising after rising for 18 hours:

    No-knead bread - 18 hour rise
    No-knead bread – 18 hour rise

    The recipe calls for a large heavy pot, which produced a long-disused nickel-plated cast iron Wagner Ware No. 8 Drip-Drop Roaster from the attic:

    No-knead bread - Wagner No 8 Roaster
    No-knead bread – Wagner No 8 Roaster

    I scrubbed out the interior and used it as-found to good effect. After the cookin’ was done, a few hours of electrolytic stripping seemed in order:

    No-knead bread - electrolytic pot strip
    No-knead bread – electrolytic pot strip

    The lovely nickel plating on the outside of the pot didn’t need stripping, but the interior is once again a nice flat black surface and the next loaf should drop right out …

  • Tree Stump Removal

    Tree Stump Removal

    This makes writing 3D modeling code and turning threads look downright attractive:

    Tree stump - crater
    Tree stump – crater

    The previous owners apparently surrounded a cedar (?) tree with a ring of large, decorative rocks. The tree vanished long before we arrived, with the stump accreting random stones, bricks, and similar impedimenta ever since; my first task involved (re)moving a couple hundred pounds of rocky debris.

    After using the stump as a fulcrum for that steel bar to break the rotted roots and loosen the surrounding soil, it’s out and away:

    Tree stump - excavated
    Tree stump – excavated

    Back to the Basement Laboratory …

  • Screw Thread Measurement

    Screw Thread Measurement

    While I was cutting threads for the Floor Lamp poles, I tried measuring my progress over wires:

    Floor Lamp - tube fitting - thread measurement
    Floor Lamp – tube fitting – thread measurement

    Those are three lengths of music wire, slightly bent from their storage roll, held in place with a precision clamp metric micrometer. Given the crudity of the setup, the uncalibrated wire diameter, and my lack of thread-fu, the results came out both close and unconvincing.

    A set of real thread measuring wires being cheap & readily available, I’m prepared for the next time around this block:

    Thread Measuring Wires - eBay set
    Thread Measuring Wires – eBay set

    The 185 mil “wires” (they’re all allegedly ground rod) will let me cut threads matching things like a Jesus nut; they’re suited for 3 TPI / 8 mm pitch screws. Mostly, wires from the front row will be all I ever need.

    Which look like this in action:

    Thread Measuring Wires - eBay setThread Measuring Wires - detail
    Thread Measuring Wires – eBay setThread Measuring Wires – detail

    The black doodad (the set includes half a dozen for all the wire sizes) fits over the micrometer anvil and holds two wires betwixt anvil and screw, leaving me to manipulate the screw, the third wire, and the micrometer with my remaining hands. Hence the vise holding the micrometer, which is known to be Very Bad Practice.

    From the side:

    Thread Measuring Wires - overview
    Thread Measuring Wires – overview

    All of the smaller wires measure 0.5 mil too thin, which is likely due to my lack of calibrated measurement equipment:

    Thread Measuring Wires - scant 24 mil
    Thread Measuring Wires – scant 24 mil

    The few thread pitch diameters I measured also came out slightly too small, again likely due to calibration and screw tolerances.

    The LittleMachineShop description of measuring threads over wires seems entirely adequate.

    To forestall link rot, a slightly rearranged version of their tables of wire constants:

    Thread Wire Measurement Constants
    Thread Wire Measurement Constants

    The lower table has metric thread pitches with the wire sizes in inches.

    You measure the distance over the recommended wire (in inches or millimeters, as appropriate), subtract the constant, and get the pitch diameter in the same units. Conversely, add the constant to the desired pitch diameter to get the target over-wire distance, carefully cut the thread until it measures a bit less than that, back up sixty seconds, and cut it spot on.

    Verily, it is written: there is no UnDo key (⎌) in machine shop work.

  • PiHole with DNS-over-HTTP: Revised

    More than a year later, the PiHole continues to work fine, but the process for installing the Cloudflare DoH machinery has evolved.

    (And, yes, it’s supposed to be DNS-over-HTTPS. So it goes.)

    To forestall link rot, the key points:

    cd /tmp ;  wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz
    tar -xvzf cloudflared-stable-linux-arm.tgz 
    sudo cp cloudflared /usr/local/bin
    sudo chmod +x /usr/local/bin/cloudflared
    sudo cloudflared -v
    sudo useradd -s /usr/sbin/nologin -r -M cloudflared
    sudo nano /etc/default/cloudflared
    ----
    CLOUDFLARED_OPTS=--port 5053 --upstream https://1.1.1.1/dns-query --upstream https://1.0.0.1/dns-query 
    ----
    sudo chown cloudflared:cloudflared /etc/default/cloudflared
    sudo chown cloudflared:cloudflared /usr/local/bin/cloudflared
    sudo nano /etc/systemd/system/cloudflared.service
    ----
    [Unit]
    Description=cloudflared DNS over HTTPS proxy
    After=syslog.target network-online.target
    
    [Service]
    Type=simple
    User=cloudflared
    EnvironmentFile=/etc/default/cloudflared
    ExecStart=/usr/local/bin/cloudflared proxy-dns $CLOUDFLARED_OPTS
    Restart=on-failure
    RestartSec=10
    KillMode=process
    
    [Install]
    WantedBy=multi-user.target
    ----
    sudo systemctl enable cloudflared
    sudo systemctl start cloudflared
    sudo systemctl status cloudflared

    Then aim PiHole’s DNS at 127.0.0.1#5053. It used to be on port #54, for whatever that’s worth.

    Verify it at https://1.1.1.1/help, which should tell you DoH is in full effect.

    To update the daemon, which I probably won’t remember:

    wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz
    tar -xvzf cloudflared-stable-linux-arm.tgz
    sudo systemctl stop cloudflared
    sudo cp ./cloudflared /usr/local/bin
    sudo chmod +x /usr/local/bin/cloudflared
    sudo systemctl start cloudflared
    cloudflared -v
    sudo systemctl status cloudflared

    And then It Just Works … again!

  • Garden Hose Valve Wrench: Reinforced

    Garden Hose Valve Wrench: Reinforced

    After five gardening seasons, my simple 3D printed wrench broke:

    Hose Valve Knob - fractured
    Hose Valve Knob – fractured

    Although Jason’s comment suggesting carbon-fiber reinforcing rods didn’t prompt me to lay in a stock, ordinary music wire should serve the same purpose:

    Hose Valve Knob - cut pins
    Hose Valve Knob – cut pins

    The pins are 1.6 mm diameter and 20 mm long, chopped off with hardened diagonal cutters. Next time, I must (remember to) grind the ends flat.

    The solid model needs holes in appropriate spots:

    Hose Valve Knob - Reinforced - Slic3r
    Hose Valve Knob – Reinforced – Slic3r

    Yes, I’m going to put round pins in square holes, without drilling the holes to the proper diameter: no epoxy, no adhesive, just 20 mm of pure friction.

    The drill press aligns the pins:

    Hose Valve Knob - pin ready
    Hose Valve Knob – pin ready

    And rams them about halfway down:

    Hose Valve Knob - pin midway
    Hose Valve Knob – pin midway

    Close the chuck jaws and shove them flush with the surface:

    Hose Valve Knob - pins installed
    Hose Valve Knob – pins installed

    You can see the pins and their solid plastic shells through the wrench stem:

    Hose Valve Knob - assembled
    Hose Valve Knob – assembled

    Early testing shows the reinforced wrench works just as well as the previous version, even on some new valves sporting different handles, with an equally sloppy fit for all. No surprise: I just poked holes in the existing model and left all the other dimensions alone.

    The OpenSCAD source code as a GitHub Gist:

    // Hose connector knob
    // Ed Nisley KE4ZNU – June 2015
    // 2020-05 add reinforcing rods
    Layout = "Build"; // [Knob, Stem, Show, Build]
    RodHoles = true;
    //- Extrusion parameters – must match reality!
    /* [Hidden] */
    ThreadThick = 0.25;
    ThreadWidth = 0.40;
    function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
    Protrusion = 0.1;
    HoleWindage = 0.2;
    //——
    // Dimensions
    /* [Dimensions] */
    RodOD = 1.6;
    RodAngle = 35;
    /* [Hidden] */
    StemOD = 30.0; // max OD for valve-to-valve clearance
    BossOD = 16.0; // single-ended handle boss
    SlotWidth = 13.0;
    SlotHeight = 10.0;
    StemInset = 10.0;
    StemLength = StemInset + SlotHeight + 25.0;
    StemSides = 2*4;
    Align = 0*180/StemSides; // 1* produces thinner jaw ends
    KnobOD1 = 70; // maximum dia without chamfer
    KnobOD2 = 60; // top dia
    KnobSides = 4*4;
    DomeHeight = 12; // dome shape above lobes
    KnobHeight = DomeHeight + 2*SlotHeight;
    DomeOD = KnobOD2 + (KnobOD1 – KnobOD2)*(DomeHeight/KnobHeight);
    DomeArcRad = (pow(KnobHeight,2) + pow(DomeOD,2)/4) / (2*DomeHeight);
    RodBCD = (StemOD + BossOD)/2;
    //- Adjust hole diameter to make the size come out right
    module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
    Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
    FixDia = Dia / cos(180/Sides);
    cylinder(r=(FixDia + HoleWindage)/2,h=Height,$fn=Sides);
    }
    //– Stem for valve handles
    module Stem() {
    difference() {
    rotate(Align)
    cylinder(d=StemOD,h=StemLength,$fn=StemSides);
    translate([0,0,SlotHeight/2 – Protrusion/2])
    cube([2*StemOD,SlotWidth,(SlotHeight + Protrusion)],center=true);
    translate([0,0,-Protrusion])
    cylinder(d=BossOD,h=SlotHeight,$fn=2*StemSides);
    if (RodHoles)
    for (i=[-1:1])
    rotate(i*RodAngle + 90)
    for (j=[-1,1])
    translate([j*RodBCD/2,0,-Protrusion])
    rotate(180/4)
    PolyCyl(RodOD,2*SlotHeight,4);
    }
    }
    //– Hand-friendly knob
    module KnobCap() {
    difference() {
    scale([1.0,0.75,1.0])
    rotate(180/KnobSides)
    intersection() {
    translate([0,0,(KnobHeight-DomeArcRad)])
    sphere(r=DomeArcRad,$fa=180/KnobSides);
    cylinder(r1=KnobOD1/2,r2=KnobOD2/2,h=KnobHeight,$fn=KnobSides);
    cylinder(r1=KnobOD2/2,r2=KnobOD1/2,h=KnobHeight,$fn=KnobSides);
    }
    translate([0,0,-Protrusion])
    rotate(Align)
    cylinder(d=(StemOD + 2*ThreadWidth),h=(StemInset + Protrusion),$fn=StemSides);
    }
    }
    //- Build it
    if (Layout == "Knob")
    KnobCap();
    if (Layout == "Stem")
    Stem();
    if (Layout == "Build") {
    translate([-KnobOD1/2,0,0])
    KnobCap();
    translate([StemOD/2,0,StemLength])
    rotate([180,0,0])
    Stem();
    }
    if (Layout == "Show") {
    translate([0,0,0])
    Stem();
    translate([0,0,StemLength – StemInset])
    KnobCap();
    }