PDL::IO::STL3pm
Read/write 3d stereolithography files
Usage
use PDL;use PDL::IO::STL;($vertices, $faceidx, $colours) = rstl('owl.stl'); # read an STL filewstl('file.stl', $vertices, $faceidx, $colours); # write an STL file
Overview
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 STL 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. |
Releases
2 releases since Debian 12 (Bookworm); the text changed 1 time.