import logging
import math
-from geomsmesh import geompy
+from .geomsmesh import geompy
+from .geomsmesh import geomPublish
+from .geomsmesh import geomPublishInFather
+from . import initLog
+import traceback
+from .fissError import fissError
-from produitMixte import produitMixte
-from whichSide import whichSide
+from .produitMixte import produitMixte
+from .whichSide import whichSide
def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
edgesFondIn, edgesFondFiss, wireFondFiss,
#logging.debug("edgesFondIn %s", edgesFondIn)
for iedf, edge in enumerate(edgesFondIn):
name = "edgeFondIn%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, edge, name)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name)
dist = [ geompy.MinDistance(pt, edge) for pt in verticesPipePeau]
ptPeau = verticesPipePeau[dist.index(min(dist))] # le point de verticesPipePeau a distance minimale de l'edge
[u, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss)
localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex]
centre = PointOnEdge
centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u)
- geompy.addToStudyInFather(partitionPeauFissFond, centre2, "centre2_%d"%iedf)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre2, "centre2_%d"%iedf)
verticesEdgesFondIn.append(centre)
name = "verticeEdgesFondIn%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, centre, name)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, name)
norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u)
- geompy.addToStudyInFather(partitionPeauFissFond, centre, "norm%d"%iedf)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, "norm%d"%iedf)
cercle = geompy.MakeCircle(centre, norm, rayonPipe)
- geompy.addToStudyInFather(partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
[vertex] = geompy.ExtractShapes(cercle, geompy.ShapeType["VERTEX"], False)
vec1 = geompy.MakeVector(centre, vertex)
vec2 = geompy.MakeVector(centre, ptPeau)
else:
cercle = geompy.MakeRotation(cercle, norm, -angle + math.pi)
name = "cercle%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, cercle, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, name)
cercles.append(cercle)
# --- estimation de la longueur du pipe necessaire de part et d'autre du point de sortie
edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False)
edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)]
edgesLocSorted.sort()
- ofp = geompy.BasicProperties(edgesLocSorted[0][2])[0] # distance curviligne centre locPt0
+ try:
+ ofp = geompy.BasicProperties(edgesLocSorted[0][2])[0] # distance curviligne centre locPt0
+ except:
+ texte = "Identification des éléments au débouché du pipe sur la face externe impossible. "
+ texte += "Cause possible : la ligne de fond de fissure comprend un point géométrique coincidant avec la face externe. "
+ texte += "La ligne de fond de fissure doit déboucher franchement de la face externe, et ne doit pas être coupée au niveau de la face."
+ raise fissError(traceback.extract_stack(),texte)
logging.debug("distance curviligne centre extremite0: %s", ofp)
p1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, locPt0)
p2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, locPt0)
- geompy.addToStudyInFather(wireFondFiss, p1, "p1_%d"%iedf)
- geompy.addToStudyInFather(wireFondFiss, p2, "p2_%d"%iedf)
+ geomPublishInFather(initLog.debug, wireFondFiss, p1, "p1_%d"%iedf)
+ geomPublishInFather(initLog.debug, wireFondFiss, p2, "p2_%d"%iedf)
edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True)
if geompy.MinDistance(centre, edp) < 1.e-3:
pipext = geompy.MakePipe(cercle, edp)
name = "pipeExt%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, pipext, name)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, pipext, name)
pipexts.append(pipext)
for ifa, face in enumerate(facesInside):
logging.debug(" face %s inside ajoutée", ifa)
facesFissExt.append(face)
name="faceFissExt%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, face, name)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, face, name)
dist = 1.
for ipe, edpe in enumerate(edgesPeauFis):
for ipi, edpi in enumerate(edgesPipeFis):
if dist < 1.e-3:
edgesFissExtPeau.append(edpe)
name="edgesFissExtPeau%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, edpe, name)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edpe, name)
edgesFissExtPipe.append(edpi)
name="edgesFissExtPipe%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, edpi, name)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edpi, name)
break
if dist < 1.e-3:
break