omdl  v1.0
OpenSCAD Mechanical Design Library
clamps.scad
Go to the documentation of this file.
1 //! Clamps, bushings, and grips for wires and hoses.
2 /***************************************************************************//**
3  \file
4  \author Roy Allen Sutton
5  \date 2025-2026
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 (Clamps)
31  \amu_define group_brief (Clamps, bushings, and grips for wires and hoses.)
32 
33  \amu_include (include/amu/doxyg_init_pd_gds_ipg.amu)
34 *******************************************************************************/
35 
36 //----------------------------------------------------------------------------//
37 // group and macros.
38 //----------------------------------------------------------------------------//
39 
40 /***************************************************************************//**
41  \amu_include (include/amu/doxyg_define_in_parent_open.amu)
42  \amu_define includes_required_add
43  (
44  models/3d/fastener/screws.scad
45  )
46  \amu_include (include/amu/includes_required.amu)
47 *******************************************************************************/
48 
49 //----------------------------------------------------------------------------//
50 
51 //! A clamp, bushing, and/or grip for wire, hose, and/or pipe wall penetrations.
52 /***************************************************************************//**
53  \param size <decimal-list-2 | decimal> wire size; a list [w, h]
54  or a single decimal to set the wire diameter.
55 
56  \param clamp <datastruct | integer> screw clamp; structured data
57  or a single integer to set the clamp wall side {0|1}.
58 
59  \param cone <datastruct | integer> bushing cone; structured data
60  or a single integer to set the cone wall side {0|1}.
61 
62  \param grip <datastruct | integer> zip tie grip; structured data
63  or a single integer to set the grip wall side {0|1}.
64 
65  \param wth <decimal> wall thickness.
66 
67  \param gap <decimal> wire gap percentage.
68 
69  \param mode <integer> operation mode {0=hole, 1=part-a, 2=part-b,
70  3=parts-a and b}.
71 
72  \details
73 
74  Construct a clamp, cone bushing, and/or a grip as a stand alone
75  part or as a wall penetration hole finish that can secure or
76  provide strain relief for passing wires, pipes, hoses, etc. The
77  penetration can be circular or rectangular dependent on the size
78  specification.
79 
80  ## Multi-value and structured parameters
81 
82  ### clamp
83 
84  #### Data structure fields: clamp
85 
86  e | data type | default value | parameter description
87  ---:|:-----------------:|:-----------------:|:------------------------------------
88  0 | integer-list-2 \| integer | required | wall side
89  1 | decimal | h | base height
90  2 | datastruct \| decimal | (see below) | screw bore
91  3 | decimal | d*3 | clamp depth
92  4 | decimal-list-2 \| decimal | 15 | pinch bar size
93 
94  ##### clamp[0]: wall side
95 
96  The clamp can be placed on either side of the wall by assigning \b
97  0 or \b 1. To place a clamp on both sides of the wall, assign the
98  value list <b>[0, 1]</b>.
99 
100  ##### clamp[2]: screw bore
101 
102  e | data type | default value | parameter description
103  ---:|:-----------------:|:-----------------:|:------------------------------------
104  0 | decimal | max(size)/4 | \p d : bore diameter
105  1 | decimal | h | \p l : bore length
106  2 | (see below) | [d*2, d/3, d/3] | \p h : screw head
107  3 | (see below) | \b undef | \p n : screw nut
108  4 | (see below) | \b undef | \p s : nut slot cutout
109 
110  See screw_bore() for documentation of the data types for the screw
111  bore parameters \p h, \p n, and \p s.
112 
113  ##### clamp[4]: pinch bar size
114 
115  The pinch bar size, [h, w], is specified as a percentage of the
116  penetration size height and the clamp depth. When a single decimal
117  is specified, the height and width percentage are the same.
118 
119  ### cone
120 
121  e | data type | default value | parameter description
122  ---:|:-----------------:|:-----------------:|:------------------------------------
123  0 | integer-list-2 \| integer | required | wall side
124  1 | decimal | max(size)/2 | cone base width
125  2 | decimal | max(size)/3 | cone height
126  3 | decimal | 255 | extrude mode
127 
128  The extrusion mode controls which sections of the cone are rendered.
129  For more information see the mode parameter for extrude_rotate_trl().
130 
131  ##### cone[0]: wall side
132 
133  The cone can be placed on either side of the wall by assigning \b 0
134  or \b 1. To place a cone on both sides of the wall, assign the
135  value list <b>[0, 1]</b>.
136 
137  ### grip
138 
139  e | data type | default value | parameter description
140  ---:|:-----------------:|:-----------------:|:------------------------------------
141  0 | integer-list-2 \| integer | required | wall side
142  1 | decimal | max(size)/2 | zip tie width
143  2 | decimal | max(size)/6 | zip tie height
144  3 | decimal | max(size)*3/7 | grip base width
145  4 | decimal | max(size)*3/2 | grip height
146  5 | integer | 4 | cut count
147  6 | decimal | 4/5 | cut height fraction
148  7 | decimal | min(size)/5 | cut width
149  8 | decimal | 0 | cut rotational offset
150 
151  ##### grip[0]: wall side
152 
153  The grip can be placed on either side of the wall by assigning \b 0
154  or \b 1. To place a grip on both sides of the wall, assign the
155  value list <b>[0, 1]</b>.
156 
157  \amu_define scope_id (example_clamp)
158  \amu_define title (Clamp example)
159  \amu_define image_views (top back diag)
160  \amu_define image_size (sxga)
161 
162  \amu_include (include/amu/scope_diagrams_3d.amu)
163 
164  \amu_define scope_id (example_cone)
165  \amu_define title (Cone example)
166  \amu_define image_views (top back diag)
167  \amu_define image_size (sxga)
168 
169  \amu_include (include/amu/scope_diagrams_3d.amu)
170 
171  \amu_define scope_id (example_grip)
172  \amu_define title (Grip example)
173  \amu_define image_views (top back diag)
174  \amu_define image_size (sxga)
175 
176  \amu_include (include/amu/scope_diagrams_3d.amu)
177 *******************************************************************************/
178 module clamp_cg
179 (
180  size = 1,
181 
182  clamp,
183  cone,
184  grip,
185 
186  wth = 0,
187  gap = 10,
188 
189  mode
190 )
191 {
192  //
193  // hole
194  //
195 
196  sw = defined_e_or(size, 0, size);
197  sh = defined_e_or(size, 1, sw);
198 
199  ww = sw * (1 + gap/100);
200  wh = sh * (1 + gap/100);
201 
202  wmax = max([ww, wh]);
203  wmin = min([ww, wh]);
204 
205  // type; 0=circle, 1=rectangle
206  wt = is_list(size) && (len(size) > 1) ? 1 : 0;
207 
208  wr = (wt == 0) ? ww/2 : wmin/4;
209  wl = (wt == 0) ? undef : [ww-wr*2, wh-wr*2];
210 
211  //
212  // removals
213  //
214 
215  if (mode == 0)
216  {
217  // hole passage
218  hull()
219  extrude_rotate_trl(l=wl, r=wr)
220  square([eps, wth+eps*8], center=true);
221  }
222 
223  else
224 
225  //
226  // additions
227  //
228 
229  {
230  // clamp
231  if ( is_defined(clamp) )
232  {
233  s = defined_e_or(clamp, 0, clamp); // wall side
234 
235  bh = defined_e_or(clamp, 1, wh); // base height
236  sb = defined_e_or(clamp, 2, wmax/4); // (1) screw bore
237 
238  // (1) screw bore: d, l, h, n, s
239  // * see screw_bore()
240  sbd = defined_e_or(sb, 0, sb);
241  sbl = defined_e_or(sb, 1, bh);
242  sbh = defined_e_or(sb, 2, [sbd*2, sbd/3, sbd/3]);
243  sbn = defined_e_or(sb, 3, undef);
244  sbs = defined_e_or(sb, 4, undef);
245 
246  cd = defined_e_or(clamp, 3, sbd*3); // clamp depth
247  pb = defined_e_or(clamp, 4, 15); // (2) pinch bar
248 
249  // (2) pinch bar: percentage of wire height and clamp depth [height, width]
250  php = defined_e_or(pb, 0, pb);
251  pwp = defined_e_or(pb, 1, php);
252 
253  pbh = php * wh / 100; // pinch bar height
254  pbw = pwp * cd / 100; // pinch bar width
255 
256  wsw = ww/2 * (1+5/10); // saddle width
257  ssw = cd; // screw bore shoulder width
258 
259  // clamp base
260  h_bp =
261  [
262  [0, -bh],
263  [wsw + ssw, -bh],
264  [wsw + ssw, -wh/2],
265  [wsw, -wh/2],
266  [wsw, 0],
267  ];
268 
269  h_bvr = [1, 1/2, 0, 1] * wmin/4;
270  h_bvrm = [1, 1, 0, 1];
271 
272  bp = concat( [for (i=h_bp) i], [for (i=reverse(h_bp)) [-i.x, i.y]] );
273  bvr = concat( [for (i=h_bvr) i], [for (i=reverse(h_bvr)) i] );
274  bvrm = concat( [for (i=h_bvrm) i], [for (i=reverse(h_bvrm)) i] );
275 
276  bpr = polygon_round_eve_all_p(bp, bvr, bvrm);
277 
278  // clamp strap
279  h_sp =
280  [
281  [0, -wh/2],
282  [wsw + ssw, -wh/2],
283  [wsw + ssw, wh/2],
284  [wsw, wh/2],
285  [wsw, wh],
286  ];
287 
288  h_svr = [1, 1/2, 1/2, 1] * wmin/4;
289  h_svrm = [5, 1, 1, 1];
290 
291  sp = concat( [for (i=h_sp) i], [for (i=reverse(h_sp)) [-i.x, i.y]] );
292  svr = concat( [for (i=h_svr) i], [for (i=reverse(h_svr)) i] );
293  svrm = concat( [for (i=h_svrm) i], [for (i=reverse(h_svrm)) i] );
294 
295  spr = polygon_round_eve_all_p(sp, svr, svrm);
296 
297  for (s = is_list(s) ? s : [s])
298  rotate([0, s * 180, 0])
299  translate([0, 0, cd/2 + wth/2])
300  union()
301  {
302  difference()
303  {
304  union()
305  {
306  // clamp strap
307  if ( binary_bit_is(mode, 1, 1) )
308  difference()
309  {
310  extrude_linear_mss( h=cd, center=true )
311  polygon(spr);
312 
313  translate([0, wh*(gap/100), 0])
314  scale([1+(gap/200), 1, 1+eps*4])
315  extrude_linear_mss( h=cd, center=true )
316  polygon(bpr);
317  }
318 
319  // clamp base
320  if ( binary_bit_is(mode, 0, 1) )
321  extrude_linear_mss( h=cd, center=true )
322  polygon(bpr);
323  }
324 
325  // remove hole
326  clamp_cg(size=size, wth=cd+eps*8, mode=0);
327 
328  // bore screws
329  for (x = [-1, 1] )
330  translate([x * (wsw + ssw/2), wh/2, 0])
331  rotate([270, 0, 0])
332  screw_bore(d=sbd, l=sbl +wh/2 + eps*8, h=sbh, n=sbn, s=sbs, a=1);
333  }
334 
335  // add strap pinch bars
336  if ( binary_bit_is(mode, 1, 1) )
337  for (i = [-1, 1] )
338  translate([0, +wh/2, i * (cd/2-pbw)])
339  rotate([0, 90, 0])
340  extrude_linear_mss( h=ww, center=true )
341  rhombus( [pbw, pbh*2], center=true);
342 
343  // add base pinch bar
344  if ( binary_bit_is(mode, 0, 1) )
345  translate([0, -wh/2, 0])
346  rotate([0, 90, 0])
347  extrude_linear_mss( h=ww, center=true )
348  rhombus( [pbw, pbh*2], center=true);
349  }
350  }
351 
352  // cone
353  if ( is_defined(cone) )
354  {
355  s = defined_e_or(cone, 0, cone);
356  w = defined_e_or(cone, 1, wmax/2);
357  h = defined_e_or(cone, 2, wmax/3);
358  m = defined_e_or(cone, 3, 255);
359 
360  p =
361  [
362  origin2d,
363  [w, 0],
364  [w/3, h],
365  [0, h]
366  ];
367 
368  vr = [3, 1, 1, 0] * min([w, h])/4;
369  vrm = [3, 1, 1, 0];
370 
371  pr = polygon_round_eve_all_p(p, vr, vrm);
372 
373  for (s = is_list(s) ? s : [s])
374  rotate([0, s * 180, 0])
375  translate([0, 0, wth/2])
376  extrude_rotate_trl(l=wl, r=wr, m=m)
377  polygon(pr);
378  }
379 
380  // grip
381  if ( is_defined(grip) )
382  {
383  s = defined_e_or(grip, 0, grip);
384 
385  zw = defined_e_or(grip, 1, wmax/2);
386  zh = defined_e_or(grip, 2, wmax/6);
387 
388  w = defined_e_or(grip, 3, wmax*3/7);
389  h = defined_e_or(grip, 4, wmax*3/2);
390 
391  cn = defined_e_or(grip, 5, 4);
392  cf = defined_e_or(grip, 6, 4/5);
393  ct = defined_e_or(grip, 7, wmin/5);
394  co = defined_e_or(grip, 8, 0);
395 
396  p =
397  let
398  (
399  o = h-h/5, // offset from top
400  q = zh // zip-tie grove slant
401  )
402  [
403  origin2d,
404  [w, 0],
405  [w, o-zw-q],
406  [w-zh, o-zw],
407  [w-zh, o],
408  [w, o+q],
409  [w, h],
410  [0, h],
411 
412  [0, o], // tooth
413  [-zh/4, o-zw/2],
414  [0, o-zw]
415  ];
416 
417  vr = [3, 1, 0, 0, 1, 1, 1, 0] * min([w, h])/4;
418  vrm = [3, 1, 0, 0, 1, 1, 1, 0];
419 
420  pr = polygon_round_eve_all_p(p, vr, vrm);
421 
422  for (s = is_list(s) ? s : [s])
423  rotate([0, s * 180, 0])
424  difference()
425  {
426  translate([0, 0, wth/2])
427  extrude_rotate_trl(l=wl, r=wr)
428  polygon(pr);
429 
430  cw = wmax/2 + w*2;
431  ch = h*cf;
432 
433  repeat_radial(cn, ao=co)
434  translate([cw/2, 0, wth/2 + h - ch/2])
435  cube([cw, ct, ch + eps*4], center=true);
436  }
437  }
438  }
439 }
440 
441 //! A one piece zip tie clamp to secure wires or provide strain relief.
442 /***************************************************************************//**
443  \param size <decimal-list-2 | decimal> wire size; a list [w, h]
444  or a single decimal for (w=h).
445 
446  \param ztie <decimal-list-2 | decimal> zip tie size; a list [zw, zh]
447  or a single decimal to set zw with (zh=zw/2).
448 
449  \param clamp <datastruct> clamp size; a list [cw, ch, cd, [pbs]],
450  the clamp width, height, depth, and pinch bar
451  specification (pbs).
452 
453  \param tunnel <datastruct> zip tie tunnel configuration; (see below).
454 
455  \param vr <datastruct> rounding radii for clamp, wire seat and
456  zip tie tunnel; (see below).
457 
458  \param vrm <datastruct> rounding mode for clamp, wire seat and
459  zip tie tunnel; (see below).
460 
461  \param align <integer-list-3> part alignment; [w, h, d].
462 
463  \param mode <integer> construction mode {0=removals, 1=additions}.
464 
465  \details
466 
467  Construct a one piece clamp that uses one or more zip ties to
468  secure a wires hose, pipe, etc. The pinch bars and number of zip
469  tie tunnels can be configured as described below. When the size of
470  the clamp is not specified, default values will be assigned based
471  on the wire size. Via the \p mode parameter, the tunnels can be
472  constructed alone for object difference when integrating with other
473  design components.
474 
475  When \p size is a single decimal, the wire seat is a half-circle,
476  centered at the top edge of the clamp. When \p size is a
477  decimal-list-2, the seat is a rectangle with the upper top edge
478  aligned with the top edge of the clamp. The wire seat rounding
479  parameters are used only for the latter case.
480 
481  ## Multi-value and structured parameters
482 
483  ### clamp
484 
485  #### Data structure fields: clamp
486 
487  e | data type | default value | parameter description
488  ---:|:-----------------:|:-----------------:|:------------------------------------
489  0 | decimal | w *2 | clamp width
490  1 | decimal | h *2 | clamp height
491  2 | decimal | zw *2 | clamp depth
492  3 | decimal-list-3 \| decimal | zw /3 | pinch bar [pw, ph, po]
493 
494  ##### clamp[3]: pinch bar
495 
496  e | data type | default value | parameter description
497  ---:|:-----------------:|:-----------------:|:------------------------------------
498  0 | decimal | required | bar width
499  1 | decimal | pw /3 | bar height
500  2 | decimal | zw *3/2 | bar center offset
501 
502  ### tunnel
503 
504  #### Data structure fields: tunnel
505 
506  e | data type | default value | parameter description
507  ---:|:-----------------:|:-----------------:|:------------------------------------
508  0 | decimal | 1 | corner radius
509  1 | decimal-list-n \| decimal | 0 | list of center offsets
510  2 | integer | 0 | tunnel mode
511  3 | decimal-list-2 | [0, 0] | radial adjustment [w, h]
512  4 | decimal-list-2 | [0, 0] | center offset [w, h]
513 
514  ###### tunnel[2]: tunnel mode
515 
516  Integer value is binary encoded.
517 
518  b | description
519  ---:|:---------------------------------------
520  0-1 | w-size select {0:inner, 1:middle, 2:outer}
521  2-3 | h-size select {0:inner, 1:middle, 2:outer}
522  4 | project tunnel to bottom of clamp for zip tie access
523 
524  ### vr
525 
526  #### Data structure fields: vr
527 
528  e | data type | default value | parameter description
529  ---:|:-----------------:|:-----------------:|:------------------------------------
530  0 | decimal-list-4 \| decimal | required | clamp rounding radii
531  1 | decimal-list-4 \| decimal | 0 | seat rounding radii
532  2 | decimal-list-4 \| decimal | 0 | tunnel rounding radii
533 
534  ### vrm
535 
536  #### Data structure fields: vrm
537 
538  e | data type | default value | parameter description
539  ---:|:-----------------:|:-----------------:|:------------------------------------
540  0 | decimal-list-4 \| decimal | [1, 1, 4, 3] | clamp rounding radii
541  1 | decimal-list-4 \| decimal | [4, 3, 1, 1] | seat rounding radii
542  2 | decimal-list-4 \| decimal | 1 | tunnel rounding radii
543 
544  \amu_define scope_id (example_clamp_zt_1p)
545  \amu_define title (Zip tie clamp example)
546  \amu_define image_views (top bottom right back diag)
547  \amu_define image_size (sxga)
548 
549  \amu_include (include/amu/scope_diagrams_3d.amu)
550 *******************************************************************************/
551 module clamp_zt_1p
552 (
553  size = 1,
554  ztie = 1,
555 
556  clamp,
557  tunnel,
558 
559  vr,
560  vrm,
561 
562  align,
563 
564  mode = 1
565 )
566 {
567  //
568  // remove section at bottom for access to tunnel
569  //
570  module open_tunnel_access()
571  {
572  children(0);
573 
574  if ( binary_bit_is(tm, 4, 1) )
575  difference()
576  {
577  children(1);
578 
579  translate([0, +eps*2, 0])
580  hull()
581  children(0);
582  }
583  }
584 
585  // wire size
586  od = !is_list(size); // size one dimensional
587  wx = defined_e_or(size, 0, size);
588  wy = defined_e_or(size, 1, od ? wx/2 : wx);
589 
590  // zip tie
591  zx = defined_e_or(ztie, 0, ztie);
592  zy = defined_e_or(ztie, 1, zx/2);
593 
594  // clamp size
595  sx = defined_e_or(clamp, 0, wx*2);
596  sy = defined_e_or(clamp, 1, wy*2);
597  sz = defined_e_or(clamp, 2, zx*2);
598 
599  // wire pinch bar
600  pb = defined_e_or(clamp, 3, zx/3);
601 
602  // tunnel: [cr, inst, mode, wh-adjust, wh-offset]
603  cr = defined_e_or(tunnel, 0, 1); // corner radius
604  zi = defined_e_or(tunnel, 1, 0); // list of offset instances
605  tm = defined_e_or(tunnel, 2, 0); // 5-bit integer tunnel mode
606  ta = defined_e_or(tunnel, 3, [0, 0]); // tunnel wh-radial adjustment
607  to = defined_e_or(tunnel, 4, [0, 0]); // tunnel wh-offset
608 
609  // rounding: [clamp, wire seat, zip tunnel]
610  vr0 = defined_e_or(vr, 0, vr);
611  vr1 = defined_e_or(vr, 1, 0);
612  vr2 = defined_e_or(vr, 2, 0);
613 
614  // rounding modes: [clamp, wire seat, zip tunnel]
615  vrm0 = defined_e_or(vrm, 0, [1, 1, 4, 3]);
616  vrm1 = defined_e_or(vrm, 1, [4, 3, 1, 1]);
617  vrm2 = defined_e_or(vrm, 2, 1);
618 
619 
620  //
621  // decode pinch bar configuration
622  //
623 
624  pw = defined_e_or(pb, 0, pb);
625  ph = defined_e_or(pb, 1, pw/3);
626  po = defined_e_or(pb, 2, zx*3/2);
627 
628 
629  //
630  // decode zip tie tunnel modes
631  //
632 
633  // B0-1: x-size select
634  ztx = select_ci( [ wx, (sx+wx/2)/2, sx ], binary_iw2i(tm, 0, 2), false );
635 
636  // B2-3: y-size select
637  zty = select_ci ( [ sy, (sy+wy/2)/2, wy ], binary_iw2i(tm, 2, 2), false );
638 
639  // B2-3: y-offset select
640  zto = select_ci ( [ 0, (sy-wy/2)/4, (sy-wy)/2 ], binary_iw2i(tm, 2, 2), false );
641 
642  // B4: project tunnel to bottom of clamp
643  ztp = binary_bit_is(tm, 4, 1);
644 
645 
646  // align construction
647  translate
648  (
649  [
650  select_ci( [ 0, +sx/2, 0, -sx/2 ], defined_e_or(align, 0, 0), false ),
651  select_ci( [ 0, +sy/2, 0, -sy/2 ], defined_e_or(align, 1, 0), false ),
652  select_ci( [ 0, +sz/2, 0, -sz/2 ], defined_e_or(align, 2, 0), false )
653  ]
654  )
655  {
656  //
657  // construct clamp
658  //
659 
660  // clamp with wire seat and tunnel removed
661  difference()
662  {
663  // clamp body
664  if ( binary_bit_is(mode, 0, 1) )
665  extrude_linear_uss(sz, center=true)
667  (
668  size = [sx, sy],
669  vr = vr0,
670  vrm = vrm0,
671  center = true
672  );
673 
674  // remove wire passage
675  if ( binary_bit_is(mode, 0, 1) )
676  extrude_linear_uss(sz + eps*4, center=true)
677  if ( od )
678  {
679  translate([0, sy/2 + eps*2, 0])
680  circle(d = wx);
681  }
682  else
683  {
684  translate([0, (sy-wy)/2 + eps*2, 0])
686  (
687  size = [wx, wy],
688  vr = vr1,
689  vrm = vrm1,
690  center = true
691  );
692  }
693 
694  // remove zip tie tunnel passage
695  for (zio = zi)
696  translate([0, zto, zio] + concat(to, 0))
697  open_tunnel_access()
698  {
699  // child-0: tunnel
701  (
702  r = cr,
703  l = [ztx, zty] - 2*[cr, cr] + [zy, zy] + ta
704  )
706  (
707  size = [zy, zx],
708  vr = vr2,
709  vrm = vrm2,
710  center = true
711  );
712 
713  // child-1: area under tunnel
714  translate([0, -sy/2 + zty/4 - second(to)/2, 0])
715  rotate([90, 0, 0])
716  extrude_linear_uss(sy - zty/2 + second(to) + eps*4, center=true)
718  (
719  size = [ztx + zy*2 + first(ta), zx],
720  vr = vr2,
721  vrm = 1,
722  center = true
723  );
724  }
725  }
726 
727  // add base pinch bar sets for tunnel instance (when > 0)
728  if ( binary_bit_is(mode, 0, 1) && ( pw > 0 ) )
729  for (zio = zi, i = [-1, 1])
730  translate([0, sy/2 - wy, zio + i * po/2])
731  rotate([0, 90, 0])
732  extrude_linear_mss( h=wx, center=true )
733  difference()
734  {
735  rhombus( [pw, ph*2], center=true);
736  translate([0, -ph/2])
737  square([pw, ph], center=true);
738  }
739  }
740 }
741 
742 //! @}
743 //! @}
744 
745 
746 //----------------------------------------------------------------------------//
747 // openscad-amu auxiliary scripts
748 //----------------------------------------------------------------------------//
749 
750 /*
751 BEGIN_SCOPE example_clamp;
752  BEGIN_OPENSCAD;
753  include <omdl-base.scad>;
754  include <models/3d/fastener/screws.scad>;
755  include <parts/3d/fastener/clamps.scad>;
756 
757  $fn = 36;
758 
759  d = 7.00;
760 
761  head = undef;
762  nut = [3.5, 1.5, 0, 4, 45, 1.25];
763  slot = [undef, -3];
764  bore = [3, undef, head, nut, slot];
765 
766  clamp_cg(size=d, clamp=[0, undef, bore], mode=3);
767 
768  // end_include
769  END_OPENSCAD;
770 
771  BEGIN_MFSCRIPT;
772  include --path "${INCLUDE_PATH}" {var_init,var_gen_png2eps}.mfs;
773  table_unset_all sizes;
774 
775  images name "sizes" types "sxga";
776  views name "views" views "top back diag";
777 
778  variables set_opts_combine "sizes views";
779  variables add_opts "--viewall --autocenter --view=axes";
780 
781  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
782  END_MFSCRIPT;
783 END_SCOPE;
784 
785 BEGIN_SCOPE example_cone;
786  BEGIN_OPENSCAD;
787  include <omdl-base.scad>;
788  include <models/3d/fastener/screws.scad>;
789  include <parts/3d/fastener/clamps.scad>;
790 
791  $fn = 36;
792 
793  w = 2;
794  d = 7.00;
795  difference()
796  {
797  translate(-[d*2,d*2,w/2]) cube([d*4,d*4,w]);
798  clamp_cg(size=d, wth=w, mode=0);
799  }
800  clamp_cg(size=d, cone=[[0, 1]], mode=1);
801 
802  // end_include
803  END_OPENSCAD;
804 
805  BEGIN_MFSCRIPT;
806  include --path "${INCLUDE_PATH}" {var_init,var_gen_png2eps}.mfs;
807  table_unset_all sizes;
808 
809  images name "sizes" types "sxga";
810  views name "views" views "top back diag";
811 
812  variables set_opts_combine "sizes views";
813  variables add_opts "--viewall --autocenter --view=axes";
814 
815  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
816  END_MFSCRIPT;
817 END_SCOPE;
818 
819 BEGIN_SCOPE example_grip;
820  BEGIN_OPENSCAD;
821  include <omdl-base.scad>;
822  include <models/3d/fastener/screws.scad>;
823  include <parts/3d/fastener/clamps.scad>;
824 
825  $fn = 36;
826 
827  w = 2;
828  d = [7.00, 3.50];
829  e = max(d);
830  difference()
831  {
832  translate(-[e*2,e*2,w/2]) cube([e*4,e*4,w]);
833  clamp_cg(size=d, wth=w, mode=0);
834  }
835  clamp_cg(size=d, grip=0, mode=1);
836 
837  // end_include
838  END_OPENSCAD;
839 
840  BEGIN_MFSCRIPT;
841  include --path "${INCLUDE_PATH}" {var_init,var_gen_png2eps}.mfs;
842  table_unset_all sizes;
843 
844  images name "sizes" types "sxga";
845  views name "views" views "top back diag";
846 
847  variables set_opts_combine "sizes views";
848  variables add_opts "--viewall --autocenter --view=axes";
849 
850  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
851  END_MFSCRIPT;
852 END_SCOPE;
853 */
854 
855 /*
856 BEGIN_SCOPE example_clamp_zt_1p;
857  BEGIN_OPENSCAD;
858  include <omdl-base.scad>;
859  include <parts/3d/fastener/clamps.scad>;
860 
861  d = [10, 4];
862  z = 4;
863  c = [20, 10, 30];
864  t = [1, [-10, 0, +10], 5 + 16, [4, -2]];
865  v = [4, 1, 1];
866 
867  rotate([90,0,0]) {
868  clamp_zt_1p (size=d, ztie=z, clamp=c, tunnel=t, vr=v);
869  color("white")
870  clamp_zt_1p (size=d, ztie=z, clamp=c, tunnel=t, vr=v, mode=0);
871  }
872 
873  // end_include
874  END_OPENSCAD;
875 
876  BEGIN_MFSCRIPT;
877  include --path "${INCLUDE_PATH}" {var_init,var_gen_png2eps}.mfs;
878  table_unset_all sizes;
879 
880  images name "sizes" types "sxga";
881  views name "views" views "top bottom right back diag";
882 
883  variables set_opts_combine "sizes views";
884  variables add_opts "--viewall --autocenter --view=axes";
885 
886  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
887  END_MFSCRIPT;
888 END_SCOPE;
889 */
890 
891 //----------------------------------------------------------------------------//
892 // end of file
893 //----------------------------------------------------------------------------//
894 
origin2d
<point-2d> The origin point coordinate in 2d Euclidean space.
Definition: constants.scad:407
eps
<decimal> Epsilon, small distance to deal with overlapping shapes.
Definition: constants.scad:195
function binary_iw2i(v, s, w)
Decode the binary bits of a bit window to an integer value.
function binary_bit_is(v, b, t=1)
Test if a binary bit position of an integer value equals a test bit.
function defined_e_or(v, i, d)
Returns an element from an iterable if it exists, or a default value if not.
function second(v)
Return the second element of an iterable value.
function first(v)
Return the first element of an iterable value.
function reverse(v)
Reverse the elements 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.
module screw_bore(d=1, l=1, h, n, t, s, f, a)
Flat and beveled-head fastener bore with nut, nut slot, and bore tolerance.
Definition: screws.scad:358
module clamp_zt_1p(size=1, ztie=1, clamp, tunnel, vr, vrm, align, mode=1)
A one piece zip tie clamp to secure wires or provide strain relief.
Definition: clamps.scad:1274
module clamp_cg(size=1, clamp, cone, grip, wth=0, gap=10, mode)
A clamp, bushing, and/or grip for wire, hose, and/or pipe wall penetrations.
Definition: clamps.scad:747
module rhombus(size=1, vr, center=false)
A rhombus.
Definition: common_2d.scad:665
module cone(size=1, vr, center=false)
A cone.
Definition: common_3d.scad:461
module pg_rectangle(size=1, o, vr, vrm=1, vfn, center=false)
A polygon rectangle with vertex rounding.
Definition: polygon.scad:773
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 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
module extrude_linear_uss(h, center=false, c=true, ha=0)
Linearly extrude a 2d shape with uniformly-spaced profile scaling.
Definition: extrude.scad:666
module repeat_radial(n, r=1, ao=0, angle=true, move=false)
Radially repeat copies of child objects about a z-axis radius.
Definition: repeat.scad:462