Exemplo n.º 1
0
def write_stl(types=['stl']):
    if not check_stl():
        types = map(utils.fileDescription,types)
    fn = askFilename(GD.cfg['workdir'],types,exist=False)
    if fn:
        print "Exporting stl model to %s" % fn
        F = PF['stl_model']
        GD.gui.setBusy()
        stl.write_stla(fn,F.f)   
        GD.gui.setBusy(False)
Exemplo n.º 2
0
def writeSelectionSTL():
    """Writes the currently selected Formices to .stl files."""
    if len(selection) == 1:
        name = selection[0]
        fn = askFilename(GD.cfg["workdir"], file="%s.stl" % name, filter=["(*.stl)", "*"], exist=False)
        if fn:
            print "Writing Formex '%s' to file '%s'" % (name, fn)
            print named(name).bbox()
            chdir(fn)
            stl.write_stla(fn, named(name).f)
Exemplo n.º 3
0
    b = e.reverseElements()
    #b.setProp(2)
    
# create the bumps
for p in a:
    e = e.bump(2,p, lambda x:exp(-0.5*x),[0,1])

renderMode(rendermode)
if transparent:
    GD.canvas.alphablend = True
if bottom:
    draw(b,color=yellow,alpha=1.0)
if shrink:
    draw(e.shrink(0.8),alpha=0.5)
else:
    draw(e,alpha=0.5)

if export:
    from plugins import stl
    f = file('novation.stl','w')
    F = e # + b
    # Create triangles
    G = F.selectNodes([0,1,2])
    # If polygones, add more triangles
    for i in range(3,F.nplex()):
        G += F.selectNodes([0,i-1,i])
    clear()
    draw(G)
    stl.write_stla(f,G.f)
    f.close()