mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 01:40:33 +05:00
Règles python - Fin
This commit is contained in:
parent
60f10166b8
commit
93738e779d
@ -17,25 +17,25 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Substract a list of subShapes from another"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- substract a list of subShapes from another
|
|
||||||
|
|
||||||
def substractSubShapes(obj, subs, toRemove):
|
def substractSubShapes(obj, subs, toRemove):
|
||||||
"""
|
"""liste de subshapes par difference"""
|
||||||
liste de subshapes par difference
|
|
||||||
"""
|
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
idToremove = {}
|
idToremove = dict()
|
||||||
subList = []
|
for shape in toRemove:
|
||||||
for s in toRemove:
|
idToremove[geompy.GetSubShapeID(obj, shape)] = shape
|
||||||
idToremove[geompy.GetSubShapeID(obj, s)] = s
|
|
||||||
for s in subs:
|
subList = list()
|
||||||
idsub = geompy.GetSubShapeID(obj, s)
|
for shape in subs:
|
||||||
if idsub not in list(idToremove.keys()):
|
idsub = geompy.GetSubShapeID(obj, shape)
|
||||||
subList.append(s)
|
if ( idsub not in idToremove ):
|
||||||
|
subList.append(shape)
|
||||||
|
|
||||||
logging.debug("subList=%s", subList)
|
logging.debug("subList=%s", subList)
|
||||||
|
|
||||||
return subList
|
return subList
|
||||||
|
@ -17,20 +17,20 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""tore et plan de fissure"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
import math
|
|
||||||
from .triedreBase import triedreBase
|
from .triedreBase import triedreBase
|
||||||
|
|
||||||
O, OX, OY, OZ = triedreBase()
|
O, OX, OY, OZ = triedreBase()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- tore et plan de fissure
|
|
||||||
|
|
||||||
def toreFissure(minRad,allonge,rayTore):
|
def toreFissure(minRad,allonge,rayTore):
|
||||||
"""
|
"""
|
||||||
Construction de la geometrie du tore elliptique autour du front de fissure.
|
Construction de la geometrie du tore elliptique autour du front de fissure.
|
||||||
@ -38,53 +38,53 @@ def toreFissure(minRad,allonge,rayTore):
|
|||||||
@param minRad :petit rayon
|
@param minRad :petit rayon
|
||||||
@param allonge :rapport grand rayon / petit rayon
|
@param allonge :rapport grand rayon / petit rayon
|
||||||
@param rayTore :rayon du tore construit autour de la generatrice de l'ellipse
|
@param rayTore :rayon du tore construit autour de la generatrice de l'ellipse
|
||||||
@return (generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part) : ellipse, section du tore,
|
@return (generatrice, face_gen_fiss, pipe, face_fissure, plane, pipe_part) : ellipse, section du tore,
|
||||||
tore plein, face plane de le fissure, plan de la fissure, tore partitioné par le plan de fissure.
|
tore plein, face plane de le fissure, plan de la fissure, tore partitioné par le plan de fissure.
|
||||||
"""
|
"""
|
||||||
logging.info("start ", minRad, allonge, rayTore)
|
logging.info("start %s %s %s", minRad, allonge, rayTore)
|
||||||
|
|
||||||
Vertex_1 = geompy.MakeVertex( minRad, 0, 0)
|
vertex_1 = geompy.MakeVertex( minRad, 0., 0.)
|
||||||
Vertex_2 = geompy.MakeVertex(-minRad, 0, 0)
|
vertex_2 = geompy.MakeVertex(-minRad, 0., 0.)
|
||||||
Vertex_3 = geompy.MakeRotation(Vertex_1, OZ, 45*math.pi/180.0)
|
vertex_3 = geompy.Makerotation(vertex_1, OZ, 45.*math.pi/180.0)
|
||||||
Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
|
arc = geompy.MakeArc(vertex_1, vertex_2, vertex_3)
|
||||||
generatrice = geompy.MakeScaleAlongAxes(Arc_1, O, 1, allonge, 1)
|
generatrice = geompy.MakeScaleAlongAxes(arc, O, 1, allonge, 1)
|
||||||
|
|
||||||
#geomPublish(initLog.debug, Vertex_1, 'Vertex_1' )
|
#geomPublish(initLog.debug, vertex_1, 'vertex_1' )
|
||||||
#geomPublish(initLog.debug, Vertex_2, 'Vertex_2' )
|
#geomPublish(initLog.debug, vertex_2, 'vertex_2' )
|
||||||
#geomPublish(initLog.debug, Vertex_3, 'Vertex_3' )
|
#geomPublish(initLog.debug, vertex_3, 'vertex_3' )
|
||||||
#geomPublish(initLog.debug, Arc_1, 'Arc_1' )
|
#geomPublish(initLog.debug, arc, 'arc' )
|
||||||
#geomPublish(initLog.debug, generatrice, 'generatrice' )
|
#geomPublish(initLog.debug, generatrice, 'generatrice' )
|
||||||
|
|
||||||
# --- face circulaire sur la generatrice, pour extrusion
|
# --- face circulaire sur la generatrice, pour extrusion
|
||||||
|
|
||||||
Circle_1 = geompy.MakeCircle(O, OY, rayTore)
|
circle = geompy.MakeCircle(O, OY, rayTore)
|
||||||
Rotation_1 = geompy.MakeRotation(Circle_1, OY, -90*math.pi/180.0)
|
rotation = geompy.MakeRotation(circle, OY, -90.*math.pi/180.0)
|
||||||
Translation_1 = geompy.MakeTranslation(Rotation_1, minRad, 0, 0)
|
translation = geompy.MakeTranslation(rotation, minRad, 0., 0.)
|
||||||
FaceGenFiss = geompy.MakeFaceWires([Translation_1], 1)
|
face_gen_fiss = geompy.MakeFaceWires([translation], 1)
|
||||||
|
|
||||||
#geomPublish(initLog.debug, Circle_1, 'Circle_1' )
|
#geomPublish(initLog.debug, circle, 'circle' )
|
||||||
#geomPublish(initLog.debug, Rotation_1, 'Rotation_1' )
|
#geomPublish(initLog.debug, rotation, 'rotation' )
|
||||||
#geomPublish(initLog.debug, Translation_1, 'Translation_1' )
|
#geomPublish(initLog.debug, translation, 'translation' )
|
||||||
#geomPublish(initLog.debug, FaceGenFiss, 'FaceGenFiss' )
|
#geomPublish(initLog.debug, face_gen_fiss, 'face_gen_fiss' )
|
||||||
|
|
||||||
# --- tore extrude
|
# --- tore extrude
|
||||||
|
|
||||||
Pipe_1 = geompy.MakePipe(FaceGenFiss, generatrice)
|
pipe = geompy.MakePipe(face_gen_fiss, generatrice)
|
||||||
|
|
||||||
# --- plan fissure, delimite par la generatrice
|
# --- plan fissure, delimite par la generatrice
|
||||||
|
|
||||||
Scale_1_vertex_3 = geompy.GetSubShape(generatrice, [3])
|
scale_vertex_3 = geompy.GetSubShape(generatrice, [3])
|
||||||
Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Scale_1_vertex_3)
|
line = geompy.MakeLineTwoPnt(vertex_1, scale_vertex_3)
|
||||||
FaceFissure = geompy.MakeFaceWires([generatrice, Line_1], 1)
|
face_fissure = geompy.MakeFaceWires([generatrice, line], 1)
|
||||||
|
|
||||||
#geomPublishInFather(initLog.debug, generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' )
|
#geomPublishInFather(initLog.debug, generatrice, scale_vertex_3, 'scale_1:vertex_3' )
|
||||||
#geomPublish(initLog.debug, Line_1, 'Line_1' )
|
#geomPublish(initLog.debug, line, 'line' )
|
||||||
#geomPublish(initLog.debug, FaceFissure, 'FaceFissure' )
|
#geomPublish(initLog.debug, face_fissure, 'face_fissure' )
|
||||||
|
|
||||||
# --- tore coupe en 2 demi tore de section 1/2 disque
|
# --- tore coupe en 2 demi tore de section 1/2 disque
|
||||||
|
|
||||||
Plane_1 = geompy.MakePlane(O, OZ, 2000)
|
plane = geompy.MakePlane(O, OZ, 2000)
|
||||||
Pipe1Part = geompy.MakePartition([Pipe_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
|
pipe_part = geompy.MakePartition([pipe], [plane], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
|
||||||
geomPublish(initLog.debug, Pipe1Part , 'Pipe1Part' )
|
geomPublish(initLog.debug, pipe_part , 'pipe_part' )
|
||||||
|
|
||||||
return generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part
|
return generatrice, face_gen_fiss, pipe, face_fissure, plane, pipe_part
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Origine et vecteurs de base"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
# --- origine et vecteurs de base
|
from . import initLog
|
||||||
|
|
||||||
O = None
|
O = None
|
||||||
OX = None
|
OX = None
|
||||||
@ -38,7 +38,7 @@ def triedreBase():
|
|||||||
"""
|
"""
|
||||||
global O, OX, OY, OZ
|
global O, OX, OY, OZ
|
||||||
|
|
||||||
if O == None:
|
if ( O is None ):
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
O = geompy.MakeVertex(0, 0, 0)
|
O = geompy.MakeVertex(0, 0, 0)
|
||||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
|
@ -17,34 +17,36 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
def trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau):
|
def trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau):
|
||||||
"""
|
"""Pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau"""
|
||||||
pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau
|
|
||||||
"""
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
j = 0
|
i_aux = 0
|
||||||
for face in facesInside:
|
for face in facesInside:
|
||||||
edgesPeauFis = []
|
|
||||||
edgesPipeFis = []
|
edgesPeauFis = list()
|
||||||
edgesPipeFnd = []
|
edgesPipeFis = list()
|
||||||
|
edgesPipeFnd = list()
|
||||||
try:
|
try:
|
||||||
edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
|
edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
|
||||||
edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"])
|
edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"])
|
||||||
edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"])
|
edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
|
|
||||||
|
if ( edgesPeauFis and edgesPipeFis and ( not edgesPipeFnd ) ):
|
||||||
edgesFissExtPeau.append(edgesPeauFis[0])
|
edgesFissExtPeau.append(edgesPeauFis[0])
|
||||||
name="edgesFissExtPeau%d"%j
|
name="edgesFissExtPeau{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name)
|
geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name)
|
||||||
j += 1
|
i_aux += 1
|
||||||
|
|
||||||
return edgesFissExtPeau
|
return edgesFissExtPeau
|
@ -17,13 +17,11 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même)"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même)
|
|
||||||
|
|
||||||
def whichSide(face, obj, tol = 1.e-3):
|
def whichSide(face, obj, tol = 1.e-3):
|
||||||
"""
|
"""
|
||||||
Position d'un objet par rapport a une face (non nécessairement plane).
|
Position d'un objet par rapport a une face (non nécessairement plane).
|
||||||
@ -40,6 +38,7 @@ def whichSide(face, obj, tol = 1.e-3):
|
|||||||
nbFaces = geompy.NbShapes(obj, geompy.ShapeType["FACE"]) # --- attention ! pour une seule face presente, renvoie 2
|
nbFaces = geompy.NbShapes(obj, geompy.ShapeType["FACE"]) # --- attention ! pour une seule face presente, renvoie 2
|
||||||
logging.debug(" nbFaces %s", nbFaces)
|
logging.debug(" nbFaces %s", nbFaces)
|
||||||
vertices = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
|
vertices = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
|
||||||
|
|
||||||
if nbEdges > 0 and nbFaces == 0: # --- edges
|
if nbEdges > 0 and nbFaces == 0: # --- edges
|
||||||
if nbEdges <= 2:
|
if nbEdges <= 2:
|
||||||
point = geompy.MakeVertexOnCurve(obj, 0.5)
|
point = geompy.MakeVertexOnCurve(obj, 0.5)
|
||||||
@ -49,17 +48,20 @@ def whichSide(face, obj, tol = 1.e-3):
|
|||||||
for anEdge in edges:
|
for anEdge in edges:
|
||||||
point = geompy.MakeVertexOnCurve(anEdge, 0.5)
|
point = geompy.MakeVertexOnCurve(anEdge, 0.5)
|
||||||
vertices.append(point)
|
vertices.append(point)
|
||||||
|
|
||||||
elif nbFaces >0: # --- faces
|
elif nbFaces >0: # --- faces
|
||||||
if nbFaces <=2:
|
if nbFaces <=2:
|
||||||
point = geompy.MakeVertexOnSurface(obj, 0.5, 0.5)
|
point = geompy.MakeVertexOnSurface(obj, 0.5, 0.5)
|
||||||
vertices.append(point)
|
vertices.append(point)
|
||||||
if nbFaces > 2:
|
else:
|
||||||
faces = geompy.ExtractShapes(obj, geompy.ShapeType["FACE"], False)
|
faces = geompy.ExtractShapes(obj, geompy.ShapeType["FACE"], False)
|
||||||
for aFace in faces:
|
for aFace in faces:
|
||||||
point = geompy.MakeVertexOnSurface(aFace, 0.5, 0.5)
|
point = geompy.MakeVertexOnSurface(aFace, 0.5, 0.5)
|
||||||
vertices.append(point)
|
vertices.append(point)
|
||||||
|
|
||||||
else: # --- vertices
|
else: # --- vertices
|
||||||
vertices = [obj]
|
vertices = [obj]
|
||||||
|
|
||||||
for vertex in vertices:
|
for vertex in vertices:
|
||||||
distance = geompy.MinDistance(vertex, face)
|
distance = geompy.MinDistance(vertex, face)
|
||||||
logging.debug(" distance %s", distance)
|
logging.debug(" distance %s", distance)
|
||||||
@ -74,5 +76,5 @@ def whichSide(face, obj, tol = 1.e-3):
|
|||||||
side = -1
|
side = -1
|
||||||
break
|
break
|
||||||
logging.debug(" side %s", side)
|
logging.debug(" side %s", side)
|
||||||
return side
|
|
||||||
|
|
||||||
|
return side
|
||||||
|
@ -17,12 +17,11 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même)"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from .geomsmesh import geompy
|
||||||
# --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même)
|
|
||||||
|
|
||||||
def whichSideMulti(facerefs, ifil, obj, centre, tol = 1.e-3):
|
def whichSideMulti(facerefs, ifil, obj, centre, tol = 1.e-3):
|
||||||
"""
|
"""
|
||||||
@ -39,6 +38,7 @@ def whichSideMulti(facerefs, ifil, obj, centre, tol = 1.e-3):
|
|||||||
nbEdges = geompy.NbShapes(obj, geompy.ShapeType["EDGE"]) # --- attention ! pour une seule edge presente, renvoie 2
|
nbEdges = geompy.NbShapes(obj, geompy.ShapeType["EDGE"]) # --- attention ! pour une seule edge presente, renvoie 2
|
||||||
logging.debug(" nbEdges %s", nbEdges)
|
logging.debug(" nbEdges %s", nbEdges)
|
||||||
vertices = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
|
vertices = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
|
||||||
|
|
||||||
if nbEdges > 0 : # --- edges
|
if nbEdges > 0 : # --- edges
|
||||||
if nbEdges <= 2:
|
if nbEdges <= 2:
|
||||||
point = geompy.MakeVertexOnCurve(obj, 0.5)
|
point = geompy.MakeVertexOnCurve(obj, 0.5)
|
||||||
@ -50,6 +50,7 @@ def whichSideMulti(facerefs, ifil, obj, centre, tol = 1.e-3):
|
|||||||
vertices.append(point)
|
vertices.append(point)
|
||||||
else: # --- vertices
|
else: # --- vertices
|
||||||
vertices = [obj]
|
vertices = [obj]
|
||||||
|
|
||||||
nbOnRef = 0
|
nbOnRef = 0
|
||||||
nbOnOther = 0
|
nbOnOther = 0
|
||||||
for vertex in vertices:
|
for vertex in vertices:
|
||||||
@ -70,20 +71,21 @@ def whichSideMulti(facerefs, ifil, obj, centre, tol = 1.e-3):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
nbMiss += 1
|
nbMiss += 1
|
||||||
pass # peut-être inside, tester les autres faces
|
# peut-être inside, tester les autres faces
|
||||||
else:
|
else:
|
||||||
if i == ifil:
|
if i == ifil:
|
||||||
nbOnRef +=1 # le point est sur la face de référence, on continue avec les autres points
|
nbOnRef +=1 # le point est sur la face de référence, on continue avec les autres points
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
nbOnOther += 1 # le point est sur une autre face, mais il peut aussi être sur la face de référence...
|
nbOnOther += 1 # le point est sur une autre face, mais il peut aussi être sur la face de référence...
|
||||||
pass # on peut tester les autres faces
|
# on peut tester les autres faces
|
||||||
if nbMiss == len(facerefs):
|
if nbMiss == len(facerefs):
|
||||||
side = 1 # inside
|
side = 1 # inside
|
||||||
if side != 0:
|
if side != 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
if side == 0 and nbOnRef < len(vertices):
|
if side == 0 and nbOnRef < len(vertices):
|
||||||
side = 1 # inside
|
side = 1 # inside
|
||||||
logging.debug(" side %s", side)
|
logging.debug(" side %s", side)
|
||||||
return side
|
|
||||||
|
|
||||||
|
return side
|
||||||
|
@ -17,12 +17,11 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même)"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from .geomsmesh import geompy
|
||||||
# --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même)
|
|
||||||
|
|
||||||
def whichSideVertex(face, vertex, tol = 1.e-3):
|
def whichSideVertex(face, vertex, tol = 1.e-3):
|
||||||
"""
|
"""
|
||||||
@ -34,6 +33,7 @@ def whichSideVertex(face, vertex, tol = 1.e-3):
|
|||||||
side = 0
|
side = 0
|
||||||
distance = geompy.MinDistance(vertex, face)
|
distance = geompy.MinDistance(vertex, face)
|
||||||
#logging.debug(" distance %s", distance)
|
#logging.debug(" distance %s", distance)
|
||||||
|
|
||||||
if distance > tol:
|
if distance > tol:
|
||||||
projection = geompy.MakeProjection(vertex, face)
|
projection = geompy.MakeProjection(vertex, face)
|
||||||
normal = geompy.GetNormal(face, projection)
|
normal = geompy.GetNormal(face, projection)
|
||||||
@ -41,8 +41,8 @@ def whichSideVertex(face, vertex, tol = 1.e-3):
|
|||||||
angle = geompy.GetAngle(normal, vect)
|
angle = geompy.GetAngle(normal, vect)
|
||||||
#logging.debug(" angle %s", angle)
|
#logging.debug(" angle %s", angle)
|
||||||
side = 1
|
side = 1
|
||||||
if abs(angle) > 10:
|
if ( abs(angle) > 10 ):
|
||||||
side = -1
|
side = -1
|
||||||
logging.debug("side %s distance %s", side, distance)
|
logging.debug("side %s distance %s", side, distance)
|
||||||
return side
|
|
||||||
|
|
||||||
|
return side
|
||||||
|
Loading…
Reference in New Issue
Block a user