from moebius import *
from scad import *
-nomsize = 30;
+nomsize = 50;
wire = 3.0;
# number of wires
ns = 10 # around tube
nv += -nv % kv
-nw += -hw % kw
+nw += -nw % 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)))
+ r = (p +
+ wire/nomsize * (vec_surfacenormal * sin(sigma) +
+ vec_acrosswire * cos(sigma)))
+ #print(' round_wire',p,vec_surfacenormal, vec_acrosswire, sigma, r,
+ # file=sys.stderr)
+ return r
def make_moebius(objname):
print('module %s(){' % objname)
- extents = ScadObject() # wires along extents
- travers = ScadObject(): # wires along traverses
+ # wires:
+ extents = [ ScadObject() for v in range(0,nv) ] # along extents
+ travers = [ ScadObject() for w in range(0,nw) ] # 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 = []
+ print('VWS',v,w,s, file=sys.stderr)
+ sigmas = [ (s + sx)/ns * tau for sx in 0,1 ]
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 ])
+ for a in 0,1
+ for p, norm, extt, trav in (m.details(v+a, w),)
+ for sx 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 b in 0,1
+ for p, norm, extt, trav in (m.details(v, w+b),)
+ for sx in 0,1 ])
for v in range(0, nv):
- travers[v].writeout_core()
+ print('// extent v=', v)
+ extents[v].writeout_core(nomsize)
for w in range(0, nw):
- travers[w].writeout_core()
- print '}'
+ print('// travers w=', w)
+ travers[w].writeout_core(nomsize)
+ print('}')
make_moebius('MoebiusMesh')
print('moebiuscore_nomsize=%s;' % repr(nomsize))