Skip to content

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.

License

Notifications You must be signed in to change notification settings

fgheorghe/php3d-stl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php3d-stl

Build Status Scrutinizer Code Quality Build Status

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());

About

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages