essai formalisation niveaux de debug

This commit is contained in:
Paul RASCLE 2014-11-28 14:35:10 +01:00
parent 77b224bfc9
commit b016dcf830
3 changed files with 31 additions and 23 deletions

View File

@ -2,7 +2,7 @@
import logging
logging.info('start')
from initLog import getLogLevel
import initLog
import salome
salome.salome_init()
@ -15,11 +15,11 @@ smesh = smeshBuilder.New(salome.myStudy)
logging.debug("initialisation de geompy et smesh OK")
def geomPublishDebug(aShape, aName):
if getLogLevel() <= 1:
def geomPublish(level,aShape, aName):
if initLog.getLogLevel() <= level:
geompy.addToStudy(aShape, aName)
def geomPublishDebugInFather(aFather, aShape, aName):
if getLogLevel() <= 1:
def geomPublishInFather(level, aFather, aShape, aName):
if initLog.getLogLevel() <= level:
geompy.addToStudyInFather(aFather, aShape, aName)

View File

@ -3,8 +3,9 @@
import logging
from geomsmesh import geompy
from geomsmesh import geomPublishDebug
from geomsmesh import geomPublishDebugInFather
from geomsmesh import geomPublish
from geomsmesh import geomPublishInFather
import initLog
from substractSubShapes import substractSubShapes
@ -39,13 +40,13 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
nameEdge = "edgeRadFacePipePeau%d"%i
facesPipePeau[i] = face
endsEdgeFond[i] = sharedVertices[0]
geomPublishDebug(face, nameFace)
geomPublishDebug(sharedVertices[0], nameVert)
geomPublish(initLog.debug, face, nameFace)
geomPublish(initLog.debug, sharedVertices[0], nameVert)
edgesFace = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
for edge in edgesFace:
if geompy.MinDistance(edge, sharedVertices[0]) < 1e-3:
edgeRadFacePipePeau[i] = edge
geomPublishDebug(edge, nameEdge)
geomPublish(initLog.debug, edge, nameEdge)
break
pass
pass
@ -62,14 +63,14 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
geompy.UnionList(grpEdgesCirc, edges)
edgesCircPeau[i] = grpEdgesCirc
name = "edgeCirc%d"%i
geomPublishDebugInFather(facePeau, grpEdgesCirc, name)
geomPublishInFather(initLog.debug, facePeau, grpEdgesCirc, name)
edgesListees = edgesListees + edges
vertices = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["VERTEX"])
grpVertCircPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"])
geompy.UnionList(grpVertCircPeau, vertices)
verticesCircPeau[i] = grpVertCircPeau
name = "pointEdgeCirc%d"%i
geomPublishDebugInFather(facePeau, grpVertCircPeau, name)
geomPublishInFather(initLog.debug, facePeau, grpVertCircPeau, name)
pass
pass # --- au moins une extrémité du pipe sur cette face de peau
@ -80,7 +81,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
for i, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge)
name = "edgepeau%d"%i
geomPublishDebugInFather(facePeau,edgepeau, name)
geomPublishInFather(initLog.debug, facePeau,edgepeau, name)
logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau))
if geompy.ShapeInfo(edgepeau)['EDGE'] > 1:
logging.debug(" EDGES multiples")
@ -97,7 +98,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
if aretesVivesC is not None:
bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC)
if bordsVifs is not None:
geomPublishDebugInFather(facePeau, bordsVifs, "bordsVifs")
geomPublishInFather(initLog.debug, facePeau, bordsVifs, "bordsVifs")
groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs)
grptmp = None
if len(aretesVivesCoupees) > 0:
@ -111,7 +112,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
edv = geompy.ExtractShapes(grpnew, geompy.ShapeType["EDGE"], False)
aretesVivesCoupees += edv
logging.debug("aretesVivesCoupees %s",aretesVivesCoupees)
geomPublishDebugInFather(facePeau, groupEdgesBordPeau , "EdgesBords")
geomPublishInFather(initLog.debug, facePeau, groupEdgesBordPeau , "EdgesBords")
# --- edges de la face de peau partagées avec la face de fissure
@ -125,7 +126,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau):
edgesFissurePeau[i] = edge
name = "edgeFissurePeau%d"%i
geomPublishDebugInFather(facePeau, edge, name)
geomPublishInFather(initLog.debug, facePeau, edge, name)
for edge in edges: # on ajoute après les edges manquantes
if edge not in edgesFissurePeau:
edgesFissurePeau.append(edge)
@ -133,7 +134,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
for i, edge in enumerate(edges):
edgesFissurePeau.append(edge)
name = "edgeFissurePeau%d"%i
geomPublishDebugInFather(facePeau, edge, name)
geomPublishInFather(initLog.debug, facePeau, edge, name)
return (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,

View File

@ -1,41 +1,48 @@
# -*- coding: utf-8 -*-
import logging
loglevel = 3
debug = 10
info = 20
warning = 30
error = 40
critical = 50
loglevel = warning
def setDebug():
global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.DEBUG)
loglevel = 1
loglevel = debug
logging.info('start Debug %s', loglevel)
def setVerbose():
global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.INFO)
loglevel = 2
loglevel = info
logging.info('start Verbose %s', loglevel)
def setRelease():
global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.WARNING)
loglevel = 3
loglevel = warning
logging.warning('start Release %s', loglevel)
def setUnitTests():
global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.CRITICAL)
loglevel = 4
loglevel = critical
logging.critical('start UnitTests %s', loglevel)
def setPerfTests():
global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.CRITICAL)
loglevel = 5
loglevel = critical
logging.info('start PerfTests %s', loglevel)
def getLogLevel():