Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Check Free Boundaries
1 # Check Free Boundaries
2 
3 import salome
4 salome.salome_init()
5 from salome.geom import geomBuilder
6 geompy = geomBuilder.New(salome.myStudy)
7 
8 # create a shape
9 box1 = geompy.MakeBox(0, 0, 0, 100, 100, 100)
10 box2 = geompy.MakeBox(20, 20, -20, 80, 80, 120)
11 cut = geompy.MakeCut(box1, box2)
12 sid = geompy.addToStudy(cut, "Shape")
13 
14 # get all faces
15 faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
16 
17 # for each face, get free boundaries
18 for fi in range(len(faces)):
19  fid = geompy.addToStudyInFather(cut, faces[fi], "Face %d" % (fi+1))
20  isSuccess, closedWires, openWires = geompy.GetFreeBoundary(faces[fi])
21  if isSuccess:
22  print "Check free boudaries in face %d: OK" % (fi+1)
23  print "-- Nb of closed boundaries = %d" % len(closedWires)
24  for wi in range(len(closedWires)):
25  wid = geompy.addToStudyInFather(faces[fi], closedWires[wi], "Closed wire %d" % (wi+1))
26  pass
27  print "-- Nb of open boundaries = %d" % len(openWires)
28  for wi in range(len(openWires)):
29  wid = geompy.addToStudyInFather(faces[fi], openWires[wi], "Open wire %d" % (wi+1))
30  pass
31  pass
32  else:
33  print "Check free boudaries in face %d: KO" % (fi+1)
34  pass
35  pass

Download this script