totalrot = res['total rot'] xmin,xmax = bb[:,axis] dx = (xmax-xmin) / nslices x = arange(nslices+1) * dx N = unitVector(axis) P = [ bb[0]+N*s for s in x ] return P,N,totalrot else: return None reset() smooth() lights(True) transparent(False) setView('horse',[20,20,0]) S = TriSurface.read(getcfg('datadir')+'/horse.gts') bb = S.bbox() t = -0.3 bb[0] = (1.0-t)*bb[0] + t*bb[1] draw(S,bbox=bb,view='front') try: P,n,t = askSlices(S.bbox()) except: exit() a = t/len(P) F = S.toFormex() G = []
axis = res['Direction'] nslices = res['# slices'] totalrot = res['total rot'] xmin,xmax = bb[:,axis] dx = (xmax-xmin) / nslices x = arange(nslices+1) * dx N = unitVector(axis) P = [ bb[0]+N*s for s in x ] return P,N,totalrot else: return [],[] smooth() setView('horse',[20,20,0]) chdir('/home/bene/prj/pyformex/stl') S = TriSurface.read('horse-upright.gts') bb = S.bbox() t = -0.3 bb[0] = (1.0-t)*bb[0] + t*bb[1] draw(S,bbox=bb,view='front') P,n,t = askSlices(S.bbox()) a = t/len(P) F = S.toFormex() G = [] old = seterr(all='ignore') for i,p in enumerate(P): F1 = F.cutAtPlane(p,-n) F1.setProp(i)