from __future__ import absolute_import
__copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
+import os
import webbrowser
import threading
import time
from Cura.util import machineCom
from Cura.util import profile
from Cura.util import gcodeGenerator
-from Cura.util.resources import getPathForImage
+from Cura.util import resources
class InfoBox(wx.Panel):
self.sizer = wx.GridBagSizer(5, 5)
self.SetSizer(self.sizer)
- self.attentionBitmap = wx.Bitmap(getPathForImage('attention.png'))
- self.errorBitmap = wx.Bitmap(getPathForImage('error.png'))
- self.readyBitmap = wx.Bitmap(getPathForImage('ready.png'))
+ self.attentionBitmap = wx.Bitmap(resources.getPathForImage('attention.png'))
+ self.errorBitmap = wx.Bitmap(resources.getPathForImage('error.png'))
+ self.readyBitmap = wx.Bitmap(resources.getPathForImage('ready.png'))
self.busyBitmap = [
- wx.Bitmap(getPathForImage('busy-0.png')),
- wx.Bitmap(getPathForImage('busy-1.png')),
- wx.Bitmap(getPathForImage('busy-2.png')),
- wx.Bitmap(getPathForImage('busy-3.png'))
+ wx.Bitmap(resources.getPathForImage('busy-0.png')),
+ wx.Bitmap(resources.getPathForImage('busy-1.png')),
+ wx.Bitmap(resources.getPathForImage('busy-2.png')),
+ wx.Bitmap(resources.getPathForImage('busy-3.png'))
]
self.bitmap = wx.StaticBitmap(self, -1, wx.EmptyBitmapRGBA(24, 24, red=255, green=255, blue=255, alpha=1))
#self.AddText('* Do your first print')
-class RepRapInfoPage(InfoPage):
+class OtherMachineSelectPage(InfoPage):
def __init__(self, parent):
- super(RepRapInfoPage, self).__init__(parent, "RepRap information")
- self.AddText(
- _("RepRap machines are vastly different, and there is no\ndefault configuration in Cura for any of them."))
+ super(OtherMachineSelectPage, self).__init__(parent, "Other machine information")
+ self.AddText(_("The following pre-defined machine profiles are available"))
+ self.AddText(_("Note that these profiles are not guaranteed to give good results,\nor work at all. Extra tweaks might be required."))
+ self.options = []
+ machines = resources.getDefaultMachineProfiles()
+ machines.sort()
+ for filename in machines:
+ name = os.path.splitext(os.path.basename(filename))[0]
+ item = self.AddRadioButton(name)
+ item.filename = filename
+ item.Bind(wx.EVT_RADIOBUTTON, self.OnProfileSelect)
+ self.options.append(item)
+ self.AddSeperator()
+ item = self.AddRadioButton('Custom...')
+ item.SetValue(True)
+ item.Bind(wx.EVT_RADIOBUTTON, self.OnOtherSelect)
+
+ def OnProfileSelect(self, e):
+ wx.wizard.WizardPageSimple.Chain(self, self.GetParent().otherMachineInfoPage)
+
+ def OnOtherSelect(self, e):
+ wx.wizard.WizardPageSimple.Chain(self, self.GetParent().customRepRapInfoPage)
+
+ def StoreData(self):
+ for option in self.options:
+ if option.GetValue():
+ profile.loadProfile(option.filename)
+ profile.loadMachineSettings(option.filename)
+
+class OtherMachineInfoPage(InfoPage):
+ def __init__(self, parent):
+ super(OtherMachineInfoPage, self).__init__(parent, "Cura Ready!")
+ self.AddText(_("Cura is now ready to be used!"))
+
+class CustomRepRapInfoPage(InfoPage):
+ def __init__(self, parent):
+ super(CustomRepRapInfoPage, self).__init__(parent, "Custom RepRap information")
+ self.AddText(_("RepRap machines can be vastly different, so here you can set your own settings."))
+ self.AddText(_("Be sure to review the default profile before running it on your machine."))
self.AddText(_("If you like a default profile for your machine added,\nthen make an issue on github."))
self.AddSeperator()
self.AddText(_("You will have to manually install Marlin or Sprinter firmware."))
self.Ultimaker2Radio.Bind(wx.EVT_RADIOBUTTON, self.OnUltimaker2Select)
self.UltimakerRadio = self.AddRadioButton("Ultimaker")
self.UltimakerRadio.Bind(wx.EVT_RADIOBUTTON, self.OnUltimakerSelect)
- self.OtherRadio = self.AddRadioButton(_("Other (Ex: RepRap)"))
+ self.OtherRadio = self.AddRadioButton(_("Other (Ex: RepRap, MakerBot)"))
self.OtherRadio.Bind(wx.EVT_RADIOBUTTON, self.OnOtherSelect)
self.AddSeperator()
self.AddText(_("The collection of anonymous usage information helps with the continued improvement of Cura."))
wx.wizard.WizardPageSimple.Chain(self, self.GetParent().ultimakerSelectParts)
def OnOtherSelect(self, e):
- wx.wizard.WizardPageSimple.Chain(self, self.GetParent().repRapInfoPage)
+ wx.wizard.WizardPageSimple.Chain(self, self.GetParent().otherMachineSelectPage)
def AllowNext(self):
wx.wizard.WizardPageSimple.Chain(self, self.GetParent().ultimaker2ReadyPage)
def __init__(self, parent):
super(UltimakerCheckupPage, self).__init__(parent, "Ultimaker Checkup")
- self.checkBitmap = wx.Bitmap(getPathForImage('checkmark.png'))
- self.crossBitmap = wx.Bitmap(getPathForImage('cross.png'))
- self.unknownBitmap = wx.Bitmap(getPathForImage('question.png'))
- self.endStopNoneBitmap = wx.Bitmap(getPathForImage('endstop_none.png'))
- self.endStopXMinBitmap = wx.Bitmap(getPathForImage('endstop_xmin.png'))
- self.endStopXMaxBitmap = wx.Bitmap(getPathForImage('endstop_xmax.png'))
- self.endStopYMinBitmap = wx.Bitmap(getPathForImage('endstop_ymin.png'))
- self.endStopYMaxBitmap = wx.Bitmap(getPathForImage('endstop_ymax.png'))
- self.endStopZMinBitmap = wx.Bitmap(getPathForImage('endstop_zmin.png'))
- self.endStopZMaxBitmap = wx.Bitmap(getPathForImage('endstop_zmax.png'))
+ self.checkBitmap = wx.Bitmap(resources.getPathForImage('checkmark.png'))
+ self.crossBitmap = wx.Bitmap(resources.getPathForImage('cross.png'))
+ self.unknownBitmap = wx.Bitmap(resources.getPathForImage('question.png'))
+ self.endStopNoneBitmap = wx.Bitmap(resources.getPathForImage('endstop_none.png'))
+ self.endStopXMinBitmap = wx.Bitmap(resources.getPathForImage('endstop_xmin.png'))
+ self.endStopXMaxBitmap = wx.Bitmap(resources.getPathForImage('endstop_xmax.png'))
+ self.endStopYMinBitmap = wx.Bitmap(resources.getPathForImage('endstop_ymin.png'))
+ self.endStopYMaxBitmap = wx.Bitmap(resources.getPathForImage('endstop_ymax.png'))
+ self.endStopZMinBitmap = wx.Bitmap(resources.getPathForImage('endstop_zmin.png'))
+ self.endStopZMaxBitmap = wx.Bitmap(resources.getPathForImage('endstop_zmax.png'))
self.AddText(
_("It is a good idea to do a few sanity checks now on your Ultimaker.\nYou can skip these if you know your machine is functional."))
self.ultimakerCalibrateStepsPerEPage = UltimakerCalibrateStepsPerEPage(self)
self.bedLevelPage = bedLevelWizardMain(self)
self.headOffsetCalibration = headOffsetCalibrationPage(self)
- self.repRapInfoPage = RepRapInfoPage(self)
+ self.otherMachineSelectPage = OtherMachineSelectPage(self)
+ self.customRepRapInfoPage = CustomRepRapInfoPage(self)
+ self.otherMachineInfoPage = OtherMachineInfoPage(self)
self.ultimaker2ReadyPage = Ultimaker2ReadyPage(self)
wx.wizard.WizardPageSimple.Chain(self.ultimakerFirmwareUpgradePage, self.ultimakerCheckupPage)
wx.wizard.WizardPageSimple.Chain(self.ultimakerCheckupPage, self.bedLevelPage)
#wx.wizard.WizardPageSimple.Chain(self.ultimakerCalibrationPage, self.ultimakerCalibrateStepsPerEPage)
+ wx.wizard.WizardPageSimple.Chain(self.otherMachineSelectPage, self.customRepRapInfoPage)
self.FitToPage(self.firstInfoPage)
self.GetPageAreaSizer().Add(self.firstInfoPage)
--- /dev/null
+[machine]\r
+machine_name = MakerBot Replicator\r
+machine_type = MakerBot\r
+machine_width = 225\r
+machine_depth = 145\r
+machine_height = 150\r
+machine_center_is_zero = False\r
+has_heated_bed = True\r
+gcode_flavor = MakerBot\r
+extruder_amount = 1\r
+\r
+[profile]\r
+filament_diameter = 1.75\r
+nozzle_size = 0.4\r
+layer_height = 0.15\r
+fill_density = 10\r
+print_speed = 50\r
+print_temperature = 220\r
+travel_speed = 150\r
+\r
+[alterations]\r
+start.gcode = ; -- START GCODE --\r
+ M136 (enable build)\r
+ M73 P0\r
+ G162 X Y F2000(home XY axes maximum)\r
+ G161 Z F900(home Z axis minimum)\r
+ G92 X0 Y0 Z-5 A0 B0 (set Z to -5)\r
+ G1 Z0.0 F{max_z_speed}(move Z to '0')\r
+ G161 Z F100(home Z axis minimum)\r
+ M132 X Y Z A B (Recall stored home offsets for XYZAB axis)\r
+ G92 X152 Y72 Z0 A0 B0\r
+ G1 X-141 Y-74 Z40 F{travel_speed} (move to waiting position)\r
+ G130 X20 Y20 A20 B20 (Lower stepper Vrefs while heating)\r
+ M135 T0\r
+ M104 S220 T0\r
+ M133 T0\r
+ G130 X127 Y127 A127 B127 (Set Stepper motor Vref to defaults)\r
+ ; Sliced {filename} at: {day} {date} {time}\r
+ ; Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}\r
+ ; Print time: {print_time}\r
+ ; Filament used: {filament_amount}m {filament_weight}g\r
+ ; Filament cost: {filament_cost}\r
+ M73 P0; \r
+ ; -- end of START GCODE --\r
+\r
+end.gcode = ; -- END GCODE --\r
+ M127 T0; fan off\r
+ M127 T0 (Fan Off)\r
+ M18 A B(Turn off A and B Steppers)\r
+ G1 Z155 F900\r
+ G162 X Y F2000\r
+ M18 X Y Z(Turn off steppers after a build)\r
+ M104 S0 T0\r
+ M70 P5 (We <3 Making Things!)\r
+ M72 P1 ( Play Ta-Da song )\r
+ M73 P100\r
+ M137 (build end notification)\r
+ ; -- end of END GCODE --\r
setting('machine_center_is_zero', 'False', bool, 'machine', 'hidden')
setting('ultimaker_extruder_upgrade', 'False', bool, 'machine', 'hidden')
setting('has_heated_bed', 'False', bool, 'machine', 'hidden').setLabel(_("Heated bed"), _("If you have an heated bed, this enabled heated bed settings (requires restart)"))
-setting('gcode_flavor', 'RepRap (Marlin/Sprinter)', ['RepRap (Marlin/Sprinter)', 'UltiGCode'], 'machine', 'hidden').setLabel(_("GCode Flavor"), _("Flavor of generated GCode.\nRepRap is normal 5D GCode which works on Marlin/Sprinter based firmwares.\nUltiGCode is a variation of the RepRap GCode which puts more settings in the machine instead of the slicer."))
+setting('gcode_flavor', 'RepRap (Marlin/Sprinter)', ['RepRap (Marlin/Sprinter)', 'UltiGCode', 'MakerBot'], 'machine', 'hidden').setLabel(_("GCode Flavor"), _("Flavor of generated GCode.\nRepRap is normal 5D GCode which works on Marlin/Sprinter based firmwares.\nUltiGCode is a variation of the RepRap GCode which puts more settings in the machine instead of the slicer.\nMakerBot GCode has a few changes in the way GCode is generated, but still requires MakerWare to generate to X3G."))
setting('extruder_amount', '1', ['1','2','3','4'], 'machine', 'hidden').setLabel(_("Extruder count"), _("Amount of extruders in your machine."))
setting('extruder_offset_x1', '-21.6', float, 'machine', 'hidden').setLabel(_("Offset X"), _("The offset of your secondary extruder compared to the primary."))
setting('extruder_offset_y1', '0.0', float, 'machine', 'hidden').setLabel(_("Offset Y"), _("The offset of your secondary extruder compared to the primary."))
setActiveMachine(int(getPreferenceFloat('active_machine')))
+def loadMachineSettings(filename):
+ global settingsList
+ #Read a configuration file as global config
+ profileParser = ConfigParser.ConfigParser()
+ try:
+ profileParser.read(filename)
+ except ConfigParser.ParsingError:
+ return
+
+ for set in settingsList:
+ if set.isMachineSetting():
+ if profileParser.has_option('machine', set.getName()):
+ set.setValue(unicode(profileParser.get('machine', set.getName()), 'utf-8', 'replace'))
+ checkAndUpdateMachineName()
+
def savePreferences(filename):
global settingsList
#Save the current profile to an ini file