Moved all the mechanical stuff into a subdirectory

This commit is contained in:
2022-04-02 14:43:51 +02:00
parent e9fad1ff5c
commit ed4a15658e
11 changed files with 0 additions and 0 deletions

149
mechanical/.openscad-format Normal file
View File

@@ -0,0 +1,149 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
...

11
mechanical/TODO.md Normal file
View File

@@ -0,0 +1,11 @@
## Mechanical
* Add place to mount electronics (likely just an extra part)
* add slot for motor electronic connection
## Electronics
Must contain:
* Two TMC2209 drivers
* Two 4-pin screw terminals for motors
* Arduino?

88
mechanical/assembly.scad Normal file
View File

@@ -0,0 +1,88 @@
include <constants.scad>
include <parts.scad>
module frame() {
translate([ corner_offset, 0, 0 ]) rotate([ 0, 90, 0 ])
tslot(xsize - 2 * corner_offset);
translate([ 0, corner_offset, 0 ]) rotate([ -90, 0, 0 ])
tslot(ysize - 2 * corner_offset - rail_holder_width + wall_thickness);
translate([ frame_size/2 + rail_holder_width, ysize, 0 ]) rotate([ 0, 90, 0 ])
tslot(xsize - frame_size - rail_holder_width * 2);
translate([ xsize, corner_offset, 0 ]) rotate([ -90, 0, 0 ])
tslot(ysize - 2 * corner_offset - rail_holder_width + wall_thickness);
}
module corners() {
translate([ 0, 0 ]) flcorner();
translate([ xsize, 0, 0 ]) frcorner();
translate([ xsize, ysize, 0 ]) brcorner();
translate([ 0, ysize, 0 ]) blcorner();
}
module rails() {
frame_offset = yrail_offset;
colorize(stock_color) {
for (xpos = [ frame_offset, xsize - frame_offset ]) {
rail_len = ysize - corner_offset * 2;
bom_item(printable = false,
label = str("steel_bar(d=8mm, len=", rail_len, "mm)"));
translate([ xpos, frame_size / 2 + wall_thickness ]) rotate([ -90, 0, 0 ])
cylinder(d = rail_diam, h = ysize - corner_offset * 2);
}
}
}
module ysled_rails() {
yoff = ysled_rail_spacing / 2;
rail_len = xsize - frame_size - yrail_offset * 2;
colorize(stock_color) for (ypos = [ -yoff, yoff ]) {
bom_item(printable = false,
label = str("steel_bar(d=8mm, len=", rail_len, "mm)"));
translate([ frame_size / 2, ypos, 0 ]) rotate([ 0, 90, 0 ])
cylinder(d = rail_diam, h = rail_len);
}
}
module xsled() {
xdiff = sled_xsize / 2 + frame_size / 2;
translate([ 0, 0, frame_size ]) xsled_frame();
}
module moving_parts(xpos = cur_xpos, ypos = cur_ypos) {
translate([ yrail_offset, cur_ypos, 0 ]) ysled_slider();
translate([ xsize - yrail_offset, cur_ypos, 0 ]) rotate([ 180, 180, 0 ])
ysled_slider(is_left = false);
translate([ yrail_offset, cur_ypos, 0 ]) if ($preview) ysled_rails();
translate([ cur_xpos, cur_ypos, 0 ]) {
// xsled();
xsled2();
}
}
union() {
if ($preview)
frame();
if ($preview)
rails();
corners();
moving_parts();
}
*union() {
rails();
frame();
intersection() {
union() {
corners();
}
translate([-1000, - 1000, -1000])
cube([2000, 2000, 1000]);
}
}
*xsled2();

20
mechanical/constants.scad Normal file
View File

@@ -0,0 +1,20 @@
use_colors = true;
xsize = 450;
ysize = 400;
sled_ysize = 7 * 25.4;
sled_xsize = 8 * 25.4;
xmin = 155;
ymin = 140;
// 130..320
cur_xpos = 155;
// 140..260
cur_ypos = 140;
echo(str("Range = ", [ xsize - xmin * 2, ysize - ymin * 2 ]));
//$fn = 30;
screw_hole_expansion = 1.1;
screw_num_sides = 7;

19
mechanical/gen_parts.scad Normal file
View File

@@ -0,0 +1,19 @@
use <assembly.scad>;
module genpart(id = 0) {
if (id <= 0) {
echo(str("Children: ", $children));
} else {
children(id-1);
}
}
genpart(id) {
flcorner();
frcorner();
brcorner();
blcorner();
ysled_slider(177.8);
ysled_slider(177.8);
xsled2();
}

27
mechanical/genbom.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
function bom() {
openscad --export-format echo -o - assembly.scad |grep 'BOM: print'
}
function run_scad() {
openscad --export-format echo -o - "$@" gen_parts.scad |
sed -ne '/^ECHO: /{' -e 's/^ECHO: "\(.*\)"$/\1/' -e p -e '}'
}
function partcount() {
run_scad -D id=0
}
nparts=$(partcount |sed -e 's/Children: //')
mkdir -p print
for i in $(seq $nparts); do
part_name="$(run_scad -D id=$i |grep 'BOM: print' |sed -e 's/BOM: print \([^(]*\).*/\1/')"
printf "%s: <%s>\n" $i "$part_name"
fname="print/${i}_${part_name}"
openscad -o "${fname}.amf" \
-D id=$i \
gen_parts.scad
done
#run_scad -D id=1

14
mechanical/lib.scad Normal file
View File

@@ -0,0 +1,14 @@
module bom_item(printable = true, label = "") {
print_label = printable ? " print " : " stock ";
item_label = label == "" ? parent_module(1) : label;
echo(str("BOM:", print_label, item_label));
}
module slotify(vector) {
for (child = [0:$children-1]) {
hull() {
children(child);
translate(vector) children(child);
}
}
}

657
mechanical/parts.scad Normal file
View File

@@ -0,0 +1,657 @@
include <constants.scad>
include <lib.scad>
include <stock_parts.scad>
include <units.inc>
frame_size = 20;
wall_thickness = 2;
corner_size = 40; // length of mating surface between corner and frame
// The length along each edge that the corner bracket takes. I.e., if
// you construct a frame of four corner brackets and 4 tubes of length
// $L-$corner_size, the distance between opposite tubes' centerlines
// will be $L.
corner_offset = frame_size / 2 + wall_thickness;
rail_diam = 8;
ysled_extralen = frame_size; // on each end
// Both of these are distance from frame centerline
belt_height1 = frame_size / 2 + wall_thickness + belt_width / 2 + 2;
belt_height2 = belt_height1 + belt_width + 2;
// calculated
ysled_rail_spacing = (sled_ysize);
motor_shaft_xoffset = 15;
motor_mount_length_adjustment = 8;
motor_mount_length = nema17_face + wall_thickness + motor_mount_length_adjustment;
// distance between centerline of rail and centerline of frame Y tube.
yrail_offset = motor_shaft_xoffset + pulley_sbend_offset;
// Generates bar of length $l, centered on origin extending in +Z
module tslot(l) {
bom_item(printable = false, label = str("tslot(", l, "mm)"));
colorize(stock_color) {
translate([ -frame_size / 2, -frame_size / 2, 0 ])
cube([ frame_size, frame_size, l ]);
}
}
// A corner, with tubes extending in +x and +y.
module corner_base(extension = wall_thickness) {
odim = frame_size / 2 + wall_thickness;
ldim = frame_size / 2 + corner_size + (extension - wall_thickness);
actual_corner_offset = frame_size / 2 + extension;
cap_points = [
[ -odim, -odim ], [ -odim, ldim ], [ odim, ldim ],
[odim, odim], [ ldim, odim ],
[ ldim, -odim ]
];
difference() {
translate([ 0, 0, -odim ]) linear_extrude(odim * 2)
polygon(points = cap_points);
// two bars...
translate([ -frame_size / 2, actual_corner_offset, -frame_size / 2 ])
cube([ frame_size, ldim, frame_size ]);
translate([ actual_corner_offset, -frame_size / 2, -frame_size / 2 ])
cube([ ldim, frame_size, frame_size ]);
// Screw holes
for (pos = [10, 30],
mirror_normal = [[0,1,0], [1,-1,0]]) {
mirror(mirror_normal)
translate([pos + actual_corner_offset, 0, -odim])
union() {
cylinder(d = 8, h=2, center=true);
cylinder(d = 5 * screw_hole_expansion, h = odim);
}
}
// Adjustable feet
cylinder(d=8, h=odim * 2 + 1, center=true, $fn = screw_num_sides);
}
}
rail_holder_width = (yrail_offset - frame_size / 2 - wall_thickness) * 2;
module rail_holder(in_x) {
odim = frame_size / 2 + wall_thickness;
box_size = (yrail_offset - odim) * 2;
assert(box_size == rail_holder_width);
ldim = frame_size / 2 + box_size;
tube_offset = (corner_size) / 2 + wall_thickness;
tube_rotation = in_x ? 90 : 0;
translated_rail_offset = yrail_offset - frame_size / 2 - wall_thickness;
translate([ odim, odim, -odim ]) {
difference() {
cube([
!in_x ? box_size - wall_thickness : 10,
!in_x ? 10 : box_size - wall_thickness,
wall_thickness * 2 + frame_size
]);
translate(
[ translated_rail_offset, translated_rail_offset, frame_size / 2 + wall_thickness ])
rotate([ tube_rotation - 90, tube_rotation, 0 ])
translate([ 0, 0, -corner_size ])
cylinder(d = rail_diam, corner_size * 4);
}
}
}
// centered on the rail.
module ysled_slider(associated_parts = $preview, is_left=true) {
spread = sled_ysize;
bom_item(label = str("ysled_slider(", spread, ")"));
sled_len = spread + frame_size;
sled_height = frame_size;
idler_spacing = spread / 6 + pulley_radius(idler_nteeth);
local_idler_xoffset = pulley_sbend_offset - yrail_offset + motor_shaft_xoffset;
echo("LIX:", local_idler_xoffset)
colorize("green") translate([ 0, -sled_len / 2, 0 ])
rotate([ -90, 0, 0 ]) {
difference() {
union() {
translate([ -frame_size / 2, -frame_size / 2, 0 ])
cube([ frame_size + 5, frame_size, sled_len ]);
translate([
pulley_sbend_offset - yrail_offset + motor_shaft_xoffset -
pulley_clearance_rad - 4,
-frame_size / 2, 0
]) cube([ frame_size + 5, frame_size, sled_len ]);
}
for (y = [idler_spacing, -idler_spacing]) {
rotate([90, 0, 0])
translate([local_idler_xoffset, sled_len/2 + y, 0])
cylinder(d=3, h = frame_size);
}
cylinder(d = rail_diam * 1.5, h = sled_len);
translate([ 0, 0, -1 ]) cylinder(d = bushing_od, h = bushing_len + 1);
translate([ 0, 0, sled_len - bushing_len ])
cylinder(d = bushing_od, h = bushing_len + 1);
for (zpos = [ frame_size / 2, sled_len - frame_size / 2 ]) {
translate([ sled_height / 2, 0, zpos ]) rotate([ 0, 90, 0 ]) {
cylinder(h = sled_height + 1, d = rail_diam);
}
}
}
}
// TODO: add posts for the idlers
// color("#f00")
translate(
[ local_idler_xoffset, 0, frame_size/2 - 1 ]) {
translate([ 0, idler_spacing, 0 ]) {
idler_post(belt_height = belt_height1 - frame_size/2 + 1, toothed = is_left);
}
translate([ 0, -idler_spacing, 0 ]) {
rotate([ 0, 0, -90 ]) { idler_post(belt_height = belt_height2 - frame_size/2 + 1, toothed = !is_left); }
}
}
if ($preview) {
translate([ 0, -sled_len / 2, 0 ]) rotate([ -90, 0, 0 ])
bushing();
translate([ 0, sled_len / 2, 0 ]) rotate([ 90, 0, 0 ])
bushing();
}
}
module nema17_housing() {
hwidth = corner_size + frame_size + wall_thickness;
hheight = nema17_face + wall_thickness * 2;
hdepth = frame_size + wall_thickness * 2;
vertical_extension = frame_size + belt_height2;
screw_dxy = 31 / 2;
slot_vector = [0, - motor_mount_length_adjustment, 0];
translate([ 0, -nema17_face / 2 - frame_size / 2 - wall_thickness, 0 ]) {
slotify(slot_vector) {
translate([ 0, 0, -belt_height2/2 - wall_thickness ])
cube([ nema17_face + 1, nema17_face + 1, hdepth + belt_height2 ], center = true);
cylinder(d = 23, frame_size);
}
for (x = [-1, 1], y = [-1,1]) {
slotify(slot_vector)
translate([
x * screw_dxy,
y * screw_dxy,
frame_size / 2 + wall_thickness + 0.5
])
rotate([ 180, 0, 0 ]) {
cylinder(d = 5 * screw_hole_expansion, h = wall_thickness + 1);
}
}
}
}
// belt height is the center of the belt.
// Roration is in Z axis, from +x/+y
module idler_post(belt_height, toothed = true) {
gap = 0.5;
post_radius = pulley_clearance_rad + 4;
top_shelf_thickness = 4;
total_height = idler_zmargin.y + belt_height + top_shelf_thickness + gap;
slot_radius = pulley_clearance_rad;
slot_height = idler_zmargin.x + idler_zmargin.y + gap * 2;
difference() {
union() {
// outer shell
cylinder(h = total_height, r = post_radius);
translate([ 0, -post_radius, 0 ])
cube([ post_radius, post_radius, total_height ]);
translate([ -post_radius, 0, 0 ])
cube([ post_radius, post_radius, total_height ]);
}
translate([ 0, 0, belt_height - idler_zmargin.x - gap ]) {
cylinder(r = slot_radius, slot_height);
translate([ -slot_radius, 0, 0 ])
cube([ post_radius * 2, post_radius * 2, slot_height ]);
translate([ 0, -slot_radius, 0 ])
cube([ post_radius * 2, post_radius * 2, slot_height ]);
}
cylinder(d = 3, h = total_height + 1);
translate([ 0, 0, total_height - 2 ]) cylinder(r = 3, h = 3);
}
if($preview) {
idler(height = belt_height, toothed=toothed);
}
}
module flcorner() {
bom_item();
motor_height = belt_height2 - belt_height1;
union() {
rotate([ 0, 0, 0 ]) {
corner_base();
rail_holder(false);
}
difference() {
translate([
-frame_size/2 - wall_thickness,
-frame_size/2 - wall_thickness - motor_mount_length,
-frame_size/2 - wall_thickness
])
cube([
frame_size + wall_thickness + corner_size,
motor_mount_length + wall_thickness,
frame_size + wall_thickness * 2 + motor_height
]);
translate([ motor_shaft_xoffset, 0, motor_height ]) nema17_housing();
}
// translate([motor_shaft_xoffset, 0, 0 ]) nema17_housing();
}
if ($preview)
translate([
motor_shaft_xoffset,
-nema17_face / 2 - frame_size / 2 - wall_thickness, frame_size / 2
]) {
translate([0,0,motor_height])
nema17();
translate([ 0, 0, -frame_size / 2 + belt_height2 ])
rotate([180,0,0])
{ active_pulley(); }
}
}
module frcorner() {
bom_item();
union() {
rotate([ 0, 0, 90 ]) {
corner_base();
rail_holder(true);
}
difference() {
translate([
-frame_size/2 - corner_size,
-frame_size/2 - wall_thickness - motor_mount_length,
-frame_size/2 - wall_thickness
])
cube([
frame_size + wall_thickness + corner_size,
motor_mount_length,
frame_size + wall_thickness * 2
]);
translate([ -motor_shaft_xoffset, 0, 0 ]) nema17_housing();
}
}
if ($preview)
translate([
-motor_shaft_xoffset,
-nema17_face / 2 - frame_size / 2 - wall_thickness, frame_size / 2
]) {
nema17();
translate([ 0, 0, belt_height1 - frame_size / 2 ]) {
rotate([ 180, 0, 0 ]) active_pulley();
}
}
}
module blcorner() {
bom_item();
difference() {
rotate([0, 0, 270]) {
corner_base(extension = rail_holder_width);
rail_holder(true);
}
for (pos = [
[motor_shaft_xoffset + pulley_sbend_offset, 0, 0],
[0, motor_shaft_xoffset + pulley_sbend_offset, 0],
]) {
translate(pos)
cylinder(d = 3, h = belt_height2, $fn=screw_num_sides);
}
}
translate([motor_shaft_xoffset + pulley_sbend_offset, 0, frame_size/2])
rotate([0,0,-90])
idler_post(belt_height = belt_height1 - frame_size/2, toothed=true);
translate([0, -(motor_shaft_xoffset + pulley_sbend_offset), frame_size/2])
rotate([0,0,-90])
idler_post(belt_height = belt_height2 - frame_size/2, toothed=true);
}
module brcorner() {
bom_item();
union()
rotate([ 0, 0, 180 ]) {
corner_base(extension = rail_holder_width);
rail_holder(false);
}
translate([-(motor_shaft_xoffset + pulley_sbend_offset), 0, frame_size/2])
rotate([0,0,180])
idler_post(belt_height = belt_height2 - frame_size/2, toothed=true);
translate([0, -(motor_shaft_xoffset + pulley_sbend_offset), frame_size/2])
rotate([0,0,180])
idler_post(belt_height = belt_height1 - frame_size/2, toothed=true);
}
module xsled_slider() {
slider_len = bushing_len + 10;
screw_tab_len = 20;
screw_tab_thickness = 10;
union()
// translate([screw_tab_len, 0, 0])
difference() {
union() {
rotate([ 0, 90, 0 ]) { cylinder(d = frame_size, h = slider_len); }
translate([ 0, -frame_size / 2, 0 ])
cube([ slider_len, frame_size, frame_size / 2 ]);
*translate([ -screw_tab_len, -frame_size / 2, frame_size / 2 ]) cube(
[ screw_tab_len * 2 + slider_len, frame_size, screw_tab_thickness ]);
}
rotate([ 0, 90, 0 ]) {
cylinder(d = bushing_od, h = bushing_len);
cylinder(d = rail_diam * 1.1, slider_len * 2);
}
}
if ($preview)
rotate([ 0, 90, 0 ]) bushing();
}
module sled_cornera() {
bom_item();
corner_base();
translate([ -frame_size / 2 - wall_thickness, 0, -frame_size ])
xsled_slider();
}
module sled_cornerb() {
bom_item();
corner_base();
rotate([ 0, 0, 90 ])
translate([ -frame_size / 2 - wall_thickness, 0, -frame_size ])
xsled_slider();
}
module xsled_frame() {
translate([ -sled_xsize / 2 + corner_offset, -ysled_rail_spacing / 2, 0 ])
rotate([ 0, 90, 0 ]) tslot(sled_xsize - corner_offset * 2);
translate([ -sled_xsize / 2 + corner_offset, ysled_rail_spacing / 2, 0 ])
rotate([ 0, 90, 0 ]) tslot(sled_xsize - corner_offset * 2);
translate([ -sled_xsize / 2, -ysled_rail_spacing / 2 + corner_offset, 0 ])
rotate([ -90, 0, 0 ]) tslot(sled_ysize - corner_offset * 2);
translate([ sled_xsize / 2, -ysled_rail_spacing / 2 + corner_offset, 0 ])
rotate([ -90, 0, 0 ]) tslot(sled_ysize - corner_offset * 2);
translate([ -sled_xsize / 2, -sled_ysize / 2, 0 ]) sled_cornera();
translate([ sled_xsize / 2, sled_ysize / 2, 0 ]) rotate([ 0, 0, 180 ])
sled_cornera();
translate([ sled_xsize / 2, -sled_ysize / 2, 0 ]) rotate([ 0, 0, 90 ])
sled_cornerb();
translate([ -sled_xsize / 2, sled_ysize / 2, 0 ]) rotate([ 0, 0, 270 ])
sled_cornerb();
// simulate a piece of film
if (false) {
color("#0008") cube([ 5 * inch, 4 * inch, 1 ], center = true);
}
}
gt2_clip_meshing_dist = belt_pitch * 6;
gt2_clip_peg_diam = 8; // min 6
gt2_clip_ease_in_diam = 6;
gt2_clip_narrowing_dist = 12; // distance from center of loop peg to meshing point
gt2_clip_gap_diam = gt2_clip_peg_diam + belt_thickness * 2 + 1;
gt2_clip_thickness = (gt2_clip_peg_diam + gt2_clip_gap_diam)/2;
gt2_clip_length = gt2_clip_narrowing_dist + gt2_clip_meshing_dist + gt2_clip_peg_diam / 2 + gt2_clip_gap_diam - belt_thickness;
module gt2_clip_cutout(teeth_inside) {
dual_width = belt_thickness * 2 - tooth_height;
loop_peg_diam = gt2_clip_peg_diam; // min 6mm
gap_diam = gt2_clip_gap_diam;
narrowing_ease_diam = 6;
narrowing_dist = gt2_clip_narrowing_dist;
meshing_dist = gt2_clip_meshing_dist;
ease_out_rad = gap_diam - belt_thickness ;
out_off = teeth_inside ? 0 : dual_width - belt_thickness;
translate([
-(narrowing_dist + meshing_dist + (ease_out_rad - out_off - belt_thickness))
-(teeth_inside ? tooth_height - belt_pld : belt_backing)
,
loop_peg_diam / 2,
-1])
union() {
difference() {
hull() {
circle(d = gap_diam);
polygon([
[0, 0],
[0, gap_diam / 2],
[narrowing_dist, gap_diam / 2],
[narrowing_dist, gap_diam / 2 - dual_width]
]);
}
circle(d = loop_peg_diam);
translate([narrowing_dist, gap_diam / 2 - dual_width - narrowing_ease_diam / 2])
circle(d = narrowing_ease_diam);
}
translate([narrowing_dist, gap_diam / 2])
polygon([
[0, 0],
[meshing_dist - 1, 0],
[meshing_dist, - out_off],
[meshing_dist, - belt_thickness - out_off],
[meshing_dist - 1, - dual_width],
[0, - dual_width]
]);
translate([narrowing_dist + meshing_dist, gap_diam / 2 - ease_out_rad]) {
intersection() {
translate([0, -2])
square(ease_out_rad + 2);
difference() {
circle(ease_out_rad - out_off);
circle(ease_out_rad - out_off - belt_thickness);
}
}
}
}
}
module gt2_clip(teeth_inside) {
out_off = teeth_inside ? 0 : belt_thickness - tooth_height;
actual_thickness = gt2_clip_thickness + wall_thickness;
translate([0,-actual_thickness, -belt_width/2 - 2])
difference() {
translate([-gt2_clip_length - belt_thickness + out_off/2, 0]) {
cube([gt2_clip_length + belt_thickness * 2, actual_thickness, belt_width + 4]);
mirror([0,0,1])
translate([0, actual_thickness])
linear_extrude(height=actual_thickness * 1.5, scale=[1,0])
translate([0, -actual_thickness])
square([
gt2_clip_length + belt_thickness * 2,
actual_thickness
]);
}
translate([0,0,0])
linear_extrude(belt_width + 6)
gt2_clip_cutout(teeth_inside);
}
}
module xsled2() {
bom_item();
tab_len = bushing_len * 2;
tab_thickness = bushing_od + wall_thickness * 2;
glass_thickness = 5; // TODO: Update when an actual size is available
inner_ysize = sled_ysize - tab_thickness;
film_height = belt_height2 + belt_width / 2;
ledge_width = 15;
inside_ledge_width = 8;
outside_ledge_width = ledge_width - inside_ledge_width;
film_thickness = 0.25;
finger_notch_diam = 25;
finger_notch_smdepth = 2;
glass_holder_points = [
[0, - tab_thickness / 2],
[0, film_height + glass_thickness],
[wall_thickness, film_height + glass_thickness],
[wall_thickness, film_height],
[outside_ledge_width, film_height],
[outside_ledge_width, film_height - glass_thickness],
[ledge_width, film_height - glass_thickness],
[wall_thickness * 2, - tab_thickness / 2]
];
echo("Ledge width: ", ledge_width - outside_ledge_width);
// rail attachment points
render() {
for (xsign = [1, - 1], ysign = [1, - 1]) {
translate([sled_xsize / 2 * xsign, sled_ysize / 2 * ysign, 0])
rotate([0, - 90 * xsign, 0]) {
difference() {
union() {
cylinder(d = tab_thickness, h = tab_len);
translate(
[- tab_thickness / 2, ysign > 0 ? - tab_thickness / 2 : 0, 0])
cube([tab_thickness, tab_thickness / 2 + 1, tab_len]);
}
translate([0, 0, - 0.5]) {
cylinder(d = bushing_od, h = bushing_len + 0.5);
cylinder(d = rail_diam * 1.1, h = tab_len + 1);
}
}
}
}
// glass holding frame
difference() {
union() {
translate([- sled_xsize / 2, - inner_ysize / 2, 0])
rotate([0, 90, 0]) rotate([0, 0, 90]) linear_extrude(sled_xsize)
polygon(glass_holder_points);
translate([sled_xsize / 2, inner_ysize / 2, 0])
rotate([0, 90, 180]) rotate([0, 0, 90])
linear_extrude(sled_xsize) polygon(glass_holder_points);
translate([sled_xsize / 2, - inner_ysize / 2, 0])
rotate([0, 90, 90]) rotate([0, 0, 90])
linear_extrude(inner_ysize) polygon(glass_holder_points);
translate([- sled_xsize / 2, inner_ysize / 2, 0])
rotate([0, 90, - 90]) rotate([0, 0, 90])
linear_extrude(inner_ysize) polygon(glass_holder_points);
}
// grub screw points for glass levelling
for (x = [- 1, 1],
y = [- 1, 1]) {
translate([x * (sled_xsize / 2 - outside_ledge_width - inside_ledge_width / 2),
y * (inner_ysize / 2 - outside_ledge_width - inside_ledge_width / 2),
film_height])
rotate([180, 0, 0]) {
cylinder(d = 4, h = 50);
cylinder(d = 5, h = 4 + glass_thickness);
}
}
// finger notch
translate([
- 10, - inner_ysize / 2,
film_height - glass_thickness + 0.5 - finger_notch_smdepth + finger_notch_diam / 2
]) rotate([90, 0, 0])
cylinder(d = finger_notch_diam, h = ledge_width * 3, center = true);
}
// belt attachment points
idler_spacing = sled_ysize / 6;
for (params = [
[true, [- sled_xsize / 2, idler_spacing, belt_height1]],
[false, [- sled_xsize / 2, - idler_spacing, belt_height2]],
[true, [sled_xsize / 2, idler_spacing, belt_height2]],
[false, [sled_xsize / 2, - idler_spacing, belt_height1]]
]) {
should_mirror = params[1][0] > 0 ? params[0] : !params[0];
translate(params[1])
rotate([0, 0, params[1][0] > 0 ? 90 : - 90]) {
if (should_mirror) {
mirror([1, 0, 0])
gt2_clip(params[0]);
} else {
gt2_clip(params[0]);
}
}
}
}
if ($preview) {
for (xsign = [1, - 1], ysign = [1, - 1]) {
translate([sled_xsize / 2 * xsign, sled_ysize / 2 * ysign, 0])
rotate([0, - 90 * xsign, 0]) {
bushing();
}
}
}
color("#fff3") if ($preview) {
// draw glass sheets
bom_item(label = str("glass (", glass_thickness,
", ", sled_xsize - outside_ledge_width * 2,
", ", inner_ysize - outside_ledge_width * 2,
")"), printable=false);
bom_item(label = str("glass (", glass_thickness,
", ", sled_xsize - wall_thickness * 2,
", ", inner_ysize - wall_thickness * 2,
")"), printable=false);
translate(
[0, 0, film_height - glass_thickness / 2 + 0.5])
cube(
[
sled_xsize - outside_ledge_width * 2,
inner_ysize - outside_ledge_width * 2,
glass_thickness
],
center = true);
*translate(
[0, 0, film_height + film_thickness * 2 + glass_thickness / 2 + 0.5])
cube(
[
sled_xsize - wall_thickness * 2,
inner_ysize - wall_thickness * 2,
glass_thickness
],
center = true);
}
if ($preview) {
color("#0003")
translate([0, 0, film_height + 0.5]) {
cube([5 * inch, 4 * inch, film_thickness], center = true);
}
}
}
// render()
// xsled2();

129
mechanical/stock_parts.scad Normal file
View File

@@ -0,0 +1,129 @@
include <lib.scad>
stock_color = "#aaa";
bushing_od = 15;
bushing_id = 8;
bushing_len = 24;
nema17_face = 42.3;
module colorize(colorname) {
if (use_colors) {
color(colorname) union() { children(); }
} else {
children();
}
}
module bushing() {
bom_item(printable = false, label = "Bushing");
colorize(stock_color) render() {
difference() {
cylinder(d = bushing_od, h = bushing_len);
translate([ 0, 0, -1 ]) cylinder(d = bushing_id, h = bushing_len + 2);
}
}
}
// located with the shaft in +z, face on the XY plane
module nema17(depth = 23.5) {
bom_item(printable = false, label = "NEMA-17 stepper motor");
face = 42.3;
screw_pitch = 31 / 2;
color(stock_color) render() difference() {
union() {
translate([ -face / 2, -face / 2, -depth ]) cube([ face, face, depth ]);
translate([ 0, 0, -1 ]) {
cylinder(d = 22, h = 2 + 1);
cylinder(d = 5, h = 22 + 1);
}
}
translate([ 1.25, -5, 4 ]) cube([ 10, 10, 20 ]);
// screw holes
for (x = [ -screw_pitch, screw_pitch ], y = [ -screw_pitch, screw_pitch ]) {
translate([ x, y, -10 ]) cylinder(d = 5, h = 20);
}
}
}
// belts and pulleys
belt_pitch = 2; // 2mm tooth width for GT2 = 2mm pitch
belt_width = 6;
belt_thickness = 1.38;
belt_pld =
0.254; // distance between pitch line and tips of gear teeth
belt_backing = 0.63 - belt_pld; // distance between pitch line and backing
tooth_height = 0.75; // distance from tips of belt teeth to tip of gear teeth
pulley_od = 13;
pulley_clearance_rad = pulley_od / 2 + 1.5;
function pulley_radius(nteeth) = belt_pitch * nteeth / (PI * 2);
module pulley(teeth, lrim, urim, belt_width, shaft = 5, toothed = true,
od = 0) {
bom_item(printable = false,
label = str(toothed ? "pulley(" : "idler(", "teeth=", teeth, ", ",
"flange1=", min(lrim, urim), "mm, ", "flange2=",
max(lrim, urim), "mm, ", "channel=", belt_width, "mm, ",
"shaft=", shaft, "mm", ")"));
nominal_rad = pulley_radius(teeth);
inner_rad = nominal_rad - belt_pld;
outer_rad = (od > 0) ? od / 2 : nominal_rad + belt_backing;
minor_rad = inner_rad - tooth_height;
mid_rad = inner_rad - tooth_height / 2;
idler_rad = nominal_rad - belt_backing;
dtheta = 180 / teeth;
tooth_points = [for (i = [1:1:teeth]) let(theta = i * 360 / teeth) each
[[sin(theta) * minor_rad, cos(theta) * minor_rad],
[sin(theta) * inner_rad, cos(theta) * inner_rad],
[sin(theta + dtheta) * inner_rad, cos(theta + dtheta) * inner_rad],
[sin(theta + dtheta) * minor_rad, cos(theta + dtheta) * minor_rad]]];
// echo([each [0:1:teeth]]);
// echo(tooth_points);
colorize(stock_color) render() difference() {
union() {
cylinder(r = outer_rad, h = lrim);
translate([ 0, 0, lrim ]) if (toothed) {
linear_extrude(belt_width)
polygon(tooth_points, convexity = teeth * 2 + 4);
}
else {
cylinder(r = idler_rad, h = belt_width);
}
translate([ 0, 0, lrim + belt_width ]) cylinder(r = outer_rad, h = urim);
}
translate([ 0, 0, -1 ])
cylinder(d = shaft, h = belt_width + lrim + urim + 2);
}
}
idler_zmargin = [ 6.4 / 2 + 1.05, 6.4 / 2 + 1.05 ];
idler_nteeth = 16;
module idler(height = 0, toothed = false) {
// pulley(20, 1.05, 1.05, 6.4, toothed=toothed, od=18);
translate([ 0, 0, height - idler_zmargin[0] ])
pulley(16, 1.05, 1.05, 6.4, shaft = 3, toothed = toothed, od = 13);
}
active_pulley_zmargin = [ 9.5, 4.5 ];
module active_pulley(height = 0) {
translate([ 0, 0, -active_pulley_zmargin[0] + height ])
pulley(16, 6, 1, 7, od = 13);
}
// required distance between centers of pulley and idler for an S-bend with
// right angles.
pulley_sbend_offset = (9.5 + 9.7) / 2 + 0.63;
//! pulley(12, 6, 2, toothed=false);

View File

@@ -0,0 +1,28 @@
include <constants.scad>;
include <parts.scad>;
module bearing_slot() {
intersection() {
difference() {
translate([- frame_size / 2, - frame_size / 2, 1])
cube([frame_size, frame_size, 10]);
cylinder(d = bushing_od, h = 6);
cylinder(d = rail_diam, h = 12);
}
union() {
cylinder(h = 12, d = frame_size);
translate([-frame_size/2, 0, 0])
cube([frame_size, frame_size, frame_size]);
}
}
}
let($fn = 30) {
translate([-28, 0, frame_size/2])
rotate([0,90,0]) bearing_slot();
translate([28, 0, frame_size/2])
rotate([0,-90,0]) bearing_slot();
idler_post(10);
}

2
mechanical/units.inc Normal file
View File

@@ -0,0 +1,2 @@
inch = 25.4;
cm = 10;