コード例 #1
0
def createSphere():
    _data_ = _name_ + 'createSphere_data'
    dia = Dialog(
        items=[
            _I('name', '__auto__'),
            _I('object type',
               itemtype='radio',
               choices=['TriSurface', 'Mesh', 'Formex']),
            _I('method', choices=['icosa', 'geo']),
            _I('ndiv', 8),
            _I('nx', 36),
            _I('ny', 18),
        ],
        enablers=[
            ('method', 'icosa', 'ndiv'),
            ('method', 'geo', 'nx', 'ny'),
        ],
    )
    if _data_ in pf.PF:
        dia.updateData(pf.PF[_data_])
    res = dia.getResults()
    if res:
        pf.PF[_data_] = res
        name = res['name']
        if name == '__auto__':
            name = autoName(res['object type']).next()
        if res['method'] == 'icosa':
            F = simple.sphere(res['ndiv'])
            print("Surface has %s vertices and %s faces" %
                  (F.ncoords(), F.nelems()))
            F = convert_Mesh_TriSurface(F, res['object type'])
        else:
            F = simple.sphere3(res['nx'], res['ny'])
            F = convertFormex(F, res['object type'])
            print("Surface has  %s faces" % F.nelems())
        export({name: F})
        selection.set([name])
        if res['object type'] == 'TriSurface':
            surface_menu.selection.set([name])
        selection.draw()
コード例 #2
0
ファイル: Sphere2.py プロジェクト: gunnups/pyFormex
def run():
    reset()
    nx = 4  # initial value for number of modules
    ny = 4
    m = 1.6  # refinement at each step
    ns = 6  # number of steps

    smooth()
    setView('front')
    for i in range(ns):
        print("nx=%s, ny=%s" % (nx, ny))
        b = sphere2(nx, ny, bot=-90, top=90).translate(0, -1.0)
        s = sphere3(nx, ny, bot=-90, top=90)
        s = s.translate(0, 1.0)
        s.setProp(3)
        clear()
        bb = bbox([b, s])
        draw(b, bbox=bb, wait=False)
        draw(s, bbox=bb)  #,color='random')
        nx = int(m * nx)
        ny = int(m * ny)
        sleep(2)
コード例 #3
0
ファイル: Cone.py プロジェクト: dladd/pyFormex
def run():
    reset()
    smooth()
    r=3.
    h=15.
    n=64

    F = simple.sector(r,360.,n,n,h=h,diag=None)
    F.setProp(0)
    draw(F,view='bottom')
    #setDrawOptions({'bbox':None})

    print(map(str,range(4)))
    ans = ask('How many balls do you want?',['0','1','2','3'])

    try:
        nb = int(ans)
    except:
        nb = 3

    if nb > 0:
        B = simple.sphere3(n,n,r=0.9*r,bot=-90,top=90)
        B1 = B.translate([0.,0.,0.95*h])
        B1.setProp(1)
        draw(B1)

        if nb > 1:
            B2 = B.translate([0.2*r,0.,1.15*h])
            B2.setProp(2)
            draw(B2)

        if nb > 2:
            B3 = B.translate([-0.2*r,0.1*r,1.25*h])
            B3.setProp(6)
            draw(B3)

        zoomAll()
コード例 #4
0
ファイル: Cone.py プロジェクト: gunnups/pyFormex
def run():
    reset()
    smooth()
    r = 3.
    h = 15.
    n = 64

    F = simple.sector(r, 360., n, n, h=h, diag=None)
    F.setProp(0)
    draw(F, view='bottom')
    #setDrawOptions({'bbox':None})

    print(map(str, range(4)))
    ans = ask('How many balls do you want?', ['0', '1', '2', '3'])

    try:
        nb = int(ans)
    except:
        nb = 3

    if nb > 0:
        B = simple.sphere3(n, n, r=0.9 * r, bot=-90, top=90)
        B1 = B.translate([0., 0., 0.95 * h])
        B1.setProp(1)
        draw(B1)

        if nb > 1:
            B2 = B.translate([0.2 * r, 0., 1.15 * h])
            B2.setProp(2)
            draw(B2)

        if nb > 2:
            B3 = B.translate([-0.2 * r, 0.1 * r, 1.25 * h])
            B3.setProp(6)
            draw(B3)

        zoomAll()
コード例 #5
0
level = 'normal'
topics = ['geometry','surface']
techniques = ['color']

"""

from simple import sphere2,sphere3

reset()

nx = 4
ny = 4
m = 1.6
ns = 6

smooth()
setView('front')
for i in range(ns):
    b = sphere2(nx,ny,bot=-90,top=90).translate(0,-1.0)
    s = sphere3(nx,ny,bot=-90,top=90)
    s = s.translate(0,1.0)
    s.setProp(3)
    clear()
    bb = bbox([b,s])
    draw(b,bbox=bb,wait=False)
    draw(s,bbox=bb)#,color='random')
    nx = int(m*nx)
    ny = int(m*ny)

コード例 #6
0
## Copyright (C) Benedict Verhegghe ([email protected]) 
##
## This program is distributed under the GNU General Public License
## version 2 or later (see file COPYING for details)
##
"""Sphere2"""

from simple import sphere2,sphere3

reset()

nx = 4
ny = 4
m = 1.6
ns = 6

smooth()
setView('front')
for i in range(ns):
    b = sphere2(nx,ny,bot=-90,top=90).translate(0,-1.0)
    s = sphere3(nx,ny,bot=-90,top=90).translate(0,1.0)
    s.setProp(3)
    clear()
    bb = bbox([b,s])
    draw(b,bbox=bb,wait=False)
    draw(s,bbox=bb)#,color='random')
    #GD.canvas.update()
    nx = int(m*nx)
    ny = int(m*ny)

コード例 #7
0
ファイル: Cone.py プロジェクト: BackupTheBerlios/pyformex-svn
F = simple.sector(r,360.,n,n,h=h,diag=None)
F.setProp(0)
draw(F,view='bottom')
zoomall()
zoom(1.5)


ans = ask('How many balls do you want?',['3','2','1','0'])

try:
    nb = int(ans)
except:
    nb = 3
    
if nb > 0:
    B = simple.sphere3(n,n,r=0.9*r,bot=-90,top=90)
    B1 = B.translate([0.,0.,0.95*h])
    B1.setProp(1)
    draw(B1,bbox=None)
    zoomall()
    zoom(1.5)

if nb > 1:
    B2 = B.translate([0.2*r,0.,1.15*h])
    B2.setProp(2)
    draw(B2,bbox=None)
    zoomall()
    zoom(1.5)

if nb > 2:
    B3 = B.translate([-0.2*r,0.1*r,1.25*h])