omdl  v0.9.5
OpenSCAD Mechanical Design Library
revolved.scad
Go to the documentation of this file.
1 //! Select 2D shapes revolved about the z-axis.
2 /***************************************************************************//**
3  \file
4  \author Roy Allen Sutton
5  \date 2015-2019
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 (Revolutions)
31  \amu_define group_brief (Select 2D shapes revolved about the z-axis.)
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_include (include/amu/includes_required.amu)
43 
44  \amu_define image_view (diag)
45 
46  \amu_define group_id (${parent})
47  \amu_include (include/amu/scope_diagrams_3d_in_group.amu)
48 
49  \amu_define group_id (${group})
50  \amu_include (include/amu/scope_diagrams_3d_in_group.amu)
51 
52  \amu_include (include/amu/scope_diagram_3d_object.amu)
53 *******************************************************************************/
54 
55 //----------------------------------------------------------------------------//
56 
57 //! A rectangular cross-sectional profile revolved about the z-axis.
58 /***************************************************************************//**
59  \copydoc extrude_rotate_trl()
60 
61  \copydoc rectangle_c()
62 
63  \details
64 
65  \amu_eval ( object=torus_rectangle_c ${object_ex_diagram_3d} )
66 *******************************************************************************/
67 module torus_rectangle_c
68 (
69  r,
70  pa = 0,
71  ra = 360,
72  l,
73  m = 255,
74 
75  size,
76  core,
77  t,
78  co,
79  cr = 0,
80  vr,
81  vr1,
82  vr2,
83  vrm = 0,
84  vrm1,
85  vrm2,
86  center = false
87 )
88 {
89  extrude_rotate_trl( r=r, l=l, pa=pa, ra=ra, m=m )
91  (
92  size=size, core=core, t=t,
93  co=co, cr=cr,
94  vr=vr, vr1=vr1, vr2=vr2,
95  vrm=vrm, vrm1=vrm1, vrm2=vrm2,
96  center=center
97  );
98 }
99 
100 //! An elliptical cross-sectional profile revolved about the z-axis.
101 /***************************************************************************//**
102  \copydoc extrude_rotate_trl()
103 
104  \copydoc ellipse_cs()
105 
106  \details
107 
108  \amu_eval ( object=torus_ellipse_cs ${object_ex_diagram_3d} )
109 *******************************************************************************/
110 module torus_ellipse_cs
111 (
112  r,
113  pa = 0,
114  ra = 360,
115  l,
116  m = 255,
117 
118  size,
119  core,
120  t,
121  a1 = 0,
122  a2 = 0,
123  co,
124  cr = 0
125 )
126 {
127  extrude_rotate_trl( r=r, l=l, pa=pa, ra=ra, m=m )
128  ellipse_cs
129  (
130  size=size, core=core, t=t,
131  a1=a1, a2=a2,
132  co=co, cr=cr
133  );
134 }
135 
136 //! A trapezoidal cross-sectional profile revolved about the z-axis.
137 /***************************************************************************//**
138  \copydoc extrude_rotate_trl()
139 
140  \copydoc pg_trapezoid()
141 
142  \param sl <decimal> The left side leg length of the trapezoid
143  polygon \p l.
144 
145  \details
146 
147  \amu_eval ( object=torus_pg_trapezoid ${object_ex_diagram_3d} )
148 *******************************************************************************/
149 module torus_pg_trapezoid
150 (
151  r,
152  pa = 0,
153  ra = 360,
154  l,
155  m = 255,
156 
157  b = 1,
158  h,
159  sl = 1,
160  a = 90,
161  vr,
162  vrm = 1,
163  vfn,
164  center = false
165 )
166 {
167  extrude_rotate_trl( r=r, l=l, pa=pa, ra=ra, m=m )
169  (
170  b=b,
171  h=h,
172  l=sl,
173  a=a,
174  vr=vr,
175  vrm=vrm,
176  vfn=vfn,
177  center=center
178  );
179 }
180 
181 //! @}
182 //! @}
183 
184 //----------------------------------------------------------------------------//
185 // openscad-amu auxiliary scripts
186 //----------------------------------------------------------------------------//
187 
188 /*
189 BEGIN_SCOPE diagram;
190  BEGIN_OPENSCAD;
191  include <omdl-base.scad>;
192  include <shapes/revolved.scad>;
193 
194  shape = "torus_rectangle_c";
195  $fn = 36;
196 
197  if (shape == "torus_rectangle_c")
198  torus_rectangle_c( size=[40,20], core=[35,20], r=40, l=[90,60], co=[0,2.5], vr=4, vrm=15, m=63, center=true );
199  else if (shape == "torus_ellipse_cs")
200  torus_ellipse_cs( size=[20,15], t=[2,4], r=50, a1=0, a2=180, pa=90, ra=270, co=[0,2] );
201  else if (shape == "torus_pg_trapezoid")
202  torus_pg_trapezoid( b=[20,30], sl=30, a=45, vr=[5,5,5,5], vrm=[3,2,1,4], r=40, l=[90,60], m=63, center=true );
203  END_OPENSCAD;
204 
205  BEGIN_MFSCRIPT;
206  include --path "${INCLUDE_PATH}" {var_init,var_gen_png2eps}.mfs;
207 
208  views name "views" views "diag";
209  defines name "shapes" define "shape"
210  strings "
211  torus_rectangle_c
212  torus_ellipse_cs
213  torus_pg_trapezoid
214  ";
215  variables add_opts_combine "views shapes";
216  variables add_opts "--viewall --autocenter --view=axes";
217 
218  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
219  END_MFSCRIPT;
220 END_SCOPE;
221 */
222 
223 //----------------------------------------------------------------------------//
224 // end of file
225 //----------------------------------------------------------------------------//
module ellipse_cs(size, core, t, a1=0, a2=0, co, cr=0)
A sector of an ellipse with a removed elliptical core.
Definition: basic_2d.scad:961
module rectangle_c(size, core, t, co, cr=0, vr, vr1, vr2, vrm=0, vrm1, vrm2, center=false)
A rectangle with a removed rectangular core.
Definition: basic_2d.scad:595
module pg_trapezoid(b=1, h, l=1, a=90, o=origin2d, vr, vrm=1, vfn, center=false)
A polygon trapezoid with individual vertex rounding and arc facets.
Definition: polygon.scad:710
module torus_ellipse_cs(r, pa=0, ra=360, l, m=255, size, core, t, a1=0, a2=0, co, cr=0)
An elliptical cross-sectional profile revolved about the z-axis.
Definition: revolved.scad:506
module torus_pg_trapezoid(r, pa=0, ra=360, l, m=255, b=1, h, sl=1, a=90, vr, vrm=1, vfn, center=false)
A trapezoidal cross-sectional profile revolved about the z-axis.
Definition: revolved.scad:550
module torus_rectangle_c(r, pa=0, ra=360, l, m=255, size, core, t, co, cr=0, vr, vr1, vr2, vrm=0, vrm1, vrm2, center=false)
A rectangular cross-sectional profile revolved about the z-axis.
Definition: revolved.scad:458
module extrude_rotate_trl(r, pa=0, ra=360, l, m=255)
Translate, rotate, and revolve a 2d shape about the z-axis with linear elongation.
Definition: extrude.scad:562