Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/pyrech/gcode-estimator
- Owner: pyrech
- License: mit
- Created: 2020-02-20T23:24:16.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-09-01T09:07:48.000Z (over 1 year ago)
- Last Synced: 2024-10-09T11:18:28.145Z (4 months ago)
- Topics: 3d, 3d-printing, cost, filament, gcode, length, weight
- Language: PHP
- Homepage:
- Size: 9.31 MB
- Stars: 13
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
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 unitsEstimations 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.