• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyformex.message函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyformex.message函数的典型用法代码示例。如果您正苦于以下问题:Python message函数的具体用法?Python message怎么用?Python message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了message函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: pick

def pick(mode='actor',single=False,func=None,filtr=None):
    """Enter interactive picking mode and return selection.

    See viewport.py for more details.
    This function differs in that it provides default highlighting
    during the picking operation, a button to stop the selection operation

    If no filter is given, the available filters are presented in a combobox.
    """
    if GD.canvas.selection_mode is not None:
        warning("You need to finish the previous picking operation first!")
        return

    pick_buttons = widgets.ButtonBox('Selection:',['Cancel','OK'],[GD.canvas.cancel_selection,GD.canvas.accept_selection])
    GD.GUI.statusbar.addWidget(pick_buttons)
    
    if mode == 'element':
        filters = selection_filters
    else:
        filters = selection_filters[:3]
    filter_combo = widgets.ComboBox('Filter:',filters,set_selection_filter)
    if filtr is not None and filtr in selection_filters:
        i = selection_filters.index(filtr)
        filter_combo.setIndex(i)
    GD.GUI.statusbar.addWidget(filter_combo)
    
    if func is None:
        func = highlight_funcs.get(mode,None)
    GD.message("Select %s %s" % (filtr,mode))
    sel = GD.canvas.pick(mode,single,func,filtr)
    GD.GUI.statusbar.removeWidget(pick_buttons)
    GD.GUI.statusbar.removeWidget(filter_combo)
    return sel
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:33,代码来源:draw.py


示例2: printSettings

    def printSettings(self):
        for i,v in enumerate(self.all):
            pf.message("""
## VIEWPORTS ##
Viewport %s;  Current:%s;  Settings:
%s
""" % (i, v == self.current, v.settings))
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:viewport.py


示例3: create_tetgen_volume

def create_tetgen_volume():
    """Generate a volume tetraeder mesh inside an stl surface."""
    types = [ 'STL/OFF Files (*.stl *.off)', 'All Files (*)' ]
    fn = askFilename(GD.cfg['workdir'],types)
    if os.path.exists(fn):
        sta,out = utils.runCommand('tetgen -z %s' % fn)
        GD.message(out)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:surface_menu.py


示例4: checkResultsOnServer

def checkResultsOnServer(host=None,userdir=None):
    """Get a list of job results from the cluster.

    Specify userdir='bumper/running' to get a list of running jobs.
    """
    global the_host,the_userdir,the_jobnames
    if host is None or userdir is None:
        res = askItems([
            ('host',None,'select',{'choices':['bumpfs','bumpfs2','other']}),
            ('other','',{'text':'Other host name'}),
            ('status',None,'select',{'choices':['results','running','custom']}),
            ('userdir','bumper/results/',{'text':'Custom user directory'}),
            ])
        if not res:
            return
        host = res['host']
        if host == 'other':
            host = res['other']
        status = res['status']
        if status in ['results','running']:
            userdir = 'bumper/%s/' % status
        else:
            userdir = res['userdir']
        
    jobnames = getSubdirs(host,userdir)
    if jobnames:
        the_host = host
        the_userdir = userdir
        the_jobnames = jobnames
    else:
        the_host = None
        the_userdir = None
        the_jobnames = None
    pf.message(the_jobnames)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:34,代码来源:jobs_menu.py


示例5: inputControlLines

def inputControlLines():
    """Enter three polyline paths in counterclockwise direction."""
    branch = []
    BA = []
    perspective(False)
    for i in range(6):
        pf.message("Input Branch %s" % i)
        if i % 2 == 0:
            coords = None
        else:
            coords = branch[i-1].coords[-1:]

        obj = d2.drawObject2D(mode='polyline',npoints=-1,coords=coords,zvalue=0.)

        obj.specular = 0.
        pf.canvas.removeHighlight()
        ## WHY is bbox='last' or zoomAll needed here
        if obj is not None:
            BA.append(draw(obj,color='blue',flat=True))
            zoomAll()
            branch.append(obj)
        else:
            break

    if len(branch) == 6:
        undraw(BA)
        createBranches(branch)
        zoomAll()
    else:
        warning("Incorrect definition of helper lines")
开发者ID:dladd,项目名称:pyFormex,代码行数:30,代码来源:bifmesh_menu.py


示例6: pick_parts

    def pick_parts(self,obj_type,max_objects,store_closest=False):
        """Set the list of actor parts inside the pick_window.

        obj_type can be 'element', 'point' or 'edge'(SurfaceActor only)
        max_objects specifies the maximum number of objects

        The picked object numbers are stored in self.picked.
        If store_closest==True, the closest picked object is stored in as a
        tuple ( [actor,object] ,distance) in self.picked_closest
        """
        self.picked = []
        if max_objects <= 0:
            GD.message("No such objects to be picked!")
            return
        self.camera.loadProjection(pick=self.pick_window)
        self.camera.loadMatrix()
        stackdepth = 2
        selbuf = GL.glSelectBuffer(max_objects*(3+stackdepth))
        GL.glRenderMode(GL.GL_SELECT)
        GL.glInitNames()
        for i,a in enumerate(self.actors):
            GL.glPushName(i)
            a.pickGL(obj_type)  # this will push the number of the part
            GL.glPopName()
        self.picked = []
        libGL.glRenderMode(GL.GL_RENDER)
        if selbuf[0] > 0:
            buf = asarray(selbuf).reshape(-1,3+selbuf[0])
            buf = buf[buf[:,0] > 0]
            self.picked = buf[:,3:]
            if store_closest and len(buf) > 0:
                w = buf[:,1].argmin()
                self.closest_pick = (self.picked[w], buf[w,1])
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:33,代码来源:viewport.py


示例7: importProject

def importProject():
    """Import an existing project.

    Ask the user to select an existing project file, and then import
    all or selected data from it into the current project.
    """
    proj = openProject(exist=True,access='r')
    if proj: # only if non-empty
        keys = utils.sortedKeys(proj)
        res = draw.askItems(
            [   _I('mode',choices=['All','Defined','Undefined','Selected','None'],itemtype='radio'),
                _I('selected',choices=keys,itemtype='list'),
                ],
            caption='Select variables to import',
            )
        if res:
            mode = res['mode'][0]
            if mode == 'A':
                pass
            elif mode == 'D':
                proj = utils.selectDict(proj,pf.PF)
            elif mode == 'U':
                proj = utils.removeDict(proj,pf.PF)
            elif mode == 'S':
                proj = utils.selectDict(proj,res['selected'])
            elif mode == 'N':
                return
            pf.message("Importing symbols: %s" % utils.sortedKeys(proj))
            pf.PF.update(proj)
            listProject()
开发者ID:dladd,项目名称:pyFormex,代码行数:30,代码来源:fileMenu.py


示例8: detect

def detect(trypaths=None):
    """Check if we have calpy and if so, add its path to sys.path."""

    global calpy_path

    calpy = utils.checkExternal('calpy')
    if not calpy:
        return

    pf.message("You have calpy version %s" % calpy)
    path = ''
    calpy = calpy.split('-')[0]  # trim the version trailer
    if utils.checkVersion('calpy','0.3.4-rev3',external=True) >= 0:
        sta,out = utils.runCommand('calpy --whereami')
        if not sta:
            path = out
            pf.debug("I found calpy in %s" % path)
    if not path:
        if trypaths is None:
            trypaths = [ '/usr/local/lib', '/usr/local' ]
        for p in trypaths:
            path = '%s/calpy-%s' % (p,calpy)
            if os.path.exists(path):
                pf.debug('path exists: %s' % path)
                break
            else:
                pf.debug('path does not exist: %s' % path)
                path = ''
    if path:
        #path += '/calpy'
        pf.message("I found calpy in '%s'" % path)
        sys.path.append(path)

    calpy_path = path
开发者ID:dladd,项目名称:pyFormex,代码行数:34,代码来源:calpy_itf.py


示例9: write_stl_asc

def write_stl_asc(fn,x):
    """Write a collection of triangles to an ascii .stl file.

    Parameters:

    - `fn`: file name, by preference ending with '.stl' or '.stla'
    - `x`: (ntriangles,3,3) shaped array with the vertices of the
      triangles
    """
    if not x.shape[1:] == (4,3):
        raise ValueError,"Expected an (ntri,4,3) array, got %s" % x.shape

    pf.message("Writing ascii STL %s" % fn)
    with open(fn,'wb') as fil:

        fil.write("solid  Created by %s\n" % pf.fullVersion())
        for e in x:
            fil.write("  facet normal %s %s %s\n" % tuple(e[0]))
            fil.write("    outer loop\n")
            for p in e[1:]:
                fil.write("      vertex %s %s %s\n" % tuple(p))
            fil.write("    endloop\n")
            fil.write("  endfacet\n")
        fil.write("endsolid\n")
    pf.message("Finished writing ascii STL, %s bytes" % utils.fileSize(fn))
开发者ID:dladd,项目名称:pyFormex,代码行数:25,代码来源:filewrite.py


示例10: write

    def write(self,geom,name=None,sep=None):
        """Write any geometry object to the geometry file.

        `geom` is one of the Geometry data types of pyFormex or a list
        or dict of such objects.
        Currently exported geometry objects are
        :class:`Coords`, :class:`Formex`, :class:`Mesh`,
        :class:`PolyLine`, :class:`BezierSpline`.
        The geometry object is written to the file using the specified
        separator, or the default.
        """
        self.checkWritable()
        if isinstance(geom,dict):
            for name in geom:
                self.write(geom[name],name,sep)
        elif isinstance(geom,list):
            if name is None:
                for obj in geom:
                    self.write(obj,None,sep)
            else:
                name = utils.NameSequence(name)
                for obj in geom:
                    self.write(obj,name.next(),sep)
                    
        elif hasattr(geom,'write_geom'):
            geom.write_geom(self,name,sep)
        else:
            try:
                writefunc = getattr(self,'write'+geom.__class__.__name__)
                #print writefunc
                writefunc(geom,name,sep)
            except:
                message("Can not (yet) write objects of type %s to geometry file: skipping" % type(geom))
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:33,代码来源:geomfile.py


示例11: clip_surface

def clip_surface():
    """Clip the stl model."""
    if not check_surface():
        return
    itemlist = [['axis',0],['begin',0.0],['end',1.0],['nodes','any']]
    res = askItems(itemlist,caption='Clipping Parameters')
    if res:
        updateGUI()
        nodes,elems = PF['old_surface'] = PF['surface']
        F = Formex(nodes[elems])
        bb = F.bbox()
        GD.message("Original bbox: %s" % bb) 
        xmi = bb[0][0]
        xma = bb[1][0]
        dx = xma-xmi
        axis = int(res[0][1])
        xc1 = xmi + float(res[1][1]) * dx
        xc2 = xmi + float(res[2][1]) * dx
        nodid = res[3][1]
        #print(nodid)
        clear()
        draw(F,color='yellow')
        w = F.test(nodes='any',dir=axis,min=xc1,max=xc2)
        F = F.clip(w)
        draw(F,color='red')
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:25,代码来源:surface_menu.py


示例12: workHere

def workHere():
    """Change the current working directory to the script's location.

    This function is deprecated: use chdir(_file__) instead.
    """
    GD.message("workHere is deprecated: use chdir(_file__) instead")
    chdir(GD.PF.get("curfile", ""))
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:script.py


示例13: gtsinside

def gtsinside(self,pts,dir=0):
    """_Test whether points are inside the surface.

    pts is a plex-1 Formex.
    dir is the shooting direction.

    Returns a list of point numbers that are inside.
    This is not intended to be used directly. Use inside instead
    """
    import os
    print(os.environ)
    S = self.rollAxes(dir)
    P = pts.rollAxes(dir)
    tmp = utils.tempFile(suffix='.gts').name
    tmp1 = utils.tempFile(suffix='.dta').name
    tmp2 = utils.tempFile(suffix='.out').name
    pf.message("Writing temp file %s" % tmp)
    S.write(tmp,'gts')
    pf.message("Writing temp file %s" % tmp1)
    f = open(tmp1,'w')
    P.coords.tofile(f,sep=' ')
    f.write('\n')
    f.close()
    pf.message("Performing inside testing")
    cmd = "gtsinside %s %s > %s" % (tmp,tmp1,tmp2)
    sta,out = utils.runCommand(cmd)
    os.remove(tmp)
    os.remove(tmp1)
    if sta:
        pf.message("An error occurred during the testing.\nSee file %s for more details." % tmp2)
        return None
    pf.message("Reading results from %s" % tmp2)
    ind = fromfile(tmp2,sep=' ',dtype=Int)
    return ind
开发者ID:dladd,项目名称:pyFormex,代码行数:34,代码来源:pyformex_gts.py


示例14: printBbox

 def printBbox(self):
     """Print the bbox of the current selection."""
     objects = self.check()
     for n,o in zip(self.names,objects):
         GD.message("Object %s has bbox %s" % (n,o.bbox()))
     if len(self.names) > 1:
         GD.message("Overal bbox is %s" % bbox(objects))
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:objects.py


示例15: closeProject

def closeProject(save=None,clear=None):
    """Close the current project, saving it or not.

    Parameters:

    - `save`: None, True or False. Determines whether the project should be
      saved prior to closing it. If None, it will be asked from the user.
      Note that this parameter is only used for named Projects. Temporary
      Projects are never saved implicitely.
    - `clear`: None, True or False.
    """
    if pf.PF.filename is not None:
        if save is None:
            save = draw.ack("Save the current project before closing it?")
        pf.message("Closing project %s (save=%s)" % (pf.PF.filename,save))
        if save:
            saveProject()
            if pf.PF:
                listProject()
                if clear is None:
                    clear = draw.ask("What shall I do with the existing globals?",["Delete","Keep"]) == "Delete"

    if clear:
        pf.PF.clear()

    pf.PF.filename = None
    pf.GUI.setcurproj('None')
    updateSettings({
        'curproj':pf.PF.filename,
        },save=True)
开发者ID:dladd,项目名称:pyFormex,代码行数:30,代码来源:fileMenu.py


示例16: __init__

    def __init__(self,coords,elems):
        """Create new model data.

        coords is an array with nodal coordinates
        elems is either a single element connectivity array, or a list of such.
        In a simple case, coords and elems can be the arrays obtained by 
        ``coords, elems = F.feModel()``.
        This is however limited to a model where all elements have the same
        number of nodes. Then you can use the list of elems arrays. The 'fe'
        plugin has a helper function to create this list. E.g., if ``FL`` is a
        list of Formices (possibly with different plexitude), then
        ``fe.mergeModels([Fi.feModel() for Fi in FL])``
        will return the (coords,elems) tuple to create the Model.

        The model can have node and element property numbers.
        """
        #Dict.__init__(self)
        if not type(elems) == list:
            elems = [ elems ]
        self.coords = Coords(coords)
        self.elems = [ Connectivity(e) for e in elems ]
        self.meshes = [ Mesh(self.coords,e) for e in self.elems ]
        nnodes = [ m.nnodes() for m in self.meshes ]
        nelems = [ m.nelems() for m in self.meshes ]
        nplex = [ m.nplex() for m in self.meshes ]
        self.cnodes = cumsum([0]+nnodes)
        self.celems = cumsum([0]+nelems)
        pf.message("Number of nodes: %s" % self.coords.shape[0])
        pf.message("Number of elements: %s" % self.celems[-1])
        pf.message("Number of element groups: %s" % len(nelems))
        #pf.message("Number of nodes per group: %s" % nnodes)
        pf.message("Number of elements per group: %s" % nelems)
        pf.message("Plexitude of each group: %s" % nplex)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:33,代码来源:fe.py


示例17: readMeshFile

def readMeshFile(fn):
    """Read a nodes/elems model from file.

    Returns a dict:

    - `coords`: a Coords with all nodes
    - `elems`: a list of Connectivities
    - `esets`: a list of element sets
    """
    d = {}
    fil = open(fn,'r')
    for line in fil:
        if line[0] == '#':
            line = line[1:]
        globals().update(getParams(line))
        dfil = open(filename,'r')
        if mode == 'nodes':
            d['coords'] = readNodes(dfil)
        elif mode == 'elems':
            elems = d.setdefault('elems',[])
            e = readElems(dfil,int(nplex)) - int(offset)
            elems.append(e)
        elif mode == 'esets':
            d['esets'] = readEsets(dfil)
        else:
            pf.message("Skipping unrecognized line: %s" % line)
        dfil.close()

    fil.close()
    return d
开发者ID:dladd,项目名称:pyFormex,代码行数:30,代码来源:fileread.py


示例18: read_Formex

def read_Formex(fn):
    GD.message("Reading file %s" % fn)
    t = timer.Timer()
    F = Formex.read(fn)
    nelems,nplex = F.f.shape[0:2]
    GD.message("Read %d elems of plexitude %d in %s seconds" % (nelems,nplex, t.seconds()))
    return F
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:formex_menu.py


示例19: readSelection

def readSelection(select=True,draw=True,multi=True):
    """Read a Surface (or list) from asked file name(s).

    If select is True (default), this becomes the current selection.
    If select and draw are True (default), the selection is drawn.
    """
    types = [ 'Surface Files (*.gts *.stl *.off *.neu *.smesh)', 'All Files (*)' ]
    fn = askFilename(GD.cfg['workdir'],types,multi=multi)
    if fn:
        if not multi:
            fn = [ fn ]
        chdir(fn[0])
        names = map(utils.projectName,fn)
        GD.GUI.setBusy()
        surfaces = [ read_Surface(f,False) for f in fn ]
        for i,S in enumerate(surfaces):
            S.setProp(i)
        GD.GUI.setBusy(False)
        export(dict(zip(names,surfaces)))
        if select:
            GD.message("Set selection to %s" % str(names))
            selection.set(names)
            if draw:
                if max([named(s).nfaces() for s in selection]) < 100000 or ack("""
This is a large model and drawing could take quite some time.
You should consider coarsening the model before drawing it.
Shall I proceed with the drawing now?
"""):
                    selection.draw()
    return fn
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:30,代码来源:surface_menu.py


示例20: readSelection

def readSelection(select=True,draw=True,multi=True):
    """Read a Formex (or list) from asked file name(s).

    If select is True (default), this becomes the current selection.
    If select and draw are True (default), the selection is drawn.
    """
    types = utils.fileDescription(['pgf','all'])
    fn = askFilename(GD.cfg['workdir'],types,multi=multi)
    if fn:
        if not multi:
            fn = [ fn ]
        chdir(fn[0])
        res = ODict()
        GD.GUI.setBusy()
        for f in fn:
            res.update(readGeomFile(f))
        GD.GUI.setBusy(False)
        export(res)
        if select:
            oknames = [ k for k in res if isinstance(res[k],Formex) ]
            selection.set(oknames)
            GD.message("Set Formex selection to %s" % oknames)
            if draw:
                selection.draw()
    return fn
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:25,代码来源:formex_menu.py



注:本文中的pyformex.message函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mpiutil.get_comm_rank_root函数代码示例发布时间:2022-05-25
下一篇:
Python pyformex.debug函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap