X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2FquadranglesToShapeNoCorner.py;h=0ef3227e0c8768dfc1deab776150207a3b1d199f;hb=e8173b4ff130ddb26d165c92403ef847fdfb8be2;hp=a305a05d92ee0f1d1b419f604ec982debb67f329;hpb=0c5188fd2cf587b6c74c6adce920158f7edd4419;p=modules%2Fsmesh.git diff --git a/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py b/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py index a305a05d9..0ef3227e0 100644 --- a/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py +++ b/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py @@ -1,7 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import GEOM import math import numpy as np @@ -26,7 +29,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): logging.info("start") isVecteurDefaut = False - if shapeFissureParams.has_key('vecteurDefaut'): + if 'vecteurDefaut' in shapeFissureParams: isVecteurDefaut = True vecteurDefaut = shapeFissureParams['vecteurDefaut'] @@ -40,6 +43,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): allNodeIds = meshQuad.GetNodesId() while len(allNodeIds): + logging.debug("len(allNodeIds): %s ", len(allNodeIds)) nodeIds = allNodeIds for idNode in nodeIds: # rechercher un coin elems = meshQuad.GetNodeInverseElements(idNode) @@ -152,7 +156,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): h = e/(np.sqrt(f*g)) # cosinus ruptureX = h < cosmin # True si angle > reference logging.debug("matrice de rupture X: \n%s",ruptureX) - rupX = filter(lambda x: np.prod(ruptureX[:,x]), range(len(nodeline)-2)) + rupX = [x for x in range(len(nodeline)-2) if np.prod(ruptureX[:,x])] logging.debug("colonnes de rupture: %s",rupX) # recherche d'angles supérieurs a un seuil sur une colonne : angle entre deux vecteurs successifs vecy = mat[ 1:, :, :] - mat[:-1, :, :] # vecteurs selon direction "y" @@ -164,7 +168,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): h = e/(np.sqrt(f*g)) # cosinus ruptureY = h < cosmin # True si angle > reference logging.debug("matrice de rupture Y: \n%s",ruptureY) - rupY = filter(lambda x: np.prod(ruptureY[x, :]), range(len(nodelines)-2)) + rupY = [x for x in range(len(nodelines)-2) if np.prod(ruptureY[x, :])] logging.debug("lignes de rupture: %s",rupY) if (len(rupX)*len(rupY)) > 0: logging.critical("""Cas non traité: présence d'angles vifs dans 2 directions, @@ -227,23 +231,23 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): if i == 0: noeudsBords[0].append(node) #name = "bord0_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) if i == (nbLignes -1): noeudsBords[2].append(node) #name = "bord2_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) if j == 0: noeudsBords[1].append(node) #name = "bord1_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) if j == (nbCols -1): noeudsBords[3].append(node) #name = "bord3_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) k += 1 curve = geompy.MakeInterpol(nodeList, False, False) #name = "curve_%d"%i - #geompy.addToStudy( curve, name ) + #geomPublish(initLog.debug, curve, name ) if len(curvconts) == 0 or len(curves) > 0: # éliminer les doublons de la surface sans découpe curvconts.append(nodeList) curves.append(curve) @@ -269,13 +273,13 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): pointIn_y = 0.0 pointIn_z = 0.0 pointExplicite = False - if shapeFissureParams.has_key('pointIn_x'): + if 'pointIn_x' in shapeFissureParams: pointExplicite = True pointIn_x = shapeFissureParams['pointIn_x'] - if shapeFissureParams.has_key('pointIn_y'): + if 'pointIn_y' in shapeFissureParams: pointExplicite = True pointIn_y = shapeFissureParams['pointIn_y'] - if shapeFissureParams.has_key('pointIn_z'): + if 'pointIn_z' in shapeFissureParams: pointExplicite = True pointIn_z = shapeFissureParams['pointIn_z'] if pointExplicite: @@ -283,7 +287,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): logging.debug("orientation filling par point intérieur %s", (pointIn_x, pointIn_y, pointIn_z)) vecteurDefaut = geompy.MakeVector(cdg, vertex) - if shapeFissureParams.has_key('convexe'): + if 'convexe' in shapeFissureParams: isConvexe = shapeFissureParams['convexe'] logging.debug("orientation filling par indication de convexité %s", isConvexe) cdg = geompy.MakeCDG(filling) @@ -293,11 +297,11 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): vecteurDefaut = geompy.MakeVector(vertex, cdg) if vecteurDefaut is not None: - geompy.addToStudy(normal, "normFillOrig%d"%iface) - geompy.addToStudy(vecteurDefaut, "fromInterieur%d"%iface) + geomPublish(initLog.debug, normal, "normFillOrig%d"%iface) + geomPublish(initLog.debug, vecteurDefaut, "fromInterieur%d"%iface) if geompy.GetAngleRadians(vecteurDefaut, normal) > math.pi/2.0: filling = geompy.ChangeOrientation(filling) - geompy.addToStudy( filling, "filling%d"%iface ) + geomPublish(initLog.debug, filling, "filling%d"%iface ) #geompy.ExportBREP(filling, "filling.brep") iface = iface+1 fillings.append(filling) @@ -318,7 +322,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): curve = geompy.MakeInterpol(nodes, False, False) curves.append(curve) fillcont = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True) - geompy.addToStudy( fillcont, "filcont%d"%icont ) + geomPublish(initLog.debug, fillcont, "filcont%d"%icont ) fillconts.append(fillcont) icont = icont+1 pass # --- loop while there are remaining nodes