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