CAD::Format::STL

Read/write 3D stereolithography files
Download

CAD::Format::STL Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • Eric Wilhelm
  • Publisher web site:
  • http://search.cpan.org/~ewilhelm/

CAD::Format::STL Tags


CAD::Format::STL Description

Read/write 3D stereolithography files CAD::Format::STL is a Perl module that provides object-oriented methods to read and write the STL (Stereo Lithography) file format in both binary and ASCII forms. The STL format is a simple set of 3D triangles.SYNOPSISReading: my $stl = CAD::Format::STL->new->load("foo.stl"); # what about the part/multipart? my @facets = $stl->part->facets;Writing: my $stl = CAD::Format::STL->new; my $part = $stl->add_part("my part"); $part->add_facets(@faces); $stl->save("foo.stl"); # or $stl->save(binary => "foo.stl");Streaming read/write: my $reader = CAD::Format::STL->reader("foo.stl"); my $writer = CAD::Format::STL->writer(binary => "bar.stl"); while(my $part = $reader->next_part) { my $part_name = $part->name; $writer->start_solid($part_name); while(my @data = $part->facet) { my ($normal, @vertices) = @data; my @v1 = @{$vertices}; my @v2 = @{$vertices}; my @v3 = @{$vertices}; # that's just for illustration $writer->facet(\@v1, \@v2, \@v3); # note the omitted normal } $writer->end_solid; } Requirements: · Perl


CAD::Format::STL Related Software