discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: making hexagonal holes into a polyhedron.....

RW
Roger Whiteley
Mon, Dec 18, 2023 4:09 PM

Here are a few hexagon module I use frequently to make tapered sockets
for nuts [so they tighten up as they are pulled in], and hexagonal holes
with a chamfer in the outer wall.

These might help creating objects with a little stacking and difference
for each layer.

HTH

Roger.

// hex_socket - parameters:
    //size of nut af without print allowance  (pa),
    //height or size of lead in chamfer e.g. 1 [mm]
    //height or depth of socket - socket tapers from hex_af + pa*3 to
hex_af -pa
  //stack chamfer with hex taper,  lead in chamfer uses lead in z to
determine
  //height of incoming taper.  Hex_taper uses size inflated by print
allowance
  //which is the same as the lead in chamfer finishing size, smallest
part of hex_taper
  //is the hex size with pa deducted rather than added.

module hex_socket (hex_af,lead_in_z,hex_socket_z) {
    hex_chamfer (hex_af,lead_in_z);
    translate ([0,0,lead_in_z-0.1]) hex_taper (hex_af,hex_socket_z);
}

module hex_chamfer (hex_af,lead_in_z) {
    af_size = hex_af+2lead_in_z;
    af_size2 = hex_af+pa
2;//same as af_size in module hex_taper, see
below.

    hull () {
    cylinder(d=af_size2/sqrt(3),h=0.01,$fn=hex_nut);
    translate ([0,0,lead_in_z])
        cylinder(d=af_size2
2/sqrt(3),h=0.01,$fn=hex_nut);
    }//end hull

}//end  module

module hex_taper (hex_af,hex_taper_z){
    af_size = hex_af+pa*2;
    af_size2 = hex_af-pa;

    hull () {
    cylinder(d=af_size2/sqrt(3),h=0.01,$fn=hex_nut);
    translate ([0,0,hex_taper_z])
        cylinder(d=af_size2
2/sqrt(3),h=0.01,$fn=hex_nut);
    }//end hull

}//end module

module make_chamfered_hex (hex_af,hex_z,hex_cham) {
    hex_nut = 6;
    hex_af_cham = hex_af-2hex_cham;
    hull () {
    translate ([0,0,0])
cylinder(d=hex_af_cham
2/sqrt(3),h=hex_z,$fn=hex_nut);
    translate ([0,0,hex_cham])
cylinder(d=hex_af2/sqrt(3),h=hex_z-2hex_cham,$fn=hex_nut);
    }//end hull

}//end module

A chamfered hexagon hole cutter

Here are a few hexagon module I use frequently to make tapered sockets for nuts [so they tighten up as they are pulled in], and hexagonal holes with a chamfer in the outer wall. These might help creating objects with a little stacking and difference for each layer. HTH Roger. // hex_socket - parameters:     //size of nut af without print allowance  (pa),     //height or size of lead in chamfer e.g. 1 [mm]     //height or depth of socket - socket tapers from hex_af + pa*3 to hex_af -pa   //stack chamfer with hex taper,  lead in chamfer uses lead in z to determine   //height of incoming taper.  Hex_taper uses size inflated by print allowance   //which is the same as the lead in chamfer finishing size, smallest part of hex_taper   //is the hex size with pa deducted rather than added. module hex_socket (hex_af,lead_in_z,hex_socket_z) {     hex_chamfer (hex_af,lead_in_z);     translate ([0,0,lead_in_z-0.1]) hex_taper (hex_af,hex_socket_z); } module hex_chamfer (hex_af,lead_in_z) {     af_size = hex_af+2*lead_in_z;     af_size2 = hex_af+pa*2;//same as af_size in module hex_taper, see below.     hull () {     cylinder(d=af_size*2/sqrt(3),h=0.01,$fn=hex_nut);     translate ([0,0,lead_in_z])         cylinder(d=af_size2*2/sqrt(3),h=0.01,$fn=hex_nut);     }//end hull }//end  module module hex_taper (hex_af,hex_taper_z){     af_size = hex_af+pa*2;     af_size2 = hex_af-pa;     hull () {     cylinder(d=af_size*2/sqrt(3),h=0.01,$fn=hex_nut);     translate ([0,0,hex_taper_z])         cylinder(d=af_size2*2/sqrt(3),h=0.01,$fn=hex_nut);     }//end hull }//end module module make_chamfered_hex (hex_af,hex_z,hex_cham) {     hex_nut = 6;     hex_af_cham = hex_af-2*hex_cham;     hull () {     translate ([0,0,0]) cylinder(d=hex_af_cham*2/sqrt(3),h=hex_z,$fn=hex_nut);     translate ([0,0,hex_cham]) cylinder(d=hex_af*2/sqrt(3),h=hex_z-2*hex_cham,$fn=hex_nut);     }//end hull }//end module A chamfered hexagon hole cutter