1 # -*- coding: utf-8 -*-
4 from .geomsmesh import geompy
5 from .geomsmesh import geomPublish
6 from .geomsmesh import geomPublishInFather
9 # -----------------------------------------------------------------------------
11 ## --- faces 1/2 circulaires et leur centre, edges de ces faces dans le plan de fissure
13 def facesCirculaires(bloc, tore):
15 Extraction des faces demi circulaires à l'intersection du tore partitionné et de la paroi,
16 de leur centre, les edges de ces faces situees dans le plan de fissure et un booleen par edge,
17 indiquant son sens (normal / reversed).
18 @param bloc : bloc defaut
19 @param tore : le tore partitionné et coupé
20 @return (faces, centres, edges, reverses)
24 faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
26 geomPublishInFather(initLog.debug, tore, faces[0], 'face0' )
27 geomPublishInFather(initLog.debug, tore, faces[1], 'face1' )
28 geomPublishInFather(initLog.debug, tore, faces[2], 'face2' )
29 geomPublishInFather(initLog.debug, tore, faces[3], 'face3' )
31 centres = [None, None, None, None]
32 [v1,centres[0],v3] = geompy.ExtractShapes(faces[0], geompy.ShapeType["VERTEX"], True)
33 [v1,centres[1],v3] = geompy.ExtractShapes(faces[1], geompy.ShapeType["VERTEX"], True)
34 [v1,centres[2],v3] = geompy.ExtractShapes(faces[2], geompy.ShapeType["VERTEX"], True)
35 [v1,centres[3],v3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["VERTEX"], True)
37 geomPublishInFather(initLog.debug, faces[0], centres[0], 'centre0' )
38 geomPublishInFather(initLog.debug, faces[1], centres[1], 'centre1' )
39 geomPublishInFather(initLog.debug, faces[2], centres[2], 'centre2' )
40 geomPublishInFather(initLog.debug, faces[3], centres[3], 'centre3' )
42 alledges = [None, None, None, None]
43 alledges[0] = geompy.ExtractShapes(faces[0], geompy.ShapeType["EDGE"], True)
44 alledges[1] = geompy.ExtractShapes(faces[1], geompy.ShapeType["EDGE"], True)
45 alledges[2] = geompy.ExtractShapes(faces[2], geompy.ShapeType["EDGE"], True)
46 alledges[3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["EDGE"], True)
51 for i in range(len(alledges)):
52 edgesface = alledges[i]
54 for j in range(len(edgesface)):
55 props = geompy.BasicProperties(edgesface[j])
56 lenef.append(props[0])
59 for j in range(len(edgesface)):
61 edgid = geompy.GetSubShapeID(tore, edgesface[j])
62 if not (edgid in dicoedge):
63 dicoedge[edgid] = edgesface[j]
64 edges.append(edgesface[j])
65 named = 'edge_' + str(i) + '_' +str(j)
66 geomPublishInFather(initLog.debug, faces[i], edgesface[j], named)
67 vertices = geompy.ExtractShapes(edgesface[j], geompy.ShapeType["VERTEX"], False)
68 #firstVertex = geompy.GetFirstVertex(edgesface[j])
69 if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i]):
71 #print 'reversed ' + str(edgid)
74 #print 'normal' + str(edgid)
80 return faces, centres, edges, reverses