import salome
salome.salome_init_without_session()
import GEOM
from salome.geom import geomBuilder
gg = salome.ImportComponentGUI("GEOM")
p1 = geompy.MakeVertex(35, 35, 0)
p2 = geompy.MakeVertex(35, 35, 50)
v = geompy.MakeVector(p1, p2)
cylinder = geompy.MakeCone(p1, v, 30, 20, 20)
cone = geompy.MakeCone(p1, v, 70, 40, 60)
cut = geompy.MakeCut(cone, cylinder)
faces = []
faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
f_2 = geompy.GetSubShapeID(cut, faces[0])
cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
result = geompy.GetFreeFacesIDs(cut_without_f_2)
print("A number of free faces is ", len(result))
all_faces = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["FACE"])
for face in all_faces :
sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face)
if result.count(sub_shape_id) > 0 :
face_name = "Free face %d"%(sub_shape_id)
geompy.addToStudy(face, face_name)
id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
gg.createAndDisplayGO(id_cut_without_f_2)
gg.setDisplayMode(id_cut_without_f_2,1)