<commit_before>include <config.scad>
include <thing_libutils/metric-screw.scad>

module gantry_upper_connector()
{
    // how much bigger/smaller is the upper gantry (on each side)
    upper_gantry_width_diff  = (main_upper_width-main_width)/2;
    difference()
    {
        union()
        {
            hull()
            {
                // attach to z rod
                translate([zmotor_mount_rod_offset_x,0,0])
                {
                    cubea([gantry_connector_thickness, zmotor_mount_clamp_width, extrusion_size+gantry_connector_thickness], align=[-1,0,1]);
                }

                // connect upper gantry
                translate([upper_gantry_width_diff, 0, 0])
                    translate([0,0,extrusion_size/2])
                    cubea([gantry_connector_thickness,main_upper_dist_y+extrusion_size,extrusion_size], align=[1,0,0], extrasize=[0,0,gantry_connector_thickness], extrasize_align=[0,0,1]);
            }

            translate([upper_gantry_width_diff, 0, 0])
                translate([0,0,extrusion_size])
                cubea([extrusion_size*2,main_upper_dist_y+extrusion_size,gantry_connector_thickness], align=[-1,0,1]);

        }

        // cut out z rod mounting clamp nut traps and screw holes
        translate([zmotor_mount_rod_offset_x, 0, extrusion_size/2])
        for(i=[-1,1])
        {
            translate([-.1, i*zmotor_mount_clamp_dist/2, 0])
            {
                screw_cut(
                        nut=zmotor_mount_clamp_nut,
                        h=zmotor_mount_rod_offset_x-(extrusion_size*2),
                        orient=[-1,0,0],
                        align=[-1,0,0]
                        );
            }
        }

        translate([upper_gantry_width_diff/2, 0, extrusion_size+gantry_connector_thickness])
        for(x=[-1,1])
        for(y=[-1,1])
        {
            translate([x*extrusion_thread_dia*2, y*main_upper_dist_y/2, 0])
            {
                screw_cut(extrusion_nut, h=gantry_connector_thickness+.1, nut_offset=true, orient=[0,0,-1], align=[0,0,-1]);
            }
        }

        // cutout for z rod
        translate([zmotor_mount_rod_offset_x,0,extrusion_size])
        cylindera(d=zaxis_rod_d*1.01, h=extrusion_size*3, align=[0,0,0], orient=[0,0,1]);
    }
}

/*rotate([0,180,0])*/
/*zaxis_upper_gantry_zrod_connector();*/<commit_msg>gantry/upper: Add rounding<commit_after>include <config.scad>
include <thing_libutils/metric-screw.scad>

module gantry_upper_connector()
{
    // how much bigger/smaller is the upper gantry (on each side)
    upper_gantry_width_diff  = (main_upper_width-main_width)/2;
    difference()
    {
        union()
        {
            hull()
            {
                // attach to z rod
                translate([zmotor_mount_rod_offset_x,0,0])
                {
                    rcubea([gantry_connector_thickness, zmotor_mount_clamp_width, extrusion_size+gantry_connector_thickness], align=[-1,0,1]);
                }

                // connect upper gantry
                translate([upper_gantry_width_diff, 0, 0])
                    translate([0,0,extrusion_size/2])
                    rcubea([gantry_connector_thickness,main_upper_dist_y+extrusion_size,extrusion_size], align=[1,0,0], extrasize=[0,0,gantry_connector_thickness], extrasize_align=[0,0,1]);
            }

            translate([upper_gantry_width_diff, 0, 0])
                translate([0,0,extrusion_size])
                rcubea([extrusion_size*2,main_upper_dist_y+extrusion_size,gantry_connector_thickness], align=[-1,0,1], extrasize=[gantry_connector_thickness,0,0], extrasize_align=[1,0,0]);

        }

        // cut out z rod mounting clamp nut traps and screw holes
        translate([zmotor_mount_rod_offset_x, 0, extrusion_size/2])
        for(i=[-1,1])
        {
            translate([-.1, i*zmotor_mount_clamp_dist/2, 0])
            {
                screw_cut(
                        nut=zmotor_mount_clamp_nut,
                        h=zmotor_mount_rod_offset_x-(extrusion_size*2),
                        orient=[-1,0,0],
                        align=[-1,0,0]
                        );
            }
        }

        translate([upper_gantry_width_diff/2, 0, extrusion_size+gantry_connector_thickness])
        for(x=[-1,1])
        for(y=[-1,1])
        {
            translate([x*extrusion_thread_dia*2, y*main_upper_dist_y/2, 0])
            {
                screw_cut(extrusion_nut, h=gantry_connector_thickness+.1, nut_offset=true, orient=[0,0,-1], align=[0,0,-1]);
            }
        }

        // cutout for z rod
        translate([zmotor_mount_rod_offset_x,0,extrusion_size])
        cylindera(d=zaxis_rod_d*1.01, h=extrusion_size*3, align=[0,0,0], orient=[0,0,1]);
    }
}

/*rotate([0,180,0])*/
/*gantry_upper_connector();*/
{'fraction_non_alphanumeric': 0.12396006655574043, 'fraction_numerical': 0.031405990016638935, 'mean_word_length': 2.090616966580977, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5495812', 'n_tokens_mistral': 1677, 'n_tokens_neox': 1584, 'n_words': 191}