Skip to content

Reusable cutouts #95

Description

@vladoATL

I'm looking for a solution to reuse my custom cutout. I need this to position the holes for the electronic connectors that are bolted on. This code generates such a cutout, however I don't know how to place it in the template.

//  Parameters:
//   Required:
//    p(0) = connector opening diameter
//    p(1) = horizontal distance between two screw openings
//    p(3) = wall thickness 
//   Optional:
//    p(4) =  count of screw openings arround connector <4>
module connector_w_screws( hole_dm, screw_dist, screw_dm, wall_thickness , screws_cnt = 4) {
    wall_thickness = wall_thickness + .01;
	translate([-(2*screw_dm + screw_dist)/2,-(2*screw_dm + screw_dist)/2,-wall_thickness  / 2 ])
    {
        difference() {
            plate_l = screw_dm + screw_dist ;
            cube( [plate_l,  plate_l, wall_thickness  ]);   // base plate   
            
            translate( [plate_l/2, plate_l/2, -0.01] )                 
            cylinder( d = hole_dm, h = wall_thickness  + 0.02); // connector opening
           
            trans_screw = [
                [screw_dm/2, screw_dm/2, -.01], 
                [screw_dm/2 + screw_dist, screw_dm/2 + screw_dist, -.01], 
                [screw_dm/2 + screw_dist, screw_dm/2, -0.01], 
                [screw_dm/2, screw_dm/2 + screw_dist, -0.01]
            ];
            // screws openings:
            for (i=[0:screws_cnt-1])
            {
                translate(trans_screw[i] )
                cylinder( d = screw_dm, h = wall_thickness  + .02);
            }         
        }
    }
}
connector_w_screws( 24, 26, 4, 1.8);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions