-all: moebius-core.scad
+all: moebius-core.scad moebius-mesh.scad
PLAY = /home/reprap/play
USING_AUTOS = moebius
moebius-core.scad: genscad $(PYLIBS)
./$< >$@.tmp && mv -f $@.tmp $@
+moebius-mesh.scad: meshscad $(PYLIBS)
+ ./$< >$@.tmp && mv -f $@.tmp $@
+
AUTO_TOPLEVELS := $(foreach m,$(USING_AUTOS),$(shell $(PLAY)/toplevel-find $m))
autoincs: $(AUTO_INCS)
--- /dev/null
+#!/usr/bin/python
+
+from __future__ import print_function
+
+import signal
+signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+from moebius import *
+from scad import *
+
+nomsize = 30;
+wire = 3.0;
+
+# number of wires
+kv = 10
+kw = 10
+
+# resolution
+nv = 40
+nw = 40
+ns = 10 # around tube
+
+nv += -nv % kv
+nw += -hw % kw
+
+each_v = nv / kv
+each_w = nw / kw
+
+m = Moebius(nv, nw)
+
+def round_wire(p, vec_surfacenormal, vec_acrosswire, sigma):
+ return (p +
+ wire * (vec_surfacenormal * sin(sigma) +
+ vec_acrosswire * cos*(sigma)))
+
+def make_moebius(objname):
+ print('module %s(){' % objname)
+ extents = ScadObject() # wires along extents
+ travers = ScadObject(): # wires along traverses
+ for v in range(0, nv):
+ for w in range(0, nw):
+ for s in range(0, ns):
+ sigmas = [ (s + sx)/ns * tau for sigma in 0,1 ]
+ eq = []
+ if not w % each_w:
+ extents[w].quad([ round_wire(p, norm, trav, sigmas[sx])
+ for p, norm, extt, trav in m.details(v+a, w)
+ for sx in 0,1
+ for a in 0,1 ])
+ if not v % each_v:
+ travers[v].quad([ round_wire(p, norm, extt, sigmas[sx])
+ for p, norm, extt, trav in m.details(v, w+b)
+ for sx in 0,1
+ for b in 0,1 ])
+ for v in range(0, nv):
+ travers[v].writeout_core()
+ for w in range(0, nw):
+ travers[w].writeout_core()
+ print '}'
+
+make_moebius('MoebiusMesh')
+print('moebiuscore_nomsize=%s;' % repr(nomsize))