un premier test de publication conditionnelle

This commit is contained in:
Paul RASCLE 2014-09-21 23:21:50 +02:00
parent 249a5808d8
commit 77b224bfc9
4 changed files with 43 additions and 16 deletions

View File

@ -127,7 +127,7 @@ problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.reference
# ---tous les cas en sequence, ou les cas selectionnés ...
runall = True
runall = False
if runall:
torun = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,]
else: #prob 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27

View File

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

View File

@ -3,6 +3,9 @@
import logging
from geomsmesh import geompy
from geomsmesh import geomPublishDebug
from geomsmesh import geomPublishDebugInFather
from substractSubShapes import substractSubShapes
def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSorted,
@ -36,13 +39,13 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
nameEdge = "edgeRadFacePipePeau%d"%i
facesPipePeau[i] = face
endsEdgeFond[i] = sharedVertices[0]
geompy.addToStudy(face, nameFace)
geompy.addToStudy(sharedVertices[0], nameVert)
geomPublishDebug(face, nameFace)
geomPublishDebug(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
geompy.addToStudy(edge, nameEdge)
geomPublishDebug(edge, nameEdge)
break
pass
pass
@ -59,14 +62,14 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
geompy.UnionList(grpEdgesCirc, edges)
edgesCircPeau[i] = grpEdgesCirc
name = "edgeCirc%d"%i
geompy.addToStudyInFather(facePeau, grpEdgesCirc, name)
geomPublishDebugInFather(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
geompy.addToStudyInFather(facePeau, grpVertCircPeau, name)
geomPublishDebugInFather(facePeau, grpVertCircPeau, name)
pass
pass # --- au moins une extrémité du pipe sur cette face de peau
@ -77,7 +80,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
for i, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge)
name = "edgepeau%d"%i
geompy.addToStudyInFather(facePeau,edgepeau, name)
geomPublishDebugInFather(facePeau,edgepeau, name)
logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau))
if geompy.ShapeInfo(edgepeau)['EDGE'] > 1:
logging.debug(" EDGES multiples")
@ -94,7 +97,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
if aretesVivesC is not None:
bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC)
if bordsVifs is not None:
geompy.addToStudyInFather(facePeau, bordsVifs, "bordsVifs")
geomPublishDebugInFather(facePeau, bordsVifs, "bordsVifs")
groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs)
grptmp = None
if len(aretesVivesCoupees) > 0:
@ -108,7 +111,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
edv = geompy.ExtractShapes(grpnew, geompy.ShapeType["EDGE"], False)
aretesVivesCoupees += edv
logging.debug("aretesVivesCoupees %s",aretesVivesCoupees)
geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords")
geomPublishDebugInFather(facePeau, groupEdgesBordPeau , "EdgesBords")
# --- edges de la face de peau partagées avec la face de fissure
@ -122,7 +125,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
geompy.addToStudyInFather(facePeau, edge, name)
geomPublishDebugInFather(facePeau, edge, name)
for edge in edges: # on ajoute après les edges manquantes
if edge not in edgesFissurePeau:
edgesFissurePeau.append(edge)
@ -130,7 +133,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor
for i, edge in enumerate(edges):
edgesFissurePeau.append(edge)
name = "edgeFissurePeau%d"%i
geompy.addToStudyInFather(facePeau, edge, name)
geomPublishDebugInFather(facePeau, edge, name)
return (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,

View File

@ -1,31 +1,45 @@
# -*- coding: utf-8 -*-
import logging
loglevel = 3
def setDebug():
global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.DEBUG)
logging.info('start Debug')
loglevel = 1
logging.info('start Debug %s', loglevel)
def setVerbose():
global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.INFO)
logging.info('start Verbose')
loglevel = 2
logging.info('start Verbose %s', loglevel)
def setRelease():
global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.WARNING)
logging.warning('start Release')
loglevel = 3
logging.warning('start Release %s', loglevel)
def setUnitTests():
global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.CRITICAL)
logging.critical('start UnitTests')
loglevel = 4
logging.critical('start UnitTests %s', loglevel)
def setPerfTests():
global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.CRITICAL)
logging.info('start PerfTests')
loglevel = 5
logging.info('start PerfTests %s', loglevel)
def getLogLevel():
return loglevel
#logging.basicConfig(filename='myapp.log',
# format='%(asctime)s %(message)s',