Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pyrech/gcode-estimator

Estimate the length/weight/cost of filament used for a 3D print by parsing the gcode file
https://github.com/pyrech/gcode-estimator

3d 3d-printing cost filament gcode length weight

Last synced: 4 months ago
JSON representation

Estimate the length/weight/cost of filament used for a 3D print by parsing the gcode file

Awesome Lists containing this project

README

        

# GcodeEstimator

GcodeEstimator is a PHP library to estimate the length/weight/cost of filament
used for a 3D print through the corresponding gcode file.

Requires PHP >= 7.2.

## Features

Unlike other implementations, this library supports most of g-code operations commonly used by 3d printers:

- all kind of moves (rapid, linear, clockwise arc, counter-clockwise arc)
- absolute and relative positionings
- switch between absolute/relative modes
- current position reset
- millimeter and inche units

Estimations should be quite realist whatever the slicer/printer you use.

## Installation

Use [Composer](http://getcomposer.org/) to install GcodeEstimator in your project:

```shell
composer require "pyrech/gcode-estimator"
```

## Usage

Basic usage to get the length of filament used:

```php
include __DIR__.'/vendor/autoload.php';

use Pyrech\GcodeEstimator\Estimator;

$estimator = new Estimator();
$estimate = $estimator->estimate($absolutePathToGcode);

$estimate->getLength(); // returns the length of filament used (in mm);
```

You can also estimate the weight and cost of your print by describing the
properties of your filament spool:

```php
include __DIR__.'/vendor/autoload.php';

use Pyrech\GcodeEstimator\Estimator;
use Pyrech\GcodeEstimator\Filament;

$filament = new Filament(
1.75, // filament diameter in mm
1.24, // filament density in g/cm³
750, // weight of the spool in g
25.99 // price of the spool (whatever your currency)
);

$estimator = new Estimator();
$estimate = $estimator->estimate($absolutePathToGcode, $filament);

$estimate->getLength(); // returns the length of filament used (in mm);
$estimate->getWeight(); // returns the weight of filament used (in g);
$estimate->getCost(); // returns the cost of filament used (in whatever currency you specified);
```

## Further documentation

You can see the current and past versions using one of the following:

* the `git tag` command
* the [releases page on Github](https://github.com/pyrech/gcode-estimator/releases)
* the file listing the [changes between versions](CHANGELOG.md)

And finally some meta documentation:

* [versioning and branching models](VERSIONING.md)
* [contribution instructions](CONTRIBUTING.md)

## Credits

* [All contributors](https://github.com/pyrech/gcode-estimator/graphs/contributors)

## License

GcodeEstimator is licensed under the MIT License - see the [LICENSE](LICENSE)
file for details.