in Compute(), fix showing compute error in case of imported mesh

This commit is contained in:
eap 2010-05-05 13:58:31 +00:00
parent 05577711c3
commit 3ad2a95049

View File

@ -1189,33 +1189,34 @@ class Mesh:
computeErrors = self.smeshpyD.GetComputeErrors( self.mesh, geom ) computeErrors = self.smeshpyD.GetComputeErrors( self.mesh, geom )
for err in computeErrors: for err in computeErrors:
shapeText = "" shapeText = ""
try: if self.mesh.HasShapeToMesh():
mainIOR = salome.orb.object_to_string(geom) try:
for sname in salome.myStudyManager.GetOpenStudies(): mainIOR = salome.orb.object_to_string(geom)
s = salome.myStudyManager.GetStudyByName(sname) for sname in salome.myStudyManager.GetOpenStudies():
if not s: continue s = salome.myStudyManager.GetStudyByName(sname)
mainSO = s.FindObjectIOR(mainIOR) if not s: continue
if not mainSO: continue mainSO = s.FindObjectIOR(mainIOR)
subIt = s.NewChildIterator(mainSO) if not mainSO: continue
while subIt.More(): subIt = s.NewChildIterator(mainSO)
subSO = subIt.Value() while subIt.More():
subIt.Next() subSO = subIt.Value()
obj = subSO.GetObject() subIt.Next()
if not obj: continue obj = subSO.GetObject()
go = obj._narrow( geompyDC.GEOM._objref_GEOM_Object ) if not obj: continue
if not go: continue go = obj._narrow( geompyDC.GEOM._objref_GEOM_Object )
ids = go.GetSubShapeIndices() if not go: continue
if len(ids) == 1 and ids[0] == err.subShapeID: ids = go.GetSubShapeIndices()
shapeText = '"%s"' % subSO.GetName() if len(ids) == 1 and ids[0] == err.subShapeID:
break shapeText = ' on "%s"' % subSO.GetName()
if not shapeText: break
shape = self.geompyD.GetSubShape( geom, [err.subShapeID]) if not shapeText:
if shape: shape = self.geompyD.GetSubShape( geom, [err.subShapeID])
shapeText = "%s #%s" % (shape.GetShapeType(), err.subShapeID) if shape:
else: shapeText = " on %s #%s" % (shape.GetShapeType(), err.subShapeID)
shapeText = "%subshape #%s" % (err.subShapeID) else:
except: shapeText = " on subshape #%s" % (err.subShapeID)
shapeText = "%subshape #%s" % (err.subShapeID) except:
shapeText = " on subshape #%s" % (err.subShapeID)
errText = "" errText = ""
stdErrors = ["OK", #COMPERR_OK stdErrors = ["OK", #COMPERR_OK
"Invalid input mesh", #COMPERR_BAD_INPUT_MESH "Invalid input mesh", #COMPERR_BAD_INPUT_MESH
@ -1233,7 +1234,7 @@ class Mesh:
if errText: errText += ". " if errText: errText += ". "
errText += err.comment errText += err.comment
if allReasons != "":allReasons += "\n" if allReasons != "":allReasons += "\n"
allReasons += '"%s" failed on %s. Error: %s' %(err.algoName, shapeText, errText) allReasons += '"%s" failed%s. Error: %s' %(err.algoName, shapeText, errText)
pass pass
# Treat hyp errors # Treat hyp errors