1. Go to this page and download the library: Download libre3d/render-3d library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
libre3d / render-3d example snippets
$render3d = new \Libre3d\Render3d\Render3d();
// this is the working directory, where it will put any files used during the render process, as well as the final
// rendered image.
$render3d->workingDir('/path/to/working/folder/');
// Set paths to the executables on this system
$render3d->executable('openscad', '/path/to/openscad');
$render3d->executable('povray', '/path/to/povray');
try {
// This will copy in your starting file into the working DIR if you give the full path to the starting file.
// This will also set the fileType for you.
$render3d->filename('/path/to/starting/stlfile.stl');
// Render! This will do all the necessary conversions as long as the render engine (in this
// case, the default engine, PovRAY) "knows" how to convert the file into a file it can use for rendering.
// Note that this is a multi-step process that can be further broken down if you need it to.
$renderedImagePath = $render3d->render('povray');
echo "Render successful! Rendered image will be at $renderedImagePath";
} catch (\Exception $e) {
echo "Render failed :( Exception: ".$e->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.