Last active
July 19, 2016 17:56
-
-
Save gbrown128/3911b25f8d1acc2c58fdc1af70cf29c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thickness=2; //Object setup. | |
resolution=40; | |
outer_rad=3.5; //Outline Dimentions | |
max_width=50; | |
min_width=30; | |
total_length=65; | |
cutout_rad=3.5; //Cutout Dimentions | |
cutout_width=28; | |
cutout_length=20.5; | |
screw_size=3.2; //Diameter of screw holes. | |
screw_spacing=40; | |
fuse_size=12.5; //Diameter of fuse holder | |
fuse_position=[0,(total_length-cutout_length)/2,0]; | |
//Outer hexagon positions calculations, A is top left, continues clockwise. | |
posA=[(min_width-(outer_rad))/2,(total_length/2)-outer_rad,0]; | |
posB=[-(min_width-(outer_rad))/2,(total_length/2)-outer_rad,0]; | |
posC=[(max_width/2)-outer_rad,0,0]; | |
posD=[(min_width-(outer_rad))/2,-((total_length/2)-outer_rad),0]; | |
posE=[-(min_width-(outer_rad))/2,-((total_length/2)-outer_rad),0]; | |
posF=[-((max_width/2)-outer_rad),0,0]; | |
//Inner IEC cutout calculations. | |
posS=[(cutout_width/2)-cutout_rad,(cutout_length/2)-cutout_rad,0]; | |
posT=[(cutout_width/2)-cutout_rad,-((cutout_length/2)-cutout_rad),0]; | |
posU=[-((cutout_width/2)-cutout_rad),-((cutout_length/2)-cutout_rad),0]; | |
posV=[-((cutout_width/2)-cutout_rad),(cutout_length/2)-cutout_rad,0]; | |
module outer(){ //Cylinder fot outer hexagon radius. | |
cylinder(thickness,d=outer_rad*2,$fn=resolution); | |
} | |
module inner(){ //Cylinder for cutout radius. | |
cylinder(thickness,d=cutout_rad*2,$fn=resolution); | |
} | |
module main_shape(){ //Main hexagon outline. | |
hull(){ | |
translate(posA)outer(); | |
translate(posB)outer(); | |
translate(posC)outer(); | |
translate(posD)outer(); | |
translate(posE)outer(); | |
translate(posF)outer(); | |
} | |
} | |
module IEC_cutout(){ //Cutout for the filter. | |
hull(center=true){ | |
translate(posS)inner(); | |
translate(posT)inner(); | |
translate(posU)inner(); | |
translate(posV)inner(); | |
} | |
} | |
module fuse_holder(){ //Hole for fuse holder. | |
difference(){ | |
cylinder(thickness,d=fuse_size,$fn=resolution); | |
translate([-5.75-2.5,0,0])cube(5, center=true); | |
translate([5.75+2.5,0,0])cube(5, center=true); | |
} | |
} | |
module screw_holes(){ //Holes for screws. | |
translate([screw_spacing/2,0,0])cylinder(thickness,d=screw_size,$fn=resolution); | |
translate([-screw_spacing/2,0,0])cylinder(thickness,d=screw_size,$fn=resolution); | |
} | |
difference(){ //Finally we draw the object itself. | |
main_shape(); | |
IEC_cutout(); | |
screw_holes(); | |
translate(fuse_position)fuse_holder(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment