From fa2783a6669a72f7e57529c2b55a0eaa9e3f4686 Mon Sep 17 00:00:00 2001 From: Dmitry Maylarov Date: Thu, 13 May 2021 17:36:52 +0300 Subject: [PATCH] upd thingiverse customizer to use include sixinch_library, added https://github.com/KronBjorn/SixInchRack/pull/3 --- .../thingiverse_customizer.scad | 26 +- RackCabinets/sixinch_library.scad | 386 +++++++++--------- 2 files changed, 195 insertions(+), 217 deletions(-) diff --git a/RackCabinets/ThingiverseCustomizer/thingiverse_customizer.scad b/RackCabinets/ThingiverseCustomizer/thingiverse_customizer.scad index c110513..f4d5633 100755 --- a/RackCabinets/ThingiverseCustomizer/thingiverse_customizer.scad +++ b/RackCabinets/ThingiverseCustomizer/thingiverse_customizer.scad @@ -1,17 +1,7 @@ +include<../sixinch_library.scad> $fn = 50*1; - - - - ////////////////////////////////////////////////// - // PASTE ALL OF: sixinch_library.scad IN HERE // - // Thingiverse can only accept one file. // -////////////////////////////////////////////////// - - - - -Part = "-"; // [a:All, b:FrontPlate, c:Cabinet, d:Lid, e:BackPlate, f:Handles] +Part = "a"; // [a:All, b:FrontPlate, c:Cabinet, d:Lid, e:BackPlate, f:Handles] Units = 4; Depth = 115; @@ -38,15 +28,3 @@ module go(){ } } } - - - - - - - - - - - - diff --git a/RackCabinets/sixinch_library.scad b/RackCabinets/sixinch_library.scad index 94afb3a..5bbfb04 100755 --- a/RackCabinets/sixinch_library.scad +++ b/RackCabinets/sixinch_library.scad @@ -21,31 +21,31 @@ slip = 0.35; module chimney() { -for(i=[0:8:80]){ - echo(i); - translate([20 + (width-80)/2 +i,-1,20]){ - minkowski(){ - cube([0.01,200,30]); - sphere(d=2,h=1); + for(i=[0:8:80]){ + echo(i); + translate([20 + (width-80)/2 +i,-1,20]){ + minkowski(){ + cube([0.01,200,30]); + sphere(d=2,h=1); + } } } } -} - - - module back_plate(u,dp,screw_top,screw_bottom,screw_side,square_hole,round_hole){ - - difference(){ + + +module back_plate(u,dp,screw_top,screw_bottom,screw_side,square_hole,round_hole){ + + difference(){ union(){ translate([20+gauge_box+slip,gauge_box+slip,gauge+dp-gauge_box]){ cube([width-2*gauge_box-2*slip, u*unit-2*gauge_box-2*slip, gauge_box]); } } - - //Square holes + + //Square holes for(i=[0:len(square_hole)-1]){ x = square_hole[i][0]; y = square_hole[i][1]; @@ -53,46 +53,46 @@ for(i=[0:8:80]){ h = square_hole[i][3]; translate([x+20+gauge_box,y+gauge_box,dp-1]){cube([w,h,gauge+2]);} } - - //Round holes - if(len(round_hole)>0){ - for(i=[0:len(round_hole)-1]){ - x = round_hole[i][0]; - y = round_hole[i][1]; - dia = round_hole[i][2]; - translate([20+gauge_box+x,gauge_box+y,dp-4]){ cylinder(d=dia,h=10); } + + //Round holes + if(len(round_hole)>0){ + for(i=[0:len(round_hole)-1]){ + x = round_hole[i][0]; + y = round_hole[i][1]; + dia = round_hole[i][2]; + translate([20+gauge_box+x,gauge_box+y,dp-4]){ cylinder(d=dia,h=10); } + } } - } - - - //Screw holes - if(len(screw_top)>0){ - for(i=[0:len(screw_top)-1]){ - p = screw_top[i]; - translate([p,unit*u-gauge_box-4,gauge+dp+0.1]){rotate([0,180,0]){screw();}} - translate([sixinch-p,unit*u-gauge_box-4,gauge+dp+0.1]){rotate([0,180,0]){screw();}} + + + //Screw holes + if(len(screw_top)>0){ + for(i=[0:len(screw_top)-1]){ + p = screw_top[i]; + translate([p,unit*u-gauge_box-4,gauge+dp+0.1]){rotate([0,180,0]){screw();}} + translate([sixinch-p,unit*u-gauge_box-4,gauge+dp+0.1]){rotate([0,180,0]){screw();}} + } } - } - if(len(screw_bottom)>0){ - for(i=[0:len(screw_bottom)-1]){ - p = screw_bottom[i]; - translate([p,gauge_box+4 ,gauge+dp+0.1]){rotate([0,180,0]){screw();}} - translate([sixinch-p, gauge_box+4 ,gauge+dp+0.1]){rotate([0,180,0]){screw();}} + if(len(screw_bottom)>0){ + for(i=[0:len(screw_bottom)-1]){ + p = screw_bottom[i]; + translate([p,gauge_box+4 ,gauge+dp+0.1]){rotate([0,180,0]){screw();}} + translate([sixinch-p, gauge_box+4 ,gauge+dp+0.1]){rotate([0,180,0]){screw();}} + } } - } - - if(len(screw_side)>0){ - for(i=[0:len(screw_side)-1]){ - p = screw_side[i]; - translate([sixinch-20-6, unit*p ,gauge+dp+0.1]){rotate([0,180,0]){screw();}} - translate([20+6, unit*p ,gauge+dp+0.1]){rotate([0,180,0]){screw();}} + + if(len(screw_side)>0){ + for(i=[0:len(screw_side)-1]){ + p = screw_side[i]; + translate([sixinch-20-6, unit*p ,gauge+dp+0.1]){rotate([0,180,0]){screw();}} + translate([20+6, unit*p ,gauge+dp+0.1]){rotate([0,180,0]){screw();}} + } } } } -} - - + + module peg(x,y,od,id,he){ @@ -120,7 +120,7 @@ module screwtrap(){ } translate([2,4,5]){ rotate([90,90,90]){ - translate([0,0,-10]){ cylinder(r=screw_dia/2,h=20,$fn=100);} + translate([0,0,-10]){ cylinder(r=screw_dia/2,h=20,$fn=100);} } } } @@ -142,7 +142,7 @@ module nuttrap(){ } translate([2,4,5]){ rotate([90,90,90]){ - translate([0,0,-10]){ cylinder(r=screw_dia/2,h=20,$fn=100);} + translate([0,0,-10]){ cylinder(r=screw_dia/2,h=20,$fn=100);} } } } @@ -158,20 +158,20 @@ module nuttrap(){ module cabinet (dp,u,screw_bottom_front,round_peg,screw_side_front){ difference(){ box(dp,u,screw_bottom_front,round_peg,screw_side_front); - - translate([20,unit/2+3,sixinch-40]){ cylinder(d=gauge_box,h=41);} - translate([20,unit/2+0,sixinch-40]){ cylinder(d=gauge_box,h=41);} - translate([20,unit/2-3,sixinch-40]){ cylinder(d=gauge_box,h=41);} - - translate([20+width,unit/2+3,sixinch-40]){ cylinder(d=gauge_box,h=41);} - translate([20+width,unit/2+0,sixinch-40]){ cylinder(d=gauge_box,h=41);} - translate([20+width,unit/2-3,sixinch-40]){ cylinder(d=gauge_box,h=41);} - - - } - + + translate([20,unit/2+3,sixinch-40]){ cylinder(d=gauge_box,h=41);} + translate([20,unit/2+0,sixinch-40]){ cylinder(d=gauge_box,h=41);} + translate([20,unit/2-3,sixinch-40]){ cylinder(d=gauge_box,h=41);} + + translate([20+width,unit/2+3,sixinch-40]){ cylinder(d=gauge_box,h=41);} + translate([20+width,unit/2+0,sixinch-40]){ cylinder(d=gauge_box,h=41);} + translate([20+width,unit/2-3,sixinch-40]){ cylinder(d=gauge_box,h=41);} + + } +} + @@ -180,14 +180,14 @@ module box(dp,u,screw_bottom_front,round_peg,screw_side_front){ difference(){ translate([20,0,gauge]){ difference(){ - cube([115,u*unit,dp]); - translate([gauge_box,gauge_box,-1]){ cube([115-gauge_box*2,u*unit,dp+2]);} + cube([(sixinch-40),u*unit,dp]); + translate([gauge_box,gauge_box,-1]){ cube([(sixinch-40)-gauge_box*2,u*unit,dp+2]);} } } //CHIMNEY chimney(); } - + //Screw mounts on the bottom plate for(i=[0:len(screw_bottom_front)-1]){ p = screw_bottom_front[i]; @@ -195,19 +195,19 @@ module box(dp,u,screw_bottom_front,round_peg,screw_side_front){ translate([sixinch-p+5,gauge_box,gauge]){rotate([0,-90,0]){screwtrap();}} translate([p-5,gauge_box,gauge+dp-gauge_box]){rotate([0,90,0]){screwtrap();}} translate([sixinch-p-5,gauge_box,gauge+dp-gauge_box]){rotate([0,90,0]){screwtrap();}} - } - - //Screw mounts on the side of cabinet - if(len(screw_side_front)>0){ + } + + //Screw mounts on the side of cabinet + if(len(screw_side_front)>0){ for(i=[0:len(screw_side_front)-1]){ p = screw_side_front[i]*unit; - translate([20+gauge_box,p-5,gauge]){rotate([0,-90,-90]){screwtrap();}} - translate([sixinch-20-gauge_box,p+5,gauge]){rotate([0,-90,90]){screwtrap();}} - translate([20+gauge_box,p+5,gauge+dp-gauge_box]){rotate([0,90,-90]){screwtrap();}} - translate([sixinch-20-gauge_box,p-5,gauge+dp-gauge_box]){rotate([0,90,90]){screwtrap();}} + translate([20+gauge_box,p-5,gauge]){rotate([0,-90,-90]){screwtrap();}} + translate([sixinch-20-gauge_box,p+5,gauge]){rotate([0,-90,90]){screwtrap();}} + translate([20+gauge_box,p+5,gauge+dp-gauge_box]){rotate([0,90,-90]){screwtrap();}} + translate([sixinch-20-gauge_box,p-5,gauge+dp-gauge_box]){rotate([0,90,90]){screwtrap();}} } } - + //Screw mounts for lid. Two on each side, three if dp>90 translate([20+gauge_box,unit*u-gauge_box,gauge+10]){rotate([0,0,-90]){screwtrap();}} translate([20+gauge_box,unit*u-gauge_box,gauge+dp-10-10]){rotate([0,0,-90]){screwtrap();}} @@ -217,7 +217,7 @@ module box(dp,u,screw_bottom_front,round_peg,screw_side_front){ translate([sixinch-20-gauge_box,unit*u-gauge_box,gauge+dp/2-5+10]){rotate([180,0,-90]){screwtrap();}} translate([20+gauge_box,unit*u-gauge_box,gauge+dp/2-5]){rotate([0,0,-90]){screwtrap();}} } - + //Lid rest bar translate([20+gauge_box,unit*u-3-gauge_box,gauge]){ linear_extrude(dp-gauge_box){polygon (points=[[0,0],[3,3],[0,3]]);} @@ -225,7 +225,7 @@ module box(dp,u,screw_bottom_front,round_peg,screw_side_front){ translate([sixinch-20-gauge_box,unit*u-3-gauge_box,gauge]){ linear_extrude(dp-gauge_box){polygon (points=[[0,0],[-3,3],[0,3]]);} } - + // Back/front rest bar translate([0,0,dp+gauge-2-gauge_box]){ difference(){ @@ -233,7 +233,7 @@ module box(dp,u,screw_bottom_front,round_peg,screw_side_front){ translate([20+gauge_box+2,gauge_box+2,-1]){ cube([width-2*gauge_box-4,unit*u,4]); } } } - + //PEGS Relative to inside corner translate([20+gauge_box,0,gauge]){ if(len(round_peg)>0){ @@ -244,7 +244,7 @@ module box(dp,u,screw_bottom_front,round_peg,screw_side_front){ id = round_peg[i][3]; he = round_peg[i][4]; translate([x,0,y]){peg(0,0,od,id,he); } - } + } } } } @@ -253,45 +253,45 @@ module box(dp,u,screw_bottom_front,round_peg,screw_side_front){ module lid(dp,u,screw_front,screw_back){ difference(){ - union(){ - if(len(screw_front)>0){ - for(i=[0:len(screw_front)-1]){ - p = screw_front[i]; - translate([p-5,unit*u-gauge_box,gauge]){rotate([0,-90,180]){screwtrap();}} - translate([sixinch-p-5,unit*u-gauge_box,gauge]){rotate([0,-90,180]){screwtrap();}} + union(){ + if(len(screw_front)>0){ + for(i=[0:len(screw_front)-1]){ + p = screw_front[i]; + translate([p-5,unit*u-gauge_box,gauge]){rotate([0,-90,180]){screwtrap();}} + translate([sixinch-p-5,unit*u-gauge_box,gauge]){rotate([0,-90,180]){screwtrap();}} + } + } + if(len(screw_back)>0){ + for(i=[0:len(screw_back)-1]){ + p = screw_back[i]; + translate([p+5,unit*u-gauge_box,gauge+dp-gauge_box]){rotate([0,90,180]){screwtrap();}} + translate([sixinch-p+5,unit*u-gauge_box,gauge+dp-gauge_box]){rotate([0,90,180]){screwtrap();}} + } } - } - if(len(screw_back)>0){ - for(i=[0:len(screw_back)-1]){ - p = screw_back[i]; - translate([p+5,unit*u-gauge_box,gauge+dp-gauge_box]){rotate([0,90,180]){screwtrap();}} - translate([sixinch-p+5,unit*u-gauge_box,gauge+dp-gauge_box]){rotate([0,90,180]){screwtrap();}} + + //lid + translate([20+gauge_box+slip,u*unit-gauge_box,gauge]){ + cube([115-gauge_box*2-slip*2,gauge_box,dp]); + } + //back rest + translate([sixinch/2-40,u*unit-gauge_box-2,gauge+dp-2-gauge_box]){ + cube([80,2,2]); } - } + } - //lid - translate([20+gauge_box+slip,u*unit-gauge_box,gauge]){ - cube([115-gauge_box*2-slip*2,gauge_box,dp]); - } - //back rest - translate([sixinch/2-40,u*unit-gauge_box-2,gauge+dp-2-gauge_box]){ - cube([80,2,2]); + //Negative + translate([20+gauge_box+4,unit*u+0.01 ,gauge+10+5]){rotate([90,0,0]){screw();}} + translate([20+gauge_box+4,unit*u+0.01 ,gauge+dp-10-10+5]){rotate([90,0,0]){screw();}} + translate([sixinch-20-gauge_box-4,unit*u+0.01 ,gauge+10+10-5]){rotate([90,0,0]){screw();}} + translate([sixinch-20-gauge_box-4,unit*u +0.01 ,gauge+dp-10-10+10-5]){rotate([90,0,0]){screw();}} + if(dp>90){ + translate([sixinch-20-gauge_box-4,unit*u+0.01 ,gauge+dp/2-5+10-5]){rotate([90,0,0]){screw();}} + translate([20+gauge_box+4,unit*u+0.01 ,gauge+dp/2-5+5]){rotate([90,0,0]){screw();}} } - } + chimney(); - //Negative - translate([20+gauge_box+4,unit*u+0.01 ,gauge+10+5]){rotate([90,0,0]){screw();}} - translate([20+gauge_box+4,unit*u+0.01 ,gauge+dp-10-10+5]){rotate([90,0,0]){screw();}} - translate([sixinch-20-gauge_box-4,unit*u+0.01 ,gauge+10+10-5]){rotate([90,0,0]){screw();}} - translate([sixinch-20-gauge_box-4,unit*u +0.01 ,gauge+dp-10-10+10-5]){rotate([90,0,0]){screw();}} - if(dp>90){ - translate([sixinch-20-gauge_box-4,unit*u+0.01 ,gauge+dp/2-5+10-5]){rotate([90,0,0]){screw();}} - translate([20+gauge_box+4,unit*u+0.01 ,gauge+dp/2-5+5]){rotate([90,0,0]){screw();}} - } - chimney(); - -} + } } @@ -306,11 +306,11 @@ module screw(){ module frontholes(u,screw_top,screw_bottom_front,screw_side_front){ if(len(screw_bottom_front)>0){ - for(i=[0:len(screw_bottom_front)-1]){ - p = screw_bottom_front[i]; - translate([p,gauge_box+4,-0.01]){screw();} - translate([sixinch-p,gauge_box+4,-0.01]){screw();} - } + for(i=[0:len(screw_bottom_front)-1]){ + p = screw_bottom_front[i]; + translate([p,gauge_box+4,-0.01]){screw();} + translate([sixinch-p,gauge_box+4,-0.01]){screw();} + } } if(len(screw_side_front)>0){ for(i=[0:len(screw_side_front)-1]){ @@ -320,20 +320,20 @@ module frontholes(u,screw_top,screw_bottom_front,screw_side_front){ } } if(len(screw_top)>0){ - for(i=[0:len(screw_top)-1]){ - p = screw_top[i]; - translate([p,unit*u-gauge_box-4,-0.01]){screw();} - translate([sixinch-p,unit*u-gauge_box-4,-0.01]){screw();} - } + for(i=[0:len(screw_top)-1]){ + p = screw_top[i]; + translate([p,unit*u-gauge_box-4,-0.01]){screw();} + translate([sixinch-p,unit*u-gauge_box-4,-0.01]){screw();} + } } } - + module handle(u,print){ - + if(print){ translate([16,-u*unit,8]){rotate([0,90,0]){handle1(u);}} translate([0,-u*unit,8]){rotate([0,90,0]){handle1(u);}} @@ -347,7 +347,7 @@ module handle1(u){ difference(){ handle2(8,u*unit-4,10,3); translate([-1,5,-1]){handle2(10,u*unit-10-4,6,3);} - + translate([4,2.5,-1]){ cylinder(r=screw_hole/2,h=9);} translate([4,u*unit-4-2.5,-1]){ cylinder(r=screw_hole/2,h=9);} } @@ -380,7 +380,7 @@ module insideprofile(l){ union(){ translate([7.6,10,0]){cube([4.8,10,l]);} translate([0,7.6,0]){cube([20,4.8,l]);} - + translate([6.5,10-2.1,0]){cube([7 ,10,l]);} translate([2.1,6.5,0]){cube([15.8,7 ,l]);} } @@ -414,27 +414,27 @@ module leftbottomplate(t){ translate([(sixinch+20)/2,-1,-1]){ cube([(sixinch+20)/2+1,sixinch+20+2,t+2]); } - # translate([10,10,-1]){cylinder(r=2.5,h=base+2);} +# translate([10,10,-1]){cylinder(r=2.5,h=base+2);} translate([10,sixinch+20-10,-1]){cylinder(r=2.5,h=base+2);} - - + + translate([(sixinch+20)/2-20,-1,2.1]){cube([40,sixinch+20+2,2]);} - - } - + + } + translate([0,0,base]){insideprofile(10);} rotate([0,0,180]){translate([-20,-sixinch-20,base]){insideprofile(10);}} } module bottomplate(t){ -translate([1,1,0]){ - minkowski(){ - cube([sixinch+20-2,sixinch+20-2,t-1]); - cylinder(r=1,h=1); + translate([1,1,0]){ + minkowski(){ + cube([sixinch+20-2,sixinch+20-2,t-1]); + cylinder(r=1,h=1); + } } } -} @@ -443,33 +443,33 @@ module frontplate(u,square_hole,round_hole,round_peg,screw_side_front,screw_top, difference(){ baseplate(u); - - - + + + //Square holes if(len(square_hole)>0){ - for(i=[0:len(square_hole)-1]){ - x = square_hole[i][0]; - y = square_hole[i][1]; - w = square_hole[i][2]; - h = square_hole[i][3]; - translate([x,y,-1]){cube([w,h,gauge+2]);} - } + for(i=[0:len(square_hole)-1]){ + x = square_hole[i][0]; + y = square_hole[i][1]; + w = square_hole[i][2]; + h = square_hole[i][3]; + translate([x,y,-1]){cube([w,h,gauge+2]);} + } } - - //Round holes + + //Round holes if(len(round_hole)>0){ - for(i=[0:len(round_hole)-1]){ - x = round_hole[i][0]; - y = round_hole[i][1]; - d = round_hole[i][2]; - translate([x,y,-1]){cylinder(r=d/2,gauge+1);} - } - } + for(i=[0:len(round_hole)-1]){ + x = round_hole[i][0]; + y = round_hole[i][1]; + d = round_hole[i][2]; + translate([x,y,-1]){cylinder(r=d/2,gauge+1);} + } + } //Cabinet holes frontholes(u,screw_top,screw_bottom_front,screw_side_front); - + //Handle holes translate([18,4.5,gauge-0.25]){rotate([180,0,0]){screw();}} translate([18,u*unit-4.5,gauge-0.25]){rotate([180,0,0]){screw();}} @@ -479,24 +479,24 @@ module frontplate(u,square_hole,round_hole,round_peg,screw_side_front,screw_top, //chassis support /* - translate([20+gauge_box,gauge_box,gauge]){ - difference(){ - cube([115-gauge_box*2,u*unit-2*gauge_box,3]); - translate([gauge_box,gauge_box,-1]){ cube([115-gauge_box*4,u*unit-gauge_box*4,5]);} - } - } */ + translate([20+gauge_box,gauge_box,gauge]){ + difference(){ + cube([115-gauge_box*2,u*unit-2*gauge_box,3]); + translate([gauge_box,gauge_box,-1]){ cube([115-gauge_box*4,u*unit-gauge_box*4,5]);} + } + } */ - //Handle base + //Handle base /* - translate([14,0,0]){ - cube([8,u*unit,gauge/2]); - } - translate([sixinch-22,0,0]){ - cube([8,u*unit,gauge/2]); - } - */ + translate([14,0,0]){ + cube([8,u*unit,gauge/2]); + } + translate([sixinch-22,0,0]){ + cube([8,u*unit,gauge/2]); + } + */ //Support pegs if(len(round_peg)>0){ @@ -508,23 +508,23 @@ module frontplate(u,square_hole,round_hole,round_peg,screw_side_front,screw_top, he = round_peg[i][4]; translate([x,y,gauge]){ difference(){ - # cylinder(r=od/2,h=he); - # cylinder(r=id/2,h=he+1); +# cylinder(r=od/2,h=he); +# cylinder(r=id/2,h=he+1); } } - + } } - + //cabinet support bars translate([0,0,gauge]){ translate([20+width*0.25,gauge_box,0]){ cube([width*0.5,1,1.5]); } translate([20+width*0.25,unit*u-1-gauge_box,0]){ cube([width*0.5,1,1.5]); } } - - - - } + + + +} @@ -535,24 +535,24 @@ module frontplate(u,square_hole,round_hole,round_peg,screw_side_front,screw_top, module baseplate(u,handle){ difference(){ - union(){ - translate([1.25,1.25,1.25]){ - minkowski(){ - cube([sixinch-2.5,unit*u-2.5,gauge-2.5]); - sphere(r=1.25); + union(){ + translate([1.25,1.25,1.25]){ + minkowski(){ + cube([sixinch-2.5,unit*u-2.5,gauge-2.5]); + sphere(r=1.25); + } } } - } - //Rack mount holes - translate([10-0.5,unit/2,-gauge/2]) {cylinder(r=2.3,gauge*2);} - translate([sixinch-10+0.5,unit/2,-gauge/2]) {cylinder(r=2.3,gauge*2);} - translate([10-0.5,u*unit-(unit/2),-gauge/2]) {cylinder(r=2.3,gauge*2);} - translate([sixinch-10+0.5,u*unit-(unit/2),-gauge/2]){cylinder(r=2.3,gauge*2);} - if(u>=5){ - translate([10-0.5,(u*unit)/2,-gauge/2]) {cylinder(r=2.3,gauge*2);} - translate([sixinch-10+0.5,(u*unit)/2,-gauge/2]) {cylinder(r=2.3,gauge*2);} - } -} + //Rack mount holes + translate([10-0.5,unit/2,-gauge/2]) {cylinder(r=2.3,gauge*2);} + translate([sixinch-10+0.5,unit/2,-gauge/2]) {cylinder(r=2.3,gauge*2);} + translate([10-0.5,u*unit-(unit/2),-gauge/2]) {cylinder(r=2.3,gauge*2);} + translate([sixinch-10+0.5,u*unit-(unit/2),-gauge/2]){cylinder(r=2.3,gauge*2);} + if(u>=5){ + translate([10-0.5,(u*unit)/2,-gauge/2]) {cylinder(r=2.3,gauge*2);} + translate([sixinch-10+0.5,(u*unit)/2,-gauge/2]) {cylinder(r=2.3,gauge*2);} + } + } }