def shape_from_stl(filename): if not os.path.isfile(filename): raise FileNotFoundError("%s not found." % filename) stl_reader = StlAPI_Reader() the_shape = TopoDS_Shape() stl_reader.Read(the_shape, filename) if the_shape.IsNull(): raise AssertionError("Shape is null.") return the_shape
def read_stl_file(filename): """ opens a stl file, reads the content, and returns a BRep topods_shape object """ assert os.path.isfile(filename) stl_reader = StlAPI_Reader() the_shape = TopoDS_Shape() stl_reader.Read(the_shape, filename) assert not the_shape.IsNull() return the_shape
def read_stl_file(filename): """opens a stl file, reads the content, and returns a BRep topods_shape object""" if not os.path.isfile(filename): raise FileNotFoundError(f"{filename} not found.") the_shape = TopoDS_Shape() stlapi_Read(the_shape, filename) if the_shape.IsNull(): raise AssertionError("Shape is null.") return the_shape