omdl  v0.9.5
OpenSCAD Mechanical Design Library
lmxuu.scad
Go to the documentation of this file.
1 //! Linear motion bearing model.
2 /***************************************************************************//**
3  \file
4  \author Roy Allen Sutton
5  \date 2024
6 
7  \copyright
8 
9  This file is part of [omdl] (https://github.com/royasutton/omdl),
10  an OpenSCAD mechanical design library.
11 
12  The \em omdl is free software; you can redistribute it and/or modify
13  it under the terms of the [GNU Lesser General Public License]
14  (http://www.gnu.org/licenses/lgpl.html) as published by the Free
15  Software Foundation; either version 2.1 of the License, or (at
16  your option) any later version.
17 
18  The \em omdl is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with the \em omdl; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26  02110-1301, USA; or see <http://www.gnu.org/licenses/>.
27 
28  \details
29 
30  \amu_define group_name (lmxuu)
31  \amu_define group_brief (Linear motion bearing model.)
32 
33  \amu_include (include/amu/pgid_path_pstem_pg.amu)
34 *******************************************************************************/
35 
36 //----------------------------------------------------------------------------//
37 // group and macros.
38 //----------------------------------------------------------------------------//
39 
40 /***************************************************************************//**
41  \amu_include (include/amu/group_in_parent_start.amu)
42  \amu_define includes_required_add
43  (
44  database/component/bearing/linear_lmxuu.scad
45  )
46  \amu_include (include/amu/includes_required.amu)
47 *******************************************************************************/
48 
49 //----------------------------------------------------------------------------//
50 
51 //! Linear motion bearing model.
52 /***************************************************************************//**
53  \param n <string> the bearing model name (see: [database table]).
54  \param align <integer> model z-alignment; {0:bottom, 1:middle, 2:top}.
55  \param shell <boolean> render shell only.
56  \param wc <boolean> render with color.
57 
58  \details
59 
60  The available model names can be found in the [database table].
61 
62  \amu_define title (Bearing example)
63  \amu_define image_views (top right diag)
64  \amu_define image_size (sxga)
65 
66  \amu_include (include/amu/scope_diagrams_3d.amu)
67 
68  [database table]: \ref database_component_bearing_linear_lmxuu
69 *******************************************************************************/
70 module lmxuu
71 (
72  n,
73  align = 1,
74  shell = false,
75  wc = true
76 )
77 {
79 
80  assert
81  (
82  ctable_exists(t, n),
83  str("model '", n, "' is undefined in table.")
84  );
85 
86  dr = ctable_get(t, n, "dr");
87  d = ctable_get(t, n, "d");
88  l = ctable_get(t, n, "l");
89  b = ctable_get(t, n, "b");
90  w = ctable_get(t, n, "w");
91  d1 = ctable_get(t, n, "d1");
92 
93  dp = 94/100 * d; // diameter of interior sleeve
94  lp = 96/100 * l; // length of interior sleeve
95 
96 
97  translate( select_ci( [ [0,0,+l/2], origin3d, [0,0,-l/2]], align, false ) )
98  if (shell == true)
99  {
100  color("silver")
101  cylinder(d=d, h=l, center=true);
102  }
103  else
104  {
105  color(wc?"silver":undef)
106  difference()
107  {
108  cylinder(d=d, h=l, center=true); // bearing shell
109  cylinder(d=dp, h=l+eps*4, center=true);
110 
111  for (i = [-1, +1] ) // mounting bands
112  translate([0, 0, b/2 * i])
113  difference()
114  {
115  cylinder(d=d+eps, h=w, center=true);
116  cylinder(d=d1, h=w, center=true);
117  }
118  }
119 
120  color(wc?"black":undef) // body
121  difference()
122  {
123  cylinder(d=dp, h=lp, center=true);
124  cylinder(d=dr, h=lp+eps*4, center=true);
125  }
126 
127  color(wc?"darkgray":undef) // sleeve
128  difference()
129  {
130  cylinder(d=(dr+d-dp), h=l-eps*4, center=true);
131  cylinder(d=dr, h=l, center=true);
132  }
133 
134  color(wc?"dimgray":undef) // band color
135  for (i = [-1, +1] )
136  translate([0, 0, b/2 * i])
137  difference()
138  {
139  cylinder(d=d1+eps, h=w, center=true);
140  cylinder(d=d1, h=w+eps*4, center=true);
141  }
142  }
143 }
144 
145 //! @}
146 //! @}
147 
148 
149 //----------------------------------------------------------------------------//
150 // openscad-amu auxiliary scripts
151 //----------------------------------------------------------------------------//
152 
153 /*
154 BEGIN_SCOPE example;
155  BEGIN_OPENSCAD;
156  include <omdl-base.scad>;
157  include <database/component/bearing/linear_lmxuu.scad>;
158  include <models/3d/bearing/lmxuu.scad>;
159 
160  lmxuu("lm8uu");
161 
162  // end_include
163  END_OPENSCAD;
164 
165  BEGIN_MFSCRIPT;
166  include --path "${INCLUDE_PATH}" {var_init,var_gen_png2eps}.mfs;
167  table_unset_all sizes;
168 
169  images name "sizes" types "sxga";
170  views name "views" views "top right diag";
171 
172  variables set_opts_combine "sizes views";
173  variables add_opts "--viewall --autocenter --view=axes";
174 
175  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
176  END_MFSCRIPT;
177 END_SCOPE;
178 */
179 
180 //----------------------------------------------------------------------------//
181 // end of file
182 //----------------------------------------------------------------------------//
origin3d
<point-3d> The origin point coordinate in 3-dimensional Euclidean space.
Definition: constants.scad:425
eps
<decimal> Epsilon, small distance to deal with overlapping shapes.
Definition: constants.scad:195
dtr_bearing_linear_lmxuu
dtc_bearing_linear_lmxuu
function select_ci(v, i, l=true)
Select specified element from list or return a default.
function ctable_exists(t, ri, ci)
Test the existence of a table row identifier, table column identifier, or both.
function ctable_get(t, ri, ci)
Get a row, a column, or a specific cell value from a table.
module lmxuu(n, align=1, shell=false, wc=true)
Linear motion bearing model.
Definition: lmxuu.scad:331