omdl  v0.9.8
OpenSCAD Mechanical Design Library
omdl_logo.scad
Go to the documentation of this file.
1 //! OpenSCAD mechanical design library logos.
2 /***************************************************************************//**
3  \file
4  \author Roy Allen Sutton
5  \date 2025
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 (omdl logos)
31  \amu_define group_brief (OpenSCAD mechanical design library logos.)
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 
45 //----------------------------------------------------------------------------//
46 
47 //! Standard omdl logo.
48 /***************************************************************************//**
49  \param r <decimal> logo radius.
50  \param c <boolean> color model.
51  \param b <boolean> bevel fins.
52  \param t <boolean> add logo text.
53  \param td <string> text direction: {"ltr" | "rtl"}.
54  \param a <integer> z-alignment: {0 | 1 | 2 | 3}.
55  \param d <decimal> logo diameter (overrides \p r).
56 
57  \details
58 
59  \amu_define scope_id (example)
60  \amu_define title (omdl logo example)
61  \amu_define image_views (top bottom back diag)
62  \amu_define image_columns (4)
63  \amu_define image_size (sxga)
64 
65  \amu_include (include/amu/scope_diagrams_3d.amu)
66 *******************************************************************************/
67 
68 module omdl_logo
69 (
70  r = 5,
71  c = false,
72  b = false,
73  t = false,
74  td = "ltr",
75  a = 0,
76  d
77 )
78 {
79  s = is_defined(d) ? d/10 : r/5;
80 
81  v1 = s/5;
82  v2 = [4, 2, 1] * s/10;
83 
84  // mss extrusions
85  h1 = s/2;
86  h2 = let
87  (
88  sh = s/6,
89  sf = 75/100
90  )
91  [ [sh, [sf, 1]], sh, [sh, [1, sf]] ];
92 
93  translate( [0, 0, select_ci([0, -h1/2, -h1, v1/2-s], a, false)] )
94  union()
95  {
96  fn = "Liberation Sans:style=Italic";
97 
98  ts = [3, 5, 4] * s;
99 
100  t1 = triangle2d_sss2ppp(ts * 1);
101  t2 = triangle2d_sss2ppp(ts * 2/3);
102 
103  // cone
104  color(c?"slategray":undef)
105  translate( [0, 0, -eps*2] )
106  cone( h=s, r=s, vr=v1 );
107 
108  // fins
109  color(c?"gainsboro":undef)
110  rotate(18)
111  repeat_radial( n=5, angle=true )
112  translate( triangle_centroid(t1) )
113  extrude_linear_mss( h=(b?h2:h1), center=false )
114  difference()
115  {
116  translate( -triangle_centroid(t1) )
117  polygon( polygon_round_eve_all_p(t1, vr=v2) );
118 
119  translate( -triangle_centroid(t2) )
120  polygon( polygon_round_eve_all_p(t2, vr=v2) );
121  }
122 
123  // text
124  if( t )
125  {
126  color(c?"slategray":undef)
127  translate([third(ts) * 4/5, 0])
128  extrude_linear_mss( h=h1, center=false )
129  text(text="omdl", size=s, font=fn, halign="center", valign="center", direction=td);
130  }
131  }
132 }
133 
134 //! @}
135 //! @}
136 
137 
138 //----------------------------------------------------------------------------//
139 // openscad-amu auxiliary scripts
140 //----------------------------------------------------------------------------//
141 
142 /*
143 BEGIN_SCOPE example;
144  BEGIN_OPENSCAD;
145  include <omdl-base.scad>;
146  include <models/3d/misc/omdl_logo.scad>;
147 
148  $fn = 36;
149 
150  omdl_logo(c=false, b=true, t=true);
151 
152  // end_include
153  END_OPENSCAD;
154 
155  BEGIN_MFSCRIPT;
156  include --path "${INCLUDE_PATH}" {var_init,var_gen_png2eps}.mfs;
157  table_unset_all sizes;
158 
159  images name "sizes" types "sxga";
160  views name "views" views "top bottom back diag";
161 
162  variables set_opts_combine "sizes views";
163  variables add_opts "--viewall --autocenter --view=axes";
164 
165  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
166  END_MFSCRIPT;
167 END_SCOPE;
168 */
169 
170 //----------------------------------------------------------------------------//
171 // end of file
172 //----------------------------------------------------------------------------//
173 
eps
<decimal> Epsilon, small distance to deal with overlapping shapes.
Definition: constants.scad:195
function third(v)
Return the third element of an iterable value.
function select_ci(v, i, l=true)
Select specified element from list or return a default.
function is_defined(v)
Test if a value is defined.
function polygon_round_eve_all_p(c, vr=0, vrm=1, vfn, w=true, cw=true)
Compute coordinates that round all of the vertices between each adjacent edges in 2D.
function triangle_centroid(c, d=2)
Compute the centroid of a triangle.
function triangle2d_sss2ppp(v, a=x_axis_ci, cw=true)
Compute a set of vertex coordinates for a triangle given its side lengths in 2D.
module omdl_logo(r=5, c=false, b=false, t=false, td="ltr", a=0, d)
Standard omdl logo.
Definition: omdl_logo.scad:328
module cone(r=1, h, d, vr)
A cone.
Definition: basic_3d.scad:461
module extrude_linear_mss(h, center=false, c=true)
Linearly extrude a 2d shape with multi-segment uniformly-spaced profile scaling.
Definition: extrude.scad:748
module repeat_radial(n, r=1, o=0, angle=true, move=false)
Radially repeat copies of child objects about a z-axis radius.
Definition: repeat.scad:462
function angle(a, from=angle_unit_default, to=angle_unit_base)
Convert an angle from some units to another.