firegore2 / php3d-stl
STL file manipulation library for PHP 7
1.0.2
2016-07-27 22:36 UTC
Requires
- php: >=7.0
- phpunit/phpunit: 5.4.6
This package is auto-updated.
Last update: 2024-12-27 16:22:31 UTC
README
Synopsis
This library provides PHP 7 functionality for reading and writing from and to 3D objects stored in STereoLithography (STL) files, useful for manipulating 3D objects for 3D Printing.
Set-up
Add this to your composer.json file:
[...] "require": { [...] "php3d/stl": "1.*" }
Then run composer:
composer.phar install
Examples
Read an STL file:
use php3d\stl\STL; use php3d\stl\STLFacetNormal; $stl = STL::fromString(file_get_contents("/path/to/file.stl"));
Add a new facet:
$stl->addFacetNormal(STLFacetNormal::fromArray(array( "coordinates" => array( 1, 2, 3), // Facet normal coordinates. "vertex" => array( array( 3, 4, 5 ), array( 3, 4, 5 ), array( 3, 4, 5 ) ) )));
To split an object:
(new STLSplit($stl))->split();
Write back to file:
file_put_contents("/path/to/file.stl", $stl->toString());