How to populate material info into gcode?

Hi all,

coming from that issue: https://github.com/OllisGit/OctoPrint-PrintJobHistory/issues/58

I want to ask if somebody knows you to populate material/filament informations to gcode from CURA.
After that, I can put the values into the history-database.

I know there is a list (list2) with predefined keys, but I could not find the material-info, only the material-guid.

{material_guid}

For PrusaSlicer, it is working, what about other slicers, is this feature available, too?

Thx, in advance
Olli

What "info" do you need?

Everything I can get :wink:
image

At minimum: Display Name, Brand and Material Type.

Different slicers are always going to have different (types of) information available.

The display name, brand and material type metadata are not available as {replacement patterns} for start- or end-gcode snippets in Cura. A postprocessing script could insert them, or I could insert them eg in the Cura OctoPrint Connection plugin or Material Settings plugin.

One of the features that simplify3d is missing is a material script, would be very use for this sort of application. (Being a printjobhistory and a simplify3d user)

Sorry, I don't have a Simplify3d license, nor do I know the first thing about extending it. I do know Cura fairly intimately though.

Hi @fieldOfView,
IMHO the "Cura OctoPrint Connection" plugin should not "improve" the gcode. It is for transfering and controlling OP.

Your "Material Settings plugin" is a good place...just for my understanding:

  • If you enhance this plugin, is it then possible for the user to place e.g. {material_display_name} in the start/end gcode?
  • Which naming conventions should be used for multi material prints
    (e.g. material_display_name, material_display_name_2, material_display_name_N)?

I never setup CURA from source and I never wrote a plugin or a patch.
Do you think it is valuable to create a pull request to support the material "replacement patterns" out of the box?

It wasn't a request for help (Edit: Reading this back hours later that sounds much grumpier than I intend, :slight_smile: ). It could be done in S3D with a post processing script, but would be quite painful; It would be much easier if S3D added a material script, which it is really missing.

S3D doesn't have the concept of extendability through user plugins unfortunately.

In S3D.

The only thing it has is filament diameter, density and price, Not sure those would be very helpful. Also not sure they are officially available as placeholder variables either.

Edit:
It is all in the gcode already.

; filamentDiameters,1.75|1.75|1.75|1.75|1.75|1.75
; filamentPricesPerKg,30|46|46|46|46|46
; filamentDensities,1.25|1.25|1.25|1.25|1.25|1.25

So S3D as far as i can see that would be some sort of post process script to be useful

But the functionality we are talking about is (only?) going to be useful for users of OctoPrint. Requiring them to install another plugin sounds counter-helpful.

Why would you want to leave it up to the user to place these lines into the start gcode if you have a plugin that can add the lines to the gcode automatically?

For other replacement patterns, cura uses the convention of {pattern_name, extruder_nr}. So it would be {material_display_name, 1} for the second extruder (arrays start at 0!), or {material_type, support_extruder_nr} for the material type used to print the supports.

Sure. But we need to make an argument for the "info" we need. If you just say "all of it, because it can be useful", chances of the PR making it are low. If you say "we need the material display name and the material type, so we can sync this information with the (...) plugin so users can (...)", it might stand a chance. The Ultimaker 3 and newer only need to know the GUID, because they also get sent an XML file containing information about the material. So that is all UM has to support for their own printers.

The disadvantage of a PR is that it will not be available until - say - Cura 4.8 (or 5.0, or whatever comes after 4.7), whereas a plugin can support Cura 3.5 and newer.

Hi @fieldOfView
Yes, your right maybe creating a Post-ProcessingScript "receive more users", but currently I don't know you to develop such script.
I found this wiki page, but this describes the sdk and not how to write postprocessor.

Do you have an other resource for me where I can learn how to develop such script?

Thx, in advance
Olli

fyi: I wrote my first PostProcessing Script (see https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/wiki/How-does-the-plugin-works#cura)

But now I am lost...how can I access the material attributes and is it possible to "attach" a python-debugger session?
If I start cura in debug-mode with ---debug I didn't see a port where I can attach.

I am grateful for any help