Welcome! Log In Create A New Profile

Advanced

Could somebody construct a python script

Posted by appjaws1 
Could somebody construct a python script
September 15, 2014 03:34PM
Hi Could somebody who is skilled in writing python construct a script to convert a few lines in a sinply3D gcode file.

This is so on the web interface the filament details and estimated time will work also the correct number of layers will be displayed.

This is the end of the file:-

; layer 60, Z = 12.1
..........
.........
last layer movements
........
........
........
; Build Summary
; Build time: 17.65 min (0.29 hr)
; Plastic volume: 4647.47 mm^3 (4.65 cc)
; Filament length: 1932.2 mm
; Material cost: 0.16

This is what it's needed to be changed to:-

; Build Summary
; Build time: 17.65 min (0.29 hr)
; Plastic volume: 4647.47 mm^3 (4.65 cc)
; filament used = 1932.2 mm
; Material cost: 0.16
; G1 Z12.1

I would then run the scrip post slicing.

Thank you for any help
Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Could somebody construct a python script
September 15, 2014 04:56PM
I wouldn't use a Python script here, IMO it makes sense to modify the firmware read those values right away smiling smiley I've just put a another binary on [www.dropbox.com], which should recognize the filament usage generated by S3D.
Re: Could somebody construct a python script
September 15, 2014 07:07PM
Modding the firmware would be great...I think that quite a few of us are using Simplify3D as our default slicer and it would be wonderful to have the full functionality of the web interface available again...many thanks for looking into this for us...
Re: Could somebody construct a python script
September 16, 2014 03:11AM
Modding the firmware would definitely be the correct solution.

In the meantime, I might be able to make a quick add-on to my Python script.

I just need to find out how to pass the strings: "; layer XXX, Z = XX.XX"

:-) Carsten
Re: Could somebody construct a python script
September 16, 2014 03:21AM
I intend to mod the firmware to do this, but I am busy with other things for a few days.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Could somebody construct a python script
September 16, 2014 06:58AM
Quote
zombiepantslol
I wouldn't use a Python script here, IMO it makes sense to modify the firmware read those values right away smiling smiley I've just put a another binary on [www.dropbox.com], which should recognize the filament usage generated by S3D.

I loaded this firmware version and ran a test but the filament usage is not being reported.
Is it correct that the version reported by the web interface will still be 089j-zpl?


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Could somebody construct a python script
September 16, 2014 08:24AM
Yes, that one didn't work, sorry. Please see [forums.reprap.org]
Re: Could somebody construct a python script
September 16, 2014 04:10PM
My 5 minute hack of it attached. Usage example:
./fixusage.py < input.g > output.g

It reads gcode from stdin and outputs it on stdout. It remembers the Z value of those "layer NN Z = 47.11", changes the format of any "filament length" lines, and prints out that comment with the last seen Z value at the end. Includes some commented-out code if you want it to read a specific named file instead of stdin.
Attachments:
open | download - fixusage.py (495 bytes)
Re: Could somebody construct a python script
September 16, 2014 04:11PM
Of course, you could make the regexes more flexible in terms of amount of whitespace and such, but whatever ugly hack works...
Re: Could somebody construct a python script
September 16, 2014 05:04PM
@jstck,
Thank you for that, it's good of you to spare the time.
Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Sorry, only registered users may post in this forum.

Click here to login