def face_is_plane(face): ''' Returns True if the TopoDS_Shape is a plane, False otherwise ''' hs = BRep_Tool_Surface(face) downcast_result = Handle_Geom_Plane().DownCast(hs) # the handle is null if downcast failed or is not possible, # that is to say the face is not a plane if downcast_result.IsNull(): return False else: return True
def geom_plane_from_face(aFace): """ Returns the geometric plane entity from a planar surface """ return Handle_Geom_Plane.DownCast(BRep_Tool_Surface(aFace)).GetObject()