Loading

PHP Filament Length/Weight/Volume Estimator for 4d G-Code

by algspd, published

PHP Filament Length/Weight/Volume Estimator for 4d G-Code by algspd Dec 2, 2012

Description

This is a PHP translation of "Filament Length/Weight/Volume Estimator for 4d G-Code" (Original Perl code by jag thingiverse.com/thing:15499 )

Recent Comments

view all

I tried to change the code as less as possible to make understandable the translation (I'm making another version for myself).
The motivation of this translation was to have the most "compact" possible cost estimator, calling the less possible interpreters (why to call php and perl, if i can just call php?).
The problem now is that I can't do the estimation over the stl file, so I have to run something like skeinforge (which I will not translate to anything :P) to get the gcode.
If you know something "simple" that can estimate an stl file volume, please let me know.

Interesting to see how little you had to change the code.  
Just out of curiosity, what motivated you to port it to PHP rather than use the perl code?  Seems like most systems with PHP installed would also have perl.

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag

Instructions

Run something like "$ php filament_length.php -f cube-20-20-10_export.gcode"

The output is something like:

Filament diameter is 3 mm
Filament density is 1.05 g/cc
Cross sectional area of filament: 0.070685775 cm^2

Total filament: 34.148 cm
Volume: 2.414 cc
Weight: 2.534 g

Use this code however you want. If you find a bug, please tell me.

I cannot use a "more free" license here but please read the code header.

Comments

You must be logged in to post a comment.

jag on Dec 2, 2012 said:

Interesting to see how little you had to change the code.  
Just out of curiosity, what motivated you to port it to PHP rather than use the perl code?  Seems like most systems with PHP installed would also have perl.

algspd on Dec 2, 2012 said:

I tried to change the code as less as possible to make understandable the translation (I'm making another version for myself).
The motivation of this translation was to have the most "compact" possible cost estimator, calling the less possible interpreters (why to call php and perl, if i can just call php?).
The problem now is that I can't do the estimation over the stl file, so I have to run something like skeinforge (which I will not translate to anything :P) to get the gcode.
If you know something "simple" that can estimate an stl file volume, please let me know.

Top