Below is the file 'scad/Pixel-screw.scad' from this revision. You can also download the file.

include <MCAD/screw.scad>

screw_length = 12;
shaft1_length = 5;
shaft2_length = 5;
screw_inner_radius = 1;
shaft1_radius = 3;
shaft2_radius = 2;
screw_radius = 20;
screw_pitch = 60;
fins = 6;
taper = 1;
groove_fraction = 0.85;
groove_width = 2;
groove_depth = 0; //0.5;
groove_taper_ratio = 0.3;

screw_travel_in = 10;
screw_travel_out = 10;

leadscrew_pitch = 60;
leadscrew_length = 30;
leadscrew_width = 2.5;
leadscrew_inner = 5;
leadscrew_outer = 7.5;
leadscrew_endcap = 2;
leadscrew_spacer = 5; // aka cone
leadscrew_starts = 4;
leadscrew_start = screw_length+leadscrew_spacer+shaft1_length;

leadscrew_width_shrink = 1;
leadscrew_inner_shrink = 0.5;
leadscrew_outer_shrink = 1;

clearance = 1;
shaft_clearance = 0.8;
body_thickness = 1;

// Overlap between the guide and the body
guide_depth = 2;

//body_length = 26;
//body_length = 30; // shaft_length+screw_length;
body_length = screw_length + screw_travel_in + shaft1_length + leadscrew_spacer + guide_depth;
body_inner_radius = screw_radius + clearance;
body_outer_radius = body_inner_radius + body_thickness;

pipe_inner_radius = 1;
pipe_hole_radius = 4;
hole_taper = 1;

body_screw_length = screw_pitch/fins;

slot_width = 1;
slot_start = shaft2_length - 3;

insert_height_inner = 4;
insert_height_outer = 6;
insert_width = 2;
insert_clearance = 0.1;
insert_block_thickness = 2 + insert_clearance;
insert_length = 20; // body_length - guide_depth;

guide_lid_depth = 2;
guide_radius = 5/2;
guide_clearance = 0; // 0.1;
guide_extra = 6;
guide_middle_radius = 8;
guide_notch_width = 4;
guide_notch_depth = 2;

guide_start_position = body_length - guide_depth;
guide_rotation = 360 * (guide_start_position - leadscrew_start) / leadscrew_pitch;

support_width = 8;
support_height = 4;
//support_length = 40;
support_radius = 14;
support_position = support_radius + support_height/2 + 1;

support_top_width = 4;
support_top_length = 5;

support_clearance = 0; //0.1;

driver_inner_radius = guide_radius;
driver_outer_radius = driver_inner_radius+guide_extra;
driver_slot_clearance = 0.5;
driver_slot_length = 25;
driver_end_cap = 2; // Later this will be an attachment for a servo horn

motor_x = 12;
motor_y = 22.5;
motor_mount_depth = 5;
motor_x_thickness = 2;
motor_y_thickness = 2;
motor_screw_diameter = 1.5;
motor_screw_housing = 3;
motor_screw_position = 14;
motor_shaft_position = 6 - motor_y/2;

motor_to_horn_end = 13;
motor_mount_to_horn_end = motor_to_horn_end - motor_mount_depth;

support_spare = 1;
shaft2_overlap = 2;
nails_length = 10;
horn_shaft_length = 5;
horn_shaft_overlap = 2;
horn_thickness = 2.5;

support_length = leadscrew_length + shaft2_length - shaft2_overlap + nails_length + horn_shaft_length - horn_shaft_overlap + horn_thickness + motor_mount_to_horn_end + support_spare;

delta = 0.1;

debug_travel = 0;

render_screw = 1;
render_pipe_screw = 0;
render_guide = 0;
render_motor_mount = 0;

// These are obsolete
render_pipe = 0;
render_pipe_alternate = 0;
render_driver = 0;

translate_guide = render_pipe_screw?(guide_start_position):0;
translate_motor_mount = render_guide?(translate_guide+support_length+guide_depth+guide_lid_depth):0;

rotate([0, 0, -360*debug_travel/leadscrew_pitch])
translate([0, 0, debug_travel])
if (render_screw) {
    // Visible screw
    augers(screw_pitch, screw_length, screw_radius, screw_inner_radius, taper, groove_fraction, groove_width, groove_depth, 0, groove_taper_ratio, fins);

    // shaft 1
    translate([0, 0, screw_length])
        translate([0, 0, -delta])
            cylinder(h=shaft1_length+2*delta, r=shaft1_radius, $fn=36);
    
    // shaft 2
    translate([0, 0, screw_length+shaft1_length+leadscrew_spacer+leadscrew_length])
    difference() {
        translate([0, 0, -delta])
            cylinder(h=shaft2_length+delta, r=shaft2_radius, $fn=36);
        translate([-shaft2_radius*1.5, -slot_width/2, slot_start])
            cube([shaft2_radius*3,slot_width, shaft2_length-slot_start+delta]);
    }
    
    // cone
    translate([0, 0, screw_length+shaft1_length])
        cylinder(h=leadscrew_spacer, r1=shaft1_radius, r2=sqrt(leadscrew_outer*leadscrew_outer + leadscrew_width*leadscrew_width), $fn=36);
    
    // leadscrew
    translate([0, 0, leadscrew_start])
    difference() {
        leadscrew(leadscrew_pitch, leadscrew_length, leadscrew_outer, leadscrew_width, leadscrew_inner, leadscrew_starts);
        translate([0, 0, -leadscrew_pitch])
        intersection() {
            leadscrew(leadscrew_pitch, leadscrew_length+2*leadscrew_pitch, leadscrew_outer-leadscrew_outer_shrink, leadscrew_width-leadscrew_width_shrink, leadscrew_inner-leadscrew_inner_shrink, leadscrew_starts);
            translate([0, 0, 0])
                cylinder(h=leadscrew_length-leadscrew_endcap, r=leadscrew_outer*2);
        }
    }
}

/* width is doubled within this module */
module leadscrew(pitch, length, outer, width, inner, n=4)
{
    augers(pitch, length, outer, width, 1, n=n);
    cylinder(h=length, r=inner);
}

module augers(pitch, length, outside_radius, inner_radius, taper_ratio = 0.25, ,groove_fraction = 0, groove_width = 0, groove1_depth = 0, groove2_depth = 0, groove_taper_ratio = 1, n = 1)
{
    for (i = [0:n-1]) {
        rotate([0, 0, i*360/n]) auger_plus(pitch, length, outside_radius, inner_radius, taper_ratio, groove_fraction, groove_width, groove1_depth, groove2_depth, groove_taper_ratio);
    }
}

module auger_plus(pitch, length, outside_radius, inner_radius, taper_ratio = 0.25, groove_fraction = 0, groove_width = 0, groove1_depth = 0, groove2_depth = 0, groove_taper_ratio = 1) {
    groove_radius = groove_fraction*(outside_radius-inner_radius) + inner_radius;
    groove_inner_radius = max(0, groove_radius - groove_width/2);
    groove_outer_radius = min(outside_radius, groove_radius + groove_width/2);
    groove_taper = (groove_outer_radius - groove_inner_radius) * (1- groove_taper_ratio) / 2;
    groove_mid_inner_radius = groove_inner_radius + groove_taper;
    groove_mid_outer_radius = groove_outer_radius - groove_taper;
    union(){
        helix(pitch, length)
        polygon(points=[
            [0,inner_radius],
            [groove_inner_radius, inner_radius * (1 + groove_inner_radius * (taper_ratio - 1) / outside_radius)],
            [groove_mid_inner_radius, inner_radius * (1 + groove_mid_inner_radius * (taper_ratio - 1) / outside_radius) + groove1_depth],
            [groove_mid_outer_radius, inner_radius * (1 + groove_mid_outer_radius * (taper_ratio - 1) / outside_radius) + groove1_depth],
            [groove_outer_radius, inner_radius * (1 + groove_outer_radius * (taper_ratio - 1) / outside_radius)],
            [outside_radius,(inner_radius * taper_ratio)],
            [outside_radius,(inner_radius * -1 * taper_ratio)],
            [groove_outer_radius, -inner_radius * (1 + groove_outer_radius * (taper_ratio - 1) / outside_radius)],
            [groove_mid_outer_radius, -inner_radius * (1 + groove_mid_outer_radius * (taper_ratio - 1) / outside_radius) - groove2_depth],
            [groove_mid_inner_radius, -inner_radius * (1 + groove_mid_inner_radius * (taper_ratio - 1) / outside_radius) - groove2_depth],
            [groove_inner_radius, -inner_radius * (1 + groove_inner_radius * (taper_ratio - 1) / outside_radius)],
            [0,(-1 * inner_radius)]],
                paths=[[0,1,2,3,4,5,6,7,8,9,10,11]]);
        cylinder(h=length, r=inner_radius);
    }
}

if (render_pipe) {
translate([render_screw?50:0, 0, 0])
    difference() {
        cylinder(h=body_length, r=body_outer_radius);
        translate([0, 0, body_screw_length]) cylinder(h=body_length - body_screw_length + delta, r=body_inner_radius);
        translate([0, 0, -delta]) augers(screw_pitch, body_screw_length+2*delta, screw_radius+clearance, screw_inner_radius+shaft_clearance, hole_taper, groove_fraction, groove_width, 0, -groove_depth, groove_taper_ratio, fins);
    }
}

if (render_pipe_alternate) {
translate([render_screw?50:0, 0, 0])
    scale([1.1,1.1,1])
    difference() {
        cylinder(h=body_length, r=body_outer_radius);
        translate([0, 0, body_screw_length]) cylinder(h=body_length - body_screw_length + delta, r=body_inner_radius);
        translate([0, 0, -delta]) augers(screw_pitch, body_screw_length+2*delta, screw_radius, screw_inner_radius, hole_taper, groove_fraction, groove_width, 0, -groove_depth, groove_taper_ratio, fins);
    }
}

module matrix_insert(c = 0) {
    translate([0, 0, -c])
    linear_extrude(height=insert_length+2*c) {
        polygon(points=[
            [body_outer_radius, insert_height_inner/2+c],
            [body_outer_radius+insert_width+2*c, insert_height_outer/2+c],
            [body_outer_radius+insert_width+2*c, -insert_height_outer/2-c],
            [body_outer_radius, -insert_height_inner/2-c]
        ]);
    }
    translate([body_outer_radius, 0, insert_length/2])
    cube([2*body_thickness, insert_height_inner+2*c, insert_length], center=true);
}

module matrix_block() {
    difference() {
        translate([-body_inner_radius-insert_width-body_thickness-2*insert_clearance, -insert_height_outer/2-insert_block_thickness])
        cube([body_thickness+insert_width+2*insert_clearance, insert_height_outer+2*insert_block_thickness, insert_length]);
        translate([-2*body_outer_radius-insert_width-2*insert_clearance, 0, 0])
            matrix_insert(insert_clearance);
    }
}

if (render_pipe_screw) {
    difference() {
        rotate([0, 0, -180/fins])
            augers(screw_pitch, body_screw_length, screw_radius+clearance, pipe_inner_radius, hole_taper, groove_fraction, groove_width, 0, -groove_depth, groove_taper_ratio, fins);
        translate([0, 0, -delta])
            cylinder(h=body_length + 2*delta, r=pipe_hole_radius);
        translate([0, 0, -delta]) augers(screw_pitch, body_screw_length+2*delta, screw_radius+clearance, screw_inner_radius+shaft_clearance, hole_taper, groove_fraction, groove_width, 0, -groove_depth, groove_taper_ratio, fins);

    }
    difference() {
        cylinder(h=body_length, r=body_outer_radius);
        translate([0, 0, -delta])
            cylinder(h=body_length + 2*delta, r=body_inner_radius);
        translate([0, 0, body_length-guide_notch_depth/2])
            cube([body_outer_radius*3, guide_notch_width+guide_clearance, guide_notch_depth+delta], center=true);
        translate([0, 0, body_length-guide_notch_depth/2])
            cube([guide_notch_width+guide_clearance, body_outer_radius*3, guide_notch_depth+delta], center=true);
    }
    matrix_insert();
    rotate([0, 0, 90]) matrix_insert();
    matrix_block();
    rotate([0, 0, 90]) matrix_block();
}

if (render_guide) {
translate([0, 0, translate_guide]) {
    difference() {
        union() {
            // Bottom plate
            cylinder(h=guide_depth+delta, r=body_inner_radius-guide_clearance);
            
            // Lugs
            intersection() {
                cylinder(h=guide_depth+delta, r=body_outer_radius);
                union() {
                    translate([0, 0, guide_notch_depth/2])
                        cube([body_outer_radius*3, guide_notch_width, guide_notch_depth+delta], center=true);
                    translate([0, 0, guide_notch_depth/2])
                        cube([guide_notch_width, body_outer_radius*3, guide_notch_depth+delta], center=true);
                }
            }

            // Top plate
            translate([0, 0, guide_depth])
                cylinder(h=guide_lid_depth, r=body_outer_radius);
            
            // Screw casing
            translate([0, 0, guide_depth + guide_lid_depth - delta])
                cylinder(h=guide_extra + delta, r=guide_middle_radius);
        }
        
        // Hole
        //translate([0, 0, -delta])
        //    cylinder(h=guide_depth+guide_lid_depth+guide_extra+2*delta, r=guide_radius, $fn=36);
        scale([1.1, 1.1, 1])
        translate([0, 0, -leadscrew_pitch])
        rotate([0, 0, -guide_rotation])
        leadscrew(leadscrew_pitch, leadscrew_length+leadscrew_pitch*2, leadscrew_outer, leadscrew_width, leadscrew_inner, leadscrew_starts);
    }
    
    // Support
    translate([0, -support_position, guide_depth + guide_lid_depth]) {
        translate([0, 0, support_length/2+delta/2])
            cube([support_width, support_height, support_length+delta], center=true);
        translate([0, 0, support_length+support_top_length/2-delta/2])
            cube([support_top_width, support_height, support_top_length+delta], center=true);
    }
}
}

if (render_driver) {
    difference() {
        cylinder(h = driver_slot_length + driver_end_cap, r=driver_outer_radius, $fn=36);
        translate([0, 0, driver_end_cap])
            cylinder(h = driver_slot_length + delta, r=driver_inner_radius, $fn=36);
    }
    cubex = (driver_inner_radius+driver_outer_radius);
    cubey = slot_width - driver_slot_clearance;
    translate([-cubex/2, -cubey/2, driver_end_cap-delta])
        cube([cubex, cubey, driver_slot_length+delta]);
}

translate([0, 0, translate_motor_mount])
if (render_motor_mount) {
    translate([0, -motor_shaft_position, motor_mount_depth/2]) {
        difference() {
            union() {
                cube([motor_x + 2*motor_x_thickness, motor_y + 2*motor_y_thickness, motor_mount_depth], center=true);
                translate([0, motor_screw_position, 0])
                    cylinder(h=motor_mount_depth, d=motor_screw_housing, $fn=36, center=true);
                translate([0, -motor_screw_position, 0])
                    cylinder(h=motor_mount_depth, d=motor_screw_housing, $fn=36, center=true);
                translate([0, (motor_screw_position + motor_y/2 + delta)/2, 0])
                cube([motor_screw_housing, motor_screw_position - motor_y/2 - delta, motor_mount_depth], center=true);
                translate([0, -(motor_screw_position + motor_y/2 + delta)/2, 0])
                cube([motor_screw_housing, motor_screw_position - motor_y/2 - delta, motor_mount_depth], center=true);
                support_extra = (support_width - support_top_width)/2;
                cube_len = support_extra+support_position+support_height/2-motor_shaft_position-motor_y/2-motor_y_thickness+delta;
                translate([0, -cube_len/2 - motor_y/2 - motor_y_thickness + delta/2, 0])
                cube([support_width, cube_len, motor_mount_depth], center=true);
            }
            cube([motor_x, motor_y, motor_mount_depth+2*delta], center=true);
            translate([0, motor_screw_position, 0])
                cylinder(h=motor_mount_depth+2*delta, d=motor_screw_diameter, $fn=36, center=true);
            translate([0, -motor_screw_position, 0])
                cylinder(h=motor_mount_depth+2*delta, d=motor_screw_diameter, $fn=36, center=true);
            translate([0, motor_shaft_position-support_position, 0])
                cube([support_top_width+2*support_clearance, support_height+2*support_clearance, motor_mount_depth+2*delta], center=true);
        }
    }
}