From c5cf308fe4b27e860060f77032acc31c55df6316 Mon Sep 17 00:00:00 2001 From: daid Date: Tue, 6 Jan 2015 14:37:16 +0100 Subject: [PATCH] Add UM2go and UM2extended to config wizard. Still missing firmware and UM2go is missing platform STL. Change platform STL handling to make the code more generic. --- Cura/gui/configWizard.py | 33 +++++++++++++---- Cura/gui/firmwareInstall.py | 47 ++++++++++++++---------- Cura/gui/mainWindow.py | 2 +- Cura/gui/sceneView.py | 73 ++++++++++++++++++++----------------- 4 files changed, 93 insertions(+), 62 deletions(-) diff --git a/Cura/gui/configWizard.py b/Cura/gui/configWizard.py index 658abaaa..f7800911 100644 --- a/Cura/gui/configWizard.py +++ b/Cura/gui/configWizard.py @@ -421,6 +421,10 @@ class MachineSelectPage(InfoPage): self.Ultimaker2Radio = self.AddRadioButton("Ultimaker2", style=wx.RB_GROUP) self.Ultimaker2Radio.SetValue(True) self.Ultimaker2Radio.Bind(wx.EVT_RADIOBUTTON, self.OnUltimaker2Select) + self.Ultimaker2ExtRadio = self.AddRadioButton("Ultimaker2extended") + self.Ultimaker2ExtRadio.Bind(wx.EVT_RADIOBUTTON, self.OnUltimaker2Select) + self.Ultimaker2GoRadio = self.AddRadioButton("Ultimaker2go") + self.Ultimaker2GoRadio.Bind(wx.EVT_RADIOBUTTON, self.OnUltimaker2Select) self.UltimakerRadio = self.AddRadioButton("Ultimaker Original") self.UltimakerRadio.Bind(wx.EVT_RADIOBUTTON, self.OnUltimakerSelect) self.UltimakerOPRadio = self.AddRadioButton("Ultimaker Original+") @@ -464,14 +468,29 @@ class MachineSelectPage(InfoPage): def StoreData(self): profile.putProfileSetting('retraction_enable', 'True') - if self.Ultimaker2Radio.GetValue(): - profile.putMachineSetting('machine_width', '230') - profile.putMachineSetting('machine_depth', '225') - profile.putMachineSetting('machine_height', '205') - profile.putMachineSetting('machine_name', 'ultimaker2') - profile.putMachineSetting('machine_type', 'ultimaker2') + if self.Ultimaker2Radio.GetValue() or self.Ultimaker2GoRadio.GetValue() or self.Ultimaker2ExtRadio.GetValue(): + if self.Ultimaker2Radio.GetValue(): + profile.putMachineSetting('machine_width', '230') + profile.putMachineSetting('machine_depth', '225') + profile.putMachineSetting('machine_height', '205') + profile.putMachineSetting('machine_name', 'ultimaker2') + profile.putMachineSetting('machine_type', 'ultimaker2') + profile.putMachineSetting('has_heated_bed', 'True') + if self.Ultimaker2GoRadio.GetValue(): + profile.putMachineSetting('machine_width', '120') + profile.putMachineSetting('machine_depth', '120') + profile.putMachineSetting('machine_height', '115') + profile.putMachineSetting('machine_name', 'ultimaker2go') + profile.putMachineSetting('machine_type', 'ultimaker2go') + profile.putMachineSetting('has_heated_bed', 'False') + if self.Ultimaker2ExtRadio.GetValue(): + profile.putMachineSetting('machine_width', '230') + profile.putMachineSetting('machine_depth', '225') + profile.putMachineSetting('machine_height', '305') + profile.putMachineSetting('machine_name', 'ultimaker2extended') + profile.putMachineSetting('machine_type', 'ultimaker2extended') + profile.putMachineSetting('has_heated_bed', 'False') profile.putMachineSetting('machine_center_is_zero', 'False') - profile.putMachineSetting('has_heated_bed', 'True') profile.putMachineSetting('gcode_flavor', 'UltiGCode') profile.putMachineSetting('extruder_head_size_min_x', '40.0') profile.putMachineSetting('extruder_head_size_min_y', '10.0') diff --git a/Cura/gui/firmwareInstall.py b/Cura/gui/firmwareInstall.py index 2ee983f2..0b101c82 100644 --- a/Cura/gui/firmwareInstall.py +++ b/Cura/gui/firmwareInstall.py @@ -17,39 +17,46 @@ from Cura.util import profile from Cura.util import resources def getDefaultFirmware(machineIndex = None): - if profile.getMachineSetting('machine_type', machineIndex) == 'ultimaker': + machine_type = profile.getMachineSetting('machine_type', machineIndex) + extruders = profile.getMachineSettingFloat('extruder_amount', machineIndex) + heated_bed = profile.getMachineSetting('has_heated_bed', machineIndex) == 'True' + baudrate = 250000 + if sys.platform.startswith('linux'): + baudrate = 115200 + if machine_type == 'ultimaker': name = 'MarlinUltimaker' - if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 2: + if extruders > 2: return None - if profile.getMachineSetting('has_heated_bed', machineIndex) == 'True': + if heated_bed: name += '-HBK' - if sys.platform.startswith('linux'): - name += '-115200' - else: - name += '-250000' - if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 1: + name += '-%d' % (baudrate) + if extruders > 1: name += '-dual' return resources.getPathForFirmware(name + '.hex') - if profile.getMachineSetting('machine_type', machineIndex) == 'ultimaker_plus': - name = 'MarlinUltimaker-UMOP' - if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 2: + if machine_type == 'ultimaker_plus': + name = 'MarlinUltimaker-UMOP-%d' % (baudrate) + if extruders > 2: return None - if sys.platform.startswith('linux'): - name += '-115200' - else: - name += '-250000' - if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 1: + if extruders > 1: name += '-dual' return resources.getPathForFirmware(name + '.hex') - if profile.getMachineSetting('machine_type', machineIndex) == 'ultimaker2': - if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 2: + if machine_type == 'ultimaker2': + if extruders > 2: return None - if profile.getMachineSettingFloat('extruder_amount', machineIndex) == 2: + if extruders > 1: return resources.getPathForFirmware("MarlinUltimaker2-dual.hex") return resources.getPathForFirmware("MarlinUltimaker2.hex") - if profile.getMachineSetting('machine_type', machineIndex) == 'Witbox': + if machine_type == 'ultimaker2go': + return resources.getPathForFirmware("MarlinUltimaker2go.hex") + if machine_type == 'ultimaker2extended': + if extruders > 2: + return None + if extruders > 1: + return resources.getPathForFirmware("MarlinUltimaker2extended-dual.hex") + return resources.getPathForFirmware("MarlinUltimaker2extended.hex") + if machine_type == 'Witbox': return resources.getPathForFirmware("MarlinWitbox.hex") return None diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 0eb99862..cc44fb23 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -369,7 +369,7 @@ class mainWindow(wx.Frame): # Enabled sash self.splitter.SetSashSize(4) self.defaultFirmwareInstallMenuItem.Enable(firmwareInstall.getDefaultFirmware() is not None) - if profile.getMachineSetting('machine_type') == 'ultimaker2': + if profile.getMachineSetting('machine_type').startswith('ultimaker2'): self.bedLevelWizardMenuItem.Enable(False) self.headOffsetWizardMenuItem.Enable(False) if int(profile.getMachineSetting('extruder_amount')) < 2: diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index bfa74277..c81ea498 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -1236,36 +1236,55 @@ class SceneView(openglGui.glGuiPanel): size = [profile.getMachineSettingFloat('machine_width'), profile.getMachineSettingFloat('machine_depth'), profile.getMachineSettingFloat('machine_height')] - machine = profile.getMachineSetting('machine_type') - if machine.startswith('ultimaker'): - if machine not in self._platformMesh: - meshes = meshLoader.loadMeshes(resources.getPathForMesh(machine + '_platform.stl')) + machine_type = profile.getMachineSetting('machine_type') + if machine_type not in self._platformMesh: + self._platformMesh[machine_type] = None + + filename = None + texture_name = None + offset = [0,0,0] + texture_offset = [0,0,0] + if machine_type == 'ultimaker2' or machine_type == 'ultimaker2extended': + filename = resources.getPathForMesh('ultimaker2_platform.stl') + offset = [0,-37,145] + texture_name = 'Ultimaker2backplate.png' + texture_offset = [0,150,-5] + if machine_type == 'ultimaker_plus': + filename = resources.getPathForMesh('ultimaker2_platform.stl') + offset = [0,-37,145] + texture_offset = [0,150,-5] + texture_name = 'UltimakerPlusbackplate.png' + if machine_type == 'ultimaker': + filename = resources.getPathForMesh('ultimaker_platform.stl') + offset = [0,0,2.5] + if machine_type == 'Witbox': + filename = resources.getPathForMesh('Witbox_platform.stl') + offset = [0,-37,145] + + if filename is not None: + meshes = meshLoader.loadMeshes(filename) if len(meshes) > 0: - self._platformMesh[machine] = meshes[0] - else: - self._platformMesh[machine] = None - if machine == 'ultimaker2' or machine == 'ultimaker_plus': - self._platformMesh[machine]._drawOffset = numpy.array([0,-37,145], numpy.float32) - else: - self._platformMesh[machine]._drawOffset = numpy.array([0,0,2.5], numpy.float32) + self._platformMesh[machine_type] = meshes[0] + self._platformMesh[machine_type]._drawOffset = numpy.array(offset, numpy.float32) + self._platformMesh[machine_type].texture = None + if texture_name is not None: + self._platformMesh[machine_type].texture = openglHelpers.loadGLTexture(texture_name) + self._platformMesh[machine_type].texture_offset = texture_offset + if self._platformMesh[machine_type] is not None: + mesh = self._platformMesh[machine_type] glColor4f(1,1,1,0.5) self._objectShader.bind() - self._renderObject(self._platformMesh[machine], False, False) + self._renderObject(mesh, False, False) self._objectShader.unbind() #For the Ultimaker 2 render the texture on the back plate to show the Ultimaker2 text. - if machine == 'ultimaker2' or machine == 'ultimaker_plus': - if not hasattr(self._platformMesh[machine], 'texture'): - if machine == 'ultimaker2': - self._platformMesh[machine].texture = openglHelpers.loadGLTexture('Ultimaker2backplate.png') - else: - self._platformMesh[machine].texture = openglHelpers.loadGLTexture('UltimakerPlusbackplate.png') - glBindTexture(GL_TEXTURE_2D, self._platformMesh[machine].texture) + if mesh.texture is not None: + glBindTexture(GL_TEXTURE_2D, mesh.texture) glEnable(GL_TEXTURE_2D) glPushMatrix() glColor4f(1,1,1,1) - glTranslate(0,150,-5) + glTranslate(mesh.texture_offset[0], mesh.texture_offset[1], mesh.texture_offset[2]) h = 50 d = 8 w = 100 @@ -1293,20 +1312,6 @@ class SceneView(openglGui.glGuiPanel): glDisable(GL_TEXTURE_2D) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glPopMatrix() - - elif machine.startswith('Witbox'): - if machine not in self._platformMesh: - meshes = meshLoader.loadMeshes(resources.getPathForMesh(machine + '_platform.stl')) - if len(meshes) > 0: - self._platformMesh[machine] = meshes[0] - else: - self._platformMesh[machine] = None - if machine == 'Witbox': - self._platformMesh[machine]._drawOffset = numpy.array([0,-37,145], numpy.float32) - glColor4f(1,1,1,0.5) - self._objectShader.bind() - self._renderObject(self._platformMesh[machine], False, False) - self._objectShader.unbind() else: glColor4f(0,0,0,1) glLineWidth(3) -- 2.30.2