[OpenSCAD] Twisted Torus

Parkinbot rudolf at digitaldocument.de
Wed Sep 26 02:55:05 EDT 2018


A moebius strip is a good exercise to explore and compare basic and advanced
OpenScad programming techniques. 
There are many examples out there (in Thingiverse) where people define a
moebius with polyhedron in a more or less direct way. Also have a look at
these.

The approach I am showing here uses a more general library, which is a very
mighty instrument for many other applications.  

Two basic techniques you can use for such a thing are explained in
https://www.thingiverse.com/thing:900137/files where you also find the
Naca_sweep lib used in the following code. As it would be a special case for
sweep() to connect a moebius structure into a ring with some (e.g. 0.5)
windings my code uses the trick to union two half moebius rings. Thus it
creates an affine representation of the two halfrings and lets the library
function sweep() do all the "hard" work.  

The lib contains the definitions of sweep() as well as the affine
counterparts of translate() and rotate() Rx_(), and so on. 



use <Naca_sweep.scad> // https://www.thingiverse.com/thing:900137/files

sweep(moebius(twist=1.5));
sweep(moebius(twist=1.5, start=180, end=360));

function moebius(r=100, start=0, step=1, end = 180, twist=0.5) =
 [for(i=[start:step:end])
  Rz_(i,
  Tx_(r, 
  Rx_(90, 
  Rz_(i*twist, square())
  )))];

function square(x=50, y=10) = 
[[-x/2, -y/2, 0], 
[-x/2, y/2, 0],
[x/2, y/2, 0],
[x/2, -y/2, 0]];



--
Sent from: http://forum.openscad.org/



More information about the Discuss mailing list