From 465ceef48e21cbd65f2c165937ff1405980f8b91 Mon Sep 17 00:00:00 2001 From: atomega Date: Wed, 30 Jun 2021 22:26:25 +0200 Subject: [PATCH] first --- arm_band.scad | 154 ++++++++++++++++++++++++++++++++++ library/box.scad | 211 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 365 insertions(+) create mode 100644 arm_band.scad create mode 100644 library/box.scad diff --git a/arm_band.scad b/arm_band.scad new file mode 100644 index 0000000..1759745 --- /dev/null +++ b/arm_band.scad @@ -0,0 +1,154 @@ + +$fn = 100; + +bandLenght = 110; +bandWidthSart = 21; +bandWidthEnd = 17; +bandThick = 2; +bandTipLenght = 15; + +shortBandLength = 75; +shortBandWidthStop = 16; + +roundingStichLenght = 10; +roundungHoleDia = 2; + +stichResess = 2; +stichStep = 4; +stichHole = 2.2; +stichAngle = 38; +stichWidth = 0.5; + +difference() +{ + strapLong(); + translate([-30,-1,0])cube([bandLenght,bandWidthSart+4,bandThick+1]); +} +//translate([0, bandWidthSart +3,0]) strapShort(); +//translate([0, bandWidthSart*2 + 5,0]) strapInsret(); + + + + + + +module roundingEnds() +{ + rounded_box(roundingStichLenght + roundungHoleDia*PI,bandWidthSart,bandWidthSart,2,0.2,0,0); +} + +module roundingEndBuckle() +{ + rounded_box(roundingStichLenght + roundungHoleDia*PI,shortBandWidthStop,shortBandWidthStop,2,0.2,0,0); +} + +module strapInsret() +{ + rounded_box(40,12,7,4,2,1,1); +} + +module strapLong() +{ + difference() + { + union() + { + rounded_box(bandLenght-bandTipLenght, bandWidthSart,bandWidthEnd,bandThick,bandThick, 0,0); + translate([bandLenght-bandTipLenght,(bandWidthSart-bandWidthEnd)/2,0])strapEnd(15,bandWidthEnd,2); + rotate([0,0,180])translate([0,-bandWidthSart,0])roundingEnds(); + } + //translate([0,stichResess,0])strapLongSticth(); + translate([0,stichResess,0])stichesStrait(0,0,bandLenght-bandTipLenght,(bandWidthSart-bandWidthEnd)/2,stichStep,stichHole,stichWidth,stichAngle,bandThick); + translate([0,-stichResess,0])stichesStrait(0,bandWidthSart,bandLenght-bandTipLenght,(bandWidthSart-bandWidthEnd)/2+bandWidthEnd-stichResess/2,stichStep,stichHole,stichWidth,stichAngle,bandThick); + + translate([50,bandWidthSart/2,0])tubes(7,2,7,4); + } +} + +module strapShort() +{ + rounded_box(shortBandLength,bandWidthSart,shortBandWidthStop,bandThick,bandThick,0,0); + rotate([0,0,180])translate([0,-bandWidthSart,0])roundingEnds(); + translate([shortBandLength,(bandWidthSart-shortBandWidthStop)/2,0])roundingEndBuckle(); +} + +module tubes(qte,dia,space,height) +{ + for( a = [0:qte]) + { + translate([a*space,0,0])cylinder(d=dia, h=height); + } +} + +module trinagle(l,w,t) +{ + //translate([0,-w/4+1,0]) + translate([0,0,0]) + { + hull() + { + translate([0,0,0])cylinder(r=0.001, h=t); + translate([w,0,0])cylinder(r=0.001, h=t); + translate([w/2,l,0])cylinder(r=0.001, h=t); + } + } +} + +module strapEnd(l,w,t) +{ + r = sqrt(pow(l,2)+pow((w/2),2)); + difference() + { + intersection() + { + translate([0,(2*r-w)+(w-r),0])cylinder(r=r, h=t); + translate([0,(w-r),0])cylinder(r=r, h=t); + } + translate([-l*1.5,0,0])cube([l*1.5,w,t]); + } +} + + + +module rounded_box(length,widthStart,widthStop,thicknessStart,thicknessStop, rStart, rStop){ + + cubeSize = 0.01; + + hull() + { + if(rStart) + { + translate([rStart,rStart,0])cylinder(r=rStart, h=thicknessStart); + translate([rStart,widthStart-rStart,0])cylinder(r=rStart, h=thicknessStart); + } + else + { + translate([rStart,rStart,0])cube([cubeSize,cubeSize,thicknessStart]); + translate([rStart,widthStart-rStart,0])cube([cubeSize,cubeSize,thicknessStart]); + } + + if(rStop) + { + translate([length-rStop,rStop+(widthStart-widthStop)/2,0])cylinder(r=rStop, h=thicknessStop); + translate([length-rStop,(widthStop-rStop) + (widthStart-widthStop)/2 ,0])cylinder(r=rStop, h=thicknessStop); + } + else + { + translate([length-rStop,rStop+(widthStart-widthStop)/2,0])cube([cubeSize,cubeSize,thicknessStop]); + translate([length-rStop,(widthStop-rStop) + (widthStart-widthStop)/2 ,0])cube([cubeSize,cubeSize,thicknessStop]); + } + } +} + + +module stichesStrait(startX,startY,stopX,stopY,stichSpace,StichLenght,stichWidth,angle,height) +{ + hypAngle = asin((stopY-startY)/(stopX-startX)); + stichCount = floor((stopX-startX)/(stichSpace)); + echo(stichCount); + for( a = [0:stichCount]) + { + rotate([0,0,hypAngle])translate([startX+stichSpace*a,startY-(sin(angle)*StichLenght)/2,0])rotate([0,0,angle])cube([StichLenght,stichWidth,height]); + } +} + diff --git a/library/box.scad b/library/box.scad new file mode 100644 index 0000000..6324e9b --- /dev/null +++ b/library/box.scad @@ -0,0 +1,211 @@ + +/* +Creator : Kerem Yollu +date : 30.06.2021 +Description : A simple Cube library with some of the most useful featured. + - Simple cube with or without all around roundig with the option of a flat top | keyCubeFull() + - Simple cube with or without rounded edges with flat top and bottom. | keyCubeRounded() + - Cube with opening defined by the desired wall thickness, intern and extern rounding radious and with the extra options of flat top and/or flat inside bottom | keyCubeEmpty() + - Cube wiht onpneing as described before but with an resses defined by his width heigt and rounding radious | keyCubeEmptyWithResses() +*/ + +$fn = 50; + + +cubeLenght = 20; +cubeWidht = 20; +cubeHeight = 40; +cubeRoundingRadious = 1; +cubeWallThickness = 1; +cubeInnerRoudingRadious = 2; +cubeRessesWidth = 1; +cubeRessesHeight = 2; +cubeRessesRadious = 3; +cubeCentered = false; +cubeFlatTop = true; +cubeFlatInside = true; + +/* +x = Lenght | mm +y = Widht | mm +z = Height | mm +t = Wall Thickness | mm +r = extern rounding radious for minkowski if = 0 the cube exterior will not be rounded | mm +flat = Top Flat | true / flase +ce = Center or not | true / flase +*/ +//keyCubeFull(cubeLenght,cubeWidht,cubeHeight,cubeRoundingRadious,cubeFlatTop,cubeCentered); +module keyCubeFull(x, y, z, r, flat = false, ce = true) +{ + if(r>0) + { + if (flat) + { + difference() + { + minkowski() + + { + x = x - r*2; + y = y - r*2; + if(ce) + + { + translate([-x/2,-y/2,-z/2+r])cube([x, y, z+r]); + } + else + + { + translate([r,r,r])cube([x, y, z]); + } + sphere(r=r); + } + + if(ce) + { + translate([-x/2,-y/2,z/2])cube([x, y, 3*r]); + } + else + { + translate([0,0,z])cube([x, y, 2*r]); + } + } + } + else + { + minkowski() + { + x = x - r*2; + y = y - r*2; + z = z - r*2; + + if(ce) + { + translate([-x/2,-y/2,-z/2])cube([x, y, z]); + } + else + { + translate([r,r,r])cube([x, y, z]); + } + sphere(r=r); + } + } + } + else + { + cube([x, y, z], center = ce); + } +} + +/* +x = Lenght | mm +y = Widht | mm +z = Height | mm +rad = extern rounding radious | mm +ce = Center or not | true / flase +*/ +//keyCubeRounded(10,10,4,3,true); +module keyCubeRounded(x,y,z,rad,ce = true) +{ + if(rad > 0) + { + if(ce) + { + translate([-x/2,-y/2,-z/2])hull() + { + translate([rad,rad,0])cylinder(r=rad, h=z); + translate([x-rad,rad,0])cylinder(r=rad, h=z); + translate([rad,y-rad,0])cylinder(r=rad, h=z); + translate([x-rad,y-rad,0])cylinder(r=rad, h=z); + } + } + else + { + hull() + { + translate([rad,rad,0])cylinder(r=rad, h=z); + translate([x-rad,rad,0])cylinder(r=rad, h=z); + translate([rad,y-rad,0])cylinder(r=rad, h=z); + translate([x-rad,y-rad,0])cylinder(r=rad, h=z); + } + } + } + else + { + cube([x,y,z], center = ce); + } +} + + +/* +x = Lenght | mm +y = Widht | mm +z = Height | mm +t = Wall Thickness | mm +r1 = extern rounding radious for minkowski if = 0 the cube exterior will not be rounded | mm +r2 = intern rounding radious for minkowski if = 0 the cube interior will not be rounded | mm +tFlat = Top Flat | true / flase +iFlat = Inside bottom flat | true / flase +ce = Center or not | true / flase +*/ +//keyCubeEmpty(cubeLenght,cubeWidht,cubeHeight,cubeWallThickness,cubeRoundingRadious,cubeInnerRoudingRadious,cubeFlatTop,cubeFlatInside,cubeCentered); +module keyCubeEmpty(x,y,z,t,r1,r2,tFlat = false, Iflat = false, ce = true) +{ + if(t < r1) + { + echo("please set wall thickness at least equal to the extern rounding diameter (r1)"); + } + else + { + difference() + { + keyCubeFull(x,y,z,r1,tFlat,ce); + if(ce) + { + if(Iflat){translate([0,0,t])keyCubeRounded(x-t*2,y-t*2,z,r2/2,ce);} + else{translate([0,0,t])keyCubeFull(x-t*2,y-t*2,z,r2,false,ce);} + } + else + { + if(Iflat){translate([t,t,t])keyCubeRounded(x-t*2,y-t*2,z,r2/2,ce);} + else{translate([t,t,t])keyCubeFull(x-t*2,y-t*2,z,r2,false,ce);} + } + } + } +} + +/* +x = Lenght | mm +y = Widht | mm +z = Height | mm +t = Wall Thickness | mm +r1 = extern rounding radious for minkowski if = 0 the cube exterior will not be rounded | mm +r2 = intern rounding radious for minkowski if = 0 the cube interior will not be rounded | mm +rsHeigh = Resses height | mm +rsWidth = Resses Width | mm +rsRad = Resses rounding radious | mm if = 0 the cresses corners will not be rounded +tFlat = Top Flat | true / flase +iFlat = Inside bottom flat | true / flase +ce = Center or not | true / flase +*/ +//keyCubeEmptyWithResses(cubeLenght,cubeWidht,cubeHeight,cubeWallThickness,cubeRoundingRadious,cubeInnerRoudingRadious,cubeRessesHeight,cubeRessesWidth,cubeRessesRadious,cubeFlatTop,cubeFlatInside,cubeCentered); +module keyCubeEmptyWithResses(x,y,z,t,r1,r2,rsHeigh,rsWidth,rsRad,tFlat = false, Iflat = false, ce = true) +{ + if(ce) + { + difference() + { + keyCubeEmpty(x,y,z,t,r1,r2,tFlat,Iflat,ce); + translate([0,0,z/2-rsHeigh/2])keyCubeRounded(x-t*2+rsWidth*2,y-t*2+rsWidth*2,rsHeigh,rsRad/2,ce); + } + } + else + { + difference() + { + keyCubeEmpty(x,y,z,t,r1,r2,tFlat,Iflat,ce); + translate([t-rsWidth,t-rsWidth,z-rsHeigh])keyCubeRounded(x-t*2+rsWidth*2,y-t*2+rsWidth*2,rsHeigh,rsRad/2,ce); + } + } +} +