0051843: TC7.2.0: script SMESH_hexaedre ends with error

make the script independent of order of edges in geometry
This commit is contained in:
eap 2013-03-27 16:07:12 +00:00
parent 5060425f7f
commit ea15756a03

View File

@ -20,39 +20,13 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
#==============================================================================
# Info.
# Bug (from script, bug) : hexaedre_modified.py, PAL6194, PAL7153
# Modified : 25/11/2004
# Author : Kovaltchuk Alexey
# Project : PAL/SALOME
#==============================================================================
#
import salome import salome
import geompy import geompy
import smesh import smesh
import math
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
myBuilder = salome.myStudy.NewBuilder()
gg = salome.ImportComponentGUI("GEOM")
ShapeTypeCompSolid = 1
ShapeTypeSolid = 2
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeWire = 5
ShapeTypeEdge = 6
ShapeTypeVertex = 7
Boolop_common = 1
Boolop_cut = 2
Boolop_fuse = 3
Boolop_section = 4
p0 = geompy.MakeVertex(0., 0., 0.) p0 = geompy.MakeVertex(0., 0., 0.)
px = geompy.MakeVertex(100., 0., 0.) px = geompy.MakeVertex(100., 0., 0.)
@ -76,82 +50,39 @@ blob=geompy.MakeCut(vol3,sphereInt)
idblob = geompy.addToStudy(blob,"blob") idblob = geompy.addToStudy(blob,"blob")
aretes = [] edgeGroups = geompy.Propagate( blob )
aretes = geompy.SubShapeAllSorted(blob, ShapeTypeEdge) assert len( edgeGroups ) == 3
eid=0
# -------------------------------
# --- numerotation des aretes
##for edge in aretes:
## edname="arete%d"%eid
## idedge=geompy.addToStudy(edge,edname)
## eid=eid+1
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)
# --- epaisseur 0 2 8 10
# --- hauteur 1 3 9 11
# --- largeur 4 5 6 7
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
print "-------------------------- mesh" print "-------------------------- mesh"
smesh.SetCurrentStudy(salome.myStudy) smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the geom shape # ---- define a mesh on the geom shape 'blob'
shape_mesh = blob mesh=smesh.Mesh(blob, "MeshBlob")
mesh=smesh.Mesh(shape_mesh, "MeshBlob")
# ---- add hypothesis and algorithms to mesh # ---- assign global hypothesis and algorithms to mesh
print "-------------------------- add hypothesis to mesh" print "-------------------------- add hypothesis to mesh"
algo1 = mesh.Segment() algo1 = mesh.Segment()
algo2 = mesh.Quadrangle() algo2 = mesh.Quadrangle()
algo3 = mesh.Hexahedron() algo3 = mesh.Hexahedron()
numberOfSegmentsA = 4 # ---- assign local hypothesis and algorithms to mesh
for edges in edgeGroups: # loop on groups of logically parallel edges
algo = mesh.Segment(aretes[0]) length = geompy.BasicProperties( edges )[0]
algo.NumberOfSegments(numberOfSegmentsA) if length < 500: nbSeg = 4
algo = mesh.Segment(aretes[2]) elif length < 2000: nbSeg = 10
algo.NumberOfSegments(numberOfSegmentsA) else: nbSeg = 15
algo = mesh.Segment(aretes[8]) algo = mesh.Segment( edges )
algo.NumberOfSegments(numberOfSegmentsA) algo.NumberOfSegments( nbSeg )
algo = mesh.Segment(aretes[10]) pass
algo.NumberOfSegments(numberOfSegmentsA)
numberOfSegmentsC = 15
algo = mesh.Segment(aretes[1])
algo.NumberOfSegments(numberOfSegmentsC)
algo = mesh.Segment(aretes[3])
algo.NumberOfSegments(numberOfSegmentsC)
algo = mesh.Segment(aretes[9])
algo.NumberOfSegments(numberOfSegmentsC)
algo = mesh.Segment(aretes[11])
algo.NumberOfSegments(numberOfSegmentsC)
numberOfSegmentsB = 10
algo = mesh.Segment(aretes[4])
algo.NumberOfSegments(numberOfSegmentsB)
algo = mesh.Segment(aretes[5])
algo.NumberOfSegments(numberOfSegmentsB)
algo = mesh.Segment(aretes[6])
algo.NumberOfSegments(numberOfSegmentsB)
algo = mesh.Segment(aretes[7])
algo.NumberOfSegments(numberOfSegmentsB)
# ---- compute mesh # ---- compute mesh
print "-------------------------- compute mesh" print "-------------------------- compute mesh"
ret=mesh.Compute() ok = mesh.Compute()
print ret if ok:
if ret != 0:
#log=mesh.GetLog(0) # no erase trace
#for linelog in log:
# print linelog
print "Information about the Mesh:" print "Information about the Mesh:"
print "Number of nodes : ", mesh.NbNodes() print "Number of nodes : ", mesh.NbNodes()
print "Number of edges : ", mesh.NbEdges() print "Number of edges : ", mesh.NbEdges()