Skip to content

FOSSILFOrtran Stereo Litography parser

A pure Fortran 2003+ OOP library for reading, writing, and manipulating STL mesh files.

Quick start

Load an STL file, print its statistics, and translate it:

fortran
use fossil
use penf, only: R8P
use vecfor, only: ex_R8P

type(surface_stl_object) :: surface
real(R8P)                :: d

! Load (ASCII or binary, auto-detected) and run the full repair pipeline.
call surface%load_from_file(file_name='cube.stl', guess_format=.true.)
call surface%sanitize
print '(A)', surface%statistics()

! Signed distance — SAH BVH + pseudo-normal sign by default.
d = surface%distance(point=2.0_R8P * ex_R8P, is_signed=.true., is_square_root=.true.)
print '(A,ES12.5)', 'signed distance = ', d

! Translate and save.
call surface%translate(x=1.0_R8P, y=2.0_R8P, z=0.5_R8P)
call surface%save_into_file(file_name='cube-moved.stl')

Authors

Contributions are welcome — see the Contributing page.

Copyrights

FOSSIL is distributed under a multi-licensing system:

Use caseLicense
FOSS projectsGPL v3
Closed source / commercialBSD 2-Clause
Closed source / commercialBSD 3-Clause
Closed source / commercialMIT

Anyone interested in using, developing, or contributing to FOSSIL is welcome — pick the license that best fits your needs.