def StoreData(self): profile.putPreference('machine_width', self.machineWidth.GetValue()) profile.putPreference('machine_depth', self.machineDepth.GetValue()) profile.putPreference('machine_height', self.machineHeight.GetValue()) profile.putProfileSetting('nozzle_size', self.nozzleSize.GetValue()) profile.putProfileSetting('wall_thickness', float(profile.getProfileSettingFloat('nozzle_size')) * 2) profile.putPreference('has_heated_bed', str(self.heatedBed.GetValue()))
def updateModelTransform(self, f=0): if len(self.objectList) < 1 or self.objectList[0].mesh is None: return profile.putProfileSetting('model_matrix', ','.join(map(str, list(self.matrix.getA().flatten())))) for obj in self.objectList: if obj.mesh is None: continue obj.mesh.matrix = self.matrix obj.mesh.processMatrix() minV = self.objectList[0].mesh.getMinimum() maxV = self.objectList[0].mesh.getMaximum() objectsBoundaryCircleSize = self.objectList[0].mesh.bounderyCircleSize for obj in self.objectList: if obj.mesh is None: continue minV = numpy.minimum(minV, obj.mesh.getMinimum()) maxV = numpy.maximum(maxV, obj.mesh.getMaximum()) objectsBoundaryCircleSize = max(objectsBoundaryCircleSize, obj.mesh.bounderyCircleSize) self.objectsMaxV = maxV self.objectsMinV = minV self.objectsSize = self.objectsMaxV - self.objectsMinV self.objectsBoundaryCircleSize = objectsBoundaryCircleSize self.glCanvas.Refresh()
def loadData(self, data, profileType): for setting, value in data.items(): if profileType == 'preference': profile.putPreference(setting, value) elif profileType == 'profile': profile.putProfileSetting(setting, value) self._callback()
def OnSettingChange(self, e): if self.type == "profile": profile.putProfileSetting(self.configName, self.GetValue()) else: profile.putPreference(self.configName, self.GetValue()) result = validators.SUCCESS msgs = [] for validator in self.validators: res, err = validator.validate() if res == validators.ERROR: result = res elif res == validators.WARNING and result != validators.ERROR: result = res if res != validators.SUCCESS: msgs.append(err) if result == validators.ERROR: self.ctrl.SetBackgroundColour("Red") elif result == validators.WARNING: self.ctrl.SetBackgroundColour("Yellow") else: self.ctrl.SetBackgroundColour(self.defaultBGColour) self.ctrl.Refresh() self.validationMsg = "\n".join(msgs) self.panel.main.UpdatePopup(self)
def OnSettingChange(self, e): if self.type == 'profile': profile.putProfileSetting(self.configName, self.GetValue()) else: profile.putPreference(self.configName, self.GetValue()) result = validators.SUCCESS msgs = [] for validator in self.validators: res, err = validator.validate() if res == validators.ERROR: result = res elif res == validators.WARNING and result != validators.ERROR: result = res if res != validators.SUCCESS: msgs.append(err) ctrl = self.ctrl if isinstance(ctrl, floatspin.FloatSpin): ctrl = ctrl.GetTextCtrl() if result == validators.ERROR: ctrl.SetBackgroundColour('Red') elif result == validators.WARNING: ctrl.SetBackgroundColour('Yellow') else: ctrl.SetBackgroundColour(self.defaultBGColour) ctrl.Refresh() self.validationMsg = '\n'.join(msgs) self.panel.main.UpdatePopup(self)
def main(): parser = OptionParser(usage="usage: %prog [options] <filename>.stl") parser.add_option("-i", "--ini", action="store", type="string", dest="profileini", help="Load settings from a profile ini file") parser.add_option("-r", "--print", action="store", type="string", dest="printfile", help="Open the printing interface, instead of the normal cura interface.") parser.add_option("-p", "--profile", action="store", type="string", dest="profile", help="Internal option, do not use!") parser.add_option("-s", "--slice", action="store_true", dest="slice", help="Slice the given files instead of opening them in Cura") (options, args) = parser.parse_args() if options.profile is not None: profile.loadGlobalProfileFromString(options.profile) if options.profileini is not None: profile.loadGlobalProfile(options.profileini) if options.printfile is not None: from Cura.gui import printWindow printWindow.startPrintInterface(options.printfile) elif options.slice is not None: from Cura.util import sliceRun sliceRun.runSlice(args) else: #Place any unused arguments as last file, so Cura starts with opening those files. if len(args) > 0: profile.putPreference('lastFile', ';'.join(args)) profile.putProfileSetting('model_matrix', '1,0,0,0,1,0,0,0,1') profile.setPluginConfig([]) #Do not import anything from Cura.gui before this spot, as the above code also needs to run in pypy. from Cura.gui import app app.CuraApp().MainLoop()
def StoreData(self): profile.putPreference('ultimaker_extruder_upgrade', str(self.springExtruder.GetValue())) profile.putPreference('has_heated_bed', str(self.heatedBed.GetValue())) if self.dualExtrusion.GetValue(): profile.putPreference('extruder_amount', '2') if profile.getPreference('ultimaker_extruder_upgrade') == 'True': profile.putProfileSetting('retraction_enable', 'True')
def StoreData(self): profile.putPreference("machine_width", self.machineWidth.GetValue()) profile.putPreference("machine_depth", self.machineDepth.GetValue()) profile.putPreference("machine_height", self.machineHeight.GetValue()) profile.putProfileSetting("nozzle_size", self.nozzleSize.GetValue()) profile.putProfileSetting("wall_thickness", float(profile.getProfileSettingFloat("nozzle_size")) * 2) profile.putPreference("has_heated_bed", str(self.heatedBed.GetValue())) profile.putPreference("machine_center_is_zero", str(self.HomeAtCenter.GetValue()))
def _update(self, e): for button in self._print_profile_options: if button.GetValue(): profile.putProfileSetting('simpleModeProfile', button.base_filename) for button in self._print_material_options: if button.GetValue(): profile.putProfileSetting('simpleModeMaterial', button.base_filename) self._callback()
def _update(self, e): material = self._getSelectedMaterial() if material: profile.putProfileSetting('simpleModeMaterial', material.name) for button in self._print_profile_options: if button.GetValue(): profile.putProfileSetting('simpleModeProfile', button.profile.name) self._callback()
def OnButtonProfile(self, event): if buttons.GenBitmapToggleButton.GetValue(self): self.SetBitmap(True) profile.putProfileSetting(self.profileSetting, 'True') else: self.SetBitmap(False) profile.putProfileSetting(self.profileSetting, 'False') if self.callback != None: self.callback() event.Skip()
def StoreData(self): profile.putPreference("ultimaker_extruder_upgrade", str(self.springExtruder.GetValue())) profile.putPreference("has_heated_bed", str(self.heatedBed.GetValue())) if self.dualExtrusion.GetValue(): profile.putPreference("extruder_amount", "2") else: profile.putPreference("extruder_amount", "1") if profile.getPreference("ultimaker_extruder_upgrade") == "True": profile.putProfileSetting("retraction_enable", "True") else: profile.putProfileSetting("retraction_enable", "False")
def StoreData(self): profile.putPreference('machine_width', self.machineWidth.GetValue()) profile.putPreference('machine_depth', self.machineDepth.GetValue()) profile.putPreference('machine_height', self.machineHeight.GetValue()) profile.putProfileSetting('nozzle_size', self.nozzleSize.GetValue()) profile.putProfileSetting( 'wall_thickness', float(profile.getProfileSettingFloat('nozzle_size')) * 2) profile.putPreference('has_heated_bed', str(self.heatedBed.GetValue())) profile.putPreference('machine_center_is_zero', str(self.HomeAtCenter.GetValue()))
def OnNormalSwitch(self, e): profile.putPreference('startMode', 'Normal') dlg = wx.MessageDialog(self, _("Copy the settings from quickprint to your full settings?\n(This will overwrite any full setting modifications you have)"), _("Profile copy"), wx.YES_NO | wx.ICON_QUESTION) result = dlg.ShowModal() == wx.ID_YES dlg.Destroy() if result: profile.resetProfile() for k, v in self.simpleSettingsPanel.getSettingOverrides().items(): profile.putProfileSetting(k, v) self.updateProfileToAllControls() self.updateSliceMode()
def _update(self, e): profile.putPreference('active_nozzle', float(self.nozzle_size_combo.GetStringSelection())) profile.putProfileSetting('nozzle_size', float(self.nozzle_size_combo.GetStringSelection())) for button in self._print_profile_options: if button.GetValue(): profile.putPreference('simpleModeProfile', button.base_filename) for button in self._print_material_options: if button.GetValue(): profile.putPreference('simpleModeMaterial', button.base_filename) profile.putPreference('simpleModePlatformAdhesion', self.platform_adhesion_combo.GetSelection()) profile.putPreference('simpleModeSupportType', self.platform_adhesion_combo.GetSelection()) self._callback()
def StoreData(self): profile.putMachineSetting('ultimaker_extruder_upgrade', str(self.springExtruder.GetValue())) profile.putMachineSetting('has_heated_bed', str(self.heatedBed.GetValue())) if self.dualExtrusion.GetValue(): profile.putMachineSetting('extruder_amount', '2') profile.putMachineSetting('machine_depth', '195') else: profile.putMachineSetting('extruder_amount', '1') if profile.getMachineSetting('ultimaker_extruder_upgrade') == 'True': profile.putProfileSetting('retraction_enable', 'True') else: profile.putProfileSetting('retraction_enable', 'False')
def StoreData(self): profile.putPreference('ultimaker_extruder_upgrade', str(self.springExtruder.GetValue())) profile.putPreference('has_heated_bed', str(self.heatedBed.GetValue())) if self.dualExtrusion.GetValue(): profile.putPreference('extruder_amount', '2') else: profile.putPreference('extruder_amount', '1') if profile.getPreference('ultimaker_extruder_upgrade') == 'True': profile.putProfileSetting('retraction_enable', 'True') else: profile.putProfileSetting('retraction_enable', 'False')
def OnScale(self, e): scale = 1.0 if self.scale.GetValue() != '': scale = self.scale.GetValue() profile.putProfileSetting('model_scale', scale) if self.glCanvas.viewMode == 'GCode' or self.glCanvas.viewMode == 'Mixed': self.setViewMode('Normal') self.glCanvas.Refresh() if self.objectsMaxV != None: size = (self.objectsMaxV - self.objectsMinV) * float(scale) self.toolbarInfo.SetValue('%0.1f %0.1f %0.1f' % (size[0], size[1], size[2]))
def saveSettings(self): settings = {} settingItems = [ 'printTypeHigh', 'printTypeNormal', 'printTypeLow', 'printTypeJoris', 'printMaterialHIPS', 'printMaterialABS', 'printMaterialPLA', 'printSupport', 'printBrim' ] for item in settingItems: if hasattr(self, item): settings[item] = getattr(self, item).GetValue() profile.putProfileSetting('simpleModeSettings', pickle.dumps(settings))
def StoreData(self): profile.putPreference('machine_width', self.machineWidth.GetValue()) profile.putPreference('machine_depth', self.machineDepth.GetValue()) profile.putPreference('machine_height', self.machineHeight.GetValue()) profile.putProfileSetting('nozzle_size', self.nozzleSize.GetValue()) profile.putProfileSetting('wall_thickness', float(profile.getProfileSettingFloat('nozzle_size')) * 2) profile.putPreference('has_heated_bed', str(self.heatedBed.GetValue())) profile.putPreference('machine_center_is_zero', str(self.HomeAtCenter.GetValue())) profile.putPreference('extruder_head_size_min_x', '0') profile.putPreference('extruder_head_size_min_y', '0') profile.putPreference('extruder_head_size_max_x', '0') profile.putPreference('extruder_head_size_max_y', '0') profile.putPreference('extruder_head_size_height', '0')
def main(): parser = OptionParser(usage="usage: %prog [options] <filename>.stl") parser.add_option("-i", "--ini", action="store", type="string", dest="profileini", help="Load settings from a profile ini file") parser.add_option( "-r", "--print", action="store", type="string", dest="printfile", help= "Open the printing interface, instead of the normal cura interface.") parser.add_option("-p", "--profile", action="store", type="string", dest="profile", help="Internal option, do not use!") parser.add_option( "-s", "--slice", action="store_true", dest="slice", help="Slice the given files instead of opening them in Cura") (options, args) = parser.parse_args() if options.profile is not None: profile.loadGlobalProfileFromString(options.profile) if options.profileini is not None: profile.loadGlobalProfile(options.profileini) if options.printfile is not None: from Cura.gui import printWindow printWindow.startPrintInterface(options.printfile) elif options.slice is not None: from Cura.util import sliceRun sliceRun.runSlice(args) else: #Place any unused arguments as last file, so Cura starts with opening those files. if len(args) > 0: profile.putPreference('lastFile', ';'.join(args)) profile.putProfileSetting('model_matrix', '1,0,0,0,1,0,0,0,1') profile.setPluginConfig([]) #Do not import anything from Cura.gui before this spot, as the above code also needs to run in pypy. from Cura.gui import app app.CuraApp().MainLoop()
def OnNormalSwitch(self, e): profile.putPreference('startMode', 'Normal') dlg = wx.MessageDialog(self, _("Copy the settings from quickprint to your full settings?\n(This will overwrite any full setting modifications you have)"), _("Profile copy"), wx.YES_NO | wx.ICON_QUESTION) result = dlg.ShowModal() == wx.ID_YES dlg.Destroy() if result: profile.resetProfile() for k, v in self.simpleSettingsPanel.getSettingOverrides().items(): if profile.getMachineSetting('machine_type').startswith('ultimaker2+'): if k == 'nozzle_size': v = round(float(v) * 1.14, 2) if k == 'wall_thickness': v = round(float(v) * 1.14, 1) profile.putProfileSetting(k, v) self.updateProfileToAllControls() self.updateSliceMode()
def saveSettings(self): settings = {} settingItems = [ "printTypeHigh", "printTypeNormal", "printTypeLow", "printTypeJoris", "printMaterialHIPS", "printMaterialABS", "printMaterialPLA", "printSupport", "printBrim", ] for item in settingItems: if hasattr(self, item): settings[item] = getattr(self, item).GetValue() profile.putProfileSetting("simpleModeSettings", pickle.dumps(settings))
def OnNormalSwitch(self, e): profile.putPreference('startMode', 'Normal') dlg = wx.MessageDialog( self, _("Copy the settings from quickprint to your full settings?\n(This will overwrite any full setting modifications you have)" ), _("Profile copy"), wx.YES_NO | wx.ICON_QUESTION) result = dlg.ShowModal() == wx.ID_YES dlg.Destroy() if result: profile.resetProfile() for k, v in self.simpleSettingsPanel.getSettingOverrides().items(): if profile.getMachineSetting('machine_type').startswith( 'ultimaker2+'): if k == 'nozzle_size': v = round(float(v) * 1.14, 2) if k == 'wall_thickness': v = round(float(v) * 1.14, 1) profile.putProfileSetting(k, v) self.updateProfileToAllControls() self.updateSliceMode()
def updateModelTransform(self, f=0): if len(self.objectList) < 1 or self.objectList[0].mesh is None: return profile.putProfileSetting( 'model_matrix', ','.join(map(str, list(self.matrix.getA().flatten())))) for obj in self.objectList: if obj.mesh is None: continue obj.mesh.matrix = self.matrix obj.mesh.processMatrix() minV = self.objectList[0].mesh.getMinimum() maxV = self.objectList[0].mesh.getMaximum() objectsBoundaryCircleSize = self.objectList[0].mesh.boundaryCircleSize for obj in self.objectList: if obj.mesh is None: continue minV = numpy.minimum(minV, obj.mesh.getMinimum()) maxV = numpy.maximum(maxV, obj.mesh.getMaximum()) objectsBoundaryCircleSize = max(objectsBoundaryCircleSize, obj.mesh.boundaryCircleSize) self.objectsMaxV = maxV self.objectsMinV = minV self.objectsSize = self.objectsMaxV - self.objectsMinV self.objectsBoundaryCircleSize = objectsBoundaryCircleSize scaleX = numpy.linalg.norm(self.matrix[::, 0].getA().flatten()) scaleY = numpy.linalg.norm(self.matrix[::, 1].getA().flatten()) scaleZ = numpy.linalg.norm(self.matrix[::, 2].getA().flatten()) self.scaleXctrl.setValue(round(scaleX, 2)) self.scaleYctrl.setValue(round(scaleY, 2)) self.scaleZctrl.setValue(round(scaleZ, 2)) self.scaleXmmctrl.setValue(round(self.objectsSize[0], 2)) self.scaleYmmctrl.setValue(round(self.objectsSize[1], 2)) self.scaleZmmctrl.setValue(round(self.objectsSize[2], 2)) self.glCanvas.Refresh()
def OnScaleMax(self, e = None, onlyScaleDown = False): if self.objectsMinV == None: return vMin = self.objectsMinV vMax = self.objectsMaxV skirtSize = 3 if profile.getProfileSettingFloat('skirt_line_count') > 0: skirtSize = 3 + profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap') scaleX1 = (self.machineSize.x - self.machineCenter.x - skirtSize) / ((vMax[0] - vMin[0]) / 2) scaleY1 = (self.machineSize.y - self.machineCenter.y - skirtSize) / ((vMax[1] - vMin[1]) / 2) scaleX2 = (self.machineCenter.x - skirtSize) / ((vMax[0] - vMin[0]) / 2) scaleY2 = (self.machineCenter.y - skirtSize) / ((vMax[1] - vMin[1]) / 2) scaleZ = self.machineSize.z / (vMax[2] - vMin[2]) scale = min(scaleX1, scaleY1, scaleX2, scaleY2, scaleZ) if scale > 1.0 and onlyScaleDown: return self.scale.SetValue(str(scale)) profile.putProfileSetting('model_scale', self.scale.GetValue()) if self.glCanvas.viewMode == 'GCode' or self.glCanvas.viewMode == 'Mixed': self.setViewMode('Normal') self.glCanvas.Refresh()
def StoreData(self): if self.UltimakerRadio.GetValue(): profile.putPreference('machine_width', '205') profile.putPreference('machine_depth', '205') profile.putPreference('machine_height', '200') profile.putPreference('machine_type', 'ultimaker') profile.putPreference('machine_center_is_zero', 'False') profile.putProfileSetting('nozzle_size', '0.4') profile.putPreference('extruder_head_size_min_x', '75.0') profile.putPreference('extruder_head_size_min_y', '18.0') profile.putPreference('extruder_head_size_max_x', '18.0') profile.putPreference('extruder_head_size_max_y', '35.0') profile.putPreference('extruder_head_size_height', '60.0') else: profile.putPreference('machine_width', '80') profile.putPreference('machine_depth', '80') profile.putPreference('machine_height', '60') profile.putPreference('machine_type', 'reprap') profile.putPreference('startMode', 'Normal') profile.putProfileSetting('nozzle_size', '0.5') profile.putProfileSetting('wall_thickness', float(profile.getProfileSetting('nozzle_size')) * 2) if self.SubmitUserStats.GetValue(): profile.putPreference('submit_slice_information', 'True') else: profile.putPreference('submit_slice_information', 'False')
def updateModelTransform(self, f=0): if len(self.objectList) < 1 or self.objectList[0].mesh is None: return profile.putProfileSetting('model_matrix', ','.join(map(str, list(self.matrix.getA().flatten())))) for obj in self.objectList: if obj.mesh is None: continue obj.mesh.matrix = self.matrix obj.mesh.processMatrix() minV = self.objectList[0].mesh.getMinimum() maxV = self.objectList[0].mesh.getMaximum() objectsBoundaryCircleSize = self.objectList[0].mesh.bounderyCircleSize for obj in self.objectList: if obj.mesh is None: continue minV = numpy.minimum(minV, obj.mesh.getMinimum()) maxV = numpy.maximum(maxV, obj.mesh.getMaximum()) objectsBoundaryCircleSize = max(objectsBoundaryCircleSize, obj.mesh.bounderyCircleSize) self.objectsMaxV = maxV self.objectsMinV = minV self.objectsSize = self.objectsMaxV - self.objectsMinV self.objectsBoundaryCircleSize = objectsBoundaryCircleSize scaleX = numpy.linalg.norm(self.matrix[::,0].getA().flatten()) scaleY = numpy.linalg.norm(self.matrix[::,1].getA().flatten()) scaleZ = numpy.linalg.norm(self.matrix[::,2].getA().flatten()) self.scaleXctrl.setValue(round(scaleX, 2)) self.scaleYctrl.setValue(round(scaleY, 2)) self.scaleZctrl.setValue(round(scaleZ, 2)) self.scaleXmmctrl.setValue(round(self.objectsSize[0], 2)) self.scaleYmmctrl.setValue(round(self.objectsSize[1], 2)) self.scaleZmmctrl.setValue(round(self.objectsSize[2], 2)) self.glCanvas.Refresh()
def Refresh_Fila(self): fila = self.filaments[self.combo_box_1.GetSelection()] if fila.type == 'Autre PLA': self.spin_ctrl_1.Enable(True) else: self.spin_ctrl_1.Enable(False) self.spin_ctrl_1.SetValue(float(fila.print_temperature)) profile.putProfileSetting('filament_diameter', fila.filament_diameter) profile.putProfileSetting('filament_flow', fila.filament_flow) profile.putProfileSetting('print_temperature', str(self.spin_ctrl_1.GetValue() + self.temp_preci))
def _update(self, e): if self.materialTypeCombo: materialType = self.materialTypeCombo.GetValue() profile.putProfileSetting('simpleModeMaterialType', materialType) material = self._getSelectedMaterial() if material: profile.putProfileSetting('simpleModeMaterial', material.name) for button in self._print_profile_options: if button.GetValue(): profile.putProfileSetting('simpleModeProfile', button.profile.name) self._callback()
def StoreData(self): if self.Ultimaker2Radio.GetValue(): profile.putMachineSetting('machine_width', '230') profile.putMachineSetting('machine_depth', '225') profile.putMachineSetting('machine_height', '205') profile.putMachineSetting('machine_type', 'ultimaker2') profile.putMachineSetting('machine_center_is_zero', 'False') profile.putMachineSetting('has_heated_bed', 'True') profile.putMachineSetting('gcode_flavor', 'UltiGCode') profile.putProfileSetting('nozzle_size', '0.4') profile.putMachineSetting('extruder_head_size_min_x', '40.0') profile.putMachineSetting('extruder_head_size_min_y', '10.0') profile.putMachineSetting('extruder_head_size_max_x', '60.0') profile.putMachineSetting('extruder_head_size_max_y', '30.0') profile.putMachineSetting('extruder_head_size_height', '60.0') elif self.UltimakerRadio.GetValue(): profile.putMachineSetting('machine_width', '205') profile.putMachineSetting('machine_depth', '205') profile.putMachineSetting('machine_height', '200') profile.putMachineSetting('machine_type', 'ultimaker') profile.putMachineSetting('machine_center_is_zero', 'False') profile.putMachineSetting('gcode_flavor', 'RepRap (Marlin/Sprinter)') profile.putProfileSetting('nozzle_size', '0.4') profile.putMachineSetting('extruder_head_size_min_x', '75.0') profile.putMachineSetting('extruder_head_size_min_y', '18.0') profile.putMachineSetting('extruder_head_size_max_x', '18.0') profile.putMachineSetting('extruder_head_size_max_y', '35.0') profile.putMachineSetting('extruder_head_size_height', '60.0') else: profile.putMachineSetting('machine_width', '80') profile.putMachineSetting('machine_depth', '80') profile.putMachineSetting('machine_height', '60') profile.putMachineSetting('machine_type', 'reprap') profile.putMachineSetting('gcode_flavor', 'RepRap (Marlin/Sprinter)') profile.putPreference('startMode', 'Normal') profile.putProfileSetting('nozzle_size', '0.5') profile.checkAndUpdateMachineName() profile.putProfileSetting('wall_thickness', float(profile.getProfileSetting('nozzle_size')) * 2) if self.SubmitUserStats.GetValue(): profile.putPreference('submit_slice_information', 'True') else: profile.putPreference('submit_slice_information', 'False')
def loadData(self, data, profileType): # Get the support settings user has set raft = profile.getProfileSetting('platform_adhesion') support = profile.getProfileSetting('support') for setting, value in data.items(): if profileType == 'preference': profile.putPreference(setting, value) elif profileType == 'profile': profile.putProfileSetting(setting, value) # Add support preferences at the end to make sure they're not written over to 'None' profile.putProfileSetting('platform_adhesion', raft) profile.putProfileSetting('support', support) self.normalSettingsPanel.updateProfileToControls()
def StoreData(self): if self.UltimakerRadio.GetValue(): profile.putPreference('machine_width', '205') profile.putPreference('machine_depth', '205') profile.putPreference('machine_height', '200') profile.putPreference('machine_type', 'ultimaker') profile.putProfileSetting('nozzle_size', '0.4') else: profile.putPreference('machine_width', '80') profile.putPreference('machine_depth', '80') profile.putPreference('machine_height', '60') profile.putPreference('machine_type', 'reprap') profile.putPreference('startMode', 'Normal') profile.putProfileSetting('nozzle_size', '0.5') 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.putPreference('machine_type', 'ultimaker') profile.putPreference('machine_center_is_zero', 'False') profile.putProfileSetting('nozzle_size', '0.4') else: profile.putPreference('machine_width', '80') profile.putPreference('machine_depth', '80') profile.putPreference('machine_height', '60') profile.putPreference('machine_type', 'reprap') profile.putProfileSetting('nozzle_size', '0.5') 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.putPreference("machine_type", "ultimaker") profile.putPreference("machine_center_is_zero", "False") profile.putProfileSetting("nozzle_size", "0.4") else: profile.putPreference("machine_width", "80") profile.putPreference("machine_depth", "80") profile.putPreference("machine_height", "60") profile.putPreference("machine_type", "reprap") profile.putPreference("startMode", "Normal") profile.putProfileSetting("nozzle_size", "0.5") profile.putProfileSetting("wall_thickness", float(profile.getProfileSetting("nozzle_size")) * 2) if self.SubmitUserStats.GetValue(): profile.putPreference("submit_slice_information", "True") else: profile.putPreference("submit_slice_information", "False")
def StoreData(self): if self.UltimakerRadio.GetValue(): profile.putPreference('machine_width', '205') profile.putPreference('machine_depth', '205') profile.putPreference('machine_height', '200') profile.putPreference('machine_type', 'ultimaker') profile.putPreference('machine_center_is_zero', 'False') profile.putProfileSetting('nozzle_size', '0.4') else: profile.putPreference('machine_width', '80') profile.putPreference('machine_depth', '80') profile.putPreference('machine_height', '60') profile.putPreference('machine_type', 'reprap') profile.putPreference('startMode', 'Normal') profile.putProfileSetting('nozzle_size', '0.5') profile.putProfileSetting( 'wall_thickness', float(profile.getProfileSetting('nozzle_size')) * 2) if self.SubmitUserStats.GetValue(): profile.putPreference('submit_slice_information', 'True') else: profile.putPreference('submit_slice_information', 'False')
def StoreData(self): profile.putProfileSetting('filament_diameter', self.filamentDiameter.GetValue())
def OnDropFiles(self, files): profile.putProfileSetting('model_matrix', '1,0,0,0,1,0,0,0,1') profile.setPluginConfig([]) self.updateProfileToControls() self._loadModels(files)
def OnResetAll(self, e=None): profile.putProfileSetting('model_matrix', '1,0,0,0,1,0,0,0,1') profile.setPluginConfig([]) self.updateProfileToControls()
def OnMouseMotion(self,e): cursorXY = 100000 radius = 0 if self.parent.objectsMaxV is not None and self.viewport is not None: radius = self.parent.objectsBounderyCircleSize * profile.getProfileSettingFloat('model_scale') p0 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 0, self.modelMatrix, self.projMatrix, self.viewport)) p1 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 1, self.modelMatrix, self.projMatrix, self.viewport)) cursorZ0 = p0 - (p1 - p0) * (p0[2] / (p1[2] - p0[2])) cursorXY = math.sqrt((cursorZ0[0] * cursorZ0[0]) + (cursorZ0[1] * cursorZ0[1])) if cursorXY >= radius * 1.1 and cursorXY <= radius * 1.3: self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING)) else: self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) if e.Dragging() and e.LeftIsDown(): if self.dragType == '': #Define the drag type depending on the cursor position. if cursorXY >= radius * 1.1 and cursorXY <= radius * 1.3: self.dragType = 'modelRotate' self.dragStart = math.atan2(cursorZ0[0], cursorZ0[1]) else: self.dragType = 'viewRotate' if self.dragType == 'viewRotate': if self.view3D: self.yaw += e.GetX() - self.oldX self.pitch -= e.GetY() - self.oldY if self.pitch > 170: self.pitch = 170 if self.pitch < 10: self.pitch = 10 else: self.offsetX += float(e.GetX() - self.oldX) * self.zoom / self.GetSize().GetHeight() * 2 self.offsetY -= float(e.GetY() - self.oldY) * self.zoom / self.GetSize().GetHeight() * 2 elif self.dragType == 'modelRotate': angle = math.atan2(cursorZ0[0], cursorZ0[1]) diff = self.dragStart - angle self.tempRotate = diff * 180 / math.pi rot = profile.getProfileSettingFloat('model_rotate_base') self.tempRotate = round((self.tempRotate + rot) / 15) * 15 - rot #Workaround for buggy ATI cards. size = self.GetSizeTuple() self.SetSize((size[0]+1, size[1])) self.SetSize((size[0], size[1])) self.Refresh() else: if self.tempRotate != 0: newRotation = profile.getProfileSettingFloat('model_rotate_base') + self.tempRotate while newRotation >= 360: newRotation -= 360 while newRotation < 0: newRotation += 360 profile.putProfileSetting('model_rotate_base', newRotation) self.parent.rotate.SetValue(newRotation) self.parent.updateModelTransform() self.tempRotate = 0 self.dragType = '' if e.Dragging() and e.RightIsDown(): self.zoom += e.GetY() - self.oldY if self.zoom < 1: self.zoom = 1 if self.zoom > 500: self.zoom = 500 self.Refresh() self.oldX = e.GetX() self.oldY = e.GetY()
def setPostProcessPluginConfig(config): profile.putProfileSetting('plugin_config', pickle.dumps(config))
def OnSimpleSwitch(self, e): profile.putPreference('startMode', 'Simple') profile.putProfileSetting('nozzle_size', profile.getPreference("active_nozzle")) self.updateSliceMode()