Salome HOME
82bca4cfe08c270698adad51b13261990b0c0fb2
[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
21 import logging
22 from .geomsmesh import geompy
23
24 # -----------------------------------------------------------------------------
25 # --- identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face)
26
27 def shapesSurFissure(blocPartition, plane1, faceFissure, gencnt):
28   """
29   TODO: a completer
30   """
31   logging.info('start')
32
33   shapesAModifier = []
34   vertex = geompy.MakeVertexOnSurface(plane1, 0.5, 0.5)
35   normal = geompy.GetNormal(plane1, vertex)
36   extrusion = geompy.MakePrismVecH(plane1, normal, 100)
37
38   sharedSolids = []
39   solids= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("SOLID"), GEOM.ST_ONIN )
40   for solid in solids:
41     sharedSolids += geompy.GetSharedShapes(faceFissure, solid, geompy.ShapeType["SOLID"])
42   logging.debug("sharedSolids %s",sharedSolids)
43
44   sharedFaces = []
45   faces= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("FACE"), GEOM.ST_ONIN )
46   for face in faces:
47     sharedFaces += geompy.GetSharedShapes(faceFissure, face, geompy.ShapeType["FACE"])
48   logging.debug("sharedFaces %s",sharedFaces)
49
50   sharedEdges = []
51   edges= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("EDGE"), GEOM.ST_ONIN )
52   for edge in edges:
53     if not edge.IsSame(gencnt):
54       sharedEdges += geompy.GetSharedShapes(faceFissure, edge, geompy.ShapeType["EDGE"])
55   logging.debug("sharedEdges %s",sharedEdges)
56
57   shapesAModifier = [ sharedSolids, sharedFaces, sharedEdges]
58   return shapesAModifier