From 2a662b2a4cb8622ae8937506b0d011ded0ae8638 Mon Sep 17 00:00:00 2001 From: jwhevans <45521229+jwhevans@users.noreply.github.com> Date: Wed, 26 Feb 2020 14:40:14 -0600 Subject: [PATCH 1/3] Update to address deprecated code assign() deprecated: replaced by let child() deprecated: replaced by children uploaded a copy of pins.scad to complete the repository for easier distribution --- arduino.scad | 795 ++++++++++++++++++++++++++------------------------- pins.scad | 165 +++++++++++ 2 files changed, 564 insertions(+), 396 deletions(-) create mode 100644 pins.scad diff --git a/arduino.scad b/arduino.scad index a122d1b..4b14fc6 100644 --- a/arduino.scad +++ b/arduino.scad @@ -20,81 +20,81 @@ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -use +include //Constructs a roughed out arduino board //Current only USB, power and headers module arduino(boardType = UNO) { - //The PCB with holes - difference() { - color("SteelBlue") - boardShape( boardType ); - translate([0,0,-pcbHeight * 0.5]) holePlacement(boardType = boardType) - color("SteelBlue") cylinder(r = mountingHoleRadius, h = pcbHeight * 2, $fn=32); - } - //Add all components to board - components( boardType = boardType, component = ALL ); + //The PCB with holes + difference() { + color("SteelBlue") + boardShape( boardType ); + translate([0,0,-pcbHeight * 0.5]) holePlacement(boardType = boardType) + color("SteelBlue") cylinder(r = mountingHoleRadius, h = pcbHeight * 2, $fn=32); + } + //Add all components to board + components( boardType = boardType, component = ALL ); } //Creates a bumper style enclosure that fits tightly around the edge of the PCB. module bumper( boardType = UNO, mountingHoles = false ) { - bumperBaseHeight = 2; - bumperHeight = bumperBaseHeight + pcbHeight + 0.5; - dimensions = boardDimensions(boardType); - - difference() { - union() { - //Outer rim of bumper - difference() { - boardShape(boardType = boardType, offset=1.4, height = bumperHeight); - translate([0,0,-0.1]) - boardShape(boardType = boardType, height = bumperHeight + 0.2); - } - - //Base of bumper - difference() { - boardShape(boardType = boardType, offset=1, height = bumperBaseHeight); - translate([0,0, -0.1]) - boardShape(boardType = boardType, offset=-2, height = bumperHeight + 0.2); - } - - //Board mounting holes - holePlacement(boardType=boardType) - cylinder(r = mountingHoleRadius + 1.5, h = bumperBaseHeight, $fn = 32); - - //Bumper mounting holes (exterior) - if( mountingHoles ) { - difference() { - hull() { - translate([-6, (dimensions[1] - 6) / 2, 0]) - cylinder( r = 6, h = pcbHeight + 2, $fn = 32 ); - translate([ -0.5, dimensions[1] / 2 - 9, 0]) - cube([0.5, 12, bumperHeight]); - } - translate([-6, (dimensions[1] - 6) / 2, 0]) - mountingHole(holeDepth = bumperHeight); - } - difference() { - hull() { - translate([dimensions[0] + 6, (dimensions[1] - 6) / 2,0]) - cylinder( r = 6, h = pcbHeight + 2, $fn = 32 ); - translate([ dimensions[0], dimensions[1] / 2 - 9, 0]) - cube([0.5, 12, bumperHeight]); - } - translate([dimensions[0] + 6, (dimensions[1] - 6) / 2,0]) - mountingHole(holeDepth = bumperHeight); - } - } - } - translate([0,0,-0.5]) - holePlacement(boardType=boardType) - cylinder(r = mountingHoleRadius, h = bumperHeight, $fn = 32); - translate([0, 0, bumperBaseHeight]) { - components(boardType = boardType, component = ALL, offset = 1); - } - translate([4,(dimensions[1] - dimensions[1] * 0.4)/2,-1]) - cube([dimensions[0] -8,dimensions[1] * 0.4,bumperBaseHeight + 2]); - } + bumperBaseHeight = 2; + bumperHeight = bumperBaseHeight + pcbHeight + 0.5; + dimensions = boardDimensions(boardType); + + difference() { + union() { + //Outer rim of bumper + difference() { + boardShape(boardType = boardType, offset=1.4, height = bumperHeight); + translate([0,0,-0.1]) + boardShape(boardType = boardType, height = bumperHeight + 0.2); + } + + //Base of bumper + difference() { + boardShape(boardType = boardType, offset=1, height = bumperBaseHeight); + translate([0,0, -0.1]) + boardShape(boardType = boardType, offset=-2, height = bumperHeight + 0.2); + } + + //Board mounting holes + holePlacement(boardType=boardType) + cylinder(r = mountingHoleRadius + 1.5, h = bumperBaseHeight, $fn = 32); + + //Bumper mounting holes (exterior) + if( mountingHoles ) { + difference() { + hull() { + translate([-6, (dimensions[1] - 6) / 2, 0]) + cylinder( r = 6, h = pcbHeight + 2, $fn = 32 ); + translate([ -0.5, dimensions[0] / 2 - 9, 0]) + cube([0.5, 12, bumperHeight]); + } + translate([-6, (dimensions[0] - 6) / 2, 0]) + mountingHole(holeDepth = bumperHeight); + } + difference() { + hull() { + translate([dimensions[0] + 6, (dimensions[1] - 6) / 2,0]) + cylinder( r = 6, h = pcbHeight + 2, $fn = 32 ); + translate([ dimensions[0], dimensions[1] / 2 - 9, 0]) + cube([0.5, 12, bumperHeight]); + } + translate([dimensions[0] + 6, (dimensions[1] - 6) / 2,0]) + mountingHole(holeDepth = bumperHeight); + } + } + } + translate([0,0,-0.5]) + holePlacement(boardType=boardType) + cylinder(r = mountingHoleRadius, h = bumperHeight, $fn = 32); + translate([0, 0, bumperBaseHeight]) { + components(boardType = boardType, component = ALL, offset = 1); + } + translate([4,(dimensions[1] - dimensions[1] * 0.4)/2,-1]) + cube([dimensions[0] -8,dimensions[1] * 0.4,bumperBaseHeight + 2]); + } } //Setting for enclosure mounting holes (Not Arduino mounting) @@ -104,98 +104,98 @@ EXTERIORMOUNTINGHOLES = 2; //Create a board enclosure module enclosure(boardType = UNO, wall = 3, offset = 3, heightExtension = 10, cornerRadius = 3, mountType = TAPHOLE) { - standOffHeight = 5; - - dimensions = boardDimensions(boardType); - boardDim = boardDimensions(boardType); - pcbDim = pcbDimensions(boardType); - - enclosureWidth = pcbDim[0] + (wall + offset) * 2; - enclosureDepth = pcbDim[1] + (wall + offset) * 2; - enclosureHeight = boardDim[2] + wall + standOffHeight + heightExtension; - - union() { - difference() { - //Main box shape - boundingBox(boardType = boardType, height = enclosureHeight, offset = wall + offset, include=PCB, cornerRadius = wall); - - translate([ 0, 0, wall]) { - //Interior of box - boundingBox(boardType = boardType, height = enclosureHeight, offset = offset, include=PCB, cornerRadius = wall); - - //Punch outs for USB and POWER - translate([0, 0, standOffHeight]) { - components(boardType = boardType, offset = 1, extension = wall + offset + 10); - } - } - - //Holes for lid clips - translate([0, enclosureDepth * 0.75 - (offset + wall), enclosureHeight]) { - translate([-offset, 0, 0]) - rotate([0, 180, 90]) clipHole(clipHeight = 10, holeDepth = wall + 0.2); - translate([offset + boardDim[0], 0, 0]) - rotate([0, 180, 270]) clipHole(clipHeight = 10, holeDepth = wall + 0.2); - } - - translate([0, enclosureDepth * 0.25 - (offset + wall), enclosureHeight]) { - translate([-offset, 0, 0]) - rotate([0, 180, 90]) clipHole(clipHeight = 10, holeDepth = wall + 0.2); - translate([offset + dimensions[0], 0, 0]) - rotate([0, 180, 270]) clipHole(clipHeight = 10, holeDepth = wall + 0.2); - } - } - translate([0, 0, wall]) { - standoffs(boardType = boardType, height = standOffHeight, mountType = mountType); - } - } + standOffHeight = 5; + + dimensions = boardDimensions(boardType); + boardDim = boardDimensions(boardType); + pcbDim = pcbDimensions(boardType); + + enclosureWidth = pcbDim[0] + (wall + offset) * 2; + enclosureDepth = pcbDim[1] + (wall + offset) * 2; + enclosureHeight = boardDim[2] + wall + standOffHeight + heightExtension; + + union() { + difference() { + //Main box shape + boundingBox(boardType = boardType, height = enclosureHeight, offset = wall + offset, include=PCB, cornerRadius = wall); + + translate([ 0, 0, wall]) { + //Interior of box + boundingBox(boardType = boardType, height = enclosureHeight, offset = offset, include=PCB, cornerRadius = wall); + + //Punch outs for USB and POWER + translate([0, 0, standOffHeight]) { + components(boardType = boardType, offset = 1, extension = wall + offset + 10); + } + } + + //Holes for lid clips + translate([0, enclosureDepth * 0.75 - (offset + wall), enclosureHeight]) { + translate([-offset, 0, 0]) + rotate([0, 180, 90]) clipHole(clipHeight = 10, holeDepth = wall + 0.2); + translate([offset + boardDim[0], 0, 0]) + rotate([0, 180, 270]) clipHole(clipHeight = 10, holeDepth = wall + 0.2); + } + + translate([0, enclosureDepth * 0.25 - (offset + wall), enclosureHeight]) { + translate([-offset, 0, 0]) + rotate([0, 180, 90]) clipHole(clipHeight = 10, holeDepth = wall + 0.2); + translate([offset + dimensions[0], 0, 0]) + rotate([0, 180, 270]) clipHole(clipHeight = 10, holeDepth = wall + 0.2); + } + } + translate([0, 0, wall]) { + standoffs(boardType = boardType, height = standOffHeight, mountType = mountType); + } + } } //Create a snap on lid for enclosure module enclosureLid( boardType = UNO, wall = 3, offset = 3, cornerRadius = 3, ventHoles = false) { - dimensions = boardDimensions(boardType); - boardDim = boardDimensions(boardType); - pcbDim = pcbDimensions(boardType); - - enclosureWidth = pcbDim[0] + (wall + offset) * 2; - enclosureDepth = pcbDim[1] + (wall + offset) * 2; - - difference() { - union() { - boundingBox(boardType = boardType, height = wall, offset = wall + offset, include=PCB, cornerRadius = wall); - - translate([0, 0, -wall * 0.5]) - boundingBox(boardType = boardType, height = wall * 0.5, offset = offset - 0.5, include=PCB, cornerRadius = wall); - - //Lid clips - translate([0, enclosureDepth * 0.75 - (offset + wall), 0]) { - translate([-offset, 0, 0]) - rotate([0, 180, 90]) clip(clipHeight = 10); - translate([offset + boardDim[0], 0, 0]) - rotate([0, 180, 270]) clip(clipHeight = 10); - } - - translate([0, enclosureDepth * 0.25 - (offset + wall), 0]) { - translate([-offset, 0, 0]) - rotate([0, 180, 90]) clip(clipHeight = 10); - translate([offset + dimensions[0], 0, 0]) - rotate([0, 180, 270]) clip(clipHeight = 10); - } - - } - } + dimensions = boardDimensions(boardType); + boardDim = boardDimensions(boardType); + pcbDim = pcbDimensions(boardType); + + enclosureWidth = pcbDim[0] + (wall + offset) * 2; + enclosureDepth = pcbDim[1] + (wall + offset) * 2; + + difference() { + union() { + boundingBox(boardType = boardType, height = wall, offset = wall + offset, include=PCB, cornerRadius = wall); + + translate([0, 0, -wall * 0.5]) + boundingBox(boardType = boardType, height = wall * 0.5, offset = offset - 0.5, include=PCB, cornerRadius = wall); + + //Lid clips + translate([0, enclosureDepth * 0.75 - (offset + wall), 0]) { + translate([-offset, 0, 0]) + rotate([0, 180, 90]) clip(clipHeight = 10); + translate([offset + boardDim[0], 0, 0]) + rotate([0, 180, 270]) clip(clipHeight = 10); + } + + translate([0, enclosureDepth * 0.25 - (offset + wall), 0]) { + translate([-offset, 0, 0]) + rotate([0, 180, 90]) clip(clipHeight = 10); + translate([offset + dimensions[0], 0, 0]) + rotate([0, 180, 270]) clip(clipHeight = 10); + } + + } + } } //Offset from board. Negative values are insets module boardShape( boardType = UNO, offset = 0, height = pcbHeight ) { - dimensions = boardDimensions(boardType); + dimensions = boardDimensions(boardType); - xScale = (dimensions[0] + offset * 2) / dimensions[0]; - yScale = (dimensions[1] + offset * 2) / dimensions[1]; + xScale = (dimensions[0] + offset * 2) / dimensions[0]; + yScale = (dimensions[1] + offset * 2) / dimensions[1]; - translate([-offset, -offset, 0]) - scale([xScale, yScale, 1.0]) - linear_extrude(height = height) - polygon(points = boardShapes[boardType]); + translate([-offset, -offset, 0]) + scale([xScale, yScale, 1.0]) + linear_extrude(height = height) + polygon(points = boardShapes[boardType]); } //Create a bounding box around the board @@ -207,30 +207,30 @@ PCB = 1; //Just the PCB COMPONENTS = 2; //Just the components module boundingBox(boardType = UNO, offset = 0, height = 0, cornerRadius = 0, include = BOARD) { - //What parts are included? Entire board, pcb or just components. - pos = ([boardPosition(boardType), pcbPosition(boardType), componentsPosition(boardType)])[include]; - dim = ([boardDimensions(boardType), pcbDimensions(boardType), componentsDimensions(boardType)])[include]; - - //Depending on if height is set position and dimensions will change - position = [ - pos[0] - offset, - pos[1] - offset, - (height == 0 ? pos[2] - offset : pos[2] ) - ]; - - dimensions = [ - dim[0] + offset * 2, - dim[1] + offset * 2, - (height == 0 ? dim[2] + offset * 2 : height) - ]; - - translate( position ) { - if( cornerRadius == 0 ) { - cube( dimensions ); - } else { - roundedCube( dimensions, cornerRadius=cornerRadius ); - } - } + //What parts are included? Entire board, pcb or just components. + pos = ([boardPosition(boardType), pcbPosition(boardType), componentsPosition(boardType)])[include]; + dim = ([boardDimensions(boardType), pcbDimensions(boardType), componentsDimensions(boardType)])[include]; + + //Depending on if height is set position and dimensions will change + position = [ + pos[0] - offset, + pos[1] - offset, + (height == 0 ? pos[2] - offset : pos[2] ) + ]; + + dimensions = [ + dim[0] + offset * 2, + dim[1] + offset * 2, + (height == 0 ? dim[2] + offset * 2 : height) + ]; + + translate( position ) { + if( cornerRadius == 0 ) { + cube( dimensions ); + } else { + roundedCube( dimensions, cornerRadius=cornerRadius ); + } + } } //Creates standoffs for different boards @@ -238,36 +238,36 @@ TAPHOLE = 0; PIN = 1; module standoffs( - boardType = UNO, - height = 10, - topRadius = mountingHoleRadius + 1, - bottomRadius = mountingHoleRadius + 2, - holeRadius = mountingHoleRadius, - mountType = TAPHOLE - ) { - - holePlacement(boardType = boardType) - union() { - difference() { - cylinder(r1 = bottomRadius, r2 = topRadius, h = height, $fn=32); - if( mountType == TAPHOLE ) { - cylinder(r = holeRadius, h = height * 4, center = true, $fn=32); - } - } - if( mountType == PIN ) { - translate([0, 0, height - 1]) - pintack( h=pcbHeight + 3, r = holeRadius, lh=3, lt=1, bh=1, br=topRadius ); - } - } + boardType = UNO, + height = 10, + topRadius = mountingHoleRadius + 1, + bottomRadius = mountingHoleRadius + 2, + holeRadius = mountingHoleRadius, + mountType = TAPHOLE + ) { + + holePlacement(boardType = boardType) + union() { + difference() { + cylinder(r1 = bottomRadius, r2 = topRadius, h = height, $fn=32); + if( mountType == TAPHOLE ) { + cylinder(r = holeRadius, h = height * 4, center = true, $fn=32); + } + } + if( mountType == PIN ) { + translate([0, 0, height - 1]) + pintack( h=pcbHeight + 3, r = holeRadius, lh=3, lt=1, bh=1, br=topRadius ); + } + } } //This is used for placing the mounting holes and for making standoffs //child elements will be centered on that chosen boards mounting hole centers module holePlacement(boardType = UNO ) { - for(i = boardHoles[boardType] ) { - translate(i) - children(0); - } + for(i = boardHoles[boardType] ) { + translate(i) + children(0); + } } //Places components on board @@ -284,74 +284,77 @@ POWER = 3; RJ45 = 4; module components( boardType = UNO, component = ALL, extension = 0, offset = 0 ) { - translate([0, 0, pcbHeight]) { - for( i = [0:len(components[boardType]) - 1] ){ - if( components[boardType][i][3] == component || component == ALL) { - //Calculates position + adjustment for offset and extention - position = components[boardType][i][0] - - (([1,1,1] - components[boardType][i][2]) * offset) - + [ min(components[boardType][i][2][0],0), min(components[boardType][i][2][1],0), min(components[boardType][i][2][2],0) ] - * extension; - //Calculates the full box size including offset and extention - dimensions = components[boardType][i][1] - + ((components[boardType][i][2] * [1,1,1]) - * components[boardType][i][2]) * extension - + ([1,1,1] - components[boardType][i][2]) * offset * 2; - translate( position ) color( components[boardType][i][4] ) - cube( dimensions ); - } - } - } + translate([0, 0, pcbHeight]) { + for( i = [0:len(components[boardType]) - 1] ){ + if( components[boardType][i][3] == component || component == ALL) { + let ( + //Calculates position + adjustment for offset and extention + position = components[boardType][i][0] - (([1,1,1] - components[boardType][i][2]) * offset) + + [ min(components[boardType][i][2][0],0), + min(components[boardType][i][2][1],0), + min(components[boardType][i][2][2],0) ] * extension, + //Calculates the full box size including offset and extention + dimensions = components[boardType][i][1] + + ((components[boardType][i][2] * [1,1,1]) + * components[boardType][i][2]) * extension + + ([1,1,1] - components[boardType][i][2]) * offset * 2 + ) { + translate( position ) color( components[boardType][i][4] ) + cube( dimensions ); + } + } + } + } } module roundedCube( dimensions = [10,10,10], cornerRadius = 1, faces=32 ) { - hull() cornerCylinders( dimensions = dimensions, cornerRadius = cornerRadius, faces=faces ); + hull() cornerCylinders( dimensions = dimensions, cornerRadius = cornerRadius, faces=faces ); } module cornerCylinders( dimensions = [10,10,10], cornerRadius = 1, faces=32 ) { - translate([ cornerRadius, cornerRadius, 0]) { - cylinder( r = cornerRadius, $fn = faces, h = dimensions[2] ); - translate([dimensions[0] - cornerRadius * 2, 0, 0]) cylinder( r = cornerRadius, $fn = faces, h = dimensions[2] ); - translate([0, dimensions[1] - cornerRadius * 2, 0]) { - cylinder( r = cornerRadius, $fn = faces, h = dimensions[2] ); - translate([dimensions[0] - cornerRadius * 2, 0, 0]) cylinder( r = cornerRadius, $fn = faces, h = dimensions[2] ); - } - } + translate([ cornerRadius, cornerRadius, 0]) { + cylinder( r = cornerRadius, $fn = faces, h = dimensions[2] ); + translate([dimensions[0] - cornerRadius * 2, 0, 0]) cylinder( r = cornerRadius, $fn = faces, h = dimensions[2] ); + translate([0, dimensions[1] - cornerRadius * 2, 0]) { + cylinder( r = cornerRadius, $fn = faces, h = dimensions[2] ); + translate([dimensions[0] - cornerRadius * 2, 0, 0]) cylinder( r = cornerRadius, $fn = faces, h = dimensions[2] ); + } + } } //Create a clip that snapps into a clipHole module clip(clipWidth = 5, clipDepth = 5, clipHeight = 5, lipDepth = 1.5, lipHeight = 3) { - translate([-clipWidth/2,-(clipDepth-lipDepth),0]) rotate([90, 0, 90]) - linear_extrude(height = clipWidth, convexity = 10) - polygon( points=[ [0, 0], - [clipDepth - lipDepth, 0], - [clipDepth - lipDepth, clipHeight - lipHeight], - [clipDepth - 0.25, clipHeight - lipHeight], - [clipDepth, clipHeight - lipHeight + 0.25], - [clipDepth - lipDepth * 0.8, clipHeight], - [(clipDepth - lipDepth) * 0.3, clipHeight] - ], - paths=[[0,1,2,3,4,5,6,7]] - ); + translate([-clipWidth/2,-(clipDepth-lipDepth),0]) rotate([90, 0, 90]) + linear_extrude(height = clipWidth, convexity = 10) + polygon( points=[ [0, 0], + [clipDepth - lipDepth, 0], + [clipDepth - lipDepth, clipHeight - lipHeight], + [clipDepth - 0.25, clipHeight - lipHeight], + [clipDepth, clipHeight - lipHeight + 0.25], + [clipDepth - lipDepth * 0.8, clipHeight], + [(clipDepth - lipDepth) * 0.3, clipHeight] + ], + paths=[[0,1,2,3,4,5,6,7]] + ); } //Hole for clip module clipHole(clipWidth = 5, clipDepth = 5, clipHeight = 5, lipDepth = 1.5, lipHeight = 3, holeDepth = 5) { - offset = 0.1; - translate([-clipWidth/2,-(clipDepth-lipDepth),0]) - translate([-offset, clipDepth - lipDepth-offset, clipHeight - lipHeight - offset]) - cube( [clipWidth + offset * 2, holeDepth, lipHeight + offset * 2] ); + offset = 0.1; + translate([-clipWidth/2,-(clipDepth-lipDepth),0]) + translate([-offset, clipDepth - lipDepth-offset, clipHeight - lipHeight - offset]) + cube( [clipWidth + offset * 2, holeDepth, lipHeight + offset * 2] ); } module mountingHole(screwHeadRad = woodscrewHeadRad, screwThreadRad = woodscrewThreadRad, screwHeadHeight = woodscrewHeadHeight, holeDepth = 10) { - union() { - translate([0, 0, -0.01]) - cylinder( r = screwThreadRad, h = 1.02, $fn = 32 ); - translate([0, 0, 1]) - cylinder( r1 = screwThreadRad, r2 = screwHeadRad, h = screwHeadHeight, $fn = 32 ); - translate([0, 0, screwHeadHeight - 0.01 + 1]) - cylinder( r = screwHeadRad, h = holeDepth - screwHeadHeight + 0.02, $fn = 32 ); - } + union() { + translate([0, 0, -0.01]) + cylinder( r = screwThreadRad, h = 1.02, $fn = 32 ); + translate([0, 0, 1]) + cylinder( r1 = screwThreadRad, r2 = screwHeadRad, h = screwHeadHeight, $fn = 32 ); + translate([0, 0, screwHeadHeight - 0.01 + 1]) + cylinder( r = screwHeadRad, h = holeDepth - screwHeadHeight + 0.02, $fn = 32 ); + } } /******************************** UTILITY FUNCTIONS *******************************/ @@ -361,27 +364,27 @@ function sides( diagonal ) = sqrt(diagonal * diagonal / 2); //Return the minimum values between two vectors of either length 2 or 3. 2D Vectors are treated as 3D vectors who final value is 0. function minVec( vector1, vector2 ) = - [min(vector1[0], vector2[0]), min(vector1[1], vector2[1]), min((vector1[2] == undef ? 0 : vector1[2]), (vector2[2] == undef ? 0 : vector2[2]) )]; + [min(vector1[0], vector2[0]), min(vector1[1], vector2[1]), min((vector1[2] == undef ? 0 : vector1[2]), (vector2[2] == undef ? 0 : vector2[2]) )]; //Return the maximum values between two vectors of either length 2 or 3. 2D Vectors are treated as 3D vectors who final value is 0. function maxVec( vector1, vector2 ) = - [max(vector1[0], vector2[0]), max(vector1[1], vector2[1]), max((vector1[2] == undef ? 0 : vector1[2]), (vector2[2] == undef ? 0 : vector2[2]) )]; + [max(vector1[0], vector2[0]), max(vector1[1], vector2[1]), max((vector1[2] == undef ? 0 : vector1[2]), (vector2[2] == undef ? 0 : vector2[2]) )]; //Determine the minimum point on a component in a list of components function minCompPoint( list, index = 0, minimum = [10000000, 10000000, 10000000] ) = - index >= len(list) ? minimum : minCompPoint( list, index + 1, minVec( minimum, list[index][0] )); + index >= len(list) ? minimum : minCompPoint( list, index + 1, minVec( minimum, list[index][0] )); //Determine the maximum point on a component in a list of components function maxCompPoint( list, index = 0, maximum = [-10000000, -10000000, -10000000] ) = - index >= len(list) ? maximum : maxCompPoint( list, index + 1, maxVec( maximum, list[index][0] + list[index][1])); + index >= len(list) ? maximum : maxCompPoint( list, index + 1, maxVec( maximum, list[index][0] + list[index][1])); //Determine the minimum point in a list of points function minPoint( list, index = 0, minimum = [10000000, 10000000, 10000000] ) = - index >= len(list) ? minimum : minPoint( list, index + 1, minVec( minimum, list[index] )); + index >= len(list) ? minimum : minPoint( list, index + 1, minVec( minimum, list[index] )); //Determine the maximum point in a list of points function maxPoint( list, index = 0, maximum = [-10000000, -10000000, -10000000] ) = - index >= len(list) ? maximum : maxPoint( list, index + 1, maxVec( maximum, list[index] )); + index >= len(list) ? maximum : maxPoint( list, index + 1, maxVec( maximum, list[index] )); //Returns the pcb position and dimensions function pcbPosition(boardType = UNO) = minPoint(boardShapes[boardType]); @@ -393,10 +396,10 @@ function componentsDimensions(boardType = UNO) = maxCompPoint(components[boardTy //Returns the position and dimensions of the box containing the pcb board function boardPosition(boardType = UNO) = - minCompPoint([[pcbPosition(boardType), pcbDimensions(boardType)], [componentsPosition(boardType), componentsDimensions(boardType)]]); + minCompPoint([[pcbPosition(boardType), pcbDimensions(boardType)], [componentsPosition(boardType), componentsDimensions(boardType)]]); function boardDimensions(boardType = UNO) = - maxCompPoint([[pcbPosition(boardType), pcbDimensions(boardType)], [componentsPosition(boardType), componentsDimensions(boardType)]]) - - minCompPoint([[pcbPosition(boardType), pcbDimensions(boardType)], [componentsPosition(boardType), componentsDimensions(boardType)]]); + maxCompPoint([[pcbPosition(boardType), pcbDimensions(boardType)], [componentsPosition(boardType), componentsDimensions(boardType)]]) + - minCompPoint([[pcbPosition(boardType), pcbDimensions(boardType)], [componentsPosition(boardType), componentsDimensions(boardType)]]); /******************************* BOARD SPECIFIC DATA ******************************/ //Board IDs @@ -431,178 +434,178 @@ arduinoHeight = 11 + pcbHeight + 0; //Duemilanove, Diecimila, NG and earlier ngHoles = [ - [ 2.54, 15.24 ], - [ 17.78, 66.04 ], - [ 45.72, 66.04 ] - ]; + [ 2.54, 15.24 ], + [ 17.78, 66.04 ], + [ 45.72, 66.04 ] + ]; //Uno, Leonardo holes unoHoles = [ - [ 2.54, 15.24 ], - [ 17.78, 66.04 ], - [ 45.72, 66.04 ], - [ 50.8, 13.97 ] - ]; + [ 2.54, 15.24 ], + [ 17.78, 66.04 ], + [ 45.72, 66.04 ], + [ 50.8, 13.97 ] + ]; //Due and Mega 2560 dueHoles = [ - [ 2.54, 15.24 ], - [ 17.78, 66.04 ], - [ 45.72, 66.04 ], - [ 50.8, 13.97 ], - [ 2.54, 90.17 ], - [ 50.8, 96.52 ] - ]; + [ 2.54, 15.24 ], + [ 17.78, 66.04 ], + [ 45.72, 66.04 ], + [ 50.8, 13.97 ], + [ 2.54, 90.17 ], + [ 50.8, 96.52 ] + ]; // Original Mega holes megaHoles = [ - [ 2.54, 15.24 ], - [ 50.8, 13.97 ], - [ 2.54, 90.17 ], - [ 50.8, 96.52 ] - ]; + [ 2.54, 15.24 ], + [ 50.8, 13.97 ], + [ 2.54, 90.17 ], + [ 50.8, 96.52 ] + ]; boardHoles = [ - ngHoles, //NG - ngHoles, //Diecimila - ngHoles, //Duemilanove - unoHoles, //Uno - unoHoles, //Leonardo - megaHoles, //Mega - dueHoles, //Mega 2560 - dueHoles, //Due - 0, //Yun - 0, //Intel Galileo - 0, //Tre - unoHoles //Ethernet - ]; + ngHoles, //NG + ngHoles, //Diecimila + ngHoles, //Duemilanove + unoHoles, //Uno + unoHoles, //Leonardo + megaHoles, //Mega + dueHoles, //Mega 2560 + dueHoles, //Due + 0, //Yun + 0, //Intel Galileo + 0, //Tre + unoHoles //Ethernet + ]; /********************************** BOARD SHAPES **********************************/ ngBoardShape = [ - [ 0.0, 0.0 ], - [ 53.34, 0.0 ], - [ 53.34, 66.04 ], - [ 50.8, 66.04 ], - [ 48.26, 68.58 ], - [ 15.24, 68.58 ], - [ 12.7, 66.04 ], - [ 1.27, 66.04 ], - [ 0.0, 64.77 ] - ]; + [ 0.0, 0.0 ], + [ 53.34, 0.0 ], + [ 53.34, 66.04 ], + [ 50.8, 66.04 ], + [ 48.26, 68.58 ], + [ 15.24, 68.58 ], + [ 12.7, 66.04 ], + [ 1.27, 66.04 ], + [ 0.0, 64.77 ] + ]; megaBoardShape = [ - [ 0.0, 0.0 ], - [ 53.34, 0.0 ], - [ 53.34, 99.06 ], - [ 52.07, 99.06 ], - [ 49.53, 101.6 ], - [ 15.24, 101.6 ], - [ 12.7, 99.06 ], - [ 2.54, 99.06 ], - [ 0.0, 96.52 ] - ]; - -boardShapes = [ - ngBoardShape, //NG - ngBoardShape, //Diecimila - ngBoardShape, //Duemilanove - ngBoardShape, //Uno - ngBoardShape, //Leonardo - megaBoardShape, //Mega - megaBoardShape, //Mega 2560 - megaBoardShape, //Due - 0, //Yun - 0, //Intel Galileo - 0, //Tre - ngBoardShape //Ethernet - ]; + [ 0.0, 0.0 ], + [ 53.34, 0.0 ], + [ 53.34, 99.06 ], + [ 52.07, 99.06 ], + [ 49.53, 101.6 ], + [ 15.24, 101.6 ], + [ 12.7, 99.06 ], + [ 2.54, 99.06 ], + [ 0.0, 96.52 ] + ]; + +boardShapes = [ + ngBoardShape, //NG + ngBoardShape, //Diecimila + ngBoardShape, //Duemilanove + ngBoardShape, //Uno + ngBoardShape, //Leonardo + megaBoardShape, //Mega + megaBoardShape, //Mega 2560 + megaBoardShape, //Due + 0, //Yun + 0, //Intel Galileo + 0, //Tre + ngBoardShape //Ethernet + ]; /*********************************** COMPONENTS ***********************************/ //Component data. //[position, dimensions, direction(which way would a cable attach), type(header, usb, etc.), color] ngComponents = [ - [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black" ], - [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[49.53, 49.53, 0], [headerWidth, headerWidth * 6, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[9.34, -6.5, 0],[12, 16, 11],[0, -1, 0], USB, "LightGray" ], - [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] - ]; + [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black" ], + [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[49.53, 49.53, 0], [headerWidth, headerWidth * 6, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[9.34, -6.5, 0],[12, 16, 11],[0, -1, 0], USB, "LightGray" ], + [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] + ]; etherComponents = [ - [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black" ], - [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[49.53, 49.53, 0], [headerWidth, headerWidth * 6, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[7.20, -4.4, 0],[16, 22, 13],[0, -1, 0], RJ45, "Green" ], - [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] - ]; + [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black" ], + [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[49.53, 49.53, 0], [headerWidth, headerWidth * 6, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[7.20, -4.4, 0],[16, 22, 13],[0, -1, 0], RJ45, "Green" ], + [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] + ]; leonardoComponents = [ - [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black" ], - [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[49.53, 49.53, 0], [headerWidth, headerWidth * 6, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[11.5, -1.1, 0],[7.5, 5.9, 3],[0, -1, 0], USB, "LightGray" ], - [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] - ]; + [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black" ], + [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[49.53, 49.53, 0], [headerWidth, headerWidth * 6, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[11.5, -1.1, 0],[7.5, 5.9, 3],[0, -1, 0], USB, "LightGray" ], + [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] + ]; megaComponents = [ - [[1.27, 22.86, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[1.27, 67.31, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[49.53, 31.75, 0], [headerWidth, headerWidth * 6, headerHeight ], [0, 0, 1], HEADER_F, "Black"], - [[49.53, 49.53, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[49.53, 72.39, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[1.27, 92.71, 0], [headerWidth * 18, headerWidth * 2, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[9.34, -6.5, 0],[12, 16, 11],[0, -1, 0], USB, "LightGray"], - [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] - ]; + [[1.27, 22.86, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[1.27, 67.31, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[49.53, 31.75, 0], [headerWidth, headerWidth * 6, headerHeight ], [0, 0, 1], HEADER_F, "Black"], + [[49.53, 49.53, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[49.53, 72.39, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[1.27, 92.71, 0], [headerWidth * 18, headerWidth * 2, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[9.34, -6.5, 0],[12, 16, 11],[0, -1, 0], USB, "LightGray"], + [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] + ]; mega2560Components = [ - [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black" ], - [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black" ], - [[1.27, 67.31, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black" ], - [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], - [[49.53, 49.53, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black" ], - [[49.53, 72.39, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black" ], - [[1.27, 92.71, 0], [headerWidth * 18, headerWidth * 2, headerHeight], [0, 0, 1], HEADER_F, "Black" ], - [[9.34, -6.5, 0],[12, 16, 11],[0, -1, 0], USB, "LightGray" ], - [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] - ]; + [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black" ], + [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black" ], + [[1.27, 67.31, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black" ], + [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black" ], + [[49.53, 49.53, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black" ], + [[49.53, 72.39, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black" ], + [[1.27, 92.71, 0], [headerWidth * 18, headerWidth * 2, headerHeight], [0, 0, 1], HEADER_F, "Black" ], + [[9.34, -6.5, 0],[12, 16, 11],[0, -1, 0], USB, "LightGray" ], + [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] + ]; dueComponents = [ - [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[1.27, 67.31, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black"], - [[49.53, 49.53, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[49.53, 72.39, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[1.27, 92.71, 0], [headerWidth * 18, headerWidth * 2, headerHeight], [0, 0, 1], HEADER_F, "Black"], - [[11.5, -1.1, 0], [7.5, 5.9, 3], [0, -1, 0], USB, "LightGray" ], - [[27.365, -1.1, 0], [7.5, 5.9, 3], [0, -1, 0], USB, "LightGray" ], - [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] - ]; - + [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[1.27, 44.45, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[1.27, 67.31, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[49.53, 26.67, 0], [headerWidth, headerWidth * 8, headerHeight ], [0, 0, 1], HEADER_F, "Black"], + [[49.53, 49.53, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[49.53, 72.39, 0], [headerWidth, headerWidth * 8, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[1.27, 92.71, 0], [headerWidth * 18, headerWidth * 2, headerHeight], [0, 0, 1], HEADER_F, "Black"], + [[11.5, -1.1, 0], [7.5, 5.9, 3], [0, -1, 0], USB, "LightGray" ], + [[27.365, -1.1, 0], [7.5, 5.9, 3], [0, -1, 0], USB, "LightGray" ], + [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] + ]; + components = [ - ngComponents, //NG - ngComponents, //Diecimila - ngComponents, //Duemilanove - ngComponents, //Uno - leonardoComponents, //Leonardo - megaComponents, //Mega - mega2560Components, //Mega 2560 - dueComponents, //Due - 0, //Yun - 0, //Intel Galileo - 0, //Tre - etherComponents //Ethernet - ]; + ngComponents, //NG + ngComponents, //Diecimila + ngComponents, //Duemilanove + ngComponents, //Uno + leonardoComponents, //Leonardo + megaComponents, //Mega + mega2560Components, //Mega 2560 + dueComponents, //Due + 0, //Yun + 0, //Intel Galileo + 0, //Tre + etherComponents //Ethernet + ]; /****************************** NON-BOARD PARAMETERS ******************************/ //Mounting holes -woodscrewHeadRad = 4.6228; //Number 8 wood screw head radius -woodscrewThreadRad = 2.1336; //Number 8 wood screw thread radius -woodscrewHeadHeight = 2.8448; //Number 8 wood screw head height +woodscrewHeadRad = 4.6228; //Number 8 wood screw head radius +woodscrewThreadRad = 2.1336; //Number 8 wood screw thread radius +woodscrewHeadHeight = 2.8448; //Number 8 wood screw head height \ No newline at end of file diff --git a/pins.scad b/pins.scad new file mode 100644 index 0000000..5159567 --- /dev/null +++ b/pins.scad @@ -0,0 +1,165 @@ +// Pin Connectors V3 +// Tony Buser +// Modified by Emmett Lalish + +object=0;//[0:pin,1:pinpeg,2:pinhole] +length=20; +diameter=8; +//Only affects pinhole +hole_twist=0;//[0:free,1:fixed] +//Only affects pinhole +hole_friction=0;//[0:loose,1:tight] +//Radial gap to help pins fit into tight holes +pin_tolerance=0.2; +//Extra gap to make loose hole +loose=0.3; +lip_height=3; +lip_thickness=1; +hf=hole_friction==0 ? false : true; +ht=hole_twist==0 ? false : true; + +if(object==0)pin(h=length,r=diameter/2,lh=lip_height,lt=lip_thickness,t=pin_tolerance); +if(object==1)pinpeg(h=length,r=diameter/2,lh=lip_height,lt=lip_thickness,t=pin_tolerance); +if(object==2)pinhole(h=length,r=diameter/2,lh=lip_height,lt=lip_thickness,t=loose, + tight=hf,fixed=ht); + +module test() { + tolerance = 0.3; + + translate([-12, 12, 0]) pinpeg(h=20); + translate([12, 12, 0]) pintack(h=10); + + difference() { + union() { + translate([0, -12, 2.5]) cube(size = [59, 20, 5], center = true); + translate([24, -12, 7.5]) cube(size = [12, 20, 15], center = true); + } + translate([-24, -12, 0]) pinhole(h=5, t=tolerance); + translate([-12, -12, 0]) pinhole(h=5, t=tolerance, tight=false); + translate([0, -12, 0]) pinhole(h=10, t=tolerance); + translate([12, -12, 0]) pinhole(h=10, t=tolerance, tight=false); + translate([24, -12, 15]) rotate([0, 180, 0]) pinhole(h=10, t=tolerance); + } +} + +module pinhole(h=10, r=4, lh=3, lt=1, t=0.3, tight=true, fixed=false) { + // h = shaft height + // r = shaft radius + // lh = lip height + // lt = lip thickness + // t = extra tolerance for loose fit + // tight = set to false if you want a joint that spins easily + // fixed = set to true so pins can't spin + +intersection(){ + union() { + if (tight == true || fixed == true) { + pin_solid(h, r, lh, lt); + translate([0,0,-t/2])cylinder(h=h+t, r=r, $fn=30); + } else { + pin_solid(h, r+t/2, lh, lt); + translate([0,0,-t/2])cylinder(h=h+t, r=r+t/2, $fn=30); + } + + + // widen the entrance hole to make insertion easier + //translate([0, 0, -0.1]) cylinder(h=lh/3, r2=r, r1=r+(t/2)+(lt/2),$fn=30); + } + if (fixed == true) { + translate([-r*2, -r*0.75, -1])cube([r*4, r*1.5, h+2]); + } +}} + +module pin(h=10, r=4, lh=3, lt=1, t=0.2, side=false) { + // h = shaft height + // r = shaft radius + // lh = lip height + // lt = lip thickness + // side = set to true if you want it printed horizontally + + if (side) { + pin_horizontal(h, r, lh, lt, t); + } else { + pin_vertical(h, r, lh, lt, t); + } +} + +module pintack(h=10, r=4, lh=3, lt=1, t=0.2, bh=3, br=8.75) { + // bh = base_height + // br = base_radius + + union() { + cylinder(h=bh, r=br); + translate([0, 0, bh]) pin(h, r, lh, lt, t); + } +} + +module pinpeg(h=20, r=4, lh=3, lt=1, t=0.2) { + union() { + translate([0,-0.05, 0]) pin(h/2+0.1, r, lh, lt, t, side=true); + translate([0,0.05, 0]) rotate([0, 0, 180]) pin(h/2+0.1, r, lh, lt, t, side=true); + } +} + +// just call pin instead, I made this module because it was easier to do the rotation option this way +// since openscad complains of recursion if I did it all in one module +module pin_vertical(h=10, r=4, lh=3, lt=1, t=0.2) { + // h = shaft height + // r = shaft radius + // lh = lip height + // lt = lip thickness + + difference() { + pin_solid(h, r-t/2, lh, lt); + + // center cut + translate([-lt*3/2, -(r*2+lt*2)/2, h/5+lt*3/2]) cube([lt*3, r*2+lt*2, h]); + //translate([0, 0, h/4]) cylinder(h=h+lh, r=r/2.5, $fn=20); + // center curve + translate([0, 0, h/5+lt*3/2]) rotate([90, 0, 0]) cylinder(h=r*2, r=lt*3/2, center=true, $fn=20); + + // side cuts + translate([-r*2, -r-r*0.75+t/2, -1]) cube([r*4, r, h+2]); + translate([-r*2, r*0.75-t/2, -1]) cube([r*4, r, h+2]); + } +} + +// call pin with side=true instead of this +module pin_horizontal(h=10, r=4, lh=3, lt=1, t=0.2) { + // h = shaft height + // r = shaft radius + // lh = lip height + // lt = lip thickness + translate([0, 0, r*0.75-t/2]) rotate([-90, 0, 0]) pin_vertical(h, r, lh, lt, t); +} + +// this is mainly to make the pinhole module easier +module pin_solid(h=10, r=4, lh=3, lt=1) { + union() { + // shaft + cylinder(h=h-lh, r=r, $fn=30); + // lip + // translate([0, 0, h-lh]) cylinder(h=lh*0.25, r1=r, r2=r+(lt/2), $fn=30); + // translate([0, 0, h-lh+lh*0.25]) cylinder(h=lh*0.25, r2=r, r1=r+(lt/2), $fn=30); + // translate([0, 0, h-lh+lh*0.50]) cylinder(h=lh*0.50, r1=r, r2=r-(lt/2), $fn=30); + + // translate([0, 0, h-lh]) cylinder(h=lh*0.50, r1=r, r2=r+(lt/2), $fn=30); + // translate([0, 0, h-lh+lh*0.50]) cylinder(h=lh*0.50, r1=r+(lt/2), r2=r-(lt/3), $fn=30); + + translate([0, 0, h-lh]) cylinder(h=lh*0.25, r1=r, r2=r+(lt/2), $fn=30); + translate([0, 0, h-lh+lh*0.25]) cylinder(h=lh*0.25, r=r+(lt/2), $fn=30); + translate([0, 0, h-lh+lh*0.50]) cylinder(h=lh*0.50, r1=r+(lt/2), r2=r-(lt/2), $fn=30); + + // translate([0, 0, h-lh]) cylinder(h=lh, r1=r+(lt/2), r2=1, $fn=30); + // translate([0, 0, h-lh-lt/2]) cylinder(h=lt/2, r1=r, r2=r+(lt/2), $fn=30); + } +} + +module pinshaft(h=10, r=4, t=0.2, side=false){ +flip=side ? 1 : 0; +translate(flip*[0,h/2,r*0.75-t/2])rotate(flip*[90,0,0]) +intersection(){ + cylinder(h=h, r=r-t/2, $fn=30); + translate([-r*2, -r*0.75+t/2, -1])cube([r*4, r*1.5-t, h+2]); +} +} \ No newline at end of file From c11728751080286276b76c102c98b394225a6512 Mon Sep 17 00:00:00 2001 From: jwhevans <45521229+jwhevans@users.noreply.github.com> Date: Wed, 26 Feb 2020 14:45:43 -0600 Subject: [PATCH 2/3] Update to address deprecated code Deprecated: assign() -> replaced with let() Deprecated: child() -> replaced with children() --- arduino.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arduino.scad b/arduino.scad index 4b14fc6..7660b60 100644 --- a/arduino.scad +++ b/arduino.scad @@ -20,7 +20,7 @@ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -include +use //Constructs a roughed out arduino board //Current only USB, power and headers From 6dc9704f417325284b580472acee0f6d10aeb46b Mon Sep 17 00:00:00 2001 From: jwhevans <45521229+jwhevans@users.noreply.github.com> Date: Wed, 26 Feb 2020 14:46:32 -0600 Subject: [PATCH 3/3] Delete pins.scad --- pins.scad | 165 ------------------------------------------------------ 1 file changed, 165 deletions(-) delete mode 100644 pins.scad diff --git a/pins.scad b/pins.scad deleted file mode 100644 index 5159567..0000000 --- a/pins.scad +++ /dev/null @@ -1,165 +0,0 @@ -// Pin Connectors V3 -// Tony Buser -// Modified by Emmett Lalish - -object=0;//[0:pin,1:pinpeg,2:pinhole] -length=20; -diameter=8; -//Only affects pinhole -hole_twist=0;//[0:free,1:fixed] -//Only affects pinhole -hole_friction=0;//[0:loose,1:tight] -//Radial gap to help pins fit into tight holes -pin_tolerance=0.2; -//Extra gap to make loose hole -loose=0.3; -lip_height=3; -lip_thickness=1; -hf=hole_friction==0 ? false : true; -ht=hole_twist==0 ? false : true; - -if(object==0)pin(h=length,r=diameter/2,lh=lip_height,lt=lip_thickness,t=pin_tolerance); -if(object==1)pinpeg(h=length,r=diameter/2,lh=lip_height,lt=lip_thickness,t=pin_tolerance); -if(object==2)pinhole(h=length,r=diameter/2,lh=lip_height,lt=lip_thickness,t=loose, - tight=hf,fixed=ht); - -module test() { - tolerance = 0.3; - - translate([-12, 12, 0]) pinpeg(h=20); - translate([12, 12, 0]) pintack(h=10); - - difference() { - union() { - translate([0, -12, 2.5]) cube(size = [59, 20, 5], center = true); - translate([24, -12, 7.5]) cube(size = [12, 20, 15], center = true); - } - translate([-24, -12, 0]) pinhole(h=5, t=tolerance); - translate([-12, -12, 0]) pinhole(h=5, t=tolerance, tight=false); - translate([0, -12, 0]) pinhole(h=10, t=tolerance); - translate([12, -12, 0]) pinhole(h=10, t=tolerance, tight=false); - translate([24, -12, 15]) rotate([0, 180, 0]) pinhole(h=10, t=tolerance); - } -} - -module pinhole(h=10, r=4, lh=3, lt=1, t=0.3, tight=true, fixed=false) { - // h = shaft height - // r = shaft radius - // lh = lip height - // lt = lip thickness - // t = extra tolerance for loose fit - // tight = set to false if you want a joint that spins easily - // fixed = set to true so pins can't spin - -intersection(){ - union() { - if (tight == true || fixed == true) { - pin_solid(h, r, lh, lt); - translate([0,0,-t/2])cylinder(h=h+t, r=r, $fn=30); - } else { - pin_solid(h, r+t/2, lh, lt); - translate([0,0,-t/2])cylinder(h=h+t, r=r+t/2, $fn=30); - } - - - // widen the entrance hole to make insertion easier - //translate([0, 0, -0.1]) cylinder(h=lh/3, r2=r, r1=r+(t/2)+(lt/2),$fn=30); - } - if (fixed == true) { - translate([-r*2, -r*0.75, -1])cube([r*4, r*1.5, h+2]); - } -}} - -module pin(h=10, r=4, lh=3, lt=1, t=0.2, side=false) { - // h = shaft height - // r = shaft radius - // lh = lip height - // lt = lip thickness - // side = set to true if you want it printed horizontally - - if (side) { - pin_horizontal(h, r, lh, lt, t); - } else { - pin_vertical(h, r, lh, lt, t); - } -} - -module pintack(h=10, r=4, lh=3, lt=1, t=0.2, bh=3, br=8.75) { - // bh = base_height - // br = base_radius - - union() { - cylinder(h=bh, r=br); - translate([0, 0, bh]) pin(h, r, lh, lt, t); - } -} - -module pinpeg(h=20, r=4, lh=3, lt=1, t=0.2) { - union() { - translate([0,-0.05, 0]) pin(h/2+0.1, r, lh, lt, t, side=true); - translate([0,0.05, 0]) rotate([0, 0, 180]) pin(h/2+0.1, r, lh, lt, t, side=true); - } -} - -// just call pin instead, I made this module because it was easier to do the rotation option this way -// since openscad complains of recursion if I did it all in one module -module pin_vertical(h=10, r=4, lh=3, lt=1, t=0.2) { - // h = shaft height - // r = shaft radius - // lh = lip height - // lt = lip thickness - - difference() { - pin_solid(h, r-t/2, lh, lt); - - // center cut - translate([-lt*3/2, -(r*2+lt*2)/2, h/5+lt*3/2]) cube([lt*3, r*2+lt*2, h]); - //translate([0, 0, h/4]) cylinder(h=h+lh, r=r/2.5, $fn=20); - // center curve - translate([0, 0, h/5+lt*3/2]) rotate([90, 0, 0]) cylinder(h=r*2, r=lt*3/2, center=true, $fn=20); - - // side cuts - translate([-r*2, -r-r*0.75+t/2, -1]) cube([r*4, r, h+2]); - translate([-r*2, r*0.75-t/2, -1]) cube([r*4, r, h+2]); - } -} - -// call pin with side=true instead of this -module pin_horizontal(h=10, r=4, lh=3, lt=1, t=0.2) { - // h = shaft height - // r = shaft radius - // lh = lip height - // lt = lip thickness - translate([0, 0, r*0.75-t/2]) rotate([-90, 0, 0]) pin_vertical(h, r, lh, lt, t); -} - -// this is mainly to make the pinhole module easier -module pin_solid(h=10, r=4, lh=3, lt=1) { - union() { - // shaft - cylinder(h=h-lh, r=r, $fn=30); - // lip - // translate([0, 0, h-lh]) cylinder(h=lh*0.25, r1=r, r2=r+(lt/2), $fn=30); - // translate([0, 0, h-lh+lh*0.25]) cylinder(h=lh*0.25, r2=r, r1=r+(lt/2), $fn=30); - // translate([0, 0, h-lh+lh*0.50]) cylinder(h=lh*0.50, r1=r, r2=r-(lt/2), $fn=30); - - // translate([0, 0, h-lh]) cylinder(h=lh*0.50, r1=r, r2=r+(lt/2), $fn=30); - // translate([0, 0, h-lh+lh*0.50]) cylinder(h=lh*0.50, r1=r+(lt/2), r2=r-(lt/3), $fn=30); - - translate([0, 0, h-lh]) cylinder(h=lh*0.25, r1=r, r2=r+(lt/2), $fn=30); - translate([0, 0, h-lh+lh*0.25]) cylinder(h=lh*0.25, r=r+(lt/2), $fn=30); - translate([0, 0, h-lh+lh*0.50]) cylinder(h=lh*0.50, r1=r+(lt/2), r2=r-(lt/2), $fn=30); - - // translate([0, 0, h-lh]) cylinder(h=lh, r1=r+(lt/2), r2=1, $fn=30); - // translate([0, 0, h-lh-lt/2]) cylinder(h=lt/2, r1=r, r2=r+(lt/2), $fn=30); - } -} - -module pinshaft(h=10, r=4, t=0.2, side=false){ -flip=side ? 1 : 0; -translate(flip*[0,h/2,r*0.75-t/2])rotate(flip*[90,0,0]) -intersection(){ - cylinder(h=h, r=r-t/2, $fn=30); - translate([-r*2, -r*0.75+t/2, -1])cube([r*4, r*1.5-t, h+2]); -} -} \ No newline at end of file