X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=doc%2Fsalome%2Fgui%2FSMESH%2Fquality_controls.htm;h=064d7b9ebf617f8013d4bc99595528f2946afd69;hp=0e7907bb7e48d20917fc13c442cc58063634643e;hb=9d11375af40826e967ab2c3bcb77d1f9d439c90c;hpb=57b43b4d010e2d0a1529d3c131bbb9d416e63258 diff --git a/doc/salome/gui/SMESH/quality_controls.htm b/doc/salome/gui/SMESH/quality_controls.htm index 0e7907bb7..064d7b9eb 100755 --- a/doc/salome/gui/SMESH/quality_controls.htm +++ b/doc/salome/gui/SMESH/quality_controls.htm @@ -1,1629 +1,1270 @@ - - - - -
-import salome
- -import geompy
- -import SMESH
- -import StdMeshers
- -- -
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", - "SMESH")
- -smesh.SetCurrentStudy(salome.myStudy)
- -- -
# create a box without - one plane
- -box = geompy.MakeBox(0., - 0., 0., 20., 20., 15.)
- -subShapeList = geompy.SubShapeAll(box, - geompy.ShapeType["FACE"])
- -- -
FaceList = - []
- -for i in range( - 5 ):
- -FaceList.append( - subShapeList[ i ] )
- -- -
aComp = geompy.MakeCompound( - FaceList )
- -aBox = geompy.Sew( - aComp, 1. )
- -idbox = geompy.addToStudy( - aBox, "box" )
- -- -
aBox = - salome.IDToObject( idbox )
- -- -
# create a mesh
- -hyp1 = smesh.CreateHypothesis("NumberOfSegments", - "libStdMeshersEngine.so")
- -hyp1.SetNumberOfSegments(5)
- -hyp2 = smesh.CreateHypothesis("MaxElementArea", - "libStdMeshersEngine.so")
- -hyp2.SetMaxElementArea(20)
- -- -
algo1 = smesh.CreateHypothesis("Regular_1D", - "libStdMeshersEngine.so")
- -algo2 = smesh.CreateHypothesis("MEFISTO_2D", - "libStdMeshersEngine.so")
- -- -
mesh = smesh.CreateMesh(aBox)
- -mesh.AddHypothesis(aBox,hyp1)
- -mesh.AddHypothesis(aBox,hyp2)
- -mesh.AddHypothesis(aBox,algo1)
- -mesh.AddHypothesis(aBox,algo2)
- -- -
smesh.Compute(mesh,aBox)
- -- -
smeshgui = salome.ImportComponentGUI("SMESH")
- -smeshgui.Init(salome.myStudyId);
- -smeshgui.SetName( - salome.ObjectToID( mesh ), "Mesh_freebord" );
- -- -
# criterion : free borders
- -aFilterMgr = smesh.CreateFilterManager()
- -aPredicate = aFilterMgr.CreateFreeBorders()
- -aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Free borders Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.EDGE, "Free borders" )
- -aGroup.Add( anIds - )
- -salome.sg.updateObjBrowser(1) -
- -- -
import salome
- -import geompy
- -import SMESH
- -import StdMeshers
- -- -
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", - "SMESH")
- -smesh.SetCurrentStudy(salome.myStudy)
- -- -
# create a box without - one plane
- -- -
box = geompy.MakeBox(0., - 0., 0., 20., 20., 15.)
- -subShapeList = geompy.SubShapeAll(box, - geompy.ShapeType["FACE"])
- -- -
FaceList = - []
- -for i in range( - 5 ):
- -FaceList.append( - subShapeList[ i ] )
- -- -
aComp = geompy.MakeCompound( - FaceList )
- -aBox = geompy.Sew( - aComp, 1. )
- -idbox = geompy.addToStudy( - aBox, "box" )
- -- -
aBox = - salome.IDToObject( idbox )
- -- -
# create a mesh
- -- -
hyp1 = smesh.CreateHypothesis("NumberOfSegments", - "libStdMeshersEngine.so")
- -hyp1.SetNumberOfSegments(5)
- -hyp2 = smesh.CreateHypothesis("MaxElementArea", - "libStdMeshersEngine.so")
- -hyp2.SetMaxElementArea(20)
- -- -
algo1 = smesh.CreateHypothesis("Regular_1D", - "libStdMeshersEngine.so")
- -algo2 = smesh.CreateHypothesis("MEFISTO_2D", - "libStdMeshersEngine.so")
- -- -
mesh = smesh.CreateMesh(aBox)
- -mesh.AddHypothesis(aBox,hyp1)
- -mesh.AddHypothesis(aBox,hyp2)
- -mesh.AddHypothesis(aBox,algo1)
- -mesh.AddHypothesis(aBox,algo2)
- -- -
smesh.Compute(mesh,aBox)
- -- -
smeshgui = salome.ImportComponentGUI("SMESH")
- -smeshgui.Init(salome.myStudyId);
- -smeshgui.SetName( - salome.ObjectToID( mesh ), "Mesh_borders_at_multi-connections" - );
- -- -
# Criterion : Borders at - multi-connection
- -aFilterMgr = smesh.CreateFilterManager()
- -aFunctor = aFilterMgr.CreateMultiConnection()
- -- -
aPredicate = aFilterMgr.CreateEqualTo()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 2 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Borders at multi-connections Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.EDGE, "Borders at multi-connections" )
- -aGroup.Add( anIds - )
- -salome.sg.updateObjBrowser(1) -
- -- -
- -
import salome
- -import geompy
- -import SMESH
- -import StdMeshers
- -- -
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", - "SMESH")
- -smesh.SetCurrentStudy(salome.myStudy)
- -- -
# create a box without - one plane
- -box = geompy.MakeBox(0., - 0., 0., 20., 20., 15.)
- -subShapeList = geompy.SubShapeAll(box, - geompy.ShapeType["FACE"])
- -- -
FaceList = - []
- -for i in range( - 5 ):
- -FaceList.append( - subShapeList[ i ] )
- -- -
aComp = geompy.MakeCompound( - FaceList )
- -aBox = geompy.Sew( - aComp, 1. )
- -idbox = geompy.addToStudy( - aBox, "box" )
- -- -
aBox = - salome.IDToObject( idbox )
- -- -
# create a mesh
- -hyp1 = smesh.CreateHypothesis("NumberOfSegments", - "libStdMeshersEngine.so")
- -hyp1.SetNumberOfSegments(5)
- -hyp2 = smesh.CreateHypothesis("MaxElementArea", - "libStdMeshersEngine.so")
- -hyp2.SetMaxElementArea(20)
- -- -
algo1 = smesh.CreateHypothesis("Regular_1D", - "libStdMeshersEngine.so")
- -algo2 = smesh.CreateHypothesis("MEFISTO_2D", - "libStdMeshersEngine.so")
- -- -
mesh = smesh.CreateMesh(aBox)
- -mesh.AddHypothesis(aBox,hyp1)
- -mesh.AddHypothesis(aBox,hyp2)
- -mesh.AddHypothesis(aBox,algo1)
- -mesh.AddHypothesis(aBox,algo2)
- -- -
smesh.Compute(mesh,aBox)
- -- -
smeshgui = salome.ImportComponentGUI("SMESH")
- -smeshgui.Init(salome.myStudyId);
- -smeshgui.SetName( - salome.ObjectToID( mesh ), "Mesh" );
- -- -
# Criterion : Length > - 3
- -aFilterMgr = smesh.CreateFilterManager()
- -aFunctor = aFilterMgr.CreateLength()
- -- -
aPredicate = aFilterMgr.CreateMoreThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 3 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Edges length > 3 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.EDGE, "Edges with legth > 3" )
- -aGroup.Add( anIds - )
- -salome.sg.updateObjBrowser(1)
- -- -
import SMESH
- -import SMESH_mechanic
- -- -
smesh = - SMESH_mechanic.smesh
- -mesh = - SMESH_mechanic.mesh
- -salome = SMESH_mechanic.salome
- -- -
aFilterMgr = smesh.CreateFilterManager()
- -- -
# Criterion : AREA > - 30
- -aFunctor = aFilterMgr.CreateArea()
- -aPredicate = aFilterMgr.CreateMoreThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 95 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -anEditor = mesh.GetMeshEditor()
- -anEditor.RemoveElements(anIds)
- -- -
# Criterion : Free Edges
- -- -
aPredicate = aFilterMgr.CreateFreeEdges()
- -aPredicate.SetMesh( - mesh )
- -aBorders = aPredicate.GetBorders()
- -- -
# create groups
- -aGroupF = mesh.CreateGroup( - SMESH.FACE, "Faces with free edges" )
- -aGroupN = mesh.CreateGroup( - SMESH.NODE, "Nodes on free edges" )
- -- -
# fill groups with elements, - corresponding to the criterion
- -print ""
- -print "Criterion: - Free edges Nb = ", len( aBorders )
- -for i in range( - len( aBorders ) ):
- -aBorder - = aBorders[ i ]
- -print - "Face # ", aBorder.myElemId, " : Edge between nodes (",
- -print - aBorder.myPnt1, ", ", aBorder.myPnt2, ")"
- -- -
aGroupF.Add( - [aBorder.myElemId] )
- -aGroupN.Add( - [aBorder.myPnt1, aBorder.myPnt2] )
- -- -
salome.sg.updateObjBrowser(1) -
- -- -
import salome
- -import geompy
- -import SMESH
- -import StdMeshers
- -- -
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", - "SMESH")
- -smesh.SetCurrentStudy(salome.myStudy)
- -- -
# create a box without - one plane
- -- -
box = geompy.MakeBox(0., - 0., 0., 20., 20., 15.)
- -subShapeList = geompy.SubShapeAll(box, - geompy.ShapeType["FACE"])
- -- -
FaceList = - []
- -for i in range( - 5 ):
- -FaceList.append( - subShapeList[ i ] )
- -- -
aComp = geompy.MakeCompound( - FaceList )
- -aBox = geompy.Sew( - aComp, 1. )
- -idbox = geompy.addToStudy( - aBox, "box" )
- -- -
aBox = - salome.IDToObject( idbox )
- -- -
# create a mesh
- -- -
hyp1 = smesh.CreateHypothesis("NumberOfSegments", - "libStdMeshersEngine.so")
- -hyp1.SetNumberOfSegments(5)
- -hyp2 = smesh.CreateHypothesis("MaxElementArea", - "libStdMeshersEngine.so")
- -hyp2.SetMaxElementArea(20)
- -- -
algo1 = smesh.CreateHypothesis("Regular_1D", - "libStdMeshersEngine.so")
- -algo2 = smesh.CreateHypothesis("MEFISTO_2D", - "libStdMeshersEngine.so")
- -- -
mesh = smesh.CreateMesh(aBox)
- -mesh.AddHypothesis(aBox,hyp1)
- -mesh.AddHypothesis(aBox,hyp2)
- -mesh.AddHypothesis(aBox,algo1)
- -mesh.AddHypothesis(aBox,algo2)
- -- -
smesh.Compute(mesh,aBox)
- -- -
smeshgui = salome.ImportComponentGUI("SMESH")
- -smeshgui.Init(salome.myStudyId);
- -smeshgui.SetName( - salome.ObjectToID( mesh ), "Mesh" );
- -- -
# Criterion : Length 2D - > 5
- -aFilterMgr = smesh.CreateFilterManager()
- -aFunctor = aFilterMgr.CreateLength2D()
- -- -
aPredicate = aFilterMgr.CreateMoreThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 5 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Edges length 2D > 5 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.FACE, "Edges with legth 2D > 5" )
- -aGroup.Add( anIds - )
- -salome.sg.updateObjBrowser(1) -
- -- -
import salome
- -import geompy
- -import SMESH
- -import StdMeshers
- -- -
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", - "SMESH")
- -smesh.SetCurrentStudy(salome.myStudy)
- -- -
# create a box without - one plane
- -box = geompy.MakeBox(0., - 0., 0., 20., 20., 15.)
- -subShapeList = geompy.SubShapeAll(box, - geompy.ShapeType["FACE"])
- -- -
FaceList = - []
- -for i in range( - 5 ):
- -FaceList.append( - subShapeList[ i ] )
- -- -
aComp = geompy.MakeCompound( - FaceList )
- -aBox = geompy.Sew( - aComp, 1. )
- -idbox = geompy.addToStudy( - aBox, "box" )
- -- -
aBox = - salome.IDToObject( idbox )
- -- -
# create a mesh
- -hyp1 = smesh.CreateHypothesis("NumberOfSegments", - "libStdMeshersEngine.so")
- -hyp1.SetNumberOfSegments(5)
- -hyp2 = smesh.CreateHypothesis("MaxElementArea", - "libStdMeshersEngine.so")
- -hyp2.SetMaxElementArea(20)
- -- -
algo1 = smesh.CreateHypothesis("Regular_1D", - "libStdMeshersEngine.so")
- -algo2 = smesh.CreateHypothesis("MEFISTO_2D", - "libStdMeshersEngine.so")
- -- -
mesh = smesh.CreateMesh(aBox)
- -mesh.AddHypothesis(aBox,hyp1)
- -mesh.AddHypothesis(aBox,hyp2)
- -mesh.AddHypothesis(aBox,algo1)
- -mesh.AddHypothesis(aBox,algo2)
- -- -
smesh.Compute(mesh,aBox)
- -smeshgui = salome.ImportComponentGUI("SMESH")
- -smeshgui.Init(salome.myStudyId);
- -smeshgui.SetName( - salome.ObjectToID( mesh ), "Mesh" );
- -- -
# Criterion : MULTI-CONNECTION - 2D = 2
- -aFilterMgr = smesh.CreateFilterManager()
- -aFunctor = aFilterMgr.CreateMultiConnection2D()
- -- -
aPredicate = aFilterMgr.CreateEqualTo()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 2 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Borders at multi-connection 2D = 2 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.FACE, "Borders at multi-connection 2D = 2" )
- -aGroup.Add( anIds - )
- -salome.sg.updateObjBrowser(1) -
- -- -
import SMESH
- -import SMESH_mechanic
- -- -
smesh = - SMESH_mechanic.smesh
- -mesh = - SMESH_mechanic.mesh
- -salome = SMESH_mechanic.salome
- -- -
aFilterMgr = smesh.CreateFilterManager()
- -- -
# Criterion : AREA > - 100
- -- -
aFunctor = aFilterMgr.CreateArea()
- -aPredicate = aFilterMgr.CreateMoreThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 100 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Area > 100 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.FACE, "Area > 100" )
- -aGroup.Add( anIds - )
- -- -
salome.sg.updateObjBrowser(1) -
- -- -
import SMESH
- -import SMESH_mechanic
- -- -
smesh = - SMESH_mechanic.smesh
- -mesh = - SMESH_mechanic.mesh
- -salome = SMESH_mechanic.salome
- -- -
aFilterMgr = smesh.CreateFilterManager()
- -- -
# Criterion : Taper > - 3e-20
- -- -
aFunctor = aFilterMgr.CreateTaper()
- -aPredicate = aFilterMgr.CreateMoreThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 3e-20 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Taper > 3e-20 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.FACE, "Taper > 3e-20" )
- -aGroup.Add( anIds - )
- -- -
salome.sg.updateObjBrowser(1) -
- -- -
import SMESH
- -import SMESH_mechanic
- -- -
smesh = - SMESH_mechanic.smesh
- -mesh = - SMESH_mechanic.mesh
- -salome = SMESH_mechanic.salome
- -- -
aFilterMgr = smesh.CreateFilterManager()
- -- -
# Criterion : ASPECT RATIO - > 1.4
- -- -
aFunctor = aFilterMgr.CreateAspectRatio()
- -aPredicate = aFilterMgr.CreateMoreThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 1.4 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Aspect Ratio > 1.4 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.FACE, "Aspect Ratio > 1.4" )
- -aGroup.Add( anIds - )
- -- -
salome.sg.updateObjBrowser(1) -
- -- -
- -
import SMESH
- -import SMESH_mechanic
- -- -
smesh = - SMESH_mechanic.smesh
- -mesh = - SMESH_mechanic.mesh
- -salome = SMESH_mechanic.salome
- -- -
aFilterMgr = smesh.CreateFilterManager()
- -- -
# Criterion : MINIMUM - ANGLE < 70
- -- -
aFunctor = aFilterMgr.CreateMinimumAngle()
- -aPredicate = aFilterMgr.CreateLessThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 70 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Minimum Angle < 70 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.FACE, "Minimum Angle < 70" )
- -aGroup.Add( anIds - )
- -- -
salome.sg.updateObjBrowser(1) -
- -- -
import SMESH
- -import SMESH_mechanic
- -- -
smesh = - SMESH_mechanic.smesh
- -mesh = - SMESH_mechanic.mesh
- -salome = SMESH_mechanic.salome
- -- -
aFilterMgr = smesh.CreateFilterManager()
- -- -
# Criterion : WARP ANGLE - > 1e-15
- -- -
aFunctor = aFilterMgr.CreateWarping()
- -aPredicate = aFilterMgr.CreateMoreThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 1e-15 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Warp > 1e-15 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.FACE, "Warp > 1e-15" )
- -aGroup.Add( anIds - )
- -salome.sg.updateObjBrowser(1) -
- -- -
import SMESH
- -import SMESH_mechanic
- -- -
smesh = - SMESH_mechanic.smesh
- -mesh = - SMESH_mechanic.mesh
- -salome = SMESH_mechanic.salome
- -- -
aFilterMgr = smesh.CreateFilterManager()
- -- -
# Criterion : Skew > - 18
- -- -
aFunctor = aFilterMgr.CreateSkew()
- -aPredicate = aFilterMgr.CreateMoreThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 18 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Skew > 18 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.FACE, "Skew > 18" )
- -aGroup.Add( anIds - )
- -- -
salome.sg.updateObjBrowser(1) -
- -- -
import SMESH
- -import SMESH_mechanic_tetra
- -- -
smesh = - SMESH_mechanic_tetra.smesh
- -mesh = - SMESH_mechanic_tetra.mesh
- -salome = SMESH_mechanic_tetra.salome
- -- -
aFilterMgr = smesh.CreateFilterManager()
- -- -
# Criterion : ASPECT RATIO - 3D > 2.2
- -- -
aFunctor = aFilterMgr.CreateAspectRatio3D()
- -aPredicate = aFilterMgr.CreateMoreThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 2.2 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print "Criterion: - Aspect Ratio 3D > 2.2 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.VOLUME, "Aspect Ratio 3D > 2.2" )
- -aGroup.Add( anIds - )
- -- -
salome.sg.updateObjBrowser(1) -
- -- -
import SMESH
- -import SMESH_mechanic_tetra
- -- -
smesh = - SMESH_mechanic_tetra.smesh
- -mesh = - SMESH_mechanic_tetra.mesh
- -salome = SMESH_mechanic_tetra.salome
- -- -
aFilterMgr = smesh.CreateFilterManager()
- -- -
# Criterion : VOLUME < - 7
- -- -
aFunctor = aFilterMgr.CreateVolume3D()
- -aPredicate = aFilterMgr.CreateLessThan()
- -aPredicate.SetNumFunctor( - aFunctor )
- -aPredicate.SetMargin( - 7 )
- -- -
aFilter = aFilterMgr.CreateFilter()
- -aFilter.SetPredicate( - aPredicate )
- -- -
anIds = aFilter.GetElementsId( - mesh )
- -- -
# print the result
- -print ""
- -print "Criterion: - Volume < 7 Nb = ", len( anIds )
- -for i in range( - len( anIds ) ):
- -print - anIds[ i ]
- -- -
# create a group
- -aGroup = mesh.CreateGroup( - SMESH.VOLUME, "Volume < 7" )
- -aGroup.Add( anIds - )
- -- -
salome.sg.updateObjBrowser(1) -
- - - - + + + + + +import salome
+ +import geompy
+ ++ +
import smesh
+ ++ +
# create open shell: a + box without one plane
+ +box + = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+ +FaceList = geompy.SubShapeAll(box, + geompy.ShapeType["FACE"])
+ +FaceList.remove(FaceList[5])
+ +box = geompy.MakeShell(FaceList)
+ +idbox = geompy.addToStudy(box, + "box")
+ ++ +
# create a mesh
+ +mesh + = smesh.Mesh(box, "Mesh_free_borders")
+ +algo = mesh.Segment()
+ +algo.NumberOfSegments(5)
+ +algo = mesh.Triangle()
+ +algo.MaxElementArea(20.)
+ +mesh.Compute()
+ ++ +
# criterion : free borders
+ +aFilter + = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
+ +anIds = mesh.GetIdsFromFilter(aFilter)
+ ++ +
+ +
# print the result
+ +print "Criterion: + Free borders Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup = mesh.CreateGroup(SMESH.EDGE, + "Free borders")
+ +aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ +import salome
+ +import geompy
+ ++ +
import smesh
+ +import SMESH
+ ++ +
# create open shell: + a box without one plane
+ +box = geompy.MakeBox(0., + 0., 0., 20., 20., 15.)
+ +FaceList = geompy.SubShapeAll(box, + geompy.ShapeType["FACE"])
+ +FaceList.remove(FaceList[5])
+ +box = geompy.MakeShell(FaceList)
+ +idbox = geompy.addToStudy(box, + "box")
+ ++ +
# create a mesh
+ +mesh + = smesh.Mesh(box, "Mesh_borders_at_multi-connections")
+ +algo = mesh.Segment()
+ +algo.NumberOfSegments(5)
+ +algo = mesh.Triangle()
+ +algo.MaxElementArea(20.)
+ +mesh.Compute()
+ ++ +
# Criterion : Borders + at multi-connection
+ +nb_conn = 2
+ ++ +
aFilter + = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, + nb_conn)
+ +anIds = mesh.GetIdsFromFilter(aFilter)
+ ++ +
+ +
# print the result
+ +print "Criterion: + Borders at multi-connections Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup = mesh.CreateGroup(SMESH.EDGE, + "Borders at multi-connections")
+ +aGroup.Add(anIds)
+ +salome.sg.updateObjBrowser(1) +
+ +import salome
+ +import geompy
+ ++ +
import smesh
+ ++ +
# create open shell: a + box without one plane
+ +box = geompy.MakeBox(0., + 0., 0., 20., 20., 15.)
+ +FaceList = geompy.SubShapeAll(box, + geompy.ShapeType["FACE"])
+ +FaceList.remove(FaceList[5])
+ +box = geompy.MakeShell(FaceList)
+ +idbox = geompy.addToStudy(box, + "box")
+ ++ +
# create a mesh
+ +mesh + = smesh.Mesh(box, "Mesh_Length_1D")
+ +algo = mesh.Segment()
+ +algo.NumberOfSegments(5)
+ +algo = mesh.Triangle()
+ +algo.MaxElementArea(20.)
+ +mesh.Compute()
+ ++ +
# Criterion : Length > + 3.
+ +length_margin = + 3.
+ ++ +
aFilter + = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin)
+ +anIds = mesh.GetIdsFromFilter(aFilter) +
+ ++ +
# print the result
+ +print "Criterion: + Edges length > ", length_margin, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup = mesh.CreateGroup(SMESH.EDGE, + "Edges with length > " + `length_margin`)
+ +aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ +import SMESH_mechanic
+ ++ +
smesh = + SMESH_mechanic.smesh
+ +mesh = + SMESH_mechanic.mesh
+ +salome = SMESH_mechanic.salome
+ ++ +
aFilterMgr = smesh.CreateFilterManager()
+ ++ +
# Remove some elements + to obtain free edges
+ +# Criterion : AREA + > 95.
+ +area_margin = 95.
+ ++ +
aFilter + = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter)
+ ++ +
mesh.RemoveElements(anIds)
+ ++ +
# Criterion : Free + Edges
+ +aBorders = mesh.GetFreeBorders() +
+ ++ +
# create groups
+ +aGroupF = mesh.CreateGroup(SMESH.FACE, + "Faces with free edges")
+ +aGroupN = mesh.CreateGroup(SMESH.NODE, + "Nodes on free edges")
+ ++ +
# fill groups with + elements, corresponding to the criterion
+ +print ""
+ +print "Criterion: + Free edges Nb = ", len(aBorders)
+ +for i in range(len(aBorders)):
+ +aBorder + = aBorders[i]
+ +print + "Face # ", aBorder.myElemId, " : Edge between nodes (",
+ +print + aBorder.myPnt1, ", ", aBorder.myPnt2, ")"
+ ++ +
aGroupF.Add([aBorder.myElemId])
+ +aGroupN.Add([aBorder.myPnt1, + aBorder.myPnt2])
+ ++ +
salome.sg.updateObjBrowser(1) +
+ ++ +
import salome
+ +import geompy
+ ++ +
import smesh
+ ++ +
# create open shell: + a box without one plane
+ +box = geompy.MakeBox(0., + 0., 0., 20., 20., 15.)
+ +FaceList = geompy.SubShapeAll(box, + geompy.ShapeType["FACE"])
+ +FaceList.remove(FaceList[5])
+ +box = geompy.MakeShell(FaceList)
+ +idbox = geompy.addToStudy(box, + "box")
+ ++ +
# create a mesh
+ +mesh + = smesh.Mesh(box, "Mesh_Length_2D")
+ +algo = mesh.Segment()
+ +algo.NumberOfSegments(5)
+ +algo = mesh.Triangle()
+ +algo.MaxElementArea(20.)
+ +mesh.Compute()
+ ++ +
# Criterion : Length + 2D > 5.7
+ +length_margin = + 5.7
+ ++ +
aFilter + = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter)
+ ++ +
# print the result
+ +print "Criterion: + Edges length 2D > ", length_margin, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup + = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + + `length_margin`)
+ +aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ ++ +
import salome
+ +import geompy
+ ++ +
import smesh
+ ++ +
# create a compound + of two glued boxes
+ +box1 = geompy.MakeBox(0., + 0., 0., 20., 20., 15.)
+ +box2 = geompy.MakeTranslation(box1, + 0., 20., 0)
+ +comp = geompy.MakeCompound([box1, + box2])
+ +box = geompy.MakeGlueFaces(comp, + 0.000001)
+ +idbox = geompy.addToStudy(box, + "box")
+ ++ +
# create a mesh
+ +mesh + = smesh.Mesh(box, "Box compound : 2D triangle mesh")
+ +algo = mesh.Segment()
+ +algo.NumberOfSegments(5)
+ +algo = mesh.Triangle()
+ +algo.MaxElementArea(20.)
+ +mesh.Compute()
+ ++ +
# Criterion : MULTI-CONNECTION + 2D = 3
+ +nb_conn = 3
+ ++ +
aFilter + = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, + nb_conn)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter) +
+ ++ +
# print the result
+ +print "Criterion: + Borders at multi-connection 2D = ", nb_conn, " Nb = ", + len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup + = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection + 2D = " + `nb_conn`)
+ +aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ ++ +
import SMESH_mechanic
+ ++ +
smesh = + SMESH_mechanic.smesh
+ +mesh = + SMESH_mechanic.mesh
+ +salome = SMESH_mechanic.salome
+ ++ +
# Criterion : AREA > + 100.
+ +area_margin = 100.
+ ++ +
aFilter = smesh.GetFilter(smesh.FACE, + smesh.FT_Area, smesh.FT_MoreThan, area_margin)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter) +
+ ++ +
# print the result
+ +print "Criterion: + Area > ", area_margin, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup = mesh.CreateEmptyGroup(smesh.FACE, + "Area > " + `area_margin`)
+ +aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ +import SMESH_mechanic
+ ++ +
smesh = + SMESH_mechanic.smesh
+ +mesh = + SMESH_mechanic.mesh
+ +salome = SMESH_mechanic.salome
+ ++ +
# Criterion : Taper + > 3e-20
+ +taper_margin = 3e-20
+ ++ +
aFilter = smesh.GetFilter(smesh.FACE, + smesh.FT_Taper, smesh.FT_MoreThan, taper_margin)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter) +
+ ++ +
# print the result
+ +print "Criterion: + Taper > ", taper_margin, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup + = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`)
+ +aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ +import SMESH_mechanic
+ ++ +
smesh = + SMESH_mechanic.smesh
+ +mesh = + SMESH_mechanic.mesh
+ +salome = SMESH_mechanic.salome
+ ++ +
# Criterion : ASPECT + RATIO > 1.8
+ +ar_margin = 1.8
+ ++ +
aFilter + = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, + ar_margin)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter) +
+ ++ +
# print the result
+ +print "Criterion: + Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup + = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`)
+ +aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ ++ +
import SMESH_mechanic
+ ++ +
smesh = + SMESH_mechanic.smesh
+ +mesh = + SMESH_mechanic.mesh
+ +salome = SMESH_mechanic.salome
+ ++ +
# Criterion : MINIMUM + ANGLE < 35.
+ +min_angle = 35.
+ ++ +
aFilter = smesh.GetFilter(smesh.FACE, + smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter) +
+ ++ +
# print the result
+ +print "Criterion: + Minimum Angle < ", min_angle, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup + = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + + `min_angle`)
+ ++ +
aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ ++ +
import SMESH_mechanic
+ ++ +
smesh = + SMESH_mechanic.smesh
+ +mesh = + SMESH_mechanic.mesh
+ +salome = SMESH_mechanic.salome
+ ++ +
# Criterion : WARP + ANGLE > 1e-15
+ +wa_margin = 1e-15
+ ++ +
aFilter = smesh.GetFilter(smesh.FACE, + smesh.FT_Warping, smesh.FT_MoreThan, wa_margin)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter) +
+ ++ +
# print the result
+ +print "Criterion: + Warp > ", wa_margin, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup = mesh.CreateEmptyGroup(smesh.FACE, + "Warp > " + `wa_margin`)
+ ++ +
aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ ++ +
import SMESH_mechanic
+ ++ +
smesh = + SMESH_mechanic.smesh
+ +mesh = + SMESH_mechanic.mesh
+ +salome = SMESH_mechanic.salome
+ ++ +
# Criterion : Skew + > 38.
+ +skew_margin = 38.
+ ++ +
aFilter = smesh.GetFilter(smesh.FACE, + smesh.FT_Skew, smesh.FT_MoreThan, skew_margin)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter)
+ ++ +
# print the result
+ +print "Criterion: + Skew > ", skew_margin, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup + = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`)
+ +aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ ++ +
import SMESH_mechanic_tetra +
+ ++ +
smesh = + SMESH_mechanic_tetra.smesh
+ +mesh = + SMESH_mechanic_tetra.mesh
+ +salome = SMESH_mechanic_tetra.salome
+ ++ +
# Criterion : ASPECT + RATIO 3D > 4.5
+ +ar_margin = 4.5
+ ++ +
aFilter = smesh.GetFilter(smesh.VOLUME, + smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter) +
+ ++ +
# print the result
+ +print "Criterion: + Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, + "Aspect Ratio 3D > " + `ar_margin`)
+ ++ +
aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ +import SMESH_mechanic_tetra
+ ++ +
smesh = + SMESH_mechanic_tetra.smesh
+ +mesh = + SMESH_mechanic_tetra.mesh
+ +salome = SMESH_mechanic_tetra.salome
+ ++ +
# Criterion : VOLUME < + 7.
+ +volume_margin = + 7.
+ ++ +
aFilter = smesh.GetFilter(smesh.VOLUME, + smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
+ ++ +
anIds = mesh.GetIdsFromFilter(aFilter) +
+ ++ +
# print the result
+ +print ""
+ +print "Criterion: + Volume < ", volume_margin, " Nb = ", len(anIds)
+ +j = 1
+ +for i in range(len(anIds)):
+ +if + j > 20: j = 1; print ""
+ +print + anIds[i],
+ +j + = j + 1
+ +pass
+ +print ""
+ ++ +
# create a group
+ +aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, + "Volume < " + `volume_margin`)
+ ++ +
aGroup.Add(anIds)
+ ++ +
salome.sg.updateObjBrowser(1) +
+ + + +