I design things to print for my workshop in my first-floor office and control my printer located in the basement in the basement when I want to print a quick test print. I have recently added an E3D Revo to my Mk3s and I often change print sheets, filament type, filament color, and nozzle for any given print. Since the printer is in an enclosure, I either open up or close up the enclosure depending on the filament requirements. At my age (74), going up and down stairs unnecessarily is to be avoided. And given the often extended time between prints, I also am never sure what the current configuration of the printer is. In light of this, I learned Python in the last couple of weeks and wrote a stand-alone application that I can use to determine the current configuration of the printer. This app works just fine, but something integrated with Octopi would be better. If someone would like to take this on, I would be glad to help by testing, etc. I have been away from programming for too long (several decades) to try to develop a plugin myself.
Hey GA neighbor, it might help to post your code to get an idea of what it's doing for someone else (like myself maybe) can determine how easy/hard it would be to convert to a plugin.
Here you go. It is obvious that I have never done OOP programming and that my documenting is done mostly with namings.
import tkinter as tk from tkinter import ttk import os root = tk.Tk() root.title('Printer Config') root.geometry('600x200') #Configure Grid root.columnconfigure(0,weight=2) root.columnconfigure(1,weight=1) root.columnconfigure(2,weight=1) root.columnconfigure(3,weight=1) root.columnconfigure(4,weight=1) #Variables sheets_data_file="SheetsData.dat" types_data_file="TypesData.dat" colors_data_file="ColorsData.dat" nozzles_data_file="NozzlesData.dat" enclosure_data_file="EnclosureData.dat" current_config_file="CurrentConfig.dat" cc_sheet='' cc_type='' cc_color='' cc_nozzle='' cc_enclosure='' selected_sheet='' selected_type='' selected_color='' selected_nozzle='' selected_enclosure='' #Functions def callback_sheet(event): global cc_sheet cc_sheet = sheet_combobox.get() button_color_red() def callback_type(event): global cc_type cc_type= type_combobox.get() button_color_red() def callback_color(event): global cc_color cc_color= color_combobox.get() button_color_red() def callback_nozzle(event): global cc_nozzle cc_nozzle= nozzle_combobox.get() button_color_red() def callback_enclosure(event): global cc_enclosure cc_enclosure= enclosure_combobox.get() button_color_red() def button_clicked(): global cc_list os.remove('CurrentConfig.dat') output_file=open('CurrentConfig.dat','w') output_file.writelines(cc_sheet) output_file.writelines(cc_type) output_file.writelines(cc_color) output_file.writelines(cc_nozzle) output_file.writelines(cc_enclosure) output_file.close() button_color_gray() def button_color_red(): btn_save.configure(bg='#EE0000',fg='#EEEE00') def button_color_gray(): btn_save.configure(bg='#F0F0F8',fg='#000000') #Make Labels ##title lbl_title=ttk.Label(root,text='CURRENT CONFIG') lbl_title.grid(column=2,row=0) ##sheets lbl_sheet=ttk.Label(root,text='Sheet') lbl_sheet.grid(column=0,row=1) ##types lbl_type=ttk.Label(root,text='Type') lbl_type.grid(column=1,row=1) ##colors lbl_color=ttk.Label(root,text='Color') lbl_color.grid(column=2,row=1) ##nozzles lbl_nozzle=ttk.Label(root,text='Nozzle') lbl_nozzle.grid(column=3,row=1) ##enclosure lbl_enclosure=ttk.Label(root,text='Enclosure') lbl_enclosure.grid(column=4,row=1) #get current configuration input_file=open(current_config_file,'r') cc_sheet=input_file.readline() cc_type=input_file.readline() cc_color=input_file.readline() cc_nozzle=input_file.readline() cc_enclosure=input_file.readline() input_file.close() #Make and fill comboboxes ##Sheets sheet_combobox=ttk.Combobox(root,width=14,height=6,state='readonly',textvariable=selected_sheet) input_file=open(sheets_data_file,'r') items=[''] for item in input_file: items.append(item) sheet_combobox['values']=items input_file.close() sheet_combobox.grid(column=0,row=3) sheet_combobox.set(cc_sheet) sheet_combobox.bind("<<ComboboxSelected>>",callback_sheet) ##Types type_combobox=ttk.Combobox(root,width=14,height=6,state='readonly',textvariable=selected_type) input_file=open(types_data_file,'r') items=[''] for item in input_file: items.append(item) type_combobox['values']=items input_file.close() type_combobox.grid(column=1,row=3) type_combobox.set(cc_type) type_combobox.bind("<<ComboboxSelected>>",callback_type) ##Colors color_combobox=ttk.Combobox(root,width=14,height=6,state='readonly',textvariable=selected_color) input_file=open(colors_data_file,'r') items=[''] for item in input_file: items.append(item) color_combobox['values']=items input_file.close() color_combobox.grid(column=2,row=3) color_combobox.set(cc_color) color_combobox.bind("<<ComboboxSelected>>",callback_color) ##Nozzles nozzle_combobox=ttk.Combobox(root,width=14,height=6,state='readonly',textvariable=selected_nozzle) input_file=open(nozzles_data_file,'r') items=[''] for item in input_file: items.append(item) nozzle_combobox['values']=items input_file.close() nozzle_combobox.grid(column=3,row=3) nozzle_combobox.set(cc_nozzle) nozzle_combobox.bind("<<ComboboxSelected>>",callback_nozzle) ##Enclosure enclosure_combobox=ttk.Combobox(root,width=14,height=6,state='readonly',textvariable=selected_enclosure) input_file=open(enclosure_data_file,'r') items=[''] for item in input_file: items.append(item) enclosure_combobox['values']=items input_file.close() enclosure_combobox.grid(column=4,row=3) enclosure_combobox.set(cc_enclosure) enclosure_combobox.bind("<<ComboboxSelected>>",callback_enclosure) #Make Save Button btn_save=tk.Button(root,text='Save',bg='#F0F0F8',fg='#000000',command=button_clicked) btn_save.grid(column=4,row=0) root.mainloop()
There are definitely some things that need to cleaned up that are left over from the multiple attempts to get everything to work as I wanted.
Not much unlike how I program my plugins. So where does this program run and when are you accessing it's interface?
I'm wondering if one of the Slicer plugins that extract data from your gcode file might be a potential option for aiding your situation now. If you know what the last gcode file that you printed, you could just look at the extra file info or just profile name possibly with the Slicer Estimator plugin.
Thanks for looking into it and for the suggestions.
I turned it into an executable file and I just execute it on whichever machine I am on at the time. My desktop in the office to see the current config or the laptop in the basement lab to update after making configuration changes.
The gcode would not tell me which print surface is installed. Slicer Estimator looks like a useful option for the poor OctoPring estimate. I currently use PrusaSlicer's estimate and the time I started the print for a rough estimate of when it will be finished, but don't always remember when the print was started.
I use your Bed Visualizer when needed. Just the other day when printing multiple models sequentially, the one on the back of the bed were having issues, investigating with Bed Visualizer revealed that the back of the bed was too low. Some quick adjustments fixed that easily. Thank you for such a useful plugin.
After looking at your other plugins, I'm going to try Bed Ready for the case when I have forgotten to remove the last print.
Just realized that since I change bed fairly often, Bed Ready probably won't be that useful, since I always can just look at the picture.
Well if you have a camera, you could always just look at the control tab for the live view too. There has been a request to allow for multiple reference snapshots to my plugin. I can also recommend PrintTimeGenius plugin for the time estimates, it works really good and gets better over time as it learns your printer.
Thanks for the recommendation, I will definitely get PrintTimeGenius. I realized that I always look at the camera image when I start a print from the office anyway.
Sounds like a fun idea, I think an implementation similar to spool manager could work. I will think about it for a bit.
Is there something I can do help? I am an experienced mobile (Android) programmer and know python/java/C++/C. This might make for an interesting mobile app
To start is there a way I can get the config and dat files so I can run this?
I actually have it working as a standalone executable that I am satisfied so far, but here are the files:
PtrCfgApp.zip (2.0 KB)
thank you for that