[Request plugin] Extra info from gcode file


#1

Hello,

I would love to have the settings saved by slicer presented in a popup.
In S3D you have all settings at the start of the gcode file.
Have options in the Octoprint plugin to select the settings you like to see.

In Cura you have settings in the bottom of the file.
Don't know if other slicers has the same


#2

That implies, that for every slicer available needs a parser to get out these information... :thinking:


#3

Well create parser for the big ones Cura, s3d and Slic3r.


#4

You could write a plugin


#5

If I only knew how to do it. Could learn how to code I guess


#6

For an experienced programmer it should certainly be no problem to build such a parser.
But such a plugin can easily become a life task.
Finally, then every - albeit small - change in the data format of the slicers must be updated in the plugin to work proberly ...


#7

You have a point, any changes to the way they present the settings will break the plugin.


#8

I dunno. If one takes a simple approach it might be do-able. In the case of Cura, it just drops at the end of the file what is a big JSON object which is then chopped up to control the line length. It's well-marked with a comment so it would be easy to find and grab.

It might be simple enough to then just have this text available for a hover-over popup to display what it found.

Rather than reading all the files, only reading the selected file would again simplify matters. A single line (or FontAwesome icon) added to the State side panel widget would be the point to query. Hover over this and a popup box would display what was found.

Personally, I'd rather have an ugly report than to wonder which slicing decisions I made for this file.

That said, I actually have written a Go language CLI which will report some Cura-specific information which was important to me at the time. In theory, one could compile it for the Raspbian operating system, place the executable into the ~/scripts folder, call it from Python using a simply plugin approach.

~/scripts/SlicingInfo ~/.octoprint/uploads/MyFile.gcode

Slicer:          Cura_SteamEngine 2.3.1
Layers:          239
Quality:         low
Profile:         Low Quality Robo C2
Filament size:   1.75
Hotend temp:     190
Bed temp:        0
Supports:        False
Retraction:      True
Jerk:            True
Speed 1st layer: 10
Print speed:     50
Travel speed:    80
Infill pattern:  cubic

#9

Did we talk here about a "possible" plugin that already exists ?!?

Didn't try it at the moment, but this should already go into the right direction for the wishes @varazir have?


#10

Well they are new just got the notification about them to day.
Well out of the box it didn't work.

Have to look at the SED command.


#11

I sometimes use that. Here's some JavaScript in one of my programs that will use sed to replace the UUID in OctoPrint's config.yaml file.

  strSedRegex =
    'sed s/upnpUuid:\ [0-9,a-z,A-Z,\-]*/upnpUuid:\ ' + strUuid + '/g';

There are days when I really hate regex, for what it's worth.


#12

ya regexp is the devil in disguise.

I use https://regex101.com/ when I testing and need help.


#13

I like that. I'll probably give it a go at some point.