Abstract: Although the STL (stereo lithography) file format is
widely used as a de facto industry standard in the rapid prototyping
industry due to its simplicity and ability to tessellation of almost all
surfaces, but there are always some defects and shortcoming in their
usage, which many of them are difficult to correct manually. In
processing the complex models, size of the file and its defects grow
extremely, therefore, correcting STL files become difficult. In this
paper through optimizing the exiting algorithms, size of the files and
memory usage of computers to process them will be reduced. In spite
of type and extent of the errors in STL files, the tail-to-head
searching method and analysis of the nearest distance between tails
and heads techniques were used. As a result STL models sliced
rapidly, and fully closed contours produced effectively and errorless.