Jump to content
Ultimaker Community of 3D Printing Experts
owen

New Cura Printer Interface

Recommended Posts

Just added fan control to the Pronterface UI in Cura

Maybe anyone else who creates one could put it in this thread

Instructions

1 Create a new folder in the Cura plugins folder and call it PronterfanUI

2 Place into that folder the full size version of the following 2 image files

Map

image

3 then create another file in that folder called script.py and copy the code below into it and restart Cura

 


#Name: Pronterfan UI
#Info: Pronterface like UI for Cura with Fan
#Depend: printwindow
#Type: printwindow
# Printer UI based on the Printrun interface by Kliment plus fan.
# Printrun is GPLv3, so this file, and the used images are GPLv3
setImage('image.png', 'map.png')
addColorCommand(0, 0, 255, sendGCode, "G91; G1 X100 F2000; G90")
addColorCommand(0, 0, 240, sendGCode, "G91; G1 X10 F2000; G90")
addColorCommand(0, 0, 220, sendGCode, "G91; G1 X1 F2000; G90")
addColorCommand(0, 0, 200, sendGCode, "G91; G1 X0.1 F2000; G90")
addColorCommand(0, 0, 180, sendGCode, "G91; G1 X-0.1 F2000; G90")
addColorCommand(0, 0, 160, sendGCode, "G91; G1 X-1 F2000; G90")
addColorCommand(0, 0, 140, sendGCode, "G91; G1 X-10 F2000; G90")
addColorCommand(0, 0, 120, sendGCode, "G91; G1 X-100 F2000; G90")
addColorCommand(0, 255, 0, sendGCode, "G91; G1 Y100 F2000; G90")
addColorCommand(0, 240, 0, sendGCode, "G91; G1 Y10 F2000; G90")
addColorCommand(0, 220, 0, sendGCode, "G91; G1 Y1 F2000; G90")
addColorCommand(0, 200, 0, sendGCode, "G91; G1 Y0.1 F2000; G90")
addColorCommand(0, 180, 0, sendGCode, "G91; G1 Y-0.1 F2000; G90")
addColorCommand(0, 160, 0, sendGCode, "G91; G1 Y-1 F2000; G90")
addColorCommand(0, 140, 0, sendGCode, "G91; G1 Y-10 F2000; G90")
addColorCommand(0, 120, 0, sendGCode, "G91; G1 Y-100 F2000; G90")
addColorCommand(255, 0, 0, sendGCode, "G91; G1 Z10 F200; G90")
addColorCommand(220, 0, 0, sendGCode, "G91; G1 Z1 F200; G90")
addColorCommand(200, 0, 0, sendGCode, "G91; G1 Z0.1 F200; G90")
addColorCommand(180, 0, 0, sendGCode, "G91; G1 Z-0.1 F200; G90")
addColorCommand(160, 0, 0, sendGCode, "G91; G1 Z-1 F200; G90")
addColorCommand(140, 0, 0, sendGCode, "G91; G1 Z-10 F200; G90")
addColorCommand(255, 255, 0, sendGCode, "G28")
addColorCommand(240, 255, 0, sendGCode, "G28 X0")
addColorCommand(220, 255, 0, sendGCode, "G28 Y0")
addColorCommand(200, 255, 0, sendGCode, "G28 Z0")
addColorCommand(0, 1, 0, sendGCode, "M107")
addColorCommand(0, 1, 5, sendGCode, "M106 S13")
addColorCommand(0, 1, 10, sendGCode, "M106 S26")
addColorCommand(0, 1, 15, sendGCode, "M106 S38")
addColorCommand(0, 1, 20, sendGCode, "M106 S51")
addColorCommand(0, 1, 25, sendGCode, "M106 S64")
addColorCommand(0, 1, 30, sendGCode, "M106 S77")
addColorCommand(0, 1, 35, sendGCode, "M106 S89")
addColorCommand(0, 1, 40, sendGCode, "M106 S102")
addColorCommand(0, 1, 45, sendGCode, "M106 S115")
addColorCommand(0, 1, 50, sendGCode, "M106 S128")
addColorCommand(0, 1, 55, sendGCode, "M106 S140")
addColorCommand(0, 1, 60, sendGCode, "M106 S153")
addColorCommand(0, 1, 65, sendGCode, "M106 S166")
addColorCommand(0, 1, 70, sendGCode, "M106 S179")
addColorCommand(0, 1, 75, sendGCode, "M106 S191")
addColorCommand(0, 1, 80, sendGCode, "M106 S204")
addColorCommand(0, 1, 85, sendGCode, "M106 S217")
addColorCommand(0, 1, 90, sendGCode, "M106 S230")
addColorCommand(0, 1, 95, sendGCode, "M106 S242")
addColorCommand(0, 1, 100, sendGCode, "M106 S255")
addTerminal(255, 0, 255)
addTemperatureGraph(180, 0, 255)
addProgressbar(255, 200, 200)
addButton(0, 255, 255, 'Connect', connect)
addButton(0, 240, 255, 'Print', startPrint)
addButton(0, 220, 255, 'Pause', pausePrint)
addButton(0, 200, 255, 'Cancel', cancelPrint)
addButton(0, 180, 255, 'Error log', showErrorLog)

4 from Preferences choose Pronterfan UI from the Print Window dropdown

 

  • Like 1

Share this post


Link to post
Share on other sites

Nice extension...! :smile:

 

Just added fan control to the Pronterface UI in Cura

Maybe anyone else who creates one could put it in this thread

[...]

 

It's a good idea to collect print interfaces in this thread for the moment. However, on the long run, I would see a new 'Cura print dialog plugin' category in the Ultimaker Wiki where the designs could be collected... similar to the 'standard' Cura plugins.

 

Share this post


Link to post
Share on other sites

Nice extension...! :smile:

It's a good idea to collect print interfaces in this thread for the moment. However, on the long run, I would see a new 'Cura print dialog plugin' category in the Ultimaker Wiki where the designs could be collected... similar to the 'standard' Cura plugins.

 

Yes, and, I hope someone will improve the interface. I quickly threw it together. But if something better comes along I have no problem in merging it into the main Cura.

That's one of the main reasons why I setup the new printer windows like this, it's easy to hack, and easy to contribute this way.

 

Share this post


Link to post
Share on other sites

@owen: I just did as you wrote. The new 'Pronterfan' option does not appear in the preferences. Only 'basic' and 'Pronterface UI'... what am I doing wrong? Tried it with RC5...

 

From within RC5 click on the Plugins tab

Click on Open Plugin Location

You should see the 'PronterfanUI' folder

In that you should see 3 files

image.png, map.png and script.py

both image files should be 781 X 400 pixels

 

Share this post


Link to post
Share on other sites

Hi,

I have come up with a way to add arbitrary UI components to the printer GUI. It works with the modified UI in the original post above, or the stock printer UI. It has the potential to help modularise the GUI plugins.

The example I have allows you to set the hot end temp for 1 or 2 extruders. Below is the code, just add it to the bottom of script.py

It happens to use the same RGB values as the terminal so will appear there and you don't need to comment out the existing 'addTerminal()' as it will remain underneath this small 2 row panel - although changing the image and map png would be better longer term.

 


######
# these are common and could/should migrate to Cura.gui.printWindow/printWindowPlugin
# they will need to be added to the 'variables' passed to the 'execfile' in __init__
def parentFrame():
return setImage.im_self # this magic is only needed in this plugin, it's the 'self' of printWindowPlugin
def addPanel(r,g,b):
printWindowPlugin = parentFrame() # magic
x, y, w, h = printWindowPlugin._getColoredRect(r,g,b)
panel= wx.Panel(printWindowPlugin)
panel.SetPosition((x, y))
panel.SetSize((w, h))
return panel
def createButton(parent, text, command, data = None):
button = wx.Button(parent, -1, _(text))
button.command = command
button.data = data
printWindowPlugin = parentFrame()
printWindowPlugin.Bind(wx.EVT_BUTTON, lambda e: command(data), button)
return button
### Below is the custom GUI Panel to control 2 extruders

import wx
# this could live in its own module and would make assembly of different GUI plugins in a single printer GUI window easier to manage
class ExtruderTemperaturePluginPanel():
def __init__(self, r,g,b):
defaultTemp = "210"
panel = addPanel(r,g,b)

self.tool0_temp = wx.TextCtrl(panel, -1, value="0")
self.tool0_zero = createButton(panel, "Set 0", sendGCode, "G91; M104 T0 S0")
self.tool0_default = createButton(panel, "Set " + defaultTemp, sendGCode, "G91; M104 T0 S" + defaultTemp)
self.tool0_setTemp = createButton(panel, "Set:", lambda s: sendGCode("G91; M104 T0 S" + s.GetValue()), self.tool0_temp)
self.tool1_temp = wx.TextCtrl(panel, -1, value="0")
self.tool1_zero = createButton(panel, "Set 0", sendGCode, "G91; M104 T1 S0")
self.tool1_default = createButton(panel, "Set " + defaultTemp, sendGCode, "G91; M104 T1 S" + defaultTemp)
self.tool1_setTemp = createButton(panel, "Set:", lambda s: sendGCode("G91; M104 T1 S" + s.GetValue()), self.tool1_temp)

sizer = wx.GridSizer(rows=10, cols=5, hgap=10, vgap=10)
sizer.Add(wx.StaticText(panel, -1, label="Extruder 1"), 0, wx.ALL, 10)
sizer.Add(self.tool0_zero, 0, wx.ALL, 10)
sizer.Add(self.tool0_default, 0, wx.ALL, 10)
sizer.Add(self.tool0_setTemp, 0, wx.ALL, 10)
sizer.Add(self.tool0_temp, 0, wx.ALL, 10)

sizer.Add(wx.StaticText(panel, -1, label = "Extruder 2"), 0, wx.ALL, 10)
sizer.Add(self.tool1_zero, 0, wx.ALL, 10)
sizer.Add(self.tool1_default, 0, wx.ALL, 10)
sizer.Add(self.tool1_setTemp, 0, wx.ALL, 10)
sizer.Add(self.tool1_temp, 0, wx.ALL, 10)
panel.SetSizer(sizer)
panel.Layout()
###
ExtruderTemperaturePluginPanel(255, 0, 255)

Share this post


Link to post
Share on other sites

This doesn't work for me.

Adding the fan to the GUI works but not the temp for the extruders.

I added the code to the bottom of script.py (in the map plugins\PronterfaceUI) and if i want to print it doesnt want to open the print window, and when i remove the new added code its working again. i'm i doing something wrong?

Also the code with the fan, on the bottom it says

 


addButton(0, 255, 255, 'Connect', connect)
addButton(0, 240, 255, 'Print', startPrint)
addButton(0, 220, 255, 'Pause', pausePrint)
addButton(0, 200, 255, 'Cancel', cancelPrint)
addButton(0, 180, 255, 'Error log', showErrorLog)

but i only have 3 buttons (connect ,print and cancel)

oh0mxd.jpg

And last question:

is it possible to give more commands behind the cancelPrint ?

i would like that if i press Cancel in the UI that the printer stops printing but the temperature from the extruder and bed stays on and that the extruder goes up a little bit and then the x and y goes to 0. i tried by typing cancelPrint, sendGcode , "M107 etc....") but it seems it doesn't accept this.

Thank you

 

Share this post


Link to post
Share on other sites

 

Also the code with the fan, on the bottom it says

 


addButton(0, 255, 255, 'Connect', connect)
addButton(0, 240, 255, 'Print', startPrint)
addButton(0, 220, 255, 'Pause', pausePrint)
addButton(0, 200, 255, 'Cancel', cancelPrint)
addButton(0, 180, 255, 'Error log', showErrorLog)

but i only have 3 buttons (connect ,print and cancel)

oh0mxd.jpg

Hi

It looks like the Pause and Error Log buttons were left off the top layer image. My guess is they should lie between the Print and Cancel buttons and after the Cancel button. If you click there I would say that they would work.

 

Share this post


Link to post
Share on other sites

Happy to see that there is some progress here. UNfortunately is all you doing beyond my possibilities...

What I´m missing at the mkoment is the possibility to (pre-) heat the bed and the nozzle. Currently I just can do that with my LCD panel, but in 14.01 this option was available.

Finally I would need some help getting this things together, I a real dummy in programming, not sure how putting this code pieces together. I think there will be a lot of people out there like me and for us it would be niche to have the code in one Piece and a short instruction where to put these...

 

Share this post


Link to post
Share on other sites

But how comes that only the Cancel button is showed?

When i change print with cancel and vice versa the cancel button is then next the print button.

So the color codes are working.

Do you know why it doesn't show the buttons (visually)?

 

Not sure, I think they were just forgotten to be put there?

 

Share this post


Link to post
Share on other sites

Those buttons only show if they are available, else they are hidden. (Pull out the USB cable after a connect is done, and the error log will show up. The pause had some issues, so is always disabled at the moment)

 

Share this post


Link to post
Share on other sites

I have changed the interface.

Added a on/off button for headbed and extruder.

The headbed temp = 55 and extruder = 205.

If you want to change these values you need to go to script and change S55 & S205 to the desired themp.

Copy the files in the zip to PronterfanUI and replace everything..

https://mega.co.nz/#!CcQmUTbI!9Q9KMSzQySp2MubyuLSxebio7wjDv4Z2t9v6MuYmkKk

The only problem i have is that the headbed doesn't work and don't know why...

Maybe any of you guys have an idea?

 


addColorCommand(120, 77, 27, sendGCode, "M140 S55")

Using this but doesn't work.

And when i change the line from the extruder to M140 S55 it works...

 

Share this post


Link to post
Share on other sites

This plugin is exactly what i´m looking for!

Unfortunately I´ve tried the Pronterfan UI in my Cura 14.03 RC6 and the interface simply does not appear. When I click on "Print" nothing happens...

Yes, I´ve copied the right files in the right folder and the preferences menu shows the option "Pronterface fan".

Any idea?

 

Share this post


Link to post
Share on other sites

Well i did change the file but it was possible you downloaded the first one.

There's an error in it.

Go to the script.py and its at the heatbed its going to say "M140" S55) and it needs to become "M140 S55")

Or just download it again. Changed the code in it

 

Share this post


Link to post
Share on other sites

Well i did change the file but it was possible you downloaded the first one.

There's an error in it.

Go to the script.py and its at the heatbed its going to say "M140" S55) and it needs to become "M140 S55")

Or just download it again. Changed the code in it

 

Is this file still good? getting a download error.....

 

Share this post


Link to post
Share on other sites

Hi, I noticed today that when copy-pasting Wayne's code, the indentation of the lines seem to be lost, which screws up the python code. When I corrected that, it works just fine. However, I found it a bit impractical that the console and the temperature panel were in the same space (as sometimes console messages would print over the temperature buttons), so I did some small modifications to the design to make some room.

I uploaded the result, to be found https://app.box.com/s/75skiqucz6az8ldine4a. Just put the files in the PronterfanUI folder, overwriting everything. This version contains fan control (by owen), temperature control (by Wayne), and on/off buttons for the heatbed and extruder (by Citystars).

I hope this will be useful to some people.

 

Share this post


Link to post
Share on other sites

Hello again, excuse my double post, but: I thought "what the hell, let's add extrusion/retraction", so I did.

You can download this new version here. As before, just extract the archive in the pronterfanUI folder, overwriting everything. This version supports fan control, temperature control, hotbed/extruder on/off and extrusion/retraction control for the first extruder. If anyone feels like adding the same functionality for the second extruder, feel free (I don't have one myself).

I'll keep the old version in my earlier post, in case there are any bugs with the new version.

I think what is needed after this version is a bit of redesign, so it looks a bit less cluttered and has a uniform style.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Our picks

    • How to 3D print with reinforced engineering materials
      Ultimaker is hosting a webinar where we explain how you can achieve and maintain a high print success rate using these new reinforced engineering materials. Learn from Ultimaker's Product Manager of Materials and top chemical engineer Bart van As how you can take your 3D printing to that next level.
      • 0 replies
    • "Back To The Future" using Generative Design & Investment Casting
      Designing for light-weight parts is becoming more important, and I’m a firm believer in the need to produce lighter weight, less over-engineered parts for the future. This is for sustainability reasons because we need to be using less raw materials and, in things like transportation, it impacts the energy usage of the product during it’s service life.
        • Like
      • 12 replies
×

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!