pyrech / gcode-estimator
计算gcode文件中使用的丝线长度/重量/成本
v1.0.1
2020-02-23 15:06 UTC
Requires
- php: >=7.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- symfony/phpunit-bridge: ^5.0
README
GcodeEstimator是一个PHP库,通过相应的gcode文件来估算3D打印使用的丝线长度/重量/成本。
需要PHP >= 7.2。
特性
与其他实现不同,此库支持3D打印机常用的大多数g-code操作
- 所有类型的移动(快速移动、线性移动、顺时针圆弧、逆时针圆弧)
- 绝对和相对定位
- 在绝对/相对模式之间切换
- 重置当前位置
- 毫米和英寸单位
无论您使用哪种切片器/打印机,估计都应该是相当真实的。
安装
使用Composer将GcodeEstimator安装到您的项目中
composer require "pyrech/gcode-estimator"
用法
基本用法以获取使用的丝线长度
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);
您还可以通过描述您的丝线卷的属性来估计打印的重量和成本
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);
进一步文档
您可以使用以下方法查看当前和过去的版本:
- 使用
git tag
命令 - Github上的发行页面
- 列出版本之间变化的文件变更日志
最后是一些元文档
致谢
许可
GcodeEstimator采用MIT许可证 - 请参阅LICENSE文件以获取详细信息。