Reading STL Files¶
STL files can be read using the functions in the main stl module.
-
stl.read_ascii_file(file)¶ Read an STL file in the ASCII format.
Takes a
file-like object (supporting areadmethod) and returns astl.Solidobject representing the data from the file.If the file is invalid in any way, raises
stl.ascii.SyntaxError.
-
stl.read_binary_file(file)¶ Read an STL file in the binary format.
Takes a
file-like object (supporting areadmethod) and returns astl.Solidobject representing the data from the file.If the file is invalid in any way, raises
stl.binary.FormatError.
-
stl.read_ascii_string(data)¶ Read geometry from a
strcontaining data in the STL ASCII format.This is just a wrapper around
read_ascii_file()that first wraps the provided string in aStringIO.StringIOobject.
-
stl.read_binary_string(data)¶ Read geometry from a
strcontaining data in the STL binary format.This is just a wrapper around
read_binary_file()that first wraps the provided string in aStringIO.StringIOobject.