import salome, geompy

face1 = geompy.MakeFaceHW(10, 10, 1)
geompy.addToStudy(face1, "face1")

face2 = geompy.MakeTranslation(face1, 5, 5, 0)
geompy.addToStudy(face2, "face2")

# Create a shape and compute the sections between the shapes
part = geompy.MakePartition([face1, face2])
geompy.addToStudy(part, "part")

# Remove extra edges does nothing here
part_repaired = geompy.RemoveExtraEdges(part)
geompy.addToStudy(part_repaired, "part_repaired")

# Create a face for each closed wire from a free boundary
[status, theClosedWires, theOpenWires] = geompy.GetFreeBoundary(part)
closedFaces = []
for i, wire in enumerate(theClosedWires):
    new_face = geompy.MakeFace(wire, 1)
    geompy.addToStudy(new_face, "new_face_%i"%(i+1))
    closedFaces.append(new_face)

salome.sg.updateObjBrowser(1)
