1//////////////////////////////////////////////////////////////////////
2// LibFile: linear_bearings.scad
3// Mounts and models for LMxUU style linear bearings.
4// Includes:
5// include <BOSL2/std.scad>
6// include <BOSL2/linear_bearings.scad>
7// FileGroup: Parts
8// FileSummary: Mounts for LMxUU style linear bearings.
9//////////////////////////////////////////////////////////////////////
10
11
12include <metric_screws.scad>
13
14
15// Section: Generic Linear Bearings
16
17// Module: linear_bearing_housing()
18// Description:
19// Creates a model of a clamp to hold a generic linear bearing cartridge.
20// Arguments:
21// d = Diameter of linear bearing. (Default: 15)
22// l = Length of linear bearing. (Default: 24)
23// tab = Clamp tab height. (Default: 7)
24// tabwall = Clamp Tab thickness. (Default: 5)
25// wall = Wall thickness of clamp housing. (Default: 3)
26// gap = Gap in clamp. (Default: 5)
27// screwsize = Size of screw to use to tighten clamp. (Default: 3)
28// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
29// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
30// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
31// Example:
32// linear_bearing_housing(d=19, l=29, wall=2, tab=6, screwsize=2.5);
33module linear_bearing_housing(d=15, l=24, tab=7, gap=5, wall=3, tabwall=5, screwsize=3, anchor=BOTTOM, spin=0, orient=UP)
34{
35 od = d+2*wall;
36 ogap = gap+2*tabwall;
37 tabh = tab/2+od/2*sqrt(2)-ogap/2;
38 h = od+tab/2;
39 anchors = [
40 named_anchor("axis", [0,0,-tab/2/2]),
41 named_anchor("screw", [0,2-ogap/2,tabh-tab/2/2],FWD),
42 named_anchor("nut", [0,ogap/2-2,tabh-tab/2/2],FWD)
43 ];
44 attachable(anchor,spin,orient, size=[l, od, h], anchors=anchors) {
45 down(tab/2/2)
46 difference() {
47 union() {
48 // Housing
49 zrot(90) teardrop(r=od/2,h=l);
50
51 // Base
52 cube([l,od,od/2], anchor=TOP);
53
54 // Tabs
55 cube([l,ogap,od/2+tab/2], anchor=BOTTOM);
56 }
57
58 // Clear bearing space
59 zrot(90) teardrop(r=d/2,h=l+0.05);
60
61 // Clear gap
62 cube([l+0.05,gap,od], anchor=BOTTOM);
63
64 up(tabh) {
65 // Screwhole
66 fwd(ogap/2-2+0.01) generic_screw(screwsize=screwsize*1.06, screwlen=ogap, headsize=screwsize*2, headlen=10, orient=FWD);
67
68 // Nut holder
69 back(ogap/2-2+0.01) metric_nut(size=screwsize, hole=false, anchor=BOTTOM, orient=BACK);
70 }
71 }
72 children();
73 }
74}
75
76
77// Module: linear_bearing()
78// Description:
79// Creates a rough model of a generic linear ball bearing cartridge.
80// Arguments:
81// l/length = The length of the linear bearing cartridge.
82// od = The outer diameter of the linear bearing cartridge.
83// id = The inner diameter of the linear bearing cartridge.
84// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
85// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
86// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
87// Example:
88// linear_bearing(l=24, od=15, id=8);
89module linear_bearing(l, od=15, id=8, length, anchor=CTR, spin=0, orient=UP) {
90 l = first_defined([l, length, 24]);
91 attachable(anchor,spin,orient, d=od, l=l) {
92 color("silver") {
93 tube(id=id, od=od, l=l-1);
94 tube(id=od-1, od=od, l=l);
95 tube(id=id, od=id+1, l=l);
96 tube(id=id+2, od=od-2, l=l);
97 }
98 children();
99 }
100}
101
102
103// Section: lmXuu Linear Bearings
104
105// Module: lmXuu_housing()
106// Description:
107// Creates a model of a clamp to hold a standard sized lmXuu linear bearing cartridge.
108// Arguments:
109// size = Standard lmXuu inner size.
110// tab = Clamp tab height. Default: 7
111// tabwall = Clamp Tab thickness. Default: 5
112// wall = Wall thickness of clamp housing. Default: 3
113// gap = Gap in clamp. Default: 5
114// screwsize = Size of screw to use to tighten clamp. Default: 3
115// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
116// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
117// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
118// Example:
119// lmXuu_housing(size=10, wall=2, tab=6, screwsize=2.5);
120module lmXuu_housing(size=8, tab=7, gap=5, wall=3, tabwall=5, screwsize=3, anchor=BOTTOM, spin=0, orient=UP)
121{
122 info = lmXuu_info(size);
123 d = info[0];
124 l = info[1];
125 linear_bearing_housing(d=d, l=l, tab=tab, gap=gap, wall=wall, tabwall=tabwall, screwsize=screwsize, orient=orient, spin=spin, anchor=anchor) children();
126}
127
128
129// Module: lmXuu_bearing()
130// Description:
131// Creates a model of an lmXuu linear ball bearing cartridge.
132// Arguments:
133// size = Standard lmXuu inner size.
134// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
135// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
136// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
137// Example:
138// lmXuu_bearing(size=10);
139module lmXuu_bearing(size=8, anchor=CTR, spin=0, orient=UP) {
140 info = lmXuu_info(size);
141 linear_bearing(l=info[1], id=size, od=info[0], anchor=anchor, spin=spin, orient=orient) children();
142}
143
144
145// Section: lmXuu Linear Bearing Info
146
147
148// Function: lmXuu_info()
149// Description:
150// Get dimensional info for a standard metric lmXuu linear bearing cartridge.
151// Returns `[DIAM, LENGTH]` for the cylindrical cartridge.
152// Arguments:
153// size = Inner diameter of lmXuu bearing, in mm.
154function lmXuu_info(size) =
155 let(
156 data = [
157 // size, diam, length
158 [ 4, 8, 12],
159 [ 5, 10, 15],
160 [ 6, 12, 19],
161 [ 8, 15, 24],
162 [ 10, 19, 29],
163 [ 12, 21, 30],
164 [ 13, 23, 32],
165 [ 16, 28, 37],
166 [ 20, 32, 42],
167 [ 25, 40, 59],
168 [ 30, 45, 64],
169 [ 35, 52, 70],
170 [ 40, 60, 80],
171 [ 50, 80, 100],
172 [ 60, 90, 110],
173 [ 80, 120, 140],
174 [100, 150, 175],
175 ],
176 found = search([size], data, 1)[0]
177 )
178 assert(found!=[], str("Unsupported lmXuu linear bearing size: ", size))
179 select(data[found], 1, -1);
180
181
182
183// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap