2013-02-12 17:35:16 +06:00
|
|
|
# Check Free Boundaries
|
|
|
|
|
|
|
|
import salome
|
2021-08-12 11:43:44 +05:00
|
|
|
salome.salome_init_without_session()
|
2013-04-04 13:06:43 +06:00
|
|
|
from salome.geom import geomBuilder
|
2017-06-13 14:57:14 +05:00
|
|
|
geompy = geomBuilder.New()
|
2013-02-12 17:35:16 +06:00
|
|
|
|
2016-03-11 14:03:17 +05:00
|
|
|
# create a shape
|
|
|
|
box1 = geompy.MakeBox(0, 0, 0, 100, 100, 100)
|
|
|
|
box2 = geompy.MakeBox(20, 20, -20, 80, 80, 120)
|
|
|
|
cut = geompy.MakeCut(box1, box2)
|
|
|
|
sid = geompy.addToStudy(cut, "Shape")
|
|
|
|
|
|
|
|
# get all faces
|
|
|
|
faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
|
|
|
|
|
|
|
|
# for each face, get free boundaries
|
|
|
|
for fi in range(len(faces)):
|
|
|
|
fid = geompy.addToStudyInFather(cut, faces[fi], "Face %d" % (fi+1))
|
|
|
|
isSuccess, closedWires, openWires = geompy.GetFreeBoundary(faces[fi])
|
|
|
|
if isSuccess:
|
2018-01-16 21:46:43 +05:00
|
|
|
print("Check free boundaries in face %d: OK" % (fi+1))
|
2017-02-10 21:07:24 +05:00
|
|
|
print("-- Nb of closed boundaries = %d" % len(closedWires))
|
2016-03-11 14:03:17 +05:00
|
|
|
for wi in range(len(closedWires)):
|
|
|
|
wid = geompy.addToStudyInFather(faces[fi], closedWires[wi], "Closed wire %d" % (wi+1))
|
|
|
|
pass
|
2017-02-10 21:07:24 +05:00
|
|
|
print("-- Nb of open boundaries = %d" % len(openWires))
|
2016-03-11 14:03:17 +05:00
|
|
|
for wi in range(len(openWires)):
|
|
|
|
wid = geompy.addToStudyInFather(faces[fi], openWires[wi], "Open wire %d" % (wi+1))
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
else:
|
2018-01-16 21:46:43 +05:00
|
|
|
print("Check free boundaries in face %d: KO" % (fi+1))
|
2016-03-11 14:03:17 +05:00
|
|
|
pass
|
|
|
|
pass
|