PDL::IO::STL(3)

NAME
PDL::IO::STL - read/write 3D stereolithography files

SYNOPSIS
 use PDL;
 use PDL::IO::STL;

 ($vertices, $faceidx, $colours) = rstl('owl.stl'); # read an STL file
 wstl('file.stl', $vertices, $faceidx, $colours); # write an STL file

DESCRIPTION
Normal-vector information is currently ignored. The "attribute byte count", used sometimes to store colour information, is currently ignored.

This module is based on CAD::Format::STL, but with "binmode" on opened filehandles and little-endian (i.e. network) order forced on the binary format.

FUNCTIONS

  rstl
Read an STL file (ASCII or binary), returning vertices and face-indices.

 ($vertices, $faceidx, $colours) = rstl('owl.stl'); # read an STL file

  wstl
Simple PDL FITS writer

  wstl 'file.stl', $vertices, $faceidx;
  wstl 'file.stl', $vertices, $faceidx, \%OPTIONS;
  wstl $fh, $vertices, $faceidx, \%OPTIONS;

Passing a file-handle is supported, so multiple parts can be written to an ASCII file with several calls.

"wstl" accepts several options that may be passed in as a hash ref if desired:

mode (default='binary')
    Whether to write out the file as ASCII or binary.

name (default='part')
    The part name to use.

AUTHOR
Ed J, based on Eric Wilhelm's code in CAD::Format::STL.