Back to index

salome-paravis  6.5.0
I2.py
Go to the documentation of this file.
00001 # Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00002 #
00003 # This library is free software; you can redistribute it and/or
00004 # modify it under the terms of the GNU Lesser General Public
00005 # License as published by the Free Software Foundation; either
00006 # version 2.1 of the License.
00007 #
00008 # This library is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 # Lesser General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU Lesser General Public
00014 # License along with this library; if not, write to the Free Software
00015 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 #
00017 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 #
00019 
00020 #This case corresponds to: /visu/MeshPresentation/I2 case
00021 # Create  mesh presentation for nodes and cells of the the given MED file 
00022 
00023 import sys
00024 from paravistest import datadir, pictureext, get_picture_dir
00025 from presentations import *
00026 from pvsimple import *
00027 import paravis
00028 
00029 # Create presentations
00030 myParavis = paravis.myParavis
00031 picturedir = get_picture_dir(sys.argv[1], "MeshPresentation/I2")
00032 
00033 theFileName = datadir +  "UnitTetra.med"
00034 print " --------------------------------- "
00035 print "file ", theFileName
00036 print " --------------------------------- "
00037 
00038 
00039 result = myParavis.ImportFile(theFileName)
00040 aProxy = GetActiveSource()
00041 if aProxy is None:
00042        raise RuntimeError, "Error: can't import file."
00043 else: print "OK"
00044 
00045 aView = GetRenderView()
00046 
00047 #%Creation of the mesh presentation%
00048 mesh_name = "UnitTetra"
00049 
00050 #^Presentation on "onNodes" and '"onCells" family^
00051 entity_types = [EntityType.NODE,EntityType.CELL]
00052 for entity_type in entity_types:
00053     entity_name = EntityType.get_name(entity_type)
00054     mesh = MeshOnEntity(aProxy, mesh_name ,entity_type)
00055     if mesh is None: 
00056         msg = "ERROR!!!Presentation of mesh on '"+entity_name+"' family wasn't created..."
00057         raise RuntimeError, msg 
00058     mesh.Visibility=1
00059     reset_view(aView)
00060     Render()
00061 
00062     # Add path separator to the end of picture path if necessery
00063     if not picturedir.endswith(os.sep):
00064             picturedir += os.sep
00065     entity_name = EntityType.get_name(entity_type)
00066     # Construct image file name
00067     pic_name = picturedir + mesh_name + "_" + entity_name + "." + pictureext
00068     
00069     process_prs_for_test(mesh, aView, pic_name)
00070 
00071 
00072