Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added an epsilon to the inside diameter of the rings to prevent bolts through holes resulting in 'WARNING: CSG normalisation resulted in empty tree'; switched to using cubes for hexagons; added 626 bearing size; #16

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bearing.scad
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function bearingDimensions(model) =
model == 608 ? [8*mm, 22*mm, 7*mm]:
model == 623 ? [3*mm, 10*mm, 4*mm]:
model == 624 ? [4*mm, 13*mm, 5*mm]:
model == 626 ? [6*mm, 19*mm, 6*mm]:
model == 627 ? [7*mm, 22*mm, 7*mm]:
model == 688 ? [8*mm, 16*mm, 4*mm]:
model == 698 ? [8*mm, 19*mm, 6*mm]:
Expand Down Expand Up @@ -84,7 +85,7 @@ module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, outline=false,
cylinder(r=od/2, h=h, $fs = 0.01);
color(holeMaterial)
translate([0,0,-10*epsilon])
cylinder(r=id/2, h=h+20*epsilon, $fs = 0.01);
cylinder(r=(id/2)+epsilon, h=h+20*epsilon, $fs = 0.01);
}
}
}
Expand Down
22 changes: 17 additions & 5 deletions nuts_and_bolts.scad
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
include <units.scad>
// Copyright 2010 D1plo1d
// modified by Ben Howes 2012
// uses hexagon module from https://github.com/josefprusa/PrusaMendel

// This library is dual licensed under the GPL 3.0 and the GNU Lesser General Public License as per http://creativecommons.org/licenses/LGPL/2.1/ .

Expand Down Expand Up @@ -137,14 +140,23 @@ COURSE_METRIC_BOLT_MAJOR_THREAD_DIAMETERS =
35.940//m36
];

module hexagon(height, depth) {
boxWidth=height/1.75;
union(){
cube([boxWidth, height, depth], true);
rotate([0,0,60]) cube([boxWidth, height, depth], true);
rotate([0,0,-60]) cube([boxWidth, height, depth], true);
}
}

module nutHole(size, units=MM, tolerance = +0.0001, proj = -1)
{
//takes a metric screw/nut size and looksup nut dimensions
radius = METRIC_NUT_AC_WIDTHS[size]/2+tolerance;
height = METRIC_NUT_THICKNESS[size]+tolerance;
radius = METRIC_NUT_AC_WIDTHS[size]+2*tolerance;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
radius = METRIC_NUT_AC_WIDTHS[size]+2*tolerance;
width = METRIC_NUT_AC_WIDTHS[size]+2*tolerance;

This isn't really a radius any more.

height = METRIC_NUT_THICKNESS[size]+tolerance*2;
if (proj == -1)
{
cylinder(r= radius, h=height, $fn = 6, center=[0,0]);
translate([0,0,(height/2)-tolerance]) hexagon(height=radius, depth=height);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
translate([0,0,(height/2)-tolerance]) hexagon(height=radius, depth=height);
translate([0,0,(height/2)-tolerance]) hexagon(height=width, depth=height);

}
if (proj == 1)
{
Expand All @@ -166,8 +178,8 @@ module boltHole(size, units=MM, length, tolerance = +0.0001, proj = -1)

if (proj == -1)
{
translate([0, 0, -capHeight])
cylinder(r= capRadius, h=capHeight);
translate([0, 0, -capHeight-epsilon])
cylinder(r= capRadius, h=capHeight+2*epsilon);
cylinder(r = radius, h = length);
}
if (proj == 1)
Expand Down
81 changes: 57 additions & 24 deletions stepper.scad
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Nema17 = [
[NemaRoundExtrusionDiameter, 22*mm],
[NemaRoundExtrusionHeight, 1.9*mm],
[NemaAxleDiameter, 5*mm],
[NemaFrontAxleLength, 18*mm],
[NemaFrontAxleLength, 21*mm],
[NemaBackAxleLength, 15*mm],
[NemaAxleFlatDepth, 0.5*mm],
[NemaAxleFlatLengthFront, 15*mm],
Expand Down Expand Up @@ -186,6 +186,43 @@ Nema34 = [
[NemaAxleFlatLengthBack, 25*mm]
];

NemaDefinitions = [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
Nema08,
-1,
-1,
Nema11,
-1,
-1,
Nema14,
-1,
-1,
Nema17,
-1,
-1,
-1,
-1,
-1,
Nema23,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
Nema34
];


function motorWidth(model=Nema23) = lookup(NemaSideSize, model);
Expand All @@ -194,36 +231,38 @@ function motorLength(model=Nema23, size=NemaMedium) = lookup(size, model);

module motor(model=Nema23, size=NemaMedium, dualAxis=false, pos=[0,0,0], orientation = [0,0,0]) {

length = lookup(size, model);
motorDef = NemaDefinitions[model];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this changes the format of the model parameter from the motor definition structure to an array index. This isn't acceptable because it'll break many designs floating around the internet that use this module.

echo(NemaDefinitions[14]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This echo shouldn't be here, I think.

length = lookup(size, motorDef);

echo(str(" Motor: Nema",lookup(NemaModel, model),", length= ",length,"mm, dual axis=",dualAxis));
echo(str(" Motor: Nema",lookup(NemaModel, motorDef),", length= ",length,"mm, dual axis=",dualAxis));

stepperBlack = BlackPaint;
stepperAluminum = Aluminum;

side = lookup(NemaSideSize, model);
side = lookup(NemaSideSize, motorDef);

cutR = lookup(NemaMountingHoleCutoutRadius, model);
lip = lookup(NemaMountingHoleLip, model);
holeDepth = lookup(NemaMountingHoleDepth, model);
cutR = lookup(NemaMountingHoleCutoutRadius, motorDef);
lip = lookup(NemaMountingHoleLip, motorDef);
holeDepth = lookup(NemaMountingHoleDepth, motorDef);

axleLengthFront = lookup(NemaFrontAxleLength, model);
axleLengthBack = lookup(NemaBackAxleLength, model);
axleRadius = lookup(NemaAxleDiameter, model) * 0.5;
axleLengthFront = lookup(NemaFrontAxleLength, motorDef);
axleLengthBack = lookup(NemaBackAxleLength, motorDef);
axleRadius = lookup(NemaAxleDiameter, motorDef) * 0.5;

extrSize = lookup(NemaRoundExtrusionHeight, model);
extrRad = lookup(NemaRoundExtrusionDiameter, model) * 0.5;
extrSize = lookup(NemaRoundExtrusionHeight, motorDef);
extrRad = lookup(NemaRoundExtrusionDiameter, motorDef) * 0.5;

holeDist = lookup(NemaDistanceBetweenMountingHoles, model) * 0.5;
holeRadius = lookup(NemaMountingHoleDiameter, model) * 0.5;
holeDist = lookup(NemaDistanceBetweenMountingHoles, motorDef) * 0.5;
holeRadius = lookup(NemaMountingHoleDiameter, motorDef) * 0.5;

mid = side / 2;

roundR = lookup(NemaEdgeRoundingRadius, model);
roundR = lookup(NemaEdgeRoundingRadius, motorDef);

axleFlatDepth = lookup(NemaAxleFlatDepth, model);
axleFlatLengthFront = lookup(NemaAxleFlatLengthFront, model);
axleFlatLengthBack = lookup(NemaAxleFlatLengthBack, model);
axleFlatDepth = lookup(NemaAxleFlatDepth, motorDef);
axleFlatLengthFront = lookup(NemaAxleFlatLengthFront, motorDef);
axleFlatLengthBack = lookup(NemaAxleFlatLengthBack, motorDef);

color(stepperBlack){
translate(pos) rotate(orientation) {
Expand Down Expand Up @@ -305,9 +344,3 @@ module motor(model=Nema23, size=NemaMedium, dualAxis=false, pos=[0,0,0], orienta
}
}
}

module roundedBox(size, edgeRadius) {
cube(size);

}