supermerill / SuperSlicer

G-code generator for 3D printers (Prusa, Voron, Creality, etc.)
4.14k stars 522 forks source link

[Feature request] New macros variable - layer_used_filament #4367

Open shm-dmitry opened 4 months ago

shm-dmitry commented 4 months ago

Is your feature request related to a problem? Please describe. I want to change filament usage in Spoolman during Printing from SD card in Octoprint.

Describe the solution you'd like New macros: layer_used_filament - total use of filament, in meters, since start of the current layer

Describe how it would work I will use M118 GCODE to send this information to the host console. At host side I will transfer this information to the Spooler.

For example:

Before layer change custom GCODE:
...
M118 E1 FILAMENT_USE ${layer_used_filament}
...

I can try to implement this feature if you have some developer documentation.

legend069 commented 4 months ago

i can see this being helpful if you cancel a print and need a 'accurate' value. would it be more accurate using a encoder so octoprint can get a real time more accurate reading ?

currently the generated .gcode file has the total amount in the file itself. image

shm-dmitry commented 4 months ago

@legend069 , Hi

Yes, this value also can be used, it's less accurate in case of cancels, but OK.

The problem with octoprint is that I want to start printing from the printer's SD card, in this mode octoprint just listens to the UART and does not see these commented values. Therefore, I need some way to send this value to the console.

legend069 commented 4 months ago

@legend069 , Hi

Yes, this value also can be used, it's less accurate in case of cancels, but OK.

The problem with octoprint is that I want to start printing from the printer's SD card, in this mode octoprint just listens to the UART and does not see these commented values. Therefore, I need some way to send this value to the console.

you're more than welcome to start looking into adding this feature. on the master repo start by reading around lines ~1200 of Gcode.cpp should be able to edit it and adjust print_statistics variable

later on this feature could be used in the graphs to provide a filament used per layer type of thing.

shm-dmitry commented 4 months ago

@legend069 , Thank you for information I will try to implement this feature. Can I ask you a few questions about this topic if I don't find the answer myself?

legend069 commented 4 months ago

@legend069 , Thank you for information I will try to implement this feature. Can I ask you a few questions about this topic if I don't find the answer myself?

you're more than welcome to ask questions, I'll do my best to answer them :)

shm-dmitry commented 4 months ago

@legend069 , what branch I have to use for development? I checked few pull requests - someone uses nightly_dev, someone - master, someone - another branches.

legend069 commented 4 months ago

someone uses nightly_de

it's personal preference aslong as you create the PR against the same branch it shouldn't matter.

shm-dmitry commented 4 months ago

I created pull request 4380