Commit db5056cc authored by William Wadsworth's avatar William Wadsworth
Browse files

bowed leg cut ladder ties

Set up to be able to show cut ties for manual bowed leg microscope
parent 30475280
Loading
Loading
Loading
Loading
+117 −35
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ module leg_flexures(params, brace){
module leg(params, brace=flex_dims().x){
    // The legs support the stage - this is either used directly
    // or via "actuator" to make the legs with levers
    
    fw=flex_dims().x;

    union(){
@@ -88,20 +89,67 @@ module leg(params, brace=flex_dims().x){
            }
        }
        leg_flexures(params, brace);
    }
}

module leg_ladder_ties(params){
    //thin links between legs
    flex_sep = upper_xy_flex_z(params)-lower_xy_flex_z();
    n = floor(flex_sep/leg_link_spacing());
    leg_inner_w = leg_outer_w(params) - 2 * leg_dims(params).x;
    if(n > 2){
        // adjust spacing so it is even
        link_space_adj = flex_sep/n;
        translate([0, leg_dims(params).y/2, lower_xy_flex_z()+link_space_adj]){
            repeat([0, 0, link_space_adj], n-1){
                    cube([leg_outer_w(params), 2, 0.5],center=true);
                cube([leg_inner_w + tiny(), 2, 0.5],center=true);
            }
        }
    }
}

module all_leg_ladder_ties(params, ties_only=false){
    // thin links between all four legs
    ties = key_lookup("print_ties", params);
    manual = ! (key_lookup("include_motor_lugs", params));

    flex_sep = upper_xy_flex_z(params)-lower_xy_flex_z();
    n = floor(flex_sep/leg_link_spacing());
    h = (n-2.5) * flex_sep/n;

    if (! ties_only){
        difference(){
            each_leg(params){
                leg_ladder_ties(params);
            }
            if (!ties && manual){
                translate([-999/2, -999, h]){
                    cube([999,999,999], center=false);
                }
            }
            if (manual){
                difference(){
                    c270_main_body_leg_cutout(params);
                    translate_x(-999/2){
                        cube([999,999,999], center=false);
                    }
                }
            }
        }
    }
    else if (manual){
        difference(){
            intersection(){
                each_front_leg(params){
                    leg_ladder_ties(params);
                }
                translate_z(h + 999/2){
                    cube([999,999,999], center=true);
                }
            }
            c270_main_body_leg_cutout(params);
        }
    }
}

/* A chamfer to be cut from the actuator legs using difference()
@@ -390,37 +438,61 @@ module xy_screw_seat(params, label=""){
               label=label);
}

module xy_legs_and_actuators(params){
    // This is the xy_actuators including the casing and all 4 legs
function c270_cutout_params(params) = let(
    leg_width = leg_outer_w(params),
    leg_r = key_lookup("leg_r", params),
    leg_a = atan((leg_width/2) / leg_r), // angle subtended by the leg
    leg_side_r = sqrt(leg_r^2 + (leg_width/2)^2),
    leg_sep = 2 * leg_side_r * sin(45-leg_a),

    // calculations for making a space for the c270 camera between the legs
    leg_width = leg_outer_w(params);
    leg_r = key_lookup("leg_r", params);
    leg_a = atan((leg_width/2) / leg_r); // angle subtended by the leg
    leg_side_r = sqrt(leg_r^2 + (leg_width/2)^2);
    leg_sep = 2 * leg_side_r * sin(45-leg_a);

    nominal_travel = upper_xy_flex_z(params) * flex_a();
    clearance = 0.5;
    c270_lens_spacer_body_width = c270_dims().x + 1.5;
    c270_oversize = c270_lens_spacer_body_width + (nominal_travel + clearance)*2;
    cut_depth = (c270_oversize - leg_sep)/2;
    nominal_travel = upper_xy_flex_z(params) * flex_a(),
    clearance = 0.5,
    c270_lens_spacer_body_width = c270_dims().x + 1.5,
    c270_oversize = c270_lens_spacer_body_width + (nominal_travel + clearance)*2,
    cut_depth = (c270_oversize - leg_sep)/2,
    // The strengthening part should move by the leg thickness, in the x-direction
    cut_xy = leg_dims(params).x * sin(45);
    c270_z_space = 22;
    c270_mid_z = (upper_xy_flex_z(params) - 1) - (c270_z_space + 4)/2;
    cut_round = 2; // c270 cover rounding radius

    manual = !(key_lookup("include_motor_lugs", params));

    // back legs - furthest from actuators
    difference(){
    cut_xy = leg_dims(params).x * sin(45),
    c270_z_space = 22,
    c270_mid_z = (upper_xy_flex_z(params) - 1) - (c270_z_space + 4)/2,
    cut_round = 2, 
    dict = [
            ["leg_sep", leg_sep],
            ["c270_oversize", c270_oversize],
            ["cut_depth", cut_depth],
            ["cut_xy", cut_xy],
            ["c270_z_space", c270_z_space], // vertical height alloed for c270
            ["c270_mid_z", c270_mid_z],
            ["rounding", 2] // c270 cover rounding radius
            ]
) dict;

module c270_main_body_leg_cutout(params){
    leg_sep = key_lookup("leg_sep", c270_cutout_params(params));
    cut_round = key_lookup("rounding", c270_cutout_params(params));
    c270_oversize = key_lookup("c270_oversize", c270_cutout_params(params));
    c270_z_space = key_lookup("c270_z_space", c270_cutout_params(params));
    cut_depth= key_lookup("cut_depth", c270_cutout_params(params));
    c270_mid_z = key_lookup("c270_mid_z", c270_cutout_params(params));
    translate_z(c270_mid_z){
        rounded_cube([c270_oversize, 99, c270_z_space], cut_round, center=true);
        reflect_x(){
            leg_frame(params, 135){
                leg(params);
            translate([-(leg_sep/2 + (cut_depth - cut_round)), 0, c270_z_space/2 - cut_round]){
                tangent_to_cylinder_plus(r=cut_round, angle=30, box=10);
            }
            if (manual){
                // bulge the legs to strengthen when cut for the c270 camera
        }
    }
}

module c270_main_body_leg_bulge(params){
    leg_r = key_lookup("leg_r", params);
    leg_width = leg_outer_w(params);
    // leg_sep = key_lookup("leg_sep", c270_cutout_params(params));
    cut_round = key_lookup("rounding", c270_cutout_params(params));
    c270_oversize = key_lookup("c270_oversize", c270_cutout_params(params));
    c270_z_space = key_lookup("c270_z_space", c270_cutout_params(params));
    // cut_depth= key_lookup("cut_depth", c270_cutout_params(params));
    cut_xy = key_lookup("cut_xy", c270_cutout_params(params));
    c270_mid_z = key_lookup("c270_mid_z", c270_cutout_params(params));
    translate([-cut_xy,cut_xy,0]){
        intersection(){
            leg_frame(params, 135){
@@ -453,17 +525,26 @@ module xy_legs_and_actuators(params){
        }
    }
}
        }
        if (manual){
            // make space for the c270 camera
            translate_z(c270_mid_z){
                rounded_cube([c270_oversize, 99, c270_z_space], cut_round, center=true);

module xy_legs_and_actuators(params){
    // This is the xy_actuators including the casing and all 4 legs

    manual = !(key_lookup("include_motor_lugs", params));

    // back legs - furthest from actuators
    difference(){
        reflect_x(){
                    translate([-(leg_sep/2 + (cut_depth - cut_round)), 0, c270_z_space/2 - cut_round]){
                        tangent_to_cylinder_plus(r=cut_round, angle=30, box=10);
            leg_frame(params, 135){
                leg(params);
            }
            if (manual){
                // bulge the legs to strengthen when cut for the c270 camera
                c270_main_body_leg_bulge(default_params());
            }
        }
        if (manual){
            // make space for the c270 camera
            c270_main_body_leg_cutout(default_params());
        }
    }
    //actuator columns and front legs - next to actuators
@@ -575,6 +656,7 @@ module xy_positioning_system(params){
    // This module creates the main XY positioning mechanism. Including the actuator columns.
    ties = key_lookup("print_ties", params);
    xy_legs_and_actuators(params);
    all_leg_ladder_ties(params);
    internal_xy_structure(params);
    xy_stage_with_nut_traps(params);

+9 −0
Original line number Diff line number Diff line
@@ -50,6 +50,15 @@ module each_leg(params){
    }
}

module each_front_leg(params){
    // Repeat for each of the front legs of the stage - furthest from the actuators
    for(angle=[135,-135]){
        leg_frame(params, angle){
            children();
        }
    }
}

module each_actuator(params){
    // Repeat this for both of the actuated legs (the ones with levers)
    reflect_x(){
+1 −0
Original line number Diff line number Diff line
@@ -338,6 +338,7 @@ def register_brim_and_ties(rendersystem):
        Camera(position=[9.7, 33, 6], angle=[45.2, 0, 315.2], distance=361),
        Camera(position=[-4, 21, 29], angle=[206, 0, 177], distance=450),
        Camera(position=[-2, 48, -12], angle=[60, 0, 4], distance=320),
        Camera(position=[-2, 48, -12], angle=[60, 0, 4], distance=320),
    ]
    imgsize = [2400, 2400]
    for manual in ["false", "true"]:
+15 −3
Original line number Diff line number Diff line
use <../openscad/libs/main_body_structure.scad>
use <../openscad/libs/main_body_transforms.scad>
use <../openscad/libs/z_axis.scad>
use <../openscad/libs/utilities.scad>
use <../openscad/libs/libdict.scad>
@@ -29,15 +30,26 @@ module render_brim_and_ties(frame, manual=false){
            }
        }
    }
    color((frame==3)? remove_colour() : body_colour()){
        xy_leg_ties(params);
    }
    if (frame < 3){
        color((frame==2)? remove_colour() : body_colour()){
            xy_actuators(params, ties_only=true);
        }
        color((frame==2)? remove_colour() : body_colour()){
            z_actuator_column(params, ties_only=true);
        }
    }
    if (frame < 4){
        color((frame==3)? remove_colour() : body_colour()){
            xy_leg_ties(params);
        }
    }
    if (frame < 5){
        if (manual){
            color((frame==4)? remove_colour() : body_colour()){
                all_leg_ladder_ties(params, ties_only=true);
            }
        }
    }
    color(body_colour()){
        render(6){
            rendered_main_body(manual=manual);