This subroutine reads the number of nodes and triangles from a given binary stl file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=PathLen), | intent(in) | :: | filename |
name of the binary stl file |
||
integer, | intent(out) | :: | nNodes |
number of nodes in the file |
||
integer, | intent(out) | :: | nTris |
number of triangles in the file |
subroutine tem_size_stlb( filename, nNodes, nTris ) ! -------------------------------------------------------------------------- !> name of the binary stl file character(len=PathLen),intent(in) :: filename !> number of nodes in the file integer,intent(out) :: nNodes !> number of triangles in the file integer,intent(out) :: nTris ! -------------------------------------------------------------------------- character(len=LabelLen) :: header integer :: stlUnit logical :: file_exists ! -------------------------------------------------------------------------- inquire(file = trim(filename), exist = file_exists) if (.not. file_exists) then write(logUnit(0),*) trim(filename)//" file was not found. Dying..." call tem_abort() endif call tem_open( newunit = stlUnit, & & file = trim(filename), & & access = 'stream', & & action = 'read', & & status = 'old' ) read(stlUnit) header read(stlUnit) nTris nNodes = nTris * 3 close(stlUnit) end subroutine tem_size_stlb