def __init__( self, parent, profileSetting, bitmapFilenameOn, bitmapFilenameOff, helpText="", id=-1, callback=None, size=(20, 20), ): self.bitmapOn = getBitmapImage(bitmapFilenameOn) self.bitmapOff = getBitmapImage(bitmapFilenameOff) super(ToggleButton, self).__init__(parent, id, self.bitmapOff, size=size) self.callback = callback self.profileSetting = profileSetting self.helpText = helpText self.SetBezelWidth(1) self.SetUseFocusIndicator(False) if self.profileSetting != "": self.SetValue(profile.getProfileSetting(self.profileSetting) == "True") self.Bind(wx.EVT_BUTTON, self.OnButtonProfile) else: self.Bind(wx.EVT_BUTTON, self.OnButton) self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave) parent.AddControl(self)
def __init__(self, parent, profileSetting, bitmapFilenameOn, bitmapFilenameOff, helpText='', id=-1, callback=None, size=(20, 20)): self.bitmapOn = getBitmapImage(bitmapFilenameOn) self.bitmapOff = getBitmapImage(bitmapFilenameOff) super(ToggleButton, self).__init__(parent, id, self.bitmapOff, size=size) self.callback = callback self.profileSetting = profileSetting self.helpText = helpText self.SetBezelWidth(1) self.SetUseFocusIndicator(False) if self.profileSetting != '': self.SetValue( profile.getProfileSetting(self.profileSetting) == 'True') self.Bind(wx.EVT_BUTTON, self.OnButtonProfile) else: self.Bind(wx.EVT_BUTTON, self.OnButton) self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave) parent.AddControl(self)
def updateProfileToControls(self): "Update the configuration wx controls to show the new configuration settings" for setting in self.settingControlList: if setting.type == 'profile': setting.SetValue(profile.getProfileSetting(setting.configName)) else: setting.SetValue(profile.getPreference(setting.configName))
def updateProfileToControls(self): "Update the configuration wx controls to show the new configuration settings" for setting in self.settingControlList: if setting.type == "profile": setting.SetValue(profile.getProfileSetting(setting.configName)) else: setting.SetValue(profile.getPreference(setting.configName))
def getFilamentWeight(self, e=0): #Calculates the weight of the filament in kg radius = float(profile.getProfileSetting('filament_diameter')) / 2 volumeM3 = (self._filamentMM[e] * (math.pi * radius * radius)) / (1000 * 1000 * 1000) return volumeM3 * profile.getPreferenceFloat( 'filament_physical_density')
def updateModelTransform(self, f=0): if len(self.objectList) < 1 or self.objectList[0].mesh == None: return rotate = profile.getProfileSettingFloat('model_rotate_base') mirrorX = profile.getProfileSetting('flip_x') == 'True' mirrorY = profile.getProfileSetting('flip_y') == 'True' mirrorZ = profile.getProfileSetting('flip_z') == 'True' swapXZ = profile.getProfileSetting('swap_xz') == 'True' swapYZ = profile.getProfileSetting('swap_yz') == 'True' for obj in self.objectList: if obj.mesh == None: continue obj.mesh.setRotateMirror(rotate, mirrorX, mirrorY, mirrorZ, swapXZ, swapYZ) minV = self.objectList[0].mesh.getMinimum() maxV = self.objectList[0].mesh.getMaximum() for obj in self.objectList: if obj.mesh == None: continue obj.mesh.getMinimumZ() minV = numpy.minimum(minV, obj.mesh.getMinimum()) maxV = numpy.maximum(maxV, obj.mesh.getMaximum()) self.objectsMaxV = maxV self.objectsMinV = minV for obj in self.objectList: if obj.mesh == None: continue obj.mesh.vertexes -= numpy.array([ minV[0] + (maxV[0] - minV[0]) / 2, minV[1] + (maxV[1] - minV[1]) / 2, minV[2] ]) #for v in obj.mesh.vertexes: # v[2] -= minV[2] # v[0] -= minV[0] + (maxV[0] - minV[0]) / 2 # v[1] -= minV[1] + (maxV[1] - minV[1]) / 2 obj.mesh.getMinimumZ() obj.dirty = True self.glCanvas.Refresh()
def _doAutoPlace(self, allowedSizeY): extraSizeMin = self.headSizeMin extraSizeMax = self.headSizeMax if profile.getProfileSettingFloat('skirt_line_count') > 0: skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap') extraSizeMin = extraSizeMin + util3d.Vector3(skirtSize, skirtSize, 0) extraSizeMax = extraSizeMax + util3d.Vector3(skirtSize, skirtSize, 0) if profile.getProfileSetting('support') != 'None': extraSizeMin = extraSizeMin + util3d.Vector3(3.0, 0, 0) extraSizeMax = extraSizeMax + util3d.Vector3(3.0, 0, 0) if self.printMode == 1: extraSizeMin = util3d.Vector3(6.0, 6.0, 0) extraSizeMax = util3d.Vector3(6.0, 6.0, 0) if extraSizeMin.x > extraSizeMax.x: posX = self.machineSize.x dirX = -1 else: posX = 0 dirX = 1 posY = 0 dirY = 1 minX = self.machineSize.x minY = self.machineSize.y maxX = 0 maxY = 0 for item in self.list: item.centerX = posX + item.getMaximum().x * item.scale * dirX item.centerY = posY + item.getMaximum().y * item.scale * dirY if item.centerY + item.getSize().y >= allowedSizeY: if dirX < 0: posX = minX - extraSizeMax.x - 1 else: posX = maxX + extraSizeMin.x + 1 posY = 0 item.centerX = posX + item.getMaximum().x * item.scale * dirX item.centerY = posY + item.getMaximum().y * item.scale * dirY posY += item.getSize().y * item.scale * dirY + extraSizeMin.y + 1 minX = min(minX, item.centerX - item.getSize().x * item.scale / 2) minY = min(minY, item.centerY - item.getSize().y * item.scale / 2) maxX = max(maxX, item.centerX + item.getSize().x * item.scale / 2) maxY = max(maxY, item.centerY + item.getSize().y * item.scale / 2) for item in self.list: if dirX < 0: item.centerX -= minX / 2 else: item.centerX += (self.machineSize.x - maxX) / 2 item.centerY += (self.machineSize.y - maxY) / 2 if minX < 0 or maxX > self.machineSize.x: return ((maxX - minX) + (maxY - minY)) * 100 return (maxX - minX) + (maxY - minY)
def getExtraHeadSize(self): extraSizeMin = self.headSizeMin extraSizeMax = self.headSizeMax if profile.getProfileSettingFloat('skirt_line_count') > 0: skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap') extraSizeMin = extraSizeMin + numpy.array([skirtSize, skirtSize, 0]) extraSizeMax = extraSizeMax + numpy.array([skirtSize, skirtSize, 0]) if profile.getProfileSetting('enable_raft') != 'False': raftSize = profile.getProfileSettingFloat('raft_margin') * 2 extraSizeMin = extraSizeMin + numpy.array([raftSize, raftSize, 0]) extraSizeMax = extraSizeMax + numpy.array([raftSize, raftSize, 0]) if profile.getProfileSetting('support') != 'None': extraSizeMin = extraSizeMin + numpy.array([3.0, 0, 0]) extraSizeMax = extraSizeMax + numpy.array([3.0, 0, 0]) if self.printMode == 1: extraSizeMin = numpy.array([6.0, 6.0, 0]) extraSizeMax = numpy.array([6.0, 6.0, 0]) return extraSizeMin, extraSizeMax
def updateModelTransform(self, f=0): if len(self.objectList) < 1 or self.objectList[0].mesh == None: return rotate = profile.getProfileSettingFloat('model_rotate_base') mirrorX = profile.getProfileSetting('flip_x') == 'True' mirrorY = profile.getProfileSetting('flip_y') == 'True' mirrorZ = profile.getProfileSetting('flip_z') == 'True' swapXZ = profile.getProfileSetting('swap_xz') == 'True' swapYZ = profile.getProfileSetting('swap_yz') == 'True' for obj in self.objectList: if obj.mesh == None: continue obj.mesh.setRotateMirror(rotate, mirrorX, mirrorY, mirrorZ, swapXZ, swapYZ) minV = self.objectList[0].mesh.getMinimum() maxV = self.objectList[0].mesh.getMaximum() for obj in self.objectList: if obj.mesh == None: continue obj.mesh.getMinimumZ() minV = minV.min(obj.mesh.getMinimum()) maxV = maxV.max(obj.mesh.getMaximum()) self.objectsMaxV = maxV self.objectsMinV = minV for obj in self.objectList: if obj.mesh == None: continue for v in obj.mesh.vertexes: v.z -= minV.z v.x -= minV.x + (maxV.x - minV.x) / 2 v.y -= minV.y + (maxV.y - minV.y) / 2 obj.mesh.getMinimumZ() obj.dirty = True self.glCanvas.Refresh()
def updateModelTransform(self, f=0): if len(self.objectList) < 1 or self.objectList[0].mesh == None: return rotate = profile.getProfileSettingFloat('model_rotate_base') mirrorX = profile.getProfileSetting('flip_x') == 'True' mirrorY = profile.getProfileSetting('flip_y') == 'True' mirrorZ = profile.getProfileSetting('flip_z') == 'True' swapXZ = profile.getProfileSetting('swap_xz') == 'True' swapYZ = profile.getProfileSetting('swap_yz') == 'True' for obj in self.objectList: if obj.mesh == None: continue obj.mesh.setRotateMirror(rotate, mirrorX, mirrorY, mirrorZ, swapXZ, swapYZ) minV = self.objectList[0].mesh.getMinimum() maxV = self.objectList[0].mesh.getMaximum() for obj in self.objectList: if obj.mesh == None: continue obj.mesh.getMinimumZ() minV = numpy.minimum(minV, obj.mesh.getMinimum()) maxV = numpy.maximum(maxV, obj.mesh.getMaximum()) self.objectsMaxV = maxV self.objectsMinV = minV for obj in self.objectList: if obj.mesh == None: continue obj.mesh.vertexes -= numpy.array([minV[0] + (maxV[0] - minV[0]) / 2, minV[1] + (maxV[1] - minV[1]) / 2, minV[2]]) #for v in obj.mesh.vertexes: # v[2] -= minV[2] # v[0] -= minV[0] + (maxV[0] - minV[0]) / 2 # v[1] -= minV[1] + (maxV[1] - minV[1]) / 2 obj.mesh.getMinimumZ() obj.dirty = True self.glCanvas.Refresh()
def updateProfileToControls(self): self.scale.SetValue(profile.getProfileSetting('model_scale')) self.rotate.SetValue(profile.getProfileSettingFloat('model_rotate_base')) self.mirrorX.SetValue(profile.getProfileSetting('flip_x') == 'True') self.mirrorY.SetValue(profile.getProfileSetting('flip_y') == 'True') self.mirrorZ.SetValue(profile.getProfileSetting('flip_z') == 'True') self.swapXZ.SetValue(profile.getProfileSetting('swap_xz') == 'True') self.swapYZ.SetValue(profile.getProfileSetting('swap_yz') == 'True') self.updateModelTransform()
def loadModelFiles(self, filelist, showWarning=False): while len(filelist) > len(self.objectList): self.objectList.append(previewObject()) for idx in xrange(len(filelist), len(self.objectList)): self.objectList[idx].mesh = None self.objectList[idx].filename = None for idx in xrange(0, len(filelist)): obj = self.objectList[idx] if obj.filename != filelist[idx]: obj.fileTime = None self.gcodeFileTime = None self.logFileTime = None obj.filename = filelist[idx] self.gcodeFilename = sliceRun.getExportFilename(filelist[0]) #Do the STL file loading in a background thread so we don't block the UI. if self.loadThread != None and self.loadThread.isAlive(): self.loadThread.join() self.loadThread = threading.Thread(target=self.doFileLoadThread) self.loadThread.daemon = True self.loadThread.start() if showWarning: if profile.getProfileSettingFloat( 'model_scale') != 1.0 or profile.getProfileSettingFloat( 'model_rotate_base') != 0 or profile.getProfileSetting( 'flip_x') != 'False' or profile.getProfileSetting( 'flip_y' ) != 'False' or profile.getProfileSetting( 'flip_z' ) != 'False' or profile.getProfileSetting( 'swap_xz' ) != 'False' or profile.getProfileSetting( 'swap_yz') != 'False': self.warningPopup.Show(True) self.warningPopup.timer.Start(5000)
def __init__(self, parent): super(UltimakerCalibrationPage, self).__init__(parent, "Ultimaker Calibration") self.AddText("Your Ultimaker requires some calibration.") self.AddText("This calibration is needed for a proper extrusion amount.") self.AddSeperator() self.AddText("The following values are needed:") self.AddText("* Diameter of filament") self.AddText("* Number of steps per mm of filament extrusion") self.AddSeperator() self.AddText("The better you have calibrated these values, the better your prints\nwill become.") self.AddSeperator() self.AddText("First we need the diameter of your filament:") self.filamentDiameter = self.AddTextCtrl(profile.getProfileSetting('filament_diameter')) self.AddText("If you do not own digital Calipers that can measure\nat least 2 digits then use 2.89mm.\nWhich is the average diameter of most filament.") self.AddText("Note: This value can be changed later at any time.")
def StoreData(self): if self.UltimakerRadio.GetValue(): profile.putPreference("machine_width", "205") profile.putPreference("machine_depth", "205") profile.putPreference("machine_height", "200") profile.putProfileSetting("nozzle_size", "0.4") profile.putProfileSetting("machine_center_x", "100") profile.putProfileSetting("machine_center_y", "100") else: profile.putPreference("machine_width", "80") profile.putPreference("machine_depth", "80") profile.putPreference("machine_height", "60") profile.putProfileSetting("nozzle_size", "0.5") profile.putProfileSetting("machine_center_x", "40") profile.putProfileSetting("machine_center_y", "40") profile.putProfileSetting("wall_thickness", float(profile.getProfileSetting("nozzle_size")) * 2)
def StoreData(self): if self.UltimakerRadio.GetValue(): profile.putPreference('machine_width', '205') profile.putPreference('machine_depth', '205') profile.putPreference('machine_height', '200') profile.putProfileSetting('nozzle_size', '0.4') profile.putProfileSetting('machine_center_x', '100') profile.putProfileSetting('machine_center_y', '100') else: profile.putPreference('machine_width', '80') profile.putPreference('machine_depth', '80') profile.putPreference('machine_height', '60') profile.putProfileSetting('nozzle_size', '0.5') profile.putProfileSetting('machine_center_x', '40') profile.putProfileSetting('machine_center_y', '40') profile.putProfileSetting('wall_thickness', float(profile.getProfileSetting('nozzle_size')) * 2)
def updateProfileToControls(self): self.scale.SetValue(profile.getProfileSetting('model_scale')) self.rotate.SetValue( profile.getProfileSettingFloat('model_rotate_base')) self.mirrorX.SetValue(profile.getProfileSetting('flip_x') == 'True') self.mirrorY.SetValue(profile.getProfileSetting('flip_y') == 'True') self.mirrorZ.SetValue(profile.getProfileSetting('flip_z') == 'True') self.swapXZ.SetValue(profile.getProfileSetting('swap_xz') == 'True') self.swapYZ.SetValue(profile.getProfileSetting('swap_yz') == 'True') self.updateModelTransform() self.glCanvas.updateProfileToControls()
def StoreData(self): if self.UltimakerRadio.GetValue(): profile.putPreference('machine_width', '205') profile.putPreference('machine_depth', '205') profile.putPreference('machine_height', '200') profile.putProfileSetting('nozzle_size', '0.4') profile.putProfileSetting('machine_center_x', '100') profile.putProfileSetting('machine_center_y', '100') else: profile.putPreference('machine_width', '80') profile.putPreference('machine_depth', '80') profile.putPreference('machine_height', '60') profile.putProfileSetting('nozzle_size', '0.5') profile.putProfileSetting('machine_center_x', '40') profile.putProfileSetting('machine_center_y', '40') profile.putProfileSetting( 'wall_thickness', float(profile.getProfileSetting('nozzle_size')) * 2)
def __init__(self, parent): super(UltimakerCalibrationPage, self).__init__(parent, "Ultimaker Calibration") self.AddText("Your Ultimaker requires some calibration.") self.AddText( "This calibration is needed for a proper extrusion amount.") self.AddSeperator() self.AddText("The following values are needed:") self.AddText("* Diameter of filament") self.AddText("* Number of steps per mm of filament extrusion") self.AddSeperator() self.AddText( "The better you have calibrated these values, the better your prints\nwill become." ) self.AddSeperator() self.AddText("First we need the diameter of your filament:") self.filamentDiameter = self.AddTextCtrl( profile.getProfileSetting('filament_diameter')) self.AddText( "If you do not own digital Calipers that can measure\nat least 2 digits then use 2.89mm.\nWhich is the average diameter of most filament." ) self.AddText("Note: This value can be changed later at any time.")
def raftLayerCount(setting): if profile.getProfileSetting("enable_raft") == "True": return "1" return "0"
def storedSettingInvertBoolean(name): return lambda setting: profile.getProfileSetting(name) == "False"
def __init__(self): super(simpleModeWindow, self).__init__(title='Cura - Quickprint - ' + version.getVersion()) wx.EVT_CLOSE(self, self.OnClose) #self.SetIcon(icon.getMainIcon()) menubar = wx.MenuBar() fileMenu = wx.Menu() i = fileMenu.Append(-1, 'Load model file...') self.Bind(wx.EVT_MENU, self.OnLoadModel, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, 'Preferences...') self.Bind(wx.EVT_MENU, self.OnPreferences, i) fileMenu.AppendSeparator() i = fileMenu.Append(wx.ID_EXIT, 'Quit') self.Bind(wx.EVT_MENU, self.OnQuit, i) menubar.Append(fileMenu, '&File') toolsMenu = wx.Menu() i = toolsMenu.Append(-1, 'Switch to Normal mode...') self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) menubar.Append(toolsMenu, 'Normal mode') helpMenu = wx.Menu() i = helpMenu.Append(-1, 'Online documentation...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://daid.github.com/Cura'), i) i = helpMenu.Append(-1, 'Report a problem...') self.Bind( wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) menubar.Append(helpMenu, 'Help') self.SetMenuBar(menubar) if profile.getPreference('lastFile') != '': self.filelist = profile.getPreference('lastFile').split(';') self.SetTitle(self.filelist[-1] + ' - Cura - ' + version.getVersion()) else: self.filelist = [] self.progressPanelList = [] #Preview window self.preview3d = preview3d.previewPanel(self) configPanel = wx.Panel(self) self.printTypeNormal = wx.RadioButton(configPanel, -1, 'Normal quality print', style=wx.RB_GROUP) self.printTypeLow = wx.RadioButton(configPanel, -1, 'Fast low quality print') self.printTypeHigh = wx.RadioButton(configPanel, -1, 'High quality print') self.printTypeJoris = wx.RadioButton(configPanel, -1, 'Thin walled cup or vase') self.printMaterialPLA = wx.RadioButton(configPanel, -1, 'PLA', style=wx.RB_GROUP) self.printMaterialABS = wx.RadioButton(configPanel, -1, 'ABS') self.printMaterialDiameter = wx.TextCtrl( configPanel, -1, profile.getProfileSetting('filament_diameter')) self.printSupport = wx.CheckBox(configPanel, -1, 'Print support structure') sizer = wx.GridBagSizer() configPanel.SetSizer(sizer) sb = wx.StaticBox(configPanel, label="Select a print type:") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printTypeNormal) boxsizer.Add(self.printTypeLow) boxsizer.Add(self.printTypeHigh) boxsizer.Add(self.printTypeJoris) sizer.Add(boxsizer, (0, 0), flag=wx.EXPAND) sb = wx.StaticBox(configPanel, label="Material:") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printMaterialPLA) boxsizer.Add(self.printMaterialABS) boxsizer.Add(wx.StaticText(configPanel, -1, 'Diameter:')) boxsizer.Add(self.printMaterialDiameter) sizer.Add(boxsizer, (1, 0), flag=wx.EXPAND) sb = wx.StaticBox(configPanel, label="Other:") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printSupport) sizer.Add(boxsizer, (2, 0), flag=wx.EXPAND) # load and slice buttons. loadButton = wx.Button(self, -1, 'Load Model') sliceButton = wx.Button(self, -1, 'Prepare print') printButton = wx.Button(self, -1, 'Print') self.Bind(wx.EVT_BUTTON, self.OnLoadModel, loadButton) self.Bind(wx.EVT_BUTTON, self.OnSlice, sliceButton) self.Bind(wx.EVT_BUTTON, self.OnPrint, printButton) #Also bind double clicking the 3D preview to load an STL file. self.preview3d.glCanvas.Bind(wx.EVT_LEFT_DCLICK, self.OnLoadModel, self.preview3d.glCanvas) #Main sizer, to position the preview window, buttons and tab control sizer = wx.GridBagSizer() self.SetSizer(sizer) sizer.Add(configPanel, (0, 0), span=(1, 1), flag=wx.EXPAND) sizer.Add(self.preview3d, (0, 1), span=(1, 3), flag=wx.EXPAND) sizer.AddGrowableCol(2) sizer.AddGrowableRow(0) sizer.Add(loadButton, (1, 1), flag=wx.RIGHT, border=5) sizer.Add(sliceButton, (1, 2), flag=wx.RIGHT, border=5) sizer.Add(printButton, (1, 3), flag=wx.RIGHT, border=5) self.sizer = sizer if len(self.filelist) > 0: self.preview3d.loadModelFiles(self.filelist) self.updateProfileToControls() self.Fit() self.SetMinSize(self.GetSize()) self.Centre() self.Show(True)
def __init__(self): super(simpleModeWindow, self).__init__(title='Cura - Quickprint - ' + version.getVersion()) wx.EVT_CLOSE(self, self.OnClose) #self.SetIcon(icon.getMainIcon()) menubar = wx.MenuBar() fileMenu = wx.Menu() i = fileMenu.Append(-1, 'Load model file...') self.Bind(wx.EVT_MENU, self.OnLoadModel, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, 'Preferences...') self.Bind(wx.EVT_MENU, self.OnPreferences, i) fileMenu.AppendSeparator() i = fileMenu.Append(wx.ID_EXIT, 'Quit') self.Bind(wx.EVT_MENU, self.OnQuit, i) menubar.Append(fileMenu, '&File') expertMenu = wx.Menu() i = expertMenu.Append(-1, 'Switch to Normal mode...') self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, 'ReRun first run wizard...') self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i) menubar.Append(expertMenu, 'Expert') helpMenu = wx.Menu() i = helpMenu.Append(-1, 'Online documentation...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/wiki'), i) i = helpMenu.Append(-1, 'Report a problem...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) menubar.Append(helpMenu, 'Help') self.SetMenuBar(menubar) if profile.getPreference('lastFile') != '': self.filelist = profile.getPreference('lastFile').split(';') self.SetTitle(self.filelist[-1] + ' - Cura - ' + version.getVersion()) else: self.filelist = [] self.progressPanelList = [] #Preview window self.preview3d = preview3d.previewPanel(self) configPanel = wx.Panel(self) self.printTypeNormal = wx.RadioButton(configPanel, -1, 'Normal quality print', style=wx.RB_GROUP) self.printTypeLow = wx.RadioButton(configPanel, -1, 'Fast low quality print') self.printTypeHigh = wx.RadioButton(configPanel, -1, 'High quality print') self.printTypeJoris = wx.RadioButton(configPanel, -1, 'Thin walled cup or vase') self.printMaterialPLA = wx.RadioButton(configPanel, -1, 'PLA', style=wx.RB_GROUP) self.printMaterialABS = wx.RadioButton(configPanel, -1, 'ABS') self.printMaterialDiameter = wx.TextCtrl(configPanel, -1, profile.getProfileSetting('filament_diameter')) self.printSupport = wx.CheckBox(configPanel, -1, 'Print support structure') sizer = wx.GridBagSizer() configPanel.SetSizer(sizer) sb = wx.StaticBox(configPanel, label="Select a print type:") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printTypeNormal) boxsizer.Add(self.printTypeLow) boxsizer.Add(self.printTypeHigh) boxsizer.Add(self.printTypeJoris) sizer.Add(boxsizer, (0,0), flag=wx.EXPAND) sb = wx.StaticBox(configPanel, label="Material:") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printMaterialPLA) boxsizer.Add(self.printMaterialABS) boxsizer.Add(wx.StaticText(configPanel, -1, 'Diameter:')) boxsizer.Add(self.printMaterialDiameter) sizer.Add(boxsizer, (1,0), flag=wx.EXPAND) sb = wx.StaticBox(configPanel, label="Other:") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printSupport) sizer.Add(boxsizer, (2,0), flag=wx.EXPAND) # load and slice buttons. loadButton = wx.Button(self, -1, 'Load Model') sliceButton = wx.Button(self, -1, 'Slice to GCode') printButton = wx.Button(self, -1, 'Print GCode') self.Bind(wx.EVT_BUTTON, self.OnLoadModel, loadButton) self.Bind(wx.EVT_BUTTON, self.OnSlice, sliceButton) self.Bind(wx.EVT_BUTTON, self.OnPrint, printButton) #Also bind double clicking the 3D preview to load an STL file. self.preview3d.glCanvas.Bind(wx.EVT_LEFT_DCLICK, self.OnLoadModel, self.preview3d.glCanvas) #Main sizer, to position the preview window, buttons and tab control sizer = wx.GridBagSizer() self.SetSizer(sizer) sizer.Add(configPanel, (0,0), span=(1,1), flag=wx.EXPAND) sizer.Add(self.preview3d, (0,1), span=(1,3), flag=wx.EXPAND) sizer.AddGrowableCol(2) sizer.AddGrowableRow(0) sizer.Add(loadButton, (1,1), flag=wx.RIGHT, border=5) sizer.Add(sliceButton, (1,2), flag=wx.RIGHT, border=5) sizer.Add(printButton, (1,3), flag=wx.RIGHT, border=5) self.sizer = sizer if len(self.filelist) > 0: self.preview3d.loadModelFiles(self.filelist) self.updateProfileToControls() self.Fit() self.SetMinSize(self.GetSize()) self.Centre() self.Show(True)
def __init__(self): super(mainWindow, self).__init__(title='Cura - ' + version.getVersion()) extruderCount = int(profile.getPreference('extruder_amount')) wx.EVT_CLOSE(self, self.OnClose) #self.SetIcon(icon.getMainIcon()) self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.supportedExtensions())) menubar = wx.MenuBar() fileMenu = wx.Menu() i = fileMenu.Append(-1, 'Load model file...\tCTRL+L') self.Bind(wx.EVT_MENU, lambda e: self._showModelLoadDialog(1), i) i = fileMenu.Append(-1, 'Prepare print...\tCTRL+R') self.Bind(wx.EVT_MENU, self.OnSlice, i) i = fileMenu.Append(-1, 'Print...\tCTRL+P') self.Bind(wx.EVT_MENU, self.OnPrint, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, 'Open Profile...') self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = fileMenu.Append(-1, 'Save Profile...') self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) i = fileMenu.Append(-1, 'Load Profile from GCode...') self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, 'Reset Profile to default') self.Bind(wx.EVT_MENU, self.OnResetProfile, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, 'Preferences...\tCTRL+,') self.Bind(wx.EVT_MENU, self.OnPreferences, i) fileMenu.AppendSeparator() i = fileMenu.Append(wx.ID_EXIT, 'Quit') self.Bind(wx.EVT_MENU, self.OnQuit, i) menubar.Append(fileMenu, '&File') toolsMenu = wx.Menu() i = toolsMenu.Append(-1, 'Switch to Quickprint...') self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i) toolsMenu.AppendSeparator() i = toolsMenu.Append(-1, 'Batch run...') self.Bind(wx.EVT_MENU, self.OnBatchRun, i) i = toolsMenu.Append(-1, 'Project planner...') self.Bind(wx.EVT_MENU, self.OnProjectPlanner, i) # i = toolsMenu.Append(-1, 'Open SVG (2D) slicer...') # self.Bind(wx.EVT_MENU, self.OnSVGSlicerOpen, i) menubar.Append(toolsMenu, 'Tools') expertMenu = wx.Menu() i = expertMenu.Append(-1, 'Open expert settings...') self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() if firmwareInstall.getDefaultFirmware() != None: i = expertMenu.Append(-1, 'Install default Marlin firmware') self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, i) i = expertMenu.Append(-1, 'Install custom firmware') self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, 'ReRun first run wizard...') self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i) menubar.Append(expertMenu, 'Expert') helpMenu = wx.Menu() i = helpMenu.Append(-1, 'Online documentation...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://daid.github.com/Cura'), i) i = helpMenu.Append(-1, 'Report a problem...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) menubar.Append(helpMenu, 'Help') self.SetMenuBar(menubar) if profile.getPreference('lastFile') != '': self.filelist = profile.getPreference('lastFile').split(';') self.SetTitle('Cura - %s - %s' % (version.getVersion(), self.filelist[-1])) else: self.filelist = [] self.progressPanelList = [] #Preview window self.preview3d = preview3d.previewPanel(self) #Main tabs nb = wx.Notebook(self) (left, right) = self.CreateConfigTab(nb, 'Print config') configBase.TitleRow(left, "Accuracy") c = configBase.SettingRow(left, "Layer height (mm)", 'layer_height', '0.2', 'Layer height in millimeters.\n0.2 is a good value for quick prints.\n0.1 gives high quality prints.') validators.validFloat(c, 0.0001) validators.warningAbove(c, lambda : (float(profile.getProfileSetting('nozzle_size')) * 80.0 / 100.0), "Thicker layers then %.2fmm (80%% nozzle size) usually give bad results and are not recommended.") c = configBase.SettingRow(left, "Wall thickness (mm)", 'wall_thickness', '0.8', 'Thickness of the walls.\nThis is used in combination with the nozzle size to define the number\nof perimeter lines and the thickness of those perimeter lines.') validators.validFloat(c, 0.0001) validators.wallThicknessValidator(c) c = configBase.SettingRow(left, "Enable retraction", 'retraction_enable', False, 'Retract the filament when the nozzle is moving over a none-printed area. Details about the retraction can be configured in the advanced tab.') configBase.TitleRow(left, "Fill") c = configBase.SettingRow(left, "Bottom/Top thickness (mm)", 'solid_layer_thickness', '0.6', 'This controls the thickness of the bottom and top layers, the amount of solid layers put down is calculated by the layer thickness and this value.\nHaving this value a multiply of the layer thickness makes sense. And keep it near your wall thickness to make an evenly strong part.') validators.validFloat(c, 0.0) c = configBase.SettingRow(left, "Fill Density (%)", 'fill_density', '20', 'This controls how densily filled the insides of your print will be. For a solid part use 100%, for an empty part use 0%. A value around 20% is usually enough') validators.validFloat(c, 0.0, 100.0) configBase.TitleRow(left, "Skirt") c = configBase.SettingRow(left, "Line count", 'skirt_line_count', '1', 'The skirt is a line drawn around the object at the first layer. This helps to prime your extruder, and to see if the object fits on your platform.\nSetting this to 0 will disable the skirt. Multiple skirt lines can help priming your extruder better for small objects.') validators.validInt(c, 0, 10) c = configBase.SettingRow(left, "Start distance (mm)", 'skirt_gap', '6.0', 'The distance between the skirt and the first layer.\nThis is the minimal distance, multiple skirt lines will be put outwards from this distance.') validators.validFloat(c, 0.0) configBase.TitleRow(right, "Speed && Temperature") c = configBase.SettingRow(right, "Print speed (mm/s)", 'print_speed', '50', 'Speed at which printing happens. A well adjusted Ultimaker can reach 150mm/s, but for good quality prints you want to print slower. Printing speed depends on a lot of factors. So you will be experimenting with optimal settings for this.') validators.validFloat(c, 1.0) validators.warningAbove(c, 150.0, "It is highly unlikely that your machine can achieve a printing speed above 150mm/s") validators.printSpeedValidator(c) #configBase.TitleRow(right, "Temperature") c = configBase.SettingRow(right, "Printing temperature", 'print_temperature', '0', 'Temperature used for printing. Set at 0 to pre-heat yourself') validators.validFloat(c, 0.0, 340.0) validators.warningAbove(c, 260.0, "Temperatures above 260C could damage your machine, be careful!") if profile.getPreference('has_heated_bed') == 'True': c = configBase.SettingRow(right, "Bed temperature", 'print_bed_temperature', '0', 'Temperature used for the heated printer bed. Set at 0 to pre-heat yourself') validators.validFloat(c, 0.0, 340.0) configBase.TitleRow(right, "Support structure") c = configBase.SettingRow(right, "Support type", 'support', ['None', 'Exterior Only', 'Everywhere'], 'Type of support structure build.\n"Exterior only" is the most commonly used support setting.\n\nNone does not do any support.\nExterior only only creates support where the support structure will touch the build platform.\nEverywhere creates support even on the insides of the model.') c = configBase.SettingRow(right, "Add raft", 'enable_raft', False, 'A raft is a few layers of lines below the bottom of the object. It prevents warping. Full raft settings can be found in the expert settings.\nFor PLA this is usually not required. But if you print with ABS it is almost required.') if extruderCount > 1: c = configBase.SettingRow(right, "Support dual extrusion", 'support_dual_extrusion', False, 'Print the support material with the 2nd extruder in a dual extrusion setup. The primary extruder will be used for normal material, while the second extruder is used to print support material.') configBase.TitleRow(right, "Filament") c = configBase.SettingRow(right, "Diameter (mm)", 'filament_diameter', '2.89', 'Diameter of your filament, as accurately as possible.\nIf you cannot measure this value you will have to callibrate it, a higher number means less extrusion, a smaller number generates more extrusion.') validators.validFloat(c, 1.0) validators.warningAbove(c, 3.5, "Are you sure your filament is that thick? Normal filament is around 3mm or 1.75mm.") c = configBase.SettingRow(right, "Packing Density", 'filament_density', '1.00', 'Packing density of your filament. This should be 1.00 for PLA and 0.85 for ABS') validators.validFloat(c, 0.5, 1.5) (left, right) = self.CreateConfigTab(nb, 'Advanced config') configBase.TitleRow(left, "Machine size") c = configBase.SettingRow(left, "Nozzle size (mm)", 'nozzle_size', '0.4', 'The nozzle size is very important, this is used to calculate the line width of the infill, and used to calculate the amount of outside wall lines and thickness for the wall thickness you entered in the print settings.') validators.validFloat(c, 0.1, 10.0) c = configBase.SettingRow(left, "Machine center X (mm)", 'machine_center_x', '100', 'The center of your machine, your print will be placed at this location') validators.validInt(c, 10) configBase.settingNotify(c, self.preview3d.updateCenterX) c = configBase.SettingRow(left, "Machine center Y (mm)", 'machine_center_y', '100', 'The center of your machine, your print will be placed at this location') validators.validInt(c, 10) configBase.settingNotify(c, self.preview3d.updateCenterY) configBase.TitleRow(left, "Retraction") c = configBase.SettingRow(left, "Minimal travel (mm)", 'retraction_min_travel', '5.0', 'Minimal amount of travel needed for a retraction to happen at all. To make sure you do not get a lot of retractions in a small area') validators.validFloat(c, 0.0) c = configBase.SettingRow(left, "Speed (mm/s)", 'retraction_speed', '40.0', 'Speed at which the filament is retracted, a higher retraction speed works better. But a very high retraction speed can lead to filament grinding.') validators.validFloat(c, 0.1) c = configBase.SettingRow(left, "Distance (mm)", 'retraction_amount', '0.0', 'Amount of retraction, set at 0 for no retraction at all. A value of 2.0mm seems to generate good results.') validators.validFloat(c, 0.0) c = configBase.SettingRow(left, "Extra length on start (mm)", 'retraction_extra', '0.0', 'Extra extrusion amount when restarting after a retraction, to better "Prime" your extruder after retraction.') validators.validFloat(c, 0.0) configBase.TitleRow(right, "Speed") c = configBase.SettingRow(right, "Travel speed (mm/s)", 'travel_speed', '150', 'Speed at which travel moves are done, a high quality build Ultimaker can reach speeds of 250mm/s. But some machines might miss steps then.') validators.validFloat(c, 1.0) validators.warningAbove(c, 300.0, "It is highly unlikely that your machine can achieve a travel speed above 300mm/s") c = configBase.SettingRow(right, "Max Z speed (mm/s)", 'max_z_speed', '1.0', 'Speed at which Z moves are done. When you Z axis is properly lubercated you can increase this for less Z blob.') validators.validFloat(c, 0.5) c = configBase.SettingRow(right, "Bottom layer speed (mm/s)", 'bottom_layer_speed', '25', 'Print speed for the bottom layer, you want to print the first layer slower so it sticks better to the printer bed.') validators.validFloat(c, 0.0) configBase.TitleRow(right, "Cool") c = configBase.SettingRow(right, "Minimal layer time (sec)", 'cool_min_layer_time', '10', 'Minimum time spend in a layer, gives the layer time to cool down before the next layer is put on top. If the layer will be placed down too fast the printer will slow down to make sure it has spend atleast this amount of seconds printing this layer.') validators.validFloat(c, 0.0) c = configBase.SettingRow(right, "Enable cooling fan", 'fan_enabled', True, 'Enable the cooling fan during the print. The extra cooling from the cooling fan is essensial during faster prints.') configBase.TitleRow(right, "Accuracy") c = configBase.SettingRow(right, "Initial layer thickness (mm)", 'bottom_thickness', '0.0', 'Layer thickness of the bottom layer. A thicker bottom layer makes sticking to the bed easier. Set to 0.0 to have the bottom layer thickness the same as the other layers.') validators.validFloat(c, 0.0) validators.warningAbove(c, lambda : (float(profile.getProfileSetting('nozzle_size')) * 3.0 / 4.0), "A bottom layer of more then %.2fmm (3/4 nozzle size) usually give bad results and is not recommended.") c = configBase.SettingRow(right, "Enable 'skin'", 'enable_skin', False, 'Skin prints the outer lines of the prints twice, each time with half the thickness. This gives the illusion of a higher print quality.') #Effects page self.effectList = profile.getEffectsList() if len(self.effectList) > 0: self.effectPanel = wx.Panel(nb) sizer = wx.GridBagSizer(2, 2) self.effectPanel.SetSizer(sizer) effectStringList = [] for effect in self.effectList: effectStringList.append(effect['name']) self.listbox = wx.ListBox(self.effectPanel, -1, choices=effectStringList) title = wx.StaticText(self.effectPanel, -1, "Effects:") title.SetFont(wx.Font(wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD)) addButton = wx.Button(self.effectPanel, -1, '>', style=wx.BU_EXACTFIT) remButton = wx.Button(self.effectPanel, -1, '<', style=wx.BU_EXACTFIT) sizer.Add(self.listbox, (1,0), span=(2,1), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM) sizer.Add(title, (0,0), border=10, flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.TOP) sizer.Add(addButton, (1,1), border=5, flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_BOTTOM) sizer.Add(remButton, (2,1), border=5, flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_TOP) sizer.AddGrowableCol(2) sizer.AddGrowableRow(1) sizer.AddGrowableRow(2) nb.AddPage(self.effectPanel, "Effects") #Alteration page self.alterationPanel = alterationPanel.alterationPanel(nb) nb.AddPage(self.alterationPanel, "Start/End-GCode") # load and slice buttons. loadButton = wx.Button(self, -1, '&Load Model') sliceButton = wx.Button(self, -1, 'P&repare print') printButton = wx.Button(self, -1, '&Print') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(1), loadButton) self.Bind(wx.EVT_BUTTON, self.OnSlice, sliceButton) self.Bind(wx.EVT_BUTTON, self.OnPrint, printButton) if extruderCount > 1: loadButton2 = wx.Button(self, -1, 'Load Dual') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(2), loadButton2) if extruderCount > 2: loadButton3 = wx.Button(self, -1, 'Load Triple') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(3), loadButton3) if extruderCount > 3: loadButton4 = wx.Button(self, -1, 'Load Quad') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(4), loadButton4) #Also bind double clicking the 3D preview to load an STL file. self.preview3d.glCanvas.Bind(wx.EVT_LEFT_DCLICK, lambda e: self._showModelLoadDialog(1), self.preview3d.glCanvas) #Main sizer, to position the preview window, buttons and tab control sizer = wx.GridBagSizer() self.SetSizer(sizer) sizer.Add(nb, (0,0), span=(1,1), flag=wx.EXPAND) sizer.Add(self.preview3d, (0,1), span=(1,2+extruderCount), flag=wx.EXPAND) sizer.AddGrowableCol(2 + extruderCount) sizer.AddGrowableRow(0) sizer.Add(loadButton, (1,1), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) if extruderCount > 1: sizer.Add(loadButton2, (1,2), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) if extruderCount > 2: sizer.Add(loadButton3, (1,3), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) if extruderCount > 3: sizer.Add(loadButton4, (1,4), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) sizer.Add(sliceButton, (1,1+extruderCount), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) sizer.Add(printButton, (1,2+extruderCount), flag=wx.RIGHT|wx.BOTTOM|wx.TOP, border=5) self.sizer = sizer if len(self.filelist) > 0: self.preview3d.loadModelFiles(self.filelist) self.updateProfileToControls() self.SetBackgroundColour(nb.GetBackgroundColour()) self.Fit() if wx.Display().GetClientArea().GetWidth() < self.GetSize().GetWidth(): f = self.GetSize().GetWidth() - wx.Display().GetClientArea().GetWidth() self.preview3d.SetMinSize(self.preview3d.GetMinSize().DecBy(f, 0)) self.Fit() self.preview3d.Fit() self.SetMinSize(self.GetSize()) self.Centre() self.Show(True)
def getSliceCommand(filename): if profile.getPreference('slicer').startswith( 'Slic3r') and getSlic3rExe() != False: slic3rExe = getSlic3rExe() if slic3rExe == False: return False cmd = [ slic3rExe, '--output-filename-format', '[input_filename_base]_export.gcode', '--nozzle-diameter', str(profile.calculateEdgeWidth()), '--print-center', '%s,%s' % (profile.getProfileSetting('machine_center_x'), profile.getProfileSetting('machine_center_y')), '--z-offset', '0', '--gcode-flavor', 'reprap', '--gcode-comments', '--filament-diameter', profile.getProfileSetting('filament_diameter'), '--extrusion-multiplier', str(1.0 / float(profile.getProfileSetting('filament_density'))), '--temperature', profile.getProfileSetting('print_temperature'), '--travel-speed', profile.getProfileSetting('travel_speed'), '--perimeter-speed', profile.getProfileSetting('print_speed'), '--small-perimeter-speed', profile.getProfileSetting('print_speed'), '--infill-speed', profile.getProfileSetting('print_speed'), '--solid-infill-speed', profile.getProfileSetting('print_speed'), '--bridge-speed', profile.getProfileSetting('print_speed'), '--bottom-layer-speed-ratio', str( float(profile.getProfileSetting('bottom_layer_speed')) / float(profile.getProfileSetting('print_speed'))), '--layer-height', profile.getProfileSetting('layer_height'), '--first-layer-height-ratio', '1.0', '--infill-every-layers', '1', '--perimeters', str(profile.calculateLineCount()), '--solid-layers', str(profile.calculateSolidLayerCount()), '--fill-density', str(float(profile.getProfileSetting('fill_density')) / 100), '--fill-angle', '45', '--fill-pattern', 'rectilinear', #rectilinear line concentric hilbertcurve archimedeanchords octagramspiral '--solid-fill-pattern', 'rectilinear', '--start-gcode', profile.getAlterationFilePath('start.gcode'), '--end-gcode', profile.getAlterationFilePath('end.gcode'), '--retract-length', profile.getProfileSetting('retraction_amount'), '--retract-speed', str(int(float(profile.getProfileSetting('retraction_speed')))), '--retract-restart-extra', profile.getProfileSetting('retraction_extra'), '--retract-before-travel', profile.getProfileSetting('retraction_min_travel'), '--retract-lift', '0', '--slowdown-below-layer-time', profile.getProfileSetting('cool_min_layer_time'), '--min-print-speed', profile.getProfileSetting('cool_min_feedrate'), '--skirts', profile.getProfileSetting('skirt_line_count'), '--skirt-distance', str(int(float(profile.getProfileSetting('skirt_gap')))), '--skirt-height', '1', '--scale', profile.getProfileSetting('model_scale'), '--rotate', profile.getProfileSetting('model_rotate_base'), '--duplicate-x', profile.getProfileSetting('model_multiply_x'), '--duplicate-y', profile.getProfileSetting('model_multiply_y'), '--duplicate-distance', '10' ] if profile.getProfileSetting('support') != 'None': cmd.extend(['--support-material']) cmd.extend([filename]) return cmd else: pypyExe = getPyPyExe() if pypyExe == False: pypyExe = sys.executable #In case we have a frozen exe, then argv[0] points to the executable, but we want to give pypy a real script file. if hasattr(sys, 'frozen'): mainScriptFile = os.path.abspath( os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..", "cura_sf.zip")) else: mainScriptFile = os.path.abspath( os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", os.path.split(sys.argv[0])[1])) cmd = [pypyExe, mainScriptFile, '-p', profile.getGlobalProfileString()] cmd.append(filename) return cmd
def OnMulXAddClick(self, e): profile.putProfileSetting( 'model_multiply_x', str(max(1, int(profile.getProfileSetting('model_multiply_x')) + 1))) self.glCanvas.Refresh()
def __init__(self, parent): super(previewPanel, self).__init__(parent, -1) self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DDKSHADOW)) self.SetMinSize((440, 320)) self.objectList = [] self.errorList = [] self.gcode = None self.objectsMinV = None self.objectsMaxV = None self.loadThread = None self.machineSize = util3d.Vector3( profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height')) self.machineCenter = util3d.Vector3( float(profile.getProfileSetting('machine_center_x')), float(profile.getProfileSetting('machine_center_y')), 0) self.glCanvas = PreviewGLCanvas(self) #Create the popup window self.warningPopup = wx.PopupWindow(self, flags=wx.BORDER_SIMPLE) self.warningPopup.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)) self.warningPopup.text = wx.StaticText( self.warningPopup, -1, 'Reset scale, rotation and mirror?') self.warningPopup.yesButton = wx.Button(self.warningPopup, -1, 'yes', style=wx.BU_EXACTFIT) self.warningPopup.noButton = wx.Button(self.warningPopup, -1, 'no', style=wx.BU_EXACTFIT) self.warningPopup.sizer = wx.BoxSizer(wx.HORIZONTAL) self.warningPopup.SetSizer(self.warningPopup.sizer) self.warningPopup.sizer.Add(self.warningPopup.text, 1, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=1) self.warningPopup.sizer.Add(self.warningPopup.yesButton, 0, flag=wx.EXPAND | wx.ALL, border=1) self.warningPopup.sizer.Add(self.warningPopup.noButton, 0, flag=wx.EXPAND | wx.ALL, border=1) self.warningPopup.Fit() self.warningPopup.Layout() self.warningPopup.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnHideWarning, self.warningPopup.timer) self.Bind(wx.EVT_BUTTON, self.OnResetAll, self.warningPopup.yesButton) self.Bind(wx.EVT_BUTTON, self.OnHideWarning, self.warningPopup.noButton) parent.Bind(wx.EVT_MOVE, self.OnMove) parent.Bind(wx.EVT_SIZE, self.OnMove) self.toolbar = toolbarUtil.Toolbar(self) group = [] toolbarUtil.RadioButton(self.toolbar, group, 'object-3d-on.png', 'object-3d-off.png', '3D view', callback=self.On3DClick) toolbarUtil.RadioButton(self.toolbar, group, 'object-top-on.png', 'object-top-off.png', 'Topdown view', callback=self.OnTopClick) self.toolbar.AddSeparator() self.showBorderButton = toolbarUtil.ToggleButton( self.toolbar, '', 'view-border-on.png', 'view-border-off.png', 'Show model borders', callback=self.OnViewChange) self.toolbar.AddSeparator() group = [] self.normalViewButton = toolbarUtil.RadioButton( self.toolbar, group, 'view-normal-on.png', 'view-normal-off.png', 'Normal model view', callback=self.OnViewChange) self.transparentViewButton = toolbarUtil.RadioButton( self.toolbar, group, 'view-transparent-on.png', 'view-transparent-off.png', 'Transparent model view', callback=self.OnViewChange) self.xrayViewButton = toolbarUtil.RadioButton( self.toolbar, group, 'view-xray-on.png', 'view-xray-off.png', 'X-Ray view', callback=self.OnViewChange) self.gcodeViewButton = toolbarUtil.RadioButton( self.toolbar, group, 'view-gcode-on.png', 'view-gcode-off.png', 'GCode view', callback=self.OnViewChange) self.mixedViewButton = toolbarUtil.RadioButton( self.toolbar, group, 'view-mixed-on.png', 'view-mixed-off.png', 'Mixed model/GCode view', callback=self.OnViewChange) self.toolbar.AddSeparator() self.layerSpin = wx.SpinCtrl(self.toolbar, -1, '', size=(21 * 4, 21), style=wx.SP_ARROW_KEYS) self.toolbar.AddControl(self.layerSpin) self.Bind(wx.EVT_SPINCTRL, self.OnLayerNrChange, self.layerSpin) self.toolbar2 = toolbarUtil.Toolbar(self) # Mirror self.mirrorX = toolbarUtil.ToggleButton( self.toolbar2, 'flip_x', 'object-mirror-x-on.png', 'object-mirror-x-off.png', 'Mirror X', callback=self.updateModelTransform) self.mirrorY = toolbarUtil.ToggleButton( self.toolbar2, 'flip_y', 'object-mirror-y-on.png', 'object-mirror-y-off.png', 'Mirror Y', callback=self.updateModelTransform) self.mirrorZ = toolbarUtil.ToggleButton( self.toolbar2, 'flip_z', 'object-mirror-z-on.png', 'object-mirror-z-off.png', 'Mirror Z', callback=self.updateModelTransform) self.toolbar2.AddSeparator() # Swap self.swapXZ = toolbarUtil.ToggleButton( self.toolbar2, 'swap_xz', 'object-swap-xz-on.png', 'object-swap-xz-off.png', 'Swap XZ', callback=self.updateModelTransform) self.swapYZ = toolbarUtil.ToggleButton( self.toolbar2, 'swap_yz', 'object-swap-yz-on.png', 'object-swap-yz-off.png', 'Swap YZ', callback=self.updateModelTransform) self.toolbar2.AddSeparator() # Scale self.scaleReset = toolbarUtil.NormalButton(self.toolbar2, self.OnScaleReset, 'object-scale.png', 'Reset model scale') self.scale = wx.TextCtrl(self.toolbar2, -1, profile.getProfileSetting('model_scale'), size=(21 * 2, 21)) self.toolbar2.AddControl(self.scale) self.scale.Bind(wx.EVT_TEXT, self.OnScale) self.scaleMax = toolbarUtil.NormalButton( self.toolbar2, self.OnScaleMax, 'object-max-size.png', 'Scale object to fit machine size') self.toolbar2.AddSeparator() # Multiply #self.mulXadd = toolbarUtil.NormalButton(self.toolbar2, self.OnMulXAddClick, 'object-mul-x-add.png', 'Increase number of models on X axis') #self.mulXsub = toolbarUtil.NormalButton(self.toolbar2, self.OnMulXSubClick, 'object-mul-x-sub.png', 'Decrease number of models on X axis') #self.mulYadd = toolbarUtil.NormalButton(self.toolbar2, self.OnMulYAddClick, 'object-mul-y-add.png', 'Increase number of models on Y axis') #self.mulYsub = toolbarUtil.NormalButton(self.toolbar2, self.OnMulYSubClick, 'object-mul-y-sub.png', 'Decrease number of models on Y axis') #self.toolbar2.AddSeparator() # Rotate self.rotateReset = toolbarUtil.NormalButton(self.toolbar2, self.OnRotateReset, 'object-rotate.png', 'Reset model rotation') self.rotate = wx.SpinCtrl( self.toolbar2, -1, profile.getProfileSetting('model_rotate_base'), size=(21 * 3, 21), style=wx.SP_WRAP | wx.SP_ARROW_KEYS) self.rotate.SetRange(0, 360) self.rotate.Bind(wx.EVT_TEXT, self.OnRotate) self.toolbar2.AddControl(self.rotate) self.toolbar2.Realize() self.OnViewChange() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.toolbar, 0, flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=1) sizer.Add(self.glCanvas, 1, flag=wx.EXPAND) sizer.Add(self.toolbar2, 0, flag=wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT, border=1) self.SetSizer(sizer)
def storedSetting(name): return lambda setting: profile.getProfileSetting(name)
def getSliceCommand(filename): if profile.getPreference('slicer').startswith('Slic3r') and getSlic3rExe() != False: slic3rExe = getSlic3rExe() if slic3rExe == False: return False cmd = [slic3rExe, '--output-filename-format', '[input_filename_base]_export.gcode', '--nozzle-diameter', str(profile.calculateEdgeWidth()), '--print-center', '%s,%s' % (profile.getProfileSetting('machine_center_x'), profile.getProfileSetting('machine_center_y')), '--z-offset', '0', '--gcode-flavor', 'reprap', '--gcode-comments', '--filament-diameter', profile.getProfileSetting('filament_diameter'), '--extrusion-multiplier', str(1.0 / float(profile.getProfileSetting('filament_density'))), '--temperature', profile.getProfileSetting('print_temperature'), '--travel-speed', profile.getProfileSetting('travel_speed'), '--perimeter-speed', profile.getProfileSetting('print_speed'), '--small-perimeter-speed', profile.getProfileSetting('print_speed'), '--infill-speed', profile.getProfileSetting('print_speed'), '--solid-infill-speed', profile.getProfileSetting('print_speed'), '--bridge-speed', profile.getProfileSetting('print_speed'), '--bottom-layer-speed-ratio', str(float(profile.getProfileSetting('bottom_layer_speed')) / float(profile.getProfileSetting('print_speed'))), '--layer-height', profile.getProfileSetting('layer_height'), '--first-layer-height-ratio', '1.0', '--infill-every-layers', '1', '--perimeters', str(profile.calculateLineCount()), '--solid-layers', str(profile.calculateSolidLayerCount()), '--fill-density', str(float(profile.getProfileSetting('fill_density'))/100), '--fill-angle', '45', '--fill-pattern', 'rectilinear', #rectilinear line concentric hilbertcurve archimedeanchords octagramspiral '--solid-fill-pattern', 'rectilinear', '--start-gcode', profile.getAlterationFilePath('start.gcode'), '--end-gcode', profile.getAlterationFilePath('end.gcode'), '--retract-length', profile.getProfileSetting('retraction_amount'), '--retract-speed', str(int(float(profile.getProfileSetting('retraction_speed')))), '--retract-restart-extra', profile.getProfileSetting('retraction_extra'), '--retract-before-travel', profile.getProfileSetting('retraction_min_travel'), '--retract-lift', '0', '--slowdown-below-layer-time', profile.getProfileSetting('cool_min_layer_time'), '--min-print-speed', profile.getProfileSetting('cool_min_feedrate'), '--skirts', profile.getProfileSetting('skirt_line_count'), '--skirt-distance', str(int(float(profile.getProfileSetting('skirt_gap')))), '--skirt-height', '1', '--scale', profile.getProfileSetting('model_scale'), '--rotate', profile.getProfileSetting('model_rotate_base'), '--duplicate-x', profile.getProfileSetting('model_multiply_x'), '--duplicate-y', profile.getProfileSetting('model_multiply_y'), '--duplicate-distance', '10'] if profile.getProfileSetting('support') != 'None': cmd.extend(['--support-material']) cmd.extend([filename]) return cmd else: pypyExe = getPyPyExe() if pypyExe == False: pypyExe = sys.executable #In case we have a frozen exe, then argv[0] points to the executable, but we want to give pypy a real script file. if hasattr(sys, 'frozen'): mainScriptFile = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..", "cura_sf.zip")) else: mainScriptFile = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", os.path.split(sys.argv[0])[1])) cmd = [pypyExe, mainScriptFile, '-p', profile.getGlobalProfileString()] if platform.system() == "Windows": try: cmd.append(str(filename)) except UnicodeEncodeError: cmd.append("#UTF8#" + filename.encode("utf-8")) else: cmd.append(filename) return cmd
def _engineSettings(self, extruderCount): settings = { 'layerThickness': int(profile.getProfileSettingFloat('layer_height') * 1000), 'initialLayerThickness': int(profile.getProfileSettingFloat('bottom_thickness') * 1000) if profile.getProfileSettingFloat('bottom_thickness') > 0.0 else int( profile.getProfileSettingFloat('layer_height') * 1000), 'filamentDiameter': int(profile.getProfileSettingFloat('filament_diameter') * 1000), 'filamentFlow': int(profile.getProfileSettingFloat('filament_flow')), 'extrusionWidth': int(profile.calculateEdgeWidth() * 1000), 'insetCount': int(profile.calculateLineCount()), 'downSkinCount': int(profile.calculateSolidLayerCount()) if profile.getProfileSetting('solid_bottom') == 'True' else 0, 'upSkinCount': int(profile.calculateSolidLayerCount()) if profile.getProfileSetting('solid_top') == 'True' else 0, 'infillOverlap': int(profile.getProfileSettingFloat('fill_overlap')), 'initialSpeedupLayers': int(4), 'initialLayerSpeed': int(profile.getProfileSettingFloat('bottom_layer_speed')), 'printSpeed': int(profile.getProfileSettingFloat('print_speed')), 'infillSpeed': int(profile.getProfileSettingFloat('infill_speed')) if int(profile.getProfileSettingFloat('infill_speed')) > 0 else int( profile.getProfileSettingFloat('print_speed')), 'moveSpeed': int(profile.getProfileSettingFloat('travel_speed')), 'fanSpeedMin': int(profile.getProfileSettingFloat('fan_speed')) if profile.getProfileSetting('fan_enabled') == 'True' else 0, 'fanSpeedMax': int(profile.getProfileSettingFloat('fan_speed_max')) if profile.getProfileSetting('fan_enabled') == 'True' else 0, 'supportAngle': int(-1) if profile.getProfileSetting('support') == 'None' else int( profile.getProfileSettingFloat('support_angle')), 'supportEverywhere': int(1) if profile.getProfileSetting('support') == 'Everywhere' else int(0), 'supportLineDistance': int(100 * profile.calculateEdgeWidth() * 1000 / profile.getProfileSettingFloat('support_fill_rate')) if profile.getProfileSettingFloat('support_fill_rate') > 0 else -1, 'supportXYDistance': int(1000 * profile.getProfileSettingFloat('support_xy_distance')), 'supportZDistance': int(1000 * profile.getProfileSettingFloat('support_z_distance')), 'supportExtruder': 0 if profile.getProfileSetting('support_dual_extrusion') == 'First extruder' else (1 if profile.getProfileSetting('support_dual_extrusion') == 'Second extruder' and profile.minimalExtruderCount() > 1 else -1), 'retractionAmount': int(profile.getProfileSettingFloat('retraction_amount') * 1000) if profile.getProfileSetting('retraction_enable') == 'True' else 0, 'retractionSpeed': int(profile.getProfileSettingFloat('retraction_speed')), 'retractionMinimalDistance': int( profile.getProfileSettingFloat('retraction_min_travel') * 1000), 'retractionAmountExtruderSwitch': int( profile.getProfileSettingFloat('retraction_dual_amount') * 1000), 'minimalExtrusionBeforeRetraction': int( profile.getProfileSettingFloat('retraction_minimal_extrusion') * 1000), 'enableCombing': 1 if profile.getProfileSetting('retraction_combing') == 'True' else 0, 'multiVolumeOverlap': int(profile.getProfileSettingFloat('overlap_dual') * 1000), 'objectSink': int(profile.getProfileSettingFloat('object_sink') * 1000), 'minimalLayerTime': int(profile.getProfileSettingFloat('cool_min_layer_time')), 'minimalFeedrate': int(profile.getProfileSettingFloat('cool_min_feedrate')), 'coolHeadLift': 1 if profile.getProfileSetting('cool_head_lift') == 'True' else 0, 'startCode': profile.getAlterationFileContents('start.gcode', extruderCount), 'endCode': profile.getAlterationFileContents('end.gcode', extruderCount), 'extruderOffset[1].X': int(profile.getMachineSettingFloat('extruder_offset_x1') * 1000), 'extruderOffset[1].Y': int(profile.getMachineSettingFloat('extruder_offset_y1') * 1000), 'extruderOffset[2].X': int(profile.getMachineSettingFloat('extruder_offset_x2') * 1000), 'extruderOffset[2].Y': int(profile.getMachineSettingFloat('extruder_offset_y2') * 1000), 'extruderOffset[3].X': int(profile.getMachineSettingFloat('extruder_offset_x3') * 1000), 'extruderOffset[3].Y': int(profile.getMachineSettingFloat('extruder_offset_y3') * 1000), 'fixHorrible': 0, } fanFullHeight = int( profile.getProfileSettingFloat('fan_full_height') * 1000) settings['fanFullOnLayerNr'] = (fanFullHeight - settings['initialLayerThickness'] - 1) / settings['layerThickness'] + 1 if settings['fanFullOnLayerNr'] < 0: settings['fanFullOnLayerNr'] = 0 if profile.getProfileSettingFloat('fill_density') == 0: settings['sparseInfillLineDistance'] = -1 elif profile.getProfileSettingFloat('fill_density') == 100: settings['sparseInfillLineDistance'] = settings['extrusionWidth'] #Set the up/down skins height to 10000 if we want a 100% filled object. # This gives better results then normal 100% infill as the sparse and up/down skin have some overlap. settings['downSkinCount'] = 10000 settings['upSkinCount'] = 10000 else: settings['sparseInfillLineDistance'] = int( 100 * profile.calculateEdgeWidth() * 1000 / profile.getProfileSettingFloat('fill_density')) if profile.getProfileSetting('platform_adhesion') == 'Brim': settings['skirtDistance'] = 0 settings['skirtLineCount'] = int( profile.getProfileSettingFloat('brim_line_count')) elif profile.getProfileSetting('platform_adhesion') == 'Raft': settings['skirtDistance'] = 0 settings['skirtLineCount'] = 0 settings['raftMargin'] = int( profile.getProfileSettingFloat('raft_margin') * 1000) settings['raftLineSpacing'] = int( profile.getProfileSettingFloat('raft_line_spacing') * 1000) settings['raftBaseThickness'] = int( profile.getProfileSettingFloat('raft_base_thickness') * 1000) settings['raftBaseLinewidth'] = int( profile.getProfileSettingFloat('raft_base_linewidth') * 1000) settings['raftInterfaceThickness'] = int( profile.getProfileSettingFloat('raft_interface_thickness') * 1000) settings['raftInterfaceLinewidth'] = int( profile.getProfileSettingFloat('raft_interface_linewidth') * 1000) else: settings['skirtDistance'] = int( profile.getProfileSettingFloat('skirt_gap') * 1000) settings['skirtLineCount'] = int( profile.getProfileSettingFloat('skirt_line_count')) settings['skirtMinLength'] = int( profile.getProfileSettingFloat('skirt_minimal_length') * 1000) if profile.getProfileSetting( 'fix_horrible_union_all_type_a') == 'True': settings['fixHorrible'] |= 0x01 if profile.getProfileSetting( 'fix_horrible_union_all_type_b') == 'True': settings['fixHorrible'] |= 0x02 if profile.getProfileSetting('fix_horrible_use_open_bits') == 'True': settings['fixHorrible'] |= 0x10 if profile.getProfileSetting( 'fix_horrible_extensive_stitching') == 'True': settings['fixHorrible'] |= 0x04 if settings['layerThickness'] <= 0: settings['layerThickness'] = 1000 if profile.getMachineSetting('gcode_flavor') == 'UltiGCode': settings['gcodeFlavor'] = 1 if profile.getProfileSetting('spiralize') == 'True': settings['spiralizeMode'] = 1 if profile.getProfileSetting('wipe_tower') == 'True': settings['wipeTowerSize'] = int( math.sqrt( profile.getProfileSettingFloat('wipe_tower_volume') * 1000 * 1000 * 1000 / settings['layerThickness'])) if profile.getProfileSetting('ooze_shield') == 'True': settings['enableOozeShield'] = 1 return settings
def __init__(self, parent): super(previewPanel, self).__init__(parent,-1) self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DDKSHADOW)) self.SetMinSize((440,320)) self.objectList = [] self.errorList = [] self.gcode = None self.objectsMinV = None self.objectsMaxV = None self.loadThread = None self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height')) self.machineCenter = util3d.Vector3(float(profile.getProfileSetting('machine_center_x')), float(profile.getProfileSetting('machine_center_y')), 0) self.glCanvas = PreviewGLCanvas(self) #Create the popup window self.warningPopup = wx.PopupWindow(self, flags=wx.BORDER_SIMPLE) self.warningPopup.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)) self.warningPopup.text = wx.StaticText(self.warningPopup, -1, 'Reset scale, rotation and mirror?') self.warningPopup.yesButton = wx.Button(self.warningPopup, -1, 'yes', style=wx.BU_EXACTFIT) self.warningPopup.noButton = wx.Button(self.warningPopup, -1, 'no', style=wx.BU_EXACTFIT) self.warningPopup.sizer = wx.BoxSizer(wx.HORIZONTAL) self.warningPopup.SetSizer(self.warningPopup.sizer) self.warningPopup.sizer.Add(self.warningPopup.text, 1, flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1) self.warningPopup.sizer.Add(self.warningPopup.yesButton, 0, flag=wx.EXPAND|wx.ALL, border=1) self.warningPopup.sizer.Add(self.warningPopup.noButton, 0, flag=wx.EXPAND|wx.ALL, border=1) self.warningPopup.Fit() self.warningPopup.Layout() self.warningPopup.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnHideWarning, self.warningPopup.timer) self.Bind(wx.EVT_BUTTON, self.OnResetAll, self.warningPopup.yesButton) self.Bind(wx.EVT_BUTTON, self.OnHideWarning, self.warningPopup.noButton) parent.Bind(wx.EVT_MOVE, self.OnMove) parent.Bind(wx.EVT_SIZE, self.OnMove) self.toolbar = toolbarUtil.Toolbar(self) group = [] toolbarUtil.RadioButton(self.toolbar, group, 'object-3d-on.png', 'object-3d-off.png', '3D view', callback=self.On3DClick) toolbarUtil.RadioButton(self.toolbar, group, 'object-top-on.png', 'object-top-off.png', 'Topdown view', callback=self.OnTopClick) self.toolbar.AddSeparator() self.showBorderButton = toolbarUtil.ToggleButton(self.toolbar, '', 'view-border-on.png', 'view-border-off.png', 'Show model borders', callback=self.OnViewChange) self.toolbar.AddSeparator() group = [] self.normalViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-normal-on.png', 'view-normal-off.png', 'Normal model view', callback=self.OnViewChange) self.transparentViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-transparent-on.png', 'view-transparent-off.png', 'Transparent model view', callback=self.OnViewChange) self.xrayViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-xray-on.png', 'view-xray-off.png', 'X-Ray view', callback=self.OnViewChange) self.gcodeViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-gcode-on.png', 'view-gcode-off.png', 'GCode view', callback=self.OnViewChange) self.mixedViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-mixed-on.png', 'view-mixed-off.png', 'Mixed model/GCode view', callback=self.OnViewChange) self.toolbar.AddSeparator() self.layerSpin = wx.SpinCtrl(self.toolbar, -1, '', size=(21*4,21), style=wx.SP_ARROW_KEYS) self.toolbar.AddControl(self.layerSpin) self.Bind(wx.EVT_SPINCTRL, self.OnLayerNrChange, self.layerSpin) self.toolbar2 = toolbarUtil.Toolbar(self) # Mirror self.mirrorX = toolbarUtil.ToggleButton(self.toolbar2, 'flip_x', 'object-mirror-x-on.png', 'object-mirror-x-off.png', 'Mirror X', callback=self.updateModelTransform) self.mirrorY = toolbarUtil.ToggleButton(self.toolbar2, 'flip_y', 'object-mirror-y-on.png', 'object-mirror-y-off.png', 'Mirror Y', callback=self.updateModelTransform) self.mirrorZ = toolbarUtil.ToggleButton(self.toolbar2, 'flip_z', 'object-mirror-z-on.png', 'object-mirror-z-off.png', 'Mirror Z', callback=self.updateModelTransform) self.toolbar2.AddSeparator() # Swap self.swapXZ = toolbarUtil.ToggleButton(self.toolbar2, 'swap_xz', 'object-swap-xz-on.png', 'object-swap-xz-off.png', 'Swap XZ', callback=self.updateModelTransform) self.swapYZ = toolbarUtil.ToggleButton(self.toolbar2, 'swap_yz', 'object-swap-yz-on.png', 'object-swap-yz-off.png', 'Swap YZ', callback=self.updateModelTransform) self.toolbar2.AddSeparator() # Scale self.scaleReset = toolbarUtil.NormalButton(self.toolbar2, self.OnScaleReset, 'object-scale.png', 'Reset model scale') self.scale = wx.TextCtrl(self.toolbar2, -1, profile.getProfileSetting('model_scale'), size=(21*2,21)) self.toolbar2.AddControl(self.scale) self.scale.Bind(wx.EVT_TEXT, self.OnScale) self.scaleMax = toolbarUtil.NormalButton(self.toolbar2, self.OnScaleMax, 'object-max-size.png', 'Scale object to fit machine size') self.toolbar2.AddSeparator() # Multiply #self.mulXadd = toolbarUtil.NormalButton(self.toolbar2, self.OnMulXAddClick, 'object-mul-x-add.png', 'Increase number of models on X axis') #self.mulXsub = toolbarUtil.NormalButton(self.toolbar2, self.OnMulXSubClick, 'object-mul-x-sub.png', 'Decrease number of models on X axis') #self.mulYadd = toolbarUtil.NormalButton(self.toolbar2, self.OnMulYAddClick, 'object-mul-y-add.png', 'Increase number of models on Y axis') #self.mulYsub = toolbarUtil.NormalButton(self.toolbar2, self.OnMulYSubClick, 'object-mul-y-sub.png', 'Decrease number of models on Y axis') #self.toolbar2.AddSeparator() # Rotate self.rotateReset = toolbarUtil.NormalButton(self.toolbar2, self.OnRotateReset, 'object-rotate.png', 'Reset model rotation') self.rotate = wx.SpinCtrl(self.toolbar2, -1, profile.getProfileSetting('model_rotate_base'), size=(21*3,21), style=wx.SP_WRAP|wx.SP_ARROW_KEYS) self.rotate.SetRange(0, 360) self.rotate.Bind(wx.EVT_TEXT, self.OnRotate) self.toolbar2.AddControl(self.rotate) self.toolbar2.Realize() self.OnViewChange() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.toolbar, 0, flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, border=1) sizer.Add(self.glCanvas, 1, flag=wx.EXPAND) sizer.Add(self.toolbar2, 0, flag=wx.EXPAND|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=1) self.SetSizer(sizer)
def loadModelFiles(self, filelist, showWarning = False): while len(filelist) > len(self.objectList): self.objectList.append(previewObject()) for idx in xrange(len(filelist), len(self.objectList)): self.objectList[idx].mesh = None self.objectList[idx].filename = None for idx in xrange(0, len(filelist)): obj = self.objectList[idx] if obj.filename != filelist[idx]: obj.fileTime = None self.gcodeFileTime = None self.logFileTime = None obj.filename = filelist[idx] self.gcodeFilename = sliceRun.getExportFilename(filelist[0]) #Do the STL file loading in a background thread so we don't block the UI. if self.loadThread != None and self.loadThread.isAlive(): self.loadThread.join() self.loadThread = threading.Thread(target=self.doFileLoadThread) self.loadThread.daemon = True self.loadThread.start() if showWarning: if profile.getProfileSettingFloat('model_scale') != 1.0 or profile.getProfileSettingFloat('model_rotate_base') != 0 or profile.getProfileSetting('flip_x') != 'False' or profile.getProfileSetting('flip_y') != 'False' or profile.getProfileSetting('flip_z') != 'False' or profile.getProfileSetting('swap_xz') != 'False' or profile.getProfileSetting('swap_yz') != 'False': self.warningPopup.Show(True) self.warningPopup.timer.Start(5000)
def getProfileInformation(): return { "carve": { "Add_Layer_Template_to_SVG": DEFSET, "Edge_Width_mm": calculateEdgeWidth, "Extra_Decimal_Places_float": DEFSET, "Import_Coarseness_ratio": DEFSET, "Layer_Height_mm": storedSettingFloat("layer_height"), "Layers_From_index": calcLayerSkip, "Layers_To_index": DEFSET, "Correct_Mesh": DEFSET, "Unproven_Mesh": DEFSET, "SVG_Viewer": DEFSET, "FlipX": storedSetting("flip_x"), "FlipY": storedSetting("flip_y"), "FlipZ": storedSetting("flip_z"), "SwapXZ": storedSetting("swap_xz"), "SwapYZ": storedSetting("swap_yz"), "Scale": storedSettingFloat("model_scale"), "Rotate": storedSettingFloat("model_rotate_base"), "CenterX": storedSettingFloat("machine_center_x"), "CenterY": storedSettingFloat("machine_center_y"), "AlternativeCenterFile": storedSetting("alternative_center"), }, "scale": { "Activate_Scale": "False", "XY_Plane_Scale_ratio": DEFSET, "Z_Axis_Scale_ratio": DEFSET, "SVG_Viewer": DEFSET, }, "bottom": { "Activate_Bottom": DEFSET, "Additional_Height_over_Layer_Thickness_ratio": DEFSET, "Altitude_mm": calcExtraBottomThickness, "SVG_Viewer": DEFSET, }, "preface": { "Meta": DEFSET, "Set_Positioning_to_Absolute": "False", "Set_Units_to_Millimeters": "False", "Start_at_Home": DEFSET, "Turn_Extruder_Off_at_Shut_Down": DEFSET, "Turn_Extruder_Off_at_Start_Up": DEFSET, }, "widen": {"Activate_Widen": DEFSET, "Widen_Width_over_Edge_Width_ratio": DEFSET}, "inset": { "Add_Custom_Code_for_Temperature_Reading": "False", "Infill_in_Direction_of_Bridge": ifSettingAboveZero("fill_density"), "Infill_Width": storedSettingFloat("nozzle_size"), "Loop_Order_Choice": DEFSET, "Overlap_Removal_Width_over_Perimeter_Width_ratio": DEFSET, "Turn_Extruder_Heater_Off_at_Shut_Down": "False", "Volume_Fraction_ratio": DEFSET, }, "fill": { "Activate_Fill": "True", "Solid_Surface_Top": storedSetting("solid_top"), "Override_First_Layer_Sequence": storedSetting("force_first_layer_sequence"), "Diaphragm_Period_layers": DEFSET, "Diaphragm_Thickness_layers": DEFSET, "Extra_Shells_on_Alternating_Solid_Layer_layers": calculateShells, "Extra_Shells_on_Base_layers": calculateShellsBase, "Extra_Shells_on_Sparse_Layer_layers": calculateShells, "Grid_Circle_Separation_over_Perimeter_Width_ratio": DEFSET, "Grid_Extra_Overlap_ratio": DEFSET, "Grid_Junction_Separation_Band_Height_layers": DEFSET, "Grid_Junction_Separation_over_Octogon_Radius_At_End_ratio": DEFSET, "Grid_Junction_Separation_over_Octogon_Radius_At_Middle_ratio": DEFSET, "Infill_Begin_Rotation_degrees": DEFSET, "Infill_Begin_Rotation_Repeat_layers": DEFSET, "Infill_Odd_Layer_Extra_Rotation_degrees": DEFSET, "Grid_Circular": ifSettingIs("infill_type", "Grid Circular"), "Grid_Hexagonal": ifSettingIs("infill_type", "Grid Hexagonal"), "Grid_Rectangular": ifSettingIs("infill_type", "Grid Rectangular"), "Line": ifSettingIs("infill_type", "Line"), "Infill_Perimeter_Overlap_ratio": storedPercentSetting("fill_overlap"), "Infill_Solidity_ratio": storedPercentSetting("fill_density"), "Infill_Width": storedSettingFloat("nozzle_size"), "Sharpest_Angle_degrees": DEFSET, "Solid_Surface_Thickness_layers": calculateSolidLayerCount, "Start_From_Choice": DEFSET, "Surrounding_Angle_degrees": DEFSET, "Thread_Sequence_Choice": storedSetting("sequence"), }, "multiply": { "Activate_Multiply": "False", "Center_X_mm": storedSettingFloat("machine_center_x"), "Center_Y_mm": storedSettingFloat("machine_center_y"), "Number_of_Columns_integer": storedSetting("model_multiply_x"), "Number_of_Rows_integer": storedSetting("model_multiply_y"), "Reverse_Sequence_every_Odd_Layer": DEFSET, "Separation_over_Perimeter_Width_ratio": calculateMultiplyDistance, }, "speed": { "Activate_Speed": "True", "Add_Flow_Rate": "True", "Bridge_Feed_Rate_Multiplier_ratio": storedPercentSetting("bridge_speed"), "Bridge_Flow_Rate_Multiplier_ratio": storedPercentSetting("bridge_speed"), "Duty_Cyle_at_Beginning_portion": DEFSET, "Duty_Cyle_at_Ending_portion": DEFSET, "Feed_Rate_mm/s": storedSettingFloat("print_speed"), "Flow_Rate_Setting_float": storedSettingFloat("print_speed"), "Object_First_Layer_Feed_Rate_Infill_Multiplier_ratio": firstLayerSpeedRatio, "Object_First_Layer_Feed_Rate_Perimeter_Multiplier_ratio": firstLayerSpeedRatio, "Object_First_Layer_Feed_Rate_Travel_Multiplier_ratio": firstLayerSpeedRatio, "Object_First_Layer_Flow_Rate_Infill_Multiplier_ratio": firstLayerSpeedRatio, "Object_First_Layer_Flow_Rate_Perimeter_Multiplier_ratio": firstLayerSpeedRatio, "Object_First_Layers_Amount_Of_Layers_For_Speed_Change": DEFSET, "Orbital_Feed_Rate_over_Operating_Feed_Rate_ratio": DEFSET, "Maximum_Z_Feed_Rate_mm/s": DEFSET, "Perimeter_Feed_Rate_Multiplier_ratio": DEFSET, "Perimeter_Flow_Rate_Multiplier_ratio": DEFSET, "Travel_Feed_Rate_mm/s": storedSettingFloat("travel_speed"), "Bottom_layer_flow_rate_ratio": calcBottomLayerFlowRateRatio, }, "temperature": { "Activate_Temperature": DEFSET, # ifSettingAboveZero('print_temperature'), "Cooling_Rate_Celcius/second": DEFSET, "Heating_Rate_Celcius/second": DEFSET, "Base_Temperature_Celcius": DEFSET, # storedSettingFloat("print_temperature"), "Interface_Temperature_Celcius": DEFSET, # storedSettingFloat("print_temperature"), "Object_First_Layer_Infill_Temperature_Celcius": DEFSET, # storedSettingFloat("print_temperature"), "Object_First_Layer_Perimeter_Temperature_Celcius": DEFSET, # storedSettingFloat("print_temperature"), "Object_Next_Layers_Temperature_Celcius": DEFSET, # storedSettingFloat("print_temperature"), "Support_Layers_Temperature_Celcius": DEFSET, # storedSettingFloat("print_temperature"), "Supported_Layers_Temperature_Celcius": DEFSET, # storedSettingFloat("print_temperature"), }, "raft": { "Activate_Raft": "True", "Add_Raft,_Elevate_Nozzle,_Orbit": DEFSET, "Base_Feed_Rate_Multiplier_ratio": DEFSET, "Base_Flow_Rate_Multiplier_ratio": storedPercentSetting("raft_base_material_amount"), "Base_Infill_Density_ratio": DEFSET, "Base_Layer_Thickness_over_Layer_Thickness": DEFSET, "Base_Layers_integer": raftLayerCount, "Base_Nozzle_Lift_over_Base_Layer_Thickness_ratio": DEFSET, "Initial_Circling": DEFSET, "Infill_Overhang_over_Extrusion_Width_ratio": DEFSET, "Interface_Feed_Rate_Multiplier_ratio": DEFSET, "Interface_Flow_Rate_Multiplier_ratio": storedPercentSetting("raft_interface_material_amount"), "Interface_Infill_Density_ratio": DEFSET, "Interface_Layer_Thickness_over_Layer_Thickness": DEFSET, "Interface_Layers_integer": raftLayerCount, "Interface_Nozzle_Lift_over_Interface_Layer_Thickness_ratio": DEFSET, "Name_of_Support_End_File": DEFSET, "Name_of_Support_Start_File": DEFSET, "Operating_Nozzle_Lift_over_Layer_Thickness_ratio": DEFSET, "Raft_Additional_Margin_over_Length_%": DEFSET, "Raft_Margin_mm": storedSettingFloat("raft_margin"), "Support_Cross_Hatch": "False", "Support_Flow_Rate_over_Operating_Flow_Rate_ratio": storedPercentSetting("support_rate"), "Support_Gap_over_Perimeter_Extrusion_Width_ratio": calcSupportDistanceRatio, "Support_Material_Choice_": storedSetting("support"), "Support_Minimum_Angle_degrees": DEFSET, "Support_Margin_mm": "3.0", "Support_Offset_X_mm": lambda setting: -profile.getPreferenceFloat("extruder_offset_x1") if profile.getProfileSetting("support_dual_extrusion") == "True" and int(profile.getPreference("extruder_amount")) > 1 else "0", "Support_Offset_Y_mm": lambda setting: -profile.getPreferenceFloat("extruder_offset_y1") if profile.getProfileSetting("support_dual_extrusion") == "True" and int(profile.getPreference("extruder_amount")) > 1 else "0", }, "skirt": { "Skirt_line_count": storedSetting("skirt_line_count"), "Convex": "True", "Gap_Width_mm": storedSetting("skirt_gap"), "Layers_To_index": "1", }, "joris": {"Activate_Joris": storedSetting("joris"), "Layers_From_index": calculateSolidLayerCount}, "chamber": { "Activate_Chamber": "False", "Bed_Temperature_Celcius": DEFSET, "Bed_Temperature_Begin_Change_Height_mm": DEFSET, "Bed_Temperature_End_Change_Height_mm": DEFSET, "Bed_Temperature_End_Celcius": DEFSET, "Chamber_Temperature_Celcius": DEFSET, "Holding_Force_bar": DEFSET, }, "tower": { "Activate_Tower": "False", "Extruder_Possible_Collision_Cone_Angle_degrees": DEFSET, "Maximum_Tower_Height_layers": DEFSET, "Tower_Start_Layer_integer": DEFSET, }, "jitter": {"Activate_Jitter": "False", "Jitter_Over_Perimeter_Width_ratio": DEFSET}, "clip": { "Activate_Clip": "False", "Clip_Over_Perimeter_Width_ratio": DEFSET, "Maximum_Connection_Distance_Over_Perimeter_Width_ratio": DEFSET, }, "smooth": { "Activate_Smooth": "False", "Layers_From_index": DEFSET, "Maximum_Shortening_over_Width_float": DEFSET, }, "stretch": { "Activate_Stretch": "False", "Cross_Limit_Distance_Over_Perimeter_Width_ratio": DEFSET, "Loop_Stretch_Over_Perimeter_Width_ratio": DEFSET, "Path_Stretch_Over_Perimeter_Width_ratio": DEFSET, "Perimeter_Inside_Stretch_Over_Perimeter_Width_ratio": DEFSET, "Perimeter_Outside_Stretch_Over_Perimeter_Width_ratio": DEFSET, "Stretch_From_Distance_Over_Perimeter_Width_ratio": DEFSET, }, "skin": { "Activate_Skin": storedSetting("enable_skin"), "Horizontal_Infill_Divisions_integer": "1", "Horizontal_Perimeter_Divisions_integer": "1", "Vertical_Divisions_integer": "2", "Hop_When_Extruding_Infill": "False", "Layers_From_index": "1", }, "comb": {"Activate_Comb": "True", "Running_Jump_Space_mm": DEFSET}, "cool": { "Activate_Cool": "True", "Bridge_Cool_Celcius": DEFSET, "Cool_Type": DEFSET, "Maximum_Cool_Celcius": DEFSET, "Minimum_Layer_Time_seconds": storedSettingFloat("cool_min_layer_time"), "Minimum_Orbital_Radius_millimeters": DEFSET, "Name_of_Cool_End_File": DEFSET, "Name_of_Cool_Start_File": DEFSET, "Orbital_Outset_millimeters": DEFSET, "Turn_Fan_On_at_Beginning": storedSetting("fan_enabled"), "Turn_Fan_Off_at_Ending": storedSetting("fan_enabled"), "Minimum_feed_rate_mm/s": storedSettingFloat("cool_min_feedrate"), "Fan_on_at_layer": storedSettingInt("fan_layer"), "Fan_speed_min_%": storedSettingInt("fan_speed"), "Fan_speed_max_%": storedSettingInt("fan_speed_max"), }, "hop": {"Activate_Hop": "False", "Hop_Over_Layer_Thickness_ratio": DEFSET, "Minimum_Hop_Angle_degrees": DEFSET}, "wipe": { "Activate_Wipe": "False", "Arrival_X_mm": DEFSET, "Arrival_Y_mm": DEFSET, "Arrival_Z_mm": DEFSET, "Departure_X_mm": DEFSET, "Departure_Y_mm": DEFSET, "Departure_Z_mm": DEFSET, "Wipe_X_mm": DEFSET, "Wipe_Y_mm": DEFSET, "Wipe_Z_mm": DEFSET, "Wipe_Period_layers": DEFSET, }, "oozebane": { "Activate_Oozebane": "False", "After_Startup_Distance_millimeters": DEFSET, "Early_Shutdown_Distance_millimeters": DEFSET, "Early_Startup_Distance_Constant_millimeters": DEFSET, "Early_Startup_Maximum_Distance_millimeters": DEFSET, "First_Early_Startup_Distance_millimeters": DEFSET, "Minimum_Distance_for_Early_Startup_millimeters": DEFSET, "Minimum_Distance_for_Early_Shutdown_millimeters": DEFSET, "Slowdown_Startup_Steps_positive_integer": DEFSET, }, "dwindle": { "Activate_Dwindle": "False", "End_Rate_Multiplier_ratio": "0.5", "Pent_Up_Volume_cubic_millimeters": "0.4", "Slowdown_Steps_positive_integer": "5", "Slowdown_Volume_cubic_millimeters": "5.0", }, "splodge": { "Activate_Splodge": "False", "Initial_Lift_over_Extra_Thickness_ratio": DEFSET, "Initial_Splodge_Feed_Rate_mm/s": DEFSET, "Operating_Splodge_Feed_Rate_mm/s": DEFSET, "Operating_Splodge_Quantity_Length_millimeters": DEFSET, "Initial_Splodge_Quantity_Length_millimeters": DEFSET, "Operating_Lift_over_Extra_Thickness_ratio": DEFSET, }, "home": {"Activate_Home": "False", "Name_of_Home_File": DEFSET}, "lash": {"Activate_Lash": "False", "X_Backlash_mm": DEFSET, "Y_Backlash_mm": DEFSET}, "fillet": { "Activate_Fillet": "False", "Arc_Point": DEFSET, "Arc_Radius": DEFSET, "Arc_Segment": DEFSET, "Bevel": DEFSET, "Corner_Feed_Rate_Multiplier_ratio": DEFSET, "Fillet_Radius_over_Perimeter_Width_ratio": DEFSET, "Reversal_Slowdown_Distance_over_Perimeter_Width_ratio": DEFSET, "Use_Intermediate_Feed_Rate_in_Corners": DEFSET, }, "limit": {"Activate_Limit": "False", "Maximum_Initial_Feed_Rate_mm/s": DEFSET}, "unpause": {"Activate_Unpause": "False", "Delay_milliseconds": DEFSET, "Maximum_Speed_ratio": DEFSET}, "dimension": { "Activate_Dimension": "True", "Absolute_Extrusion_Distance": "True", "Relative_Extrusion_Distance": "False", "Extruder_Retraction_Speed_mm/s": storedSettingFloat("retraction_speed"), "Filament_Diameter_mm": storedSettingFloat("filament_diameter"), "Filament_Packing_Density_ratio": storedSettingFloat("filament_density"), "Maximum_E_Value_before_Reset_float": DEFSET, "Minimum_Travel_for_Retraction_millimeters": storedSettingFloat("retraction_min_travel"), "Retract_Within_Island": storedSettingInvertBoolean("retract_on_jumps_only"), "Retraction_Distance_millimeters": storedSettingFloat("retraction_amount"), "Restart_Extra_Distance_millimeters": storedSettingFloat("retraction_extra"), }, "alteration": { "Activate_Alteration": storedSetting("add_start_end_gcode"), "Name_of_End_File": "end.gcode", "Name_of_Start_File": "start.gcode", "Remove_Redundant_Mcode": "True", "Replace_Variable_with_Setting": DEFSET, }, "export": { "Activate_Export": "True", "Add_Descriptive_Extension": DEFSET, "Add_Export_Suffix": DEFSET, "Add_Profile_Extension": DEFSET, "Add_Timestamp_Extension": DEFSET, "Also_Send_Output_To": DEFSET, "Analyze_Gcode": DEFSET, "Comment_Choice": DEFSET, "Do_Not_Change_Output": DEFSET, "binary_16_byte": DEFSET, "gcode_step": DEFSET, "gcode_time_segment": DEFSET, "gcode_small": DEFSET, "File_Extension": storedSetting("gcode_extension"), "Name_of_Replace_File": DEFSET, "Save_Penultimate_Gcode": "False", }, }
def OnMulXAddClick(self, e): profile.putProfileSetting('model_multiply_x', str(max(1, int(profile.getProfileSetting('model_multiply_x'))+1))) self.glCanvas.Refresh()
def __init__(self): super(mainWindow, self).__init__(title="Cura - " + version.getVersion()) wx.EVT_CLOSE(self, self.OnClose) # self.SetIcon(icon.getMainIcon()) self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, ".stl")) menubar = wx.MenuBar() fileMenu = wx.Menu() i = fileMenu.Append(-1, "Load model file...") self.Bind(wx.EVT_MENU, lambda e: self._showModelLoadDialog(1), i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, "Open Profile...") self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = fileMenu.Append(-1, "Save Profile...") self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) i = fileMenu.Append(-1, "Load Profile from GCode...") self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, "Reset Profile to default") self.Bind(wx.EVT_MENU, self.OnResetProfile, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, "Batch run...") self.Bind(wx.EVT_MENU, self.OnBatchRun, i) i = fileMenu.Append(-1, "Preferences...") self.Bind(wx.EVT_MENU, self.OnPreferences, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, "Open project planner...") self.Bind(wx.EVT_MENU, self.OnProjectPlanner, i) fileMenu.AppendSeparator() i = fileMenu.Append(wx.ID_EXIT, "Quit") self.Bind(wx.EVT_MENU, self.OnQuit, i) menubar.Append(fileMenu, "&File") simpleMenu = wx.Menu() i = simpleMenu.Append(-1, "Switch to Quickprint...") self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i) menubar.Append(simpleMenu, "Simple") expertMenu = wx.Menu() i = expertMenu.Append(-1, "Open expert settings...") self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) # i = expertMenu.Append(-1, 'Open SVG (2D) slicer...') # self.Bind(wx.EVT_MENU, self.OnSVGSlicerOpen, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, "Install default Marlin firmware") self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, i) i = expertMenu.Append(-1, "Install custom firmware") self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, "ReRun first run wizard...") self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i) menubar.Append(expertMenu, "Expert") helpMenu = wx.Menu() i = helpMenu.Append(-1, "Online documentation...") self.Bind(wx.EVT_MENU, lambda e: webbrowser.open("https://github.com/daid/Cura/wiki"), i) i = helpMenu.Append(-1, "Report a problem...") self.Bind(wx.EVT_MENU, lambda e: webbrowser.open("https://github.com/daid/Cura/issues"), i) menubar.Append(helpMenu, "Help") self.SetMenuBar(menubar) if profile.getPreference("lastFile") != "": self.filelist = profile.getPreference("lastFile").split(";") self.SetTitle(self.filelist[-1] + " - Cura - " + version.getVersion()) else: self.filelist = [] self.progressPanelList = [] # Preview window self.preview3d = preview3d.previewPanel(self) # Main tabs nb = wx.Notebook(self) (left, right) = self.CreateConfigTab(nb, "Print config") configBase.TitleRow(left, "Accuracy") c = configBase.SettingRow( left, "Layer height (mm)", "layer_height", "0.2", "Layer height in millimeters.\n0.2 is a good value for quick prints.\n0.1 gives high quality prints.", ) validators.validFloat(c, 0.0001) validators.warningAbove( c, lambda: (float(profile.getProfileSetting("nozzle_size")) * 80.0 / 100.0), "Thicker layers then %.2fmm (80%% nozzle size) usually give bad results and are not recommended.", ) c = configBase.SettingRow( left, "Wall thickness (mm)", "wall_thickness", "0.8", "Thickness of the walls.\nThis is used in combination with the nozzle size to define the number\nof perimeter lines and the thickness of those perimeter lines.", ) validators.validFloat(c, 0.0001) validators.wallThicknessValidator(c) configBase.TitleRow(left, "Fill") c = configBase.SettingRow( left, "Bottom/Top thickness (mm)", "solid_layer_thickness", "0.6", "This controls the thickness of the bottom and top layers, the amount of solid layers put down is calculated by the layer thickness and this value.\nHaving this value a multiply of the layer thickness makes sense. And keep it near your wall thickness to make an evenly strong part.", ) validators.validFloat(c, 0.0) c = configBase.SettingRow( left, "Fill Density (%)", "fill_density", "20", "This controls how densily filled the insides of your print will be. For a solid part use 100%, for an empty part use 0%. A value around 20% is usually enough", ) validators.validFloat(c, 0.0, 100.0) configBase.TitleRow(left, "Skirt") c = configBase.SettingRow( left, "Line count", "skirt_line_count", "1", "The skirt is a line drawn around the object at the first layer. This helps to prime your extruder, and to see if the object fits on your platform.\nSetting this to 0 will disable the skirt. Multiple skirt lines can help priming your extruder better for small objects.", ) validators.validInt(c, 0, 10) c = configBase.SettingRow( left, "Start distance (mm)", "skirt_gap", "6.0", "The distance between the skirt and the first layer.\nThis is the minimal distance, multiple skirt lines will be put outwards from this distance.", ) validators.validFloat(c, 0.0) configBase.TitleRow(right, "Speed && Temperature") c = configBase.SettingRow( right, "Print speed (mm/s)", "print_speed", "50", "Speed at which printing happens. A well adjusted Ultimaker can reach 150mm/s, but for good quality prints you want to print slower. Printing speed depends on a lot of factors. So you will be experimenting with optimal settings for this.", ) validators.validFloat(c, 1.0) validators.warningAbove( c, 150.0, "It is highly unlikely that your machine can achieve a printing speed above 150mm/s" ) validators.printSpeedValidator(c) # configBase.TitleRow(right, "Temperature") c = configBase.SettingRow( right, "Printing temperature", "print_temperature", "0", "Temperature used for printing. Set at 0 to pre-heat yourself", ) validators.validFloat(c, 0.0, 340.0) validators.warningAbove(c, 260.0, "Temperatures above 260C could damage your machine, be careful!") configBase.TitleRow(right, "Support") c = configBase.SettingRow( right, "Support type", "support", ["None", "Exterior Only", "Everywhere", "Empty Layers Only"], 'Type of support structure build.\n"Exterior only" is the most commonly used support setting.\n\nNone does not do any support.\nExterior only only creates support on the outside.\nEverywhere creates support even on the insides of the model.\nOnly on empty layers is for stacked objects.', ) c = configBase.SettingRow( right, "Add raft", "enable_raft", False, "A raft is a few layers of lines below the bottom of the object. It prevents warping. Full raft settings can be found in the expert settings.\nFor PLA this is usually not required. But if you print with ABS it is almost required.", ) configBase.TitleRow(right, "Filament") c = configBase.SettingRow( right, "Diameter (mm)", "filament_diameter", "2.89", "Diameter of your filament, as accurately as possible.\nIf you cannot measure this value you will have to callibrate it, a higher number means less extrusion, a smaller number generates more extrusion.", ) validators.validFloat(c, 1.0) validators.warningAbove( c, 3.5, "Are you sure your filament is that thick? Normal filament is around 3mm or 1.75mm." ) c = configBase.SettingRow( right, "Packing Density", "filament_density", "1.00", "Packing density of your filament. This should be 1.00 for PLA and 0.85 for ABS", ) validators.validFloat(c, 0.5, 1.5) (left, right) = self.CreateConfigTab(nb, "Advanced config") configBase.TitleRow(left, "Machine size") c = configBase.SettingRow( left, "Nozzle size (mm)", "nozzle_size", "0.4", "The nozzle size is very important, this is used to calculate the line width of the infill, and used to calculate the amount of outside wall lines and thickness for the wall thickness you entered in the print settings.", ) validators.validFloat(c, 0.1, 10.0) c = configBase.SettingRow( left, "Machine center X (mm)", "machine_center_x", "100", "The center of your machine, your print will be placed at this location", ) validators.validInt(c, 10) configBase.settingNotify(c, self.preview3d.updateCenterX) c = configBase.SettingRow( left, "Machine center Y (mm)", "machine_center_y", "100", "The center of your machine, your print will be placed at this location", ) validators.validInt(c, 10) configBase.settingNotify(c, self.preview3d.updateCenterY) configBase.TitleRow(left, "Retraction") c = configBase.SettingRow( left, "Minimal travel (mm)", "retraction_min_travel", "5.0", "Minimal amount of travel needed for a retraction to happen at all. To make sure you do not get a lot of retractions in a small area", ) validators.validFloat(c, 0.0) c = configBase.SettingRow( left, "Speed (mm/s)", "retraction_speed", "40.0", "Speed at which the filament is retracted, a higher retraction speed works better. But a very high retraction speed can lead to filament grinding.", ) validators.validFloat(c, 0.1) c = configBase.SettingRow( left, "Distance (mm)", "retraction_amount", "0.0", "Amount of retraction, set at 0 for no retraction at all. A value of 2.0mm seems to generate good results.", ) validators.validFloat(c, 0.0) c = configBase.SettingRow( left, "Extra length on start (mm)", "retraction_extra", "0.0", 'Extra extrusion amount when restarting after a retraction, to better "Prime" your extruder after retraction.', ) validators.validFloat(c, 0.0) configBase.TitleRow(right, "Speed") c = configBase.SettingRow( right, "Travel speed (mm/s)", "travel_speed", "150", "Speed at which travel moves are done, a high quality build Ultimaker can reach speeds of 250mm/s. But some machines might miss steps then.", ) validators.validFloat(c, 1.0) validators.warningAbove( c, 300.0, "It is highly unlikely that your machine can achieve a travel speed above 300mm/s" ) c = configBase.SettingRow( right, "Max Z speed (mm/s)", "max_z_speed", "1.0", "Speed at which Z moves are done. When you Z axis is properly lubercated you can increase this for less Z blob.", ) validators.validFloat(c, 0.5) c = configBase.SettingRow( right, "Bottom layer speed (mm/s)", "bottom_layer_speed", "25", "Print speed for the bottom layer, you want to print the first layer slower so it sticks better to the printer bed.", ) validators.validFloat(c, 0.0) configBase.TitleRow(right, "Cool") c = configBase.SettingRow( right, "Minimal layer time (sec)", "cool_min_layer_time", "10", "Minimum time spend in a layer, gives the layer time to cool down before the next layer is put on top. If the layer will be placed down too fast the printer will slow down to make sure it has spend atleast this amount of seconds printing this layer.", ) validators.validFloat(c, 0.0) c = configBase.SettingRow( right, "Enable cooling fan", "fan_enabled", True, "Enable the cooling fan during the print. The extra cooling from the cooling fan is essensial during faster prints.", ) configBase.TitleRow(right, "Accuracy") c = configBase.SettingRow( right, "Initial layer thickness (mm)", "bottom_thickness", "0.0", "Layer thickness of the bottom layer. A thicker bottom layer makes sticking to the bed easier. Set to 0.0 to have the bottom layer thickness the same as the other layers.", ) validators.validFloat(c, 0.0) validators.warningAbove( c, lambda: (float(profile.getProfileSetting("nozzle_size")) * 3.0 / 4.0), "A bottom layer of more then %.2fmm (3/4 nozzle size) usually give bad results and is not recommended.", ) c = configBase.SettingRow( right, "Enable 'skin'", "enable_skin", False, "Skin prints the outer lines of the prints twice, each time with half the thickness. This gives the illusion of a higher print quality.", ) nb.AddPage(alterationPanel.alterationPanel(nb), "Start/End-GCode") # load and slice buttons. loadButton = wx.Button(self, -1, "Load Model") sliceButton = wx.Button(self, -1, "Slice to GCode") printButton = wx.Button(self, -1, "Print GCode") self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(1), loadButton) self.Bind(wx.EVT_BUTTON, self.OnSlice, sliceButton) self.Bind(wx.EVT_BUTTON, self.OnPrint, printButton) extruderCount = int(profile.getPreference("extruder_amount")) if extruderCount > 1: loadButton2 = wx.Button(self, -1, "Load Dual") self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(2), loadButton2) if extruderCount > 2: loadButton3 = wx.Button(self, -1, "Load Triple") self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(3), loadButton3) if extruderCount > 3: loadButton4 = wx.Button(self, -1, "Load Quad") self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(4), loadButton4) # Also bind double clicking the 3D preview to load an STL file. self.preview3d.glCanvas.Bind( wx.EVT_LEFT_DCLICK, lambda e: self._showModelLoadDialog(1), self.preview3d.glCanvas ) # Main sizer, to position the preview window, buttons and tab control sizer = wx.GridBagSizer() self.SetSizer(sizer) sizer.Add(nb, (0, 0), span=(1, 1), flag=wx.EXPAND) sizer.Add(self.preview3d, (0, 1), span=(1, 2 + extruderCount), flag=wx.EXPAND) sizer.AddGrowableCol(2 + extruderCount) sizer.AddGrowableRow(0) sizer.Add(loadButton, (1, 1), flag=wx.RIGHT, border=5) if extruderCount > 1: sizer.Add(loadButton2, (1, 2), flag=wx.RIGHT, border=5) if extruderCount > 2: sizer.Add(loadButton3, (1, 3), flag=wx.RIGHT, border=5) if extruderCount > 3: sizer.Add(loadButton4, (1, 4), flag=wx.RIGHT, border=5) sizer.Add(sliceButton, (1, 1 + extruderCount), flag=wx.RIGHT, border=5) sizer.Add(printButton, (1, 2 + extruderCount), flag=wx.RIGHT, border=5) self.sizer = sizer if len(self.filelist) > 0: self.preview3d.loadModelFiles(self.filelist) self.updateProfileToControls() self.Fit() self.SetMinSize(self.GetSize()) self.Centre() self.Show(True)
def ifSettingIs(name, value): return lambda setting: profile.getProfileSetting(name) == value
def OnMulYSubClick(self, e): profile.putProfileSetting( 'model_multiply_y', str(max(1, int(profile.getProfileSetting('model_multiply_y')) - 1))) self.glCanvas.Refresh()
def raftLayerCount(setting): if profile.getProfileSetting('enable_raft') == "True": return '1' return '0'
def OnDraw(self): machineSize = self.parent.machineSize opengl.DrawMachine(machineSize) extraSizeMin = self.parent.headSizeMin extraSizeMax = self.parent.headSizeMax if profile.getProfileSettingFloat('skirt_line_count') > 0: skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap') extraSizeMin = extraSizeMin + util3d.Vector3(skirtSize, skirtSize, 0) extraSizeMax = extraSizeMax + util3d.Vector3(skirtSize, skirtSize, 0) if profile.getProfileSetting('support') != 'None': extraSizeMin = extraSizeMin + util3d.Vector3(3.0, 0, 0) extraSizeMax = extraSizeMax + util3d.Vector3(3.0, 0, 0) if self.parent.printMode == 1: extraSizeMin = util3d.Vector3(6.0, 6.0, 0) extraSizeMax = util3d.Vector3(6.0, 6.0, 0) for item in self.parent.list: item.validPlacement = True item.gotHit = False for idx1 in xrange(0, len(self.parent.list)): item = self.parent.list[idx1] iMin1 = item.getMinimum() * item.scale + util3d.Vector3(item.centerX, item.centerY, 0) - extraSizeMin - self.parent.extruderOffset[item.extruder] iMax1 = item.getMaximum() * item.scale + util3d.Vector3(item.centerX, item.centerY, 0) + extraSizeMax - self.parent.extruderOffset[item.extruder] for idx2 in xrange(0, idx1): item2 = self.parent.list[idx2] iMin2 = item2.getMinimum() * item2.scale + util3d.Vector3(item2.centerX, item2.centerY, 0) iMax2 = item2.getMaximum() * item2.scale + util3d.Vector3(item2.centerX, item2.centerY, 0) if item != item2 and iMax1.x >= iMin2.x and iMin1.x <= iMax2.x and iMax1.y >= iMin2.y and iMin1.y <= iMax2.y: item.validPlacement = False item2.gotHit = True seenSelected = False for item in self.parent.list: if item == self.parent.selection: seenSelected = True if item.modelDisplayList == None: item.modelDisplayList = glGenLists(1); if item.modelDirty: item.modelDirty = False modelSize = item.getMaximum() - item.getMinimum() glNewList(item.modelDisplayList, GL_COMPILE) opengl.DrawSTL(item) glEndList() if item.validPlacement: if self.parent.selection == item: glLightfv(GL_LIGHT0, GL_DIFFUSE, [1.0, 0.9, 0.7, 1.0]) glLightfv(GL_LIGHT0, GL_AMBIENT, [0.2, 0.3, 0.2, 0.0]) else: glLightfv(GL_LIGHT0, GL_DIFFUSE, [1.0, 0.8, 0.6, 1.0]) glLightfv(GL_LIGHT0, GL_AMBIENT, [0.2, 0.1, 0.1, 0.0]) else: if self.parent.selection == item: glLightfv(GL_LIGHT0, GL_DIFFUSE, [1.0, 0.0, 0.0, 0.0]) glLightfv(GL_LIGHT0, GL_AMBIENT, [0.2, 0.0, 0.0, 0.0]) else: glLightfv(GL_LIGHT0, GL_DIFFUSE, [1.0, 0.0, 0.0, 0.0]) glLightfv(GL_LIGHT0, GL_AMBIENT, [0.2, 0.0, 0.0, 0.0]) glPushMatrix() glEnable(GL_LIGHTING) glTranslate(item.centerX, item.centerY, 0) glPushMatrix() glEnable(GL_NORMALIZE) glScalef(item.scale, item.scale, item.scale) glCallList(item.modelDisplayList) glPopMatrix() vMin = item.getMinimum() * item.scale vMax = item.getMaximum() * item.scale vMinHead = vMin - extraSizeMin - self.parent.extruderOffset[item.extruder] vMaxHead = vMax + extraSizeMax - self.parent.extruderOffset[item.extruder] glDisable(GL_LIGHTING) if self.parent.selection == item: if item.gotHit: glColor3f(1.0,0.0,0.3) else: glColor3f(1.0,0.0,1.0) opengl.DrawBox(vMin, vMax) if item.gotHit: glColor3f(1.0,0.3,0.0) else: glColor3f(1.0,1.0,0.0) opengl.DrawBox(vMinHead, vMaxHead) elif seenSelected: if item.gotHit: glColor3f(0.5,0.0,0.1) else: glColor3f(0.5,0.0,0.5) opengl.DrawBox(vMinHead, vMaxHead) else: if item.gotHit: glColor3f(0.7,0.1,0.0) else: glColor3f(0.7,0.7,0.0) opengl.DrawBox(vMin, vMax) glPopMatrix() glFlush()
def getProfileInformation(): return { 'carve': { 'Add_Layer_Template_to_SVG': DEFSET, 'Edge_Width_mm': calculateEdgeWidth, 'Extra_Decimal_Places_float': DEFSET, 'Import_Coarseness_ratio': DEFSET, 'Layer_Height_mm': storedSettingFloat("layer_height"), 'Layers_From_index': calcLayerSkip, 'Layers_To_index': DEFSET, 'Correct_Mesh': DEFSET, 'Unproven_Mesh': DEFSET, 'SVG_Viewer': DEFSET, 'FlipX': storedSetting("flip_x"), 'FlipY': storedSetting("flip_y"), 'FlipZ': storedSetting("flip_z"), 'SwapXZ': storedSetting("swap_xz"), 'SwapYZ': storedSetting("swap_yz"), 'Scale': storedSettingFloat("model_scale"), 'Rotate': storedSettingFloat("model_rotate_base"), 'CenterX': storedSettingFloat("machine_center_x"), 'CenterY': storedSettingFloat("machine_center_y"), 'AlternativeCenterFile': storedSetting("alternative_center"), },'scale': { 'Activate_Scale': "False", 'XY_Plane_Scale_ratio': DEFSET, 'Z_Axis_Scale_ratio': DEFSET, 'SVG_Viewer': DEFSET, },'bottom': { 'Activate_Bottom': DEFSET, 'Additional_Height_over_Layer_Thickness_ratio': DEFSET, 'Altitude_mm': calcExtraBottomThickness, 'SVG_Viewer': DEFSET, },'preface': { 'Meta': DEFSET, 'Set_Positioning_to_Absolute': "False", 'Set_Units_to_Millimeters': "False", 'Start_at_Home': DEFSET, 'Turn_Extruder_Off_at_Shut_Down': DEFSET, 'Turn_Extruder_Off_at_Start_Up': DEFSET, },'widen': { 'Activate_Widen': DEFSET, 'Widen_Width_over_Edge_Width_ratio': DEFSET, },'inset': { 'Add_Custom_Code_for_Temperature_Reading': "False", 'Infill_in_Direction_of_Bridge': ifSettingAboveZero('fill_density'), 'Infill_Width': storedSettingFloat("nozzle_size"), 'Loop_Order_Choice': DEFSET, 'Overlap_Removal_Width_over_Perimeter_Width_ratio': DEFSET, 'Turn_Extruder_Heater_Off_at_Shut_Down': "False", 'Volume_Fraction_ratio': DEFSET, },'fill': { 'Activate_Fill': "True", 'Solid_Surface_Top': storedSetting("solid_top"), 'Override_First_Layer_Sequence': storedSetting("force_first_layer_sequence"), 'Diaphragm_Period_layers': DEFSET, 'Diaphragm_Thickness_layers': DEFSET, 'Extra_Shells_on_Alternating_Solid_Layer_layers': calculateShells, 'Extra_Shells_on_Base_layers': calculateShellsBase, 'Extra_Shells_on_Sparse_Layer_layers': calculateShells, 'Grid_Circle_Separation_over_Perimeter_Width_ratio': DEFSET, 'Grid_Extra_Overlap_ratio': DEFSET, 'Grid_Junction_Separation_Band_Height_layers': DEFSET, 'Grid_Junction_Separation_over_Octogon_Radius_At_End_ratio': DEFSET, 'Grid_Junction_Separation_over_Octogon_Radius_At_Middle_ratio': DEFSET, 'Infill_Begin_Rotation_degrees': DEFSET, 'Infill_Begin_Rotation_Repeat_layers': DEFSET, 'Infill_Odd_Layer_Extra_Rotation_degrees': DEFSET, 'Grid_Circular': ifSettingIs('infill_type', 'Grid Circular'), 'Grid_Hexagonal': ifSettingIs('infill_type', 'Grid Hexagonal'), 'Grid_Rectangular': ifSettingIs('infill_type', 'Grid Rectangular'), 'Line': ifSettingIs('infill_type', 'Line'), 'Infill_Perimeter_Overlap_ratio': storedPercentSetting('fill_overlap'), 'Infill_Solidity_ratio': storedPercentSetting('fill_density'), 'Infill_Width': storedSettingFloat("nozzle_size"), 'Sharpest_Angle_degrees': DEFSET, 'Solid_Surface_Thickness_layers': calculateSolidLayerCount, 'Start_From_Choice': DEFSET, 'Surrounding_Angle_degrees': DEFSET, 'Thread_Sequence_Choice': storedSetting('sequence'), },'multiply': { 'Activate_Multiply': "False", 'Center_X_mm': storedSettingFloat("machine_center_x"), 'Center_Y_mm': storedSettingFloat("machine_center_y"), 'Number_of_Columns_integer': storedSetting('model_multiply_x'), 'Number_of_Rows_integer': storedSetting('model_multiply_y'), 'Reverse_Sequence_every_Odd_Layer': DEFSET, 'Separation_over_Perimeter_Width_ratio': calculateMultiplyDistance, },'speed': { 'Activate_Speed': "True", 'Add_Flow_Rate': "True", 'Bridge_Feed_Rate_Multiplier_ratio': storedPercentSetting('bridge_speed'), 'Bridge_Flow_Rate_Multiplier_ratio': storedPercentSetting('bridge_speed'), 'Duty_Cyle_at_Beginning_portion': DEFSET, 'Duty_Cyle_at_Ending_portion': DEFSET, 'Feed_Rate_mm/s': storedSettingFloat("print_speed"), 'Flow_Rate_Setting_float': storedSettingFloat("print_speed"), 'Object_First_Layer_Feed_Rate_Infill_Multiplier_ratio': firstLayerSpeedRatio, 'Object_First_Layer_Feed_Rate_Perimeter_Multiplier_ratio': firstLayerSpeedRatio, 'Object_First_Layer_Feed_Rate_Travel_Multiplier_ratio': firstLayerSpeedRatio, 'Object_First_Layer_Flow_Rate_Infill_Multiplier_ratio': firstLayerSpeedRatio, 'Object_First_Layer_Flow_Rate_Perimeter_Multiplier_ratio': firstLayerSpeedRatio, 'Object_First_Layers_Amount_Of_Layers_For_Speed_Change': DEFSET, 'Orbital_Feed_Rate_over_Operating_Feed_Rate_ratio': DEFSET, 'Maximum_Z_Feed_Rate_mm/s': DEFSET, 'Perimeter_Feed_Rate_Multiplier_ratio': DEFSET, 'Perimeter_Flow_Rate_Multiplier_ratio': DEFSET, 'Travel_Feed_Rate_mm/s': storedSettingFloat("travel_speed"), 'Bottom_layer_flow_rate_ratio': calcBottomLayerFlowRateRatio, },'temperature': { 'Activate_Temperature': DEFSET,#ifSettingAboveZero('print_temperature'), 'Cooling_Rate_Celcius/second': DEFSET, 'Heating_Rate_Celcius/second': DEFSET, 'Base_Temperature_Celcius': DEFSET,#storedSettingFloat("print_temperature"), 'Interface_Temperature_Celcius': DEFSET,#storedSettingFloat("print_temperature"), 'Object_First_Layer_Infill_Temperature_Celcius': DEFSET,#storedSettingFloat("print_temperature"), 'Object_First_Layer_Perimeter_Temperature_Celcius': DEFSET,#storedSettingFloat("print_temperature"), 'Object_Next_Layers_Temperature_Celcius': DEFSET,#storedSettingFloat("print_temperature"), 'Support_Layers_Temperature_Celcius': DEFSET,#storedSettingFloat("print_temperature"), 'Supported_Layers_Temperature_Celcius': DEFSET,#storedSettingFloat("print_temperature"), },'raft': { 'Activate_Raft': "True", 'Add_Raft,_Elevate_Nozzle,_Orbit': DEFSET, 'Base_Feed_Rate_Multiplier_ratio': DEFSET, 'Base_Flow_Rate_Multiplier_ratio': storedPercentSetting('raft_base_material_amount'), 'Base_Infill_Density_ratio': DEFSET, 'Base_Layer_Thickness_over_Layer_Thickness': DEFSET, 'Base_Layers_integer': raftLayerCount, 'Base_Nozzle_Lift_over_Base_Layer_Thickness_ratio': DEFSET, 'Initial_Circling': DEFSET, 'Infill_Overhang_over_Extrusion_Width_ratio': DEFSET, 'Interface_Feed_Rate_Multiplier_ratio': DEFSET, 'Interface_Flow_Rate_Multiplier_ratio': storedPercentSetting('raft_interface_material_amount'), 'Interface_Infill_Density_ratio': DEFSET, 'Interface_Layer_Thickness_over_Layer_Thickness': DEFSET, 'Interface_Layers_integer': raftLayerCount, 'Interface_Nozzle_Lift_over_Interface_Layer_Thickness_ratio': DEFSET, 'Name_of_Support_End_File': DEFSET, 'Name_of_Support_Start_File': DEFSET, 'Operating_Nozzle_Lift_over_Layer_Thickness_ratio': DEFSET, 'Raft_Additional_Margin_over_Length_%': DEFSET, 'Raft_Margin_mm': storedSettingFloat('raft_margin'), 'Support_Cross_Hatch': 'False', 'Support_Flow_Rate_over_Operating_Flow_Rate_ratio': storedPercentSetting('support_rate'), 'Support_Gap_over_Perimeter_Extrusion_Width_ratio': calcSupportDistanceRatio, 'Support_Material_Choice_': storedSetting('support'), 'Support_Minimum_Angle_degrees': DEFSET, 'Support_Margin_mm': '3.0', 'Support_Offset_X_mm': lambda setting: -profile.getPreferenceFloat('extruder_offset_x1') if profile.getProfileSetting('support_dual_extrusion') == 'True' and int(profile.getPreference('extruder_amount')) > 1 else '0', 'Support_Offset_Y_mm': lambda setting: -profile.getPreferenceFloat('extruder_offset_y1') if profile.getProfileSetting('support_dual_extrusion') == 'True' and int(profile.getPreference('extruder_amount')) > 1 else '0', },'skirt': { 'Skirt_line_count': storedSetting("skirt_line_count"), 'Convex': "True", 'Gap_Width_mm': storedSetting("skirt_gap"), 'Layers_To_index': "1", },'joris': { 'Activate_Joris': storedSetting("joris"), 'Layers_From_index': calculateSolidLayerCount, },'chamber': { 'Activate_Chamber': "False", 'Bed_Temperature_Celcius': DEFSET, 'Bed_Temperature_Begin_Change_Height_mm': DEFSET, 'Bed_Temperature_End_Change_Height_mm': DEFSET, 'Bed_Temperature_End_Celcius': DEFSET, 'Chamber_Temperature_Celcius': DEFSET, 'Holding_Force_bar': DEFSET, },'tower': { 'Activate_Tower': "False", 'Extruder_Possible_Collision_Cone_Angle_degrees': DEFSET, 'Maximum_Tower_Height_layers': DEFSET, 'Tower_Start_Layer_integer': DEFSET, },'jitter': { 'Activate_Jitter': "False", 'Jitter_Over_Perimeter_Width_ratio': DEFSET, },'clip': { 'Activate_Clip': "False", 'Clip_Over_Perimeter_Width_ratio': DEFSET, 'Maximum_Connection_Distance_Over_Perimeter_Width_ratio': DEFSET, },'smooth': { 'Activate_Smooth': "False", 'Layers_From_index': DEFSET, 'Maximum_Shortening_over_Width_float': DEFSET, },'stretch': { 'Activate_Stretch': "False", 'Cross_Limit_Distance_Over_Perimeter_Width_ratio': DEFSET, 'Loop_Stretch_Over_Perimeter_Width_ratio': DEFSET, 'Path_Stretch_Over_Perimeter_Width_ratio': DEFSET, 'Perimeter_Inside_Stretch_Over_Perimeter_Width_ratio': DEFSET, 'Perimeter_Outside_Stretch_Over_Perimeter_Width_ratio': DEFSET, 'Stretch_From_Distance_Over_Perimeter_Width_ratio': DEFSET, },'skin': { 'Activate_Skin': storedSetting("enable_skin"), 'Horizontal_Infill_Divisions_integer': "1", 'Horizontal_Perimeter_Divisions_integer': "1", 'Vertical_Divisions_integer': "2", 'Hop_When_Extruding_Infill': "False", 'Layers_From_index': "1", },'comb': { 'Activate_Comb': "True", 'Running_Jump_Space_mm': DEFSET, },'cool': { 'Activate_Cool': "True", 'Bridge_Cool_Celcius': DEFSET, 'Cool_Type': DEFSET, 'Maximum_Cool_Celcius': DEFSET, 'Minimum_Layer_Time_seconds': storedSettingFloat("cool_min_layer_time"), 'Minimum_Orbital_Radius_millimeters': DEFSET, 'Name_of_Cool_End_File': DEFSET, 'Name_of_Cool_Start_File': DEFSET, 'Orbital_Outset_millimeters': DEFSET, 'Turn_Fan_On_at_Beginning': storedSetting("fan_enabled"), 'Turn_Fan_Off_at_Ending': storedSetting("fan_enabled"), 'Minimum_feed_rate_mm/s': storedSettingFloat("cool_min_feedrate"), 'Fan_on_at_layer': storedSettingInt('fan_layer'), 'Fan_speed_min_%': storedSettingInt('fan_speed'), 'Fan_speed_max_%': storedSettingInt('fan_speed_max'), },'hop': { 'Activate_Hop': "False", 'Hop_Over_Layer_Thickness_ratio': DEFSET, 'Minimum_Hop_Angle_degrees': DEFSET, },'wipe': { 'Activate_Wipe': "False", 'Arrival_X_mm': DEFSET, 'Arrival_Y_mm': DEFSET, 'Arrival_Z_mm': DEFSET, 'Departure_X_mm': DEFSET, 'Departure_Y_mm': DEFSET, 'Departure_Z_mm': DEFSET, 'Wipe_X_mm': DEFSET, 'Wipe_Y_mm': DEFSET, 'Wipe_Z_mm': DEFSET, 'Wipe_Period_layers': DEFSET, },'oozebane': { 'Activate_Oozebane': "False", 'After_Startup_Distance_millimeters': DEFSET, 'Early_Shutdown_Distance_millimeters': DEFSET, 'Early_Startup_Distance_Constant_millimeters': DEFSET, 'Early_Startup_Maximum_Distance_millimeters': DEFSET, 'First_Early_Startup_Distance_millimeters': DEFSET, 'Minimum_Distance_for_Early_Startup_millimeters': DEFSET, 'Minimum_Distance_for_Early_Shutdown_millimeters': DEFSET, 'Slowdown_Startup_Steps_positive_integer': DEFSET, },'dwindle': { 'Activate_Dwindle': "False", 'End_Rate_Multiplier_ratio': '0.5', 'Pent_Up_Volume_cubic_millimeters': "0.4", 'Slowdown_Steps_positive_integer': '5', 'Slowdown_Volume_cubic_millimeters': "5.0", },'splodge': { 'Activate_Splodge': "False", 'Initial_Lift_over_Extra_Thickness_ratio': DEFSET, 'Initial_Splodge_Feed_Rate_mm/s': DEFSET, 'Operating_Splodge_Feed_Rate_mm/s': DEFSET, 'Operating_Splodge_Quantity_Length_millimeters': DEFSET, 'Initial_Splodge_Quantity_Length_millimeters': DEFSET, 'Operating_Lift_over_Extra_Thickness_ratio': DEFSET, },'home': { 'Activate_Home': "False", 'Name_of_Home_File': DEFSET, },'lash': { 'Activate_Lash': "False", 'X_Backlash_mm': DEFSET, 'Y_Backlash_mm': DEFSET, },'fillet': { 'Activate_Fillet': "False", 'Arc_Point': DEFSET, 'Arc_Radius': DEFSET, 'Arc_Segment': DEFSET, 'Bevel': DEFSET, 'Corner_Feed_Rate_Multiplier_ratio': DEFSET, 'Fillet_Radius_over_Perimeter_Width_ratio': DEFSET, 'Reversal_Slowdown_Distance_over_Perimeter_Width_ratio': DEFSET, 'Use_Intermediate_Feed_Rate_in_Corners': DEFSET, },'limit': { 'Activate_Limit': "False", 'Maximum_Initial_Feed_Rate_mm/s': DEFSET, },'unpause': { 'Activate_Unpause': "False", 'Delay_milliseconds': DEFSET, 'Maximum_Speed_ratio': DEFSET, },'dimension': { 'Activate_Dimension': "True", 'Absolute_Extrusion_Distance': "True", 'Relative_Extrusion_Distance': "False", 'Extruder_Retraction_Speed_mm/s': storedSettingFloat('retraction_speed'), 'Filament_Diameter_mm': storedSettingFloat("filament_diameter"), 'Filament_Packing_Density_ratio': storedSettingFloat("filament_density"), 'Maximum_E_Value_before_Reset_float': DEFSET, 'Minimum_Travel_for_Retraction_millimeters': storedSettingFloat("retraction_min_travel"), 'Retract_Within_Island': storedSettingInvertBoolean("retract_on_jumps_only"), 'Retraction_Distance_millimeters': lambda setting: profile.getProfileSettingFloat('retraction_amount') if profile.getProfileSetting('retraction_enable') == 'True' else 0, 'Restart_Extra_Distance_millimeters': storedSettingFloat('retraction_extra'), },'alteration': { 'Activate_Alteration': storedSetting('add_start_end_gcode'), 'Name_of_End_File': "end.gcode", 'Name_of_Start_File': "start.gcode", 'Remove_Redundant_Mcode': "True", 'Replace_Variable_with_Setting': DEFSET, },'export': { 'Activate_Export': "True", 'Add_Descriptive_Extension': DEFSET, 'Add_Export_Suffix': DEFSET, 'Add_Profile_Extension': DEFSET, 'Add_Timestamp_Extension': DEFSET, 'Also_Send_Output_To': DEFSET, 'Analyze_Gcode': DEFSET, 'Comment_Choice': DEFSET, 'Do_Not_Change_Output': DEFSET, 'binary_16_byte': DEFSET, 'gcode_step': DEFSET, 'gcode_time_segment': DEFSET, 'gcode_small': DEFSET, 'File_Extension': storedSetting('gcode_extension'), 'Name_of_Replace_File': DEFSET, 'Save_Penultimate_Gcode': "False", } }
def OnMulYSubClick(self, e): profile.putProfileSetting('model_multiply_y', str(max(1, int(profile.getProfileSetting('model_multiply_y'))-1))) self.glCanvas.Refresh()
def __init__(self): super(mainWindow, self).__init__(title='Cura - ' + version.getVersion()) extruderCount = int(profile.getPreference('extruder_amount')) wx.EVT_CLOSE(self, self.OnClose) #self.SetIcon(icon.getMainIcon()) self.SetDropTarget( dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.supportedExtensions())) menubar = wx.MenuBar() fileMenu = wx.Menu() i = fileMenu.Append(-1, 'Load model file...\tCTRL+L') self.Bind(wx.EVT_MENU, lambda e: self._showModelLoadDialog(1), i) i = fileMenu.Append(-1, 'Prepare print...\tCTRL+R') self.Bind(wx.EVT_MENU, self.OnSlice, i) i = fileMenu.Append(-1, 'Print...\tCTRL+P') self.Bind(wx.EVT_MENU, self.OnPrint, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, 'Open Profile...') self.Bind(wx.EVT_MENU, self.OnLoadProfile, i) i = fileMenu.Append(-1, 'Save Profile...') self.Bind(wx.EVT_MENU, self.OnSaveProfile, i) i = fileMenu.Append(-1, 'Load Profile from GCode...') self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, 'Reset Profile to default') self.Bind(wx.EVT_MENU, self.OnResetProfile, i) fileMenu.AppendSeparator() i = fileMenu.Append(-1, 'Preferences...\tCTRL+,') self.Bind(wx.EVT_MENU, self.OnPreferences, i) fileMenu.AppendSeparator() i = fileMenu.Append(wx.ID_EXIT, 'Quit') self.Bind(wx.EVT_MENU, self.OnQuit, i) menubar.Append(fileMenu, '&File') toolsMenu = wx.Menu() i = toolsMenu.Append(-1, 'Switch to Quickprint...') self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i) toolsMenu.AppendSeparator() i = toolsMenu.Append(-1, 'Batch run...') self.Bind(wx.EVT_MENU, self.OnBatchRun, i) i = toolsMenu.Append(-1, 'Project planner...') self.Bind(wx.EVT_MENU, self.OnProjectPlanner, i) # i = toolsMenu.Append(-1, 'Open SVG (2D) slicer...') # self.Bind(wx.EVT_MENU, self.OnSVGSlicerOpen, i) menubar.Append(toolsMenu, 'Tools') expertMenu = wx.Menu() i = expertMenu.Append(-1, 'Open expert settings...') self.Bind(wx.EVT_MENU, self.OnExpertOpen, i) expertMenu.AppendSeparator() if firmwareInstall.getDefaultFirmware() != None: i = expertMenu.Append(-1, 'Install default Marlin firmware') self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, i) i = expertMenu.Append(-1, 'Install custom firmware') self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i) expertMenu.AppendSeparator() i = expertMenu.Append(-1, 'ReRun first run wizard...') self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i) menubar.Append(expertMenu, 'Expert') helpMenu = wx.Menu() i = helpMenu.Append(-1, 'Online documentation...') self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://daid.github.com/Cura'), i) i = helpMenu.Append(-1, 'Report a problem...') self.Bind( wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i) menubar.Append(helpMenu, 'Help') self.SetMenuBar(menubar) if profile.getPreference('lastFile') != '': self.filelist = profile.getPreference('lastFile').split(';') self.SetTitle('Cura - %s - %s' % (version.getVersion(), self.filelist[-1])) else: self.filelist = [] self.progressPanelList = [] #Preview window self.preview3d = preview3d.previewPanel(self) #Main tabs nb = wx.Notebook(self) (left, right) = self.CreateConfigTab(nb, 'Print config') configBase.TitleRow(left, "Accuracy") c = configBase.SettingRow( left, "Layer height (mm)", 'layer_height', '0.2', 'Layer height in millimeters.\n0.2 is a good value for quick prints.\n0.1 gives high quality prints.' ) validators.validFloat(c, 0.0001) validators.warningAbove( c, lambda: (float(profile.getProfileSetting('nozzle_size')) * 80.0 / 100.0), "Thicker layers then %.2fmm (80%% nozzle size) usually give bad results and are not recommended." ) c = configBase.SettingRow( left, "Wall thickness (mm)", 'wall_thickness', '0.8', 'Thickness of the walls.\nThis is used in combination with the nozzle size to define the number\nof perimeter lines and the thickness of those perimeter lines.' ) validators.validFloat(c, 0.0001) validators.wallThicknessValidator(c) c = configBase.SettingRow( left, "Enable retraction", 'retraction_enable', False, 'Retract the filament when the nozzle is moving over a none-printed area. Details about the retraction can be configured in the advanced tab.' ) configBase.TitleRow(left, "Fill") c = configBase.SettingRow( left, "Bottom/Top thickness (mm)", 'solid_layer_thickness', '0.6', 'This controls the thickness of the bottom and top layers, the amount of solid layers put down is calculated by the layer thickness and this value.\nHaving this value a multiply of the layer thickness makes sense. And keep it near your wall thickness to make an evenly strong part.' ) validators.validFloat(c, 0.0) c = configBase.SettingRow( left, "Fill Density (%)", 'fill_density', '20', 'This controls how densily filled the insides of your print will be. For a solid part use 100%, for an empty part use 0%. A value around 20% is usually enough' ) validators.validFloat(c, 0.0, 100.0) configBase.TitleRow(left, "Skirt") c = configBase.SettingRow( left, "Line count", 'skirt_line_count', '1', 'The skirt is a line drawn around the object at the first layer. This helps to prime your extruder, and to see if the object fits on your platform.\nSetting this to 0 will disable the skirt. Multiple skirt lines can help priming your extruder better for small objects.' ) validators.validInt(c, 0, 10) c = configBase.SettingRow( left, "Start distance (mm)", 'skirt_gap', '6.0', 'The distance between the skirt and the first layer.\nThis is the minimal distance, multiple skirt lines will be put outwards from this distance.' ) validators.validFloat(c, 0.0) configBase.TitleRow(right, "Speed && Temperature") c = configBase.SettingRow( right, "Print speed (mm/s)", 'print_speed', '50', 'Speed at which printing happens. A well adjusted Ultimaker can reach 150mm/s, but for good quality prints you want to print slower. Printing speed depends on a lot of factors. So you will be experimenting with optimal settings for this.' ) validators.validFloat(c, 1.0) validators.warningAbove( c, 150.0, "It is highly unlikely that your machine can achieve a printing speed above 150mm/s" ) validators.printSpeedValidator(c) #configBase.TitleRow(right, "Temperature") c = configBase.SettingRow( right, "Printing temperature", 'print_temperature', '0', 'Temperature used for printing. Set at 0 to pre-heat yourself') validators.validFloat(c, 0.0, 340.0) validators.warningAbove( c, 260.0, "Temperatures above 260C could damage your machine, be careful!") if profile.getPreference('has_heated_bed') == 'True': c = configBase.SettingRow( right, "Bed temperature", 'print_bed_temperature', '0', 'Temperature used for the heated printer bed. Set at 0 to pre-heat yourself' ) validators.validFloat(c, 0.0, 340.0) configBase.TitleRow(right, "Support structure") c = configBase.SettingRow( right, "Support type", 'support', ['None', 'Exterior Only', 'Everywhere'], 'Type of support structure build.\n"Exterior only" is the most commonly used support setting.\n\nNone does not do any support.\nExterior only only creates support where the support structure will touch the build platform.\nEverywhere creates support even on the insides of the model.' ) c = configBase.SettingRow( right, "Add raft", 'enable_raft', False, 'A raft is a few layers of lines below the bottom of the object. It prevents warping. Full raft settings can be found in the expert settings.\nFor PLA this is usually not required. But if you print with ABS it is almost required.' ) if extruderCount > 1: c = configBase.SettingRow( right, "Support dual extrusion", 'support_dual_extrusion', False, 'Print the support material with the 2nd extruder in a dual extrusion setup. The primary extruder will be used for normal material, while the second extruder is used to print support material.' ) configBase.TitleRow(right, "Filament") c = configBase.SettingRow( right, "Diameter (mm)", 'filament_diameter', '2.89', 'Diameter of your filament, as accurately as possible.\nIf you cannot measure this value you will have to callibrate it, a higher number means less extrusion, a smaller number generates more extrusion.' ) validators.validFloat(c, 1.0) validators.warningAbove( c, 3.5, "Are you sure your filament is that thick? Normal filament is around 3mm or 1.75mm." ) c = configBase.SettingRow( right, "Packing Density", 'filament_density', '1.00', 'Packing density of your filament. This should be 1.00 for PLA and 0.85 for ABS' ) validators.validFloat(c, 0.5, 1.5) (left, right) = self.CreateConfigTab(nb, 'Advanced config') configBase.TitleRow(left, "Machine size") c = configBase.SettingRow( left, "Nozzle size (mm)", 'nozzle_size', '0.4', 'The nozzle size is very important, this is used to calculate the line width of the infill, and used to calculate the amount of outside wall lines and thickness for the wall thickness you entered in the print settings.' ) validators.validFloat(c, 0.1, 10.0) c = configBase.SettingRow( left, "Machine center X (mm)", 'machine_center_x', '100', 'The center of your machine, your print will be placed at this location' ) validators.validInt(c, 10) configBase.settingNotify(c, self.preview3d.updateCenterX) c = configBase.SettingRow( left, "Machine center Y (mm)", 'machine_center_y', '100', 'The center of your machine, your print will be placed at this location' ) validators.validInt(c, 10) configBase.settingNotify(c, self.preview3d.updateCenterY) configBase.TitleRow(left, "Retraction") c = configBase.SettingRow( left, "Minimal travel (mm)", 'retraction_min_travel', '5.0', 'Minimal amount of travel needed for a retraction to happen at all. To make sure you do not get a lot of retractions in a small area' ) validators.validFloat(c, 0.0) c = configBase.SettingRow( left, "Speed (mm/s)", 'retraction_speed', '40.0', 'Speed at which the filament is retracted, a higher retraction speed works better. But a very high retraction speed can lead to filament grinding.' ) validators.validFloat(c, 0.1) c = configBase.SettingRow( left, "Distance (mm)", 'retraction_amount', '0.0', 'Amount of retraction, set at 0 for no retraction at all. A value of 2.0mm seems to generate good results.' ) validators.validFloat(c, 0.0) c = configBase.SettingRow( left, "Extra length on start (mm)", 'retraction_extra', '0.0', 'Extra extrusion amount when restarting after a retraction, to better "Prime" your extruder after retraction.' ) validators.validFloat(c, 0.0) configBase.TitleRow(right, "Speed") c = configBase.SettingRow( right, "Travel speed (mm/s)", 'travel_speed', '150', 'Speed at which travel moves are done, a high quality build Ultimaker can reach speeds of 250mm/s. But some machines might miss steps then.' ) validators.validFloat(c, 1.0) validators.warningAbove( c, 300.0, "It is highly unlikely that your machine can achieve a travel speed above 300mm/s" ) c = configBase.SettingRow( right, "Max Z speed (mm/s)", 'max_z_speed', '1.0', 'Speed at which Z moves are done. When you Z axis is properly lubercated you can increase this for less Z blob.' ) validators.validFloat(c, 0.5) c = configBase.SettingRow( right, "Bottom layer speed (mm/s)", 'bottom_layer_speed', '25', 'Print speed for the bottom layer, you want to print the first layer slower so it sticks better to the printer bed.' ) validators.validFloat(c, 0.0) configBase.TitleRow(right, "Cool") c = configBase.SettingRow( right, "Minimal layer time (sec)", 'cool_min_layer_time', '10', 'Minimum time spend in a layer, gives the layer time to cool down before the next layer is put on top. If the layer will be placed down too fast the printer will slow down to make sure it has spend atleast this amount of seconds printing this layer.' ) validators.validFloat(c, 0.0) c = configBase.SettingRow( right, "Enable cooling fan", 'fan_enabled', True, 'Enable the cooling fan during the print. The extra cooling from the cooling fan is essensial during faster prints.' ) configBase.TitleRow(right, "Accuracy") c = configBase.SettingRow( right, "Initial layer thickness (mm)", 'bottom_thickness', '0.0', 'Layer thickness of the bottom layer. A thicker bottom layer makes sticking to the bed easier. Set to 0.0 to have the bottom layer thickness the same as the other layers.' ) validators.validFloat(c, 0.0) validators.warningAbove( c, lambda: (float(profile.getProfileSetting('nozzle_size')) * 3.0 / 4.0), "A bottom layer of more then %.2fmm (3/4 nozzle size) usually give bad results and is not recommended." ) c = configBase.SettingRow( right, "Enable 'skin'", 'enable_skin', False, 'Skin prints the outer lines of the prints twice, each time with half the thickness. This gives the illusion of a higher print quality.' ) #Plugin page self.pluginPanel = pluginPanel.pluginPanel(nb) if len(self.pluginPanel.pluginList) > 0: nb.AddPage(self.pluginPanel, "Plugins") else: self.pluginPanel.Show(False) #Alteration page self.alterationPanel = alterationPanel.alterationPanel(nb) nb.AddPage(self.alterationPanel, "Start/End-GCode") # load and slice buttons. loadButton = wx.Button(self, -1, '&Load Model') sliceButton = wx.Button(self, -1, 'P&repare print') printButton = wx.Button(self, -1, '&Print') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(1), loadButton) self.Bind(wx.EVT_BUTTON, self.OnSlice, sliceButton) self.Bind(wx.EVT_BUTTON, self.OnPrint, printButton) if extruderCount > 1: loadButton2 = wx.Button(self, -1, 'Load Dual') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(2), loadButton2) if extruderCount > 2: loadButton3 = wx.Button(self, -1, 'Load Triple') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(3), loadButton3) if extruderCount > 3: loadButton4 = wx.Button(self, -1, 'Load Quad') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(4), loadButton4) #Also bind double clicking the 3D preview to load an STL file. self.preview3d.glCanvas.Bind(wx.EVT_LEFT_DCLICK, lambda e: self._showModelLoadDialog(1), self.preview3d.glCanvas) #Main sizer, to position the preview window, buttons and tab control sizer = wx.GridBagSizer() self.SetSizer(sizer) sizer.Add(nb, (0, 0), span=(1, 1), flag=wx.EXPAND) sizer.Add(self.preview3d, (0, 1), span=(1, 2 + extruderCount), flag=wx.EXPAND) sizer.AddGrowableCol(2 + extruderCount) sizer.AddGrowableRow(0) sizer.Add(loadButton, (1, 1), flag=wx.RIGHT | wx.BOTTOM | wx.TOP, border=5) if extruderCount > 1: sizer.Add(loadButton2, (1, 2), flag=wx.RIGHT | wx.BOTTOM | wx.TOP, border=5) if extruderCount > 2: sizer.Add(loadButton3, (1, 3), flag=wx.RIGHT | wx.BOTTOM | wx.TOP, border=5) if extruderCount > 3: sizer.Add(loadButton4, (1, 4), flag=wx.RIGHT | wx.BOTTOM | wx.TOP, border=5) sizer.Add(sliceButton, (1, 1 + extruderCount), flag=wx.RIGHT | wx.BOTTOM | wx.TOP, border=5) sizer.Add(printButton, (1, 2 + extruderCount), flag=wx.RIGHT | wx.BOTTOM | wx.TOP, border=5) self.sizer = sizer if len(self.filelist) > 0: self.preview3d.loadModelFiles(self.filelist) self.updateProfileToControls() self.SetBackgroundColour(nb.GetBackgroundColour()) self.Fit() if wx.Display().GetClientArea().GetWidth() < self.GetSize().GetWidth(): f = self.GetSize().GetWidth() - wx.Display().GetClientArea( ).GetWidth() self.preview3d.SetMinSize(self.preview3d.GetMinSize().DecBy(f, 0)) self.Fit() self.preview3d.Fit() self.SetMinSize(self.GetSize()) self.Centre() self.Show(True)