Salome HOME
Update of CheckDone
[modules/smesh.git] / src / Tools / blocFissure / gmu / shapesSurFissure.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2021  EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 """Identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face)"""
21
22 import logging
23
24 import GEOM
25
26 from .geomsmesh import geompy
27
28 def shapesSurFissure(blocPartition, plane1, faceFissure, gencnt):
29   """Identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face)"""
30
31   logging.info('start')
32
33   vertex = geompy.MakeVertexOnSurface(plane1, 0.5, 0.5)
34   normal = geompy.GetNormal(plane1, vertex)
35   extrusion = geompy.MakePrismVecH(plane1, normal, 100)
36
37   sharedSolids = list()
38   solids= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("SOLID"), GEOM.ST_ONIN )
39   for solid in solids:
40     sharedSolids += geompy.GetSharedShapes(faceFissure, solid, geompy.ShapeType["SOLID"])
41   logging.debug("sharedSolids %s",sharedSolids)
42
43   sharedFaces = list()
44   faces= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("FACE"), GEOM.ST_ONIN )
45   for face in faces:
46     sharedFaces += geompy.GetSharedShapes(faceFissure, face, geompy.ShapeType["FACE"])
47   logging.debug("sharedFaces %s",sharedFaces)
48
49   sharedEdges = list()
50   edges= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("EDGE"), GEOM.ST_ONIN )
51   for edge in edges:
52     if not edge.IsSame(gencnt):
53       sharedEdges += geompy.GetSharedShapes(faceFissure, edge, geompy.ShapeType["EDGE"])
54   logging.debug("sharedEdges %s",sharedEdges)
55
56   return [ sharedSolids, sharedFaces, sharedEdges ]