Back to index

salome-smesh  6.5.0
SMESH_freebord.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00005 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00006 #
00007 # This library is free software; you can redistribute it and/or
00008 # modify it under the terms of the GNU Lesser General Public
00009 # License as published by the Free Software Foundation; either
00010 # version 2.1 of the License.
00011 #
00012 # This library is distributed in the hope that it will be useful,
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 # Lesser General Public License for more details.
00016 #
00017 # You should have received a copy of the GNU Lesser General Public
00018 # License along with this library; if not, write to the Free Software
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 #
00021 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00022 #
00023 
00024 import salome
00025 import geompy
00026 import smesh
00027 
00028 
00029 # Create box without one plane
00030 
00031 box = geompy.MakeBox(0., 0., 0., 10., 20., 30.)
00032 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
00033 
00034 FaceList  = []
00035 for i in range( 5 ):
00036   FaceList.append( subShapeList[ i ] )
00037 
00038 aComp = geompy.MakeCompound( FaceList )
00039 aBox = geompy.Sew( aComp, 1. )
00040 idbox = geompy.addToStudy( aBox, "box" )
00041 
00042 aBox  = salome.IDToObject( idbox )
00043 
00044 # Create mesh
00045 smesh.SetCurrentStudy(salome.myStudy)
00046 
00047 mesh = smesh.Mesh(aBox, "Mesh_freebord")
00048 
00049 algoReg = mesh.Segment()
00050 hypNbSeg = algoReg.NumberOfSegments(5)
00051 
00052 algoMef = mesh.Triangle()
00053 hypArea = algoMef.MaxElementArea(20)
00054 
00055 
00056 mesh.Compute()
00057 
00058 
00059 # Criterion : Free edges. Create group.
00060 
00061 aCriterion = smesh.GetCriterion(smesh.EDGE, smesh.FT_FreeEdges)
00062 
00063 aGroup = mesh.MakeGroupByCriterion("Free edges", aCriterion)
00064 
00065 anIds = aGroup.GetIDs()
00066 
00067 # print result
00068 print "Criterion: Free edges Nb = ", len( anIds )
00069 for i in range( len( anIds ) ):
00070   print anIds[ i ]
00071 
00072 salome.sg.updateObjBrowser(1)