PrettyGCode with mutiple printers

I have multiple printers configured on my Octopi using octoprint_deploy script. Everything works fine except for the PrettyGCode viewer.

env.os.id: linux
env.os.platform: linux
env.python.pip: 22.3
env.python.version: 3.9.2
octoprint.version: 1.9.3

When I access the plugin from the Octoprint UI, nothing happens. When I click on the "Direct link to fullscreen mode" option, I get the following page:

Running the recommended command yields the following:

pi@octopi $ ps -ef | grep -i octoprint | grep -i python
pi        1261     1  3 Nov17 ?        06:45:38 /home/pi/oprint/bin/python /home/pi/oprint/bin/octoprint serve --config=/home/pi/.Ender5/config.yaml --basedir=/home/pi/.Ender5 --port=5003
pi        5346     1  9 19:11 ?        00:05:40 /home/pi/oprint/bin/python /home/pi/oprint/bin/octoprint serve --config=/home/pi/.Ender3/config.yaml --basedir=/home/pi/.Ender3 --port=5001

Does anyone have this plugin working with a multiple printer setup?

Thanks.

Tom

octoprint-systeminfo-20231125202545.zip (66.4 KB)

Could you please post the direct link and a systeminfo bundle?

Added the bundle. Not sure what you mean by direct link.

Tom

This direct link :slight_smile:

This selection appears on the PrettyGCode tab. It's only visible on my local network.

prettygcode2

When I click that link I get the message page in the OP.

I looks to me as if the plugin can't discern what multiple printers would look like when the services are running.

Tom

PrettyGCode is abandoned, afaik. I believe someone forked and fixed it to work with multiple instances (@jneilliii most likely).

Lol...I did fork and submit a pull request. You can copy paste this URL in plugin manager > get more > ...from URL.

https://github.com/jneilliii/OctoPrint-PrettyGCode/archive/refs/heads/patch-2.zip

Thanks. Doesn't seem to work. I'm looking at the code you changed and I'm seeing stuff like:

octoprint_prettygcode/static/js/prettygcode.js

...
                if(viewInitialized && gcodeProxy)
                    {
-                       gcodeProxy.loadGcode('/downloads/files/local/' + curJobName);
+                       gcodeProxy.loadGcode('downloads/files/local/' + curJobName);
                        printHeadSim=new PrintHeadSimulator();

I'm assuming the reason it's not working is perhaps because the location of gcode files changed in a later version of Octoprint to the uploads directory.

Tom

Followup:

That was it. I changed lines like:

-                       gcodeProxy.loadGcode('downloads/files/local/' + curJobName);
+                       gcodeProxy.loadGcode('uploads/' + curJobName);

and now it's working.

This makes no sense to me because it's mimicking the download button from the file list to load the raw data of the gcode file into js memory. That button does still link to downloads/....

image

The download button on the file list sends the file to your client. There is no downloads directory in the basedir for the server instance on Octoprint.

drwxr-xr-x 14 pi pi 4096 Nov 25 21:05 ./
drwxr-xr-x 17 pi pi 4096 Nov 26 21:03 ../
-rw-------  1 pi pi 2117 Nov 25 21:05 config.backup
-rw-------  1 pi pi 1786 Oct 23 15:50 config.system_command_migration.yaml
-rw-------  1 pi pi 2117 Nov 25 21:05 config.yaml
drwxr-xr-x  8 pi pi 4096 Nov 26 22:56 data/
drwxr-xr-x  3 pi pi 4096 Nov 25 21:05 generated/
drwxr-xr-x  2 pi pi 4096 Nov 26 22:56 logs/
drwxr-xr-x  2 pi pi 4096 Nov 25 21:05 plugins/
drwxr-xr-x  2 pi pi 4096 Nov 25 21:05 printerProfiles/
drwxr-xr-x  2 pi pi 4096 Nov 25 21:05 scripts/
drwxr-xr-x  2 pi pi 4096 Nov 25 21:05 slicingProfiles/
drwxr-xr-x  3 pi pi 4096 Nov 25 21:05 timelapse/
drwxr-xr-x  2 pi pi 4096 Nov 25 21:05 translations/
drwxr-xr-x  2 pi pi 4096 Nov 26 23:27 uploads/
-rw-------  1 pi pi  249 Oct 14 12:56 users.yaml
drwxr-xr-x  2 pi pi 4096 Nov 25 21:05 virtualSd/
drwxr-xr-x  2 pi pi 4096 Nov 25 21:05 watched/

The uploads directory is where Octoprint stores your files for printing. That's where the plugin should expect to find the file currently being printed to visualize the gcode.

It started working only when I made the change to point to the correct directory.

prettygcode3

Tom

That is correct. It is handled by a blueprint route which gets the file from the uploads folder in the basedir folder you mention:

1 Like