def OnScaleMax(self): if self.objectsMinV is 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) self.matrix *= numpy.matrix( [[scale, 0, 0], [0, scale, 0], [0, 0, scale]], numpy.float64) if self.glCanvas.viewMode == 'GCode' or self.glCanvas.viewMode == 'Mixed': self.setViewMode('Normal') self.updateModelTransform()
def mcTempUpdate(self, temp, bedTemp, targetTemp, bedTargetTemp): if self._wizardState == 1: self._wizardState = 2 wx.CallAfter(self.infoBox.SetAttention, 'Adjust the front left screw of your printer bed\nSo the nozzle just hits the bed.') wx.CallAfter(self.resumeButton.Enable, True) elif self._wizardState == 3: self._wizardState = 4 wx.CallAfter(self.infoBox.SetAttention, 'Adjust the back left screw of your printer bed\nSo the nozzle just hits the bed.') wx.CallAfter(self.resumeButton.Enable, True) elif self._wizardState == 5: self._wizardState = 6 wx.CallAfter(self.infoBox.SetAttention, 'Adjust the back right screw of your printer bed\nSo the nozzle just hits the bed.') wx.CallAfter(self.resumeButton.Enable, True) elif self._wizardState == 7: self._wizardState = 8 wx.CallAfter(self.infoBox.SetAttention, 'Adjust the front right screw of your printer bed\nSo the nozzle just hits the bed.') wx.CallAfter(self.resumeButton.Enable, True) elif self._wizardState == 9: if temp < profile.getProfileSettingFloat('print_temperature') - 5: wx.CallAfter(self.infoBox.SetInfo, 'Heating up printer: %d/%d' % (temp, profile.getProfileSettingFloat('print_temperature'))) else: self._wizardState = 10 wx.CallAfter(self.infoBox.SetInfo, 'Printing a square on the printer bed at 0.3mm height.') feedZ = profile.getProfileSettingFloat('max_z_speed') * 60 feedPrint = profile.getProfileSettingFloat('print_speed') * 60 feedTravel = profile.getProfileSettingFloat('travel_speed') * 60 w = profile.getPreferenceFloat('machine_width') d = profile.getPreferenceFloat('machine_depth') filamentRadius = profile.getProfileSettingFloat('filament_diameter') / 2 filamentArea = math.pi * filamentRadius * filamentRadius ePerMM = (profile.calculateEdgeWidth() * 0.3) / filamentArea eValue = 0.0 gcodeList = [ 'G1 Z2 F%d' % (feedZ), 'G92 E0', 'G1 X%d Y%d F%d' % (5, 5, feedTravel), 'G1 Z0.3 F%d' % (feedZ)] eValue += 5; gcodeList.append('G1 E%f F%d' % (eValue, profile.getProfileSettingFloat('retraction_speed') * 60)) for i in xrange(0, 3): dist = 5.0 + 0.4 * i eValue += (d - 2*dist) * ePerMM gcodeList.append('G1 X%d Y%d E%f F%d' % (dist, d - dist, eValue, feedPrint)) eValue += (w - 2*dist) * ePerMM gcodeList.append('G1 X%d Y%d E%f F%d' % (w - dist, d - dist, eValue, feedPrint)) eValue += (d - 2*dist) * ePerMM gcodeList.append('G1 X%d Y%d E%f F%d' % (w - dist, dist, eValue, feedPrint)) eValue += (w - 2*dist) * ePerMM gcodeList.append('G1 X%d Y%d E%f F%d' % (dist, dist, eValue, feedPrint)) gcodeList.append('M400') self.comm.printGCode(gcodeList)
def validate(self): from Cura.util import profile try: fill_distance = profile.getProfileSettingFloat('fill_distance') infill_type = profile.getProfileSetting('infill_type') # print infill_type if infill_type == 'None': return DISABLED, 'Infill has been disabled' else : if profile.getProfileSettingFloat('fill_distance') < profile.calculateEdgeWidth() : return ERROR, 'Distance between infill cannot be less than extrusion width : '+str(profile.calculateEdgeWidth()) +'mm' #elif profile.getProfileSettingFloat('fill_distance') > 0: # return SUCCESS return SUCCESS, '' except ValueError: #We already have an error by the int/float validator in this case. return SUCCESS, ''
def OnScaleMax(self): if self.objectsMinV is 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) self.matrix *= numpy.matrix([[scale,0,0],[0,scale,0],[0,0,scale]], numpy.float64) if self.glCanvas.viewMode == 'GCode' or self.glCanvas.viewMode == 'Mixed': self.setViewMode('Normal') self.updateModelTransform()
def OnScaleMax(self, e = None, onlyScaleDown = False): if self.objectsMinV is 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 if self.glCanvas.viewMode == 'GCode' or self.glCanvas.viewMode == 'Mixed': self.setViewMode('Normal') self.glCanvas.Refresh()
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 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 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 OnScaleMax(self, onlyScaleDown=False): if self.objectsMinV is 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.matrix *= numpy.matrix([[scale, 0, 0], [0, scale, 0], [0, 0, scale]], numpy.float64) if self.glCanvas.viewMode == "GCode" or self.glCanvas.viewMode == "Mixed": self.setViewMode("Normal") self.updateModelTransform()
def calculateEdgeWidth(setting): return profile.calculateEdgeWidth()
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].gcode', '--nozzle-diameter', str(profile.calculateEdgeWidth()), '--print-center', '%s,%s' % (profile.getPreferenceFloat('machine_width') / 2, profile.getPreferenceFloat('machine_depth') / 2), '--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(), '-s'] 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')), 'inset0Speed': int(profile.getProfileSettingFloat('inset0_speed')) if int(profile.getProfileSettingFloat('inset0_speed')) > 0 else int( profile.getProfileSettingFloat('print_speed')), 'insetXSpeed': int(profile.getProfileSettingFloat('insetx_speed')) if int(profile.getProfileSettingFloat('insetx_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), 'retractionZHop': int(profile.getProfileSettingFloat('retraction_hop') * 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': max(0, 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), 'relativeE': 1 if profile.getMachineSetting('relative_extrusion') == 'True' else 0, 'perimInset': int(profile.getProfileSettingFloat('perimeter_inset') * 1000), '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.getProfileSetting('support_type') == 'Lines': settings['supportType'] = 1 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 elif profile.getMachineSetting('gcode_flavor') == 'MakerBot': settings['gcodeFlavor'] = 2 if profile.getProfileSetting('spiralize') == 'True': settings['spiralizeMode'] = 1 if profile.getProfileSetting( 'wipe_tower') == 'True' and extruderCount > 1: 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 calculateShellsBase(setting): edgeWidth = profile.calculateEdgeWidth() extraWall = profile.getProfileSettingFloat('extra_base_wall_thickness') return profile.calculateLineCount() - 1 + int(extraWall / edgeWidth + 0.0001)
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(60), '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' 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['enableWipeTower'] = 1 if profile.getProfileSetting('ooze_shield') == 'True': settings['enableOozeShield'] = 1 return settings
def OnResume(self, e): feedZ = profile.getProfileSettingFloat('print_speed') * 60 feedTravel = profile.getProfileSettingFloat('travel_speed') * 60 if self._wizardState == 2: wx.CallAfter(self.infoBox.SetBusy, 'Moving head to back left corner...') self.comm.sendCommand('G1 Z3 F%d' % (feedZ)) self.comm.sendCommand('G1 X%d Y%d F%d' % (0, profile.getPreferenceFloat('machine_depth'), feedTravel)) self.comm.sendCommand('G1 Z0 F%d' % (feedZ)) self.comm.sendCommand('M400') self._wizardState = 3 elif self._wizardState == 4: wx.CallAfter(self.infoBox.SetBusy, 'Moving head to back right corner...') self.comm.sendCommand('G1 Z3 F%d' % (feedZ)) self.comm.sendCommand('G1 X%d Y%d F%d' % (profile.getPreferenceFloat('machine_width') - 5.0, profile.getPreferenceFloat('machine_depth') - 25, feedTravel)) self.comm.sendCommand('G1 Z0 F%d' % (feedZ)) self.comm.sendCommand('M400') self._wizardState = 5 elif self._wizardState == 6: wx.CallAfter(self.infoBox.SetBusy, 'Moving head to front right corner...') self.comm.sendCommand('G1 Z3 F%d' % (feedZ)) self.comm.sendCommand('G1 X%d Y%d F%d' % (profile.getPreferenceFloat('machine_width') - 5.0, 20, feedTravel)) self.comm.sendCommand('G1 Z0 F%d' % (feedZ)) self.comm.sendCommand('M400') self._wizardState = 7 elif self._wizardState == 8: wx.CallAfter(self.infoBox.SetBusy, 'Heating up printer...') self.comm.sendCommand('G1 Z15 F%d' % (feedZ)) self.comm.sendCommand('M104 S%d' % (profile.getProfileSettingFloat('print_temperature'))) self.comm.sendCommand('G1 X%d Y%d F%d' % (0, 0, feedTravel)) self._wizardState = 9 elif self._wizardState == 10: self._wizardState = 11 wx.CallAfter(self.infoBox.SetInfo, 'Printing a square on the printer bed at 0.3mm height.') feedZ = profile.getProfileSettingFloat('print_speed') * 60 feedPrint = profile.getProfileSettingFloat('print_speed') * 60 feedTravel = profile.getProfileSettingFloat('travel_speed') * 60 w = profile.getPreferenceFloat('machine_width') d = profile.getPreferenceFloat('machine_depth') filamentRadius = profile.getProfileSettingFloat('filament_diameter') / 2 filamentArea = math.pi * filamentRadius * filamentRadius ePerMM = (profile.calculateEdgeWidth() * 0.3) / filamentArea eValue = 0.0 gcodeList = [ 'G1 Z2 F%d' % (feedZ), 'G92 E0', 'G1 X%d Y%d F%d' % (5, 5, feedTravel), 'G1 Z0.3 F%d' % (feedZ)] eValue += 5.0 gcodeList.append('G1 E%f F%d' % (eValue, profile.getProfileSettingFloat('retraction_speed') * 60)) for i in xrange(0, 3): dist = 5.0 + 0.4 * float(i) eValue += (d - 2.0*dist) * ePerMM gcodeList.append('G1 X%f Y%f E%f F%d' % (dist, d - dist, eValue, feedPrint)) eValue += (w - 2.0*dist) * ePerMM gcodeList.append('G1 X%f Y%f E%f F%d' % (w - dist, d - dist, eValue, feedPrint)) eValue += (d - 2.0*dist) * ePerMM gcodeList.append('G1 X%f Y%f E%f F%d' % (w - dist, dist, eValue, feedPrint)) eValue += (w - 2.0*dist) * ePerMM gcodeList.append('G1 X%f Y%f E%f F%d' % (dist, dist, eValue, feedPrint)) gcodeList.append('M400') self.comm.printGCode(gcodeList) self.resumeButton.Enable(False)
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(60), "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" 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"]) / 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 return settings
def _engineSettings(self, extruderCount): #not used! 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, 'sparseInfillLineDistance': int(100 * profile.calculateEdgeWidth() * 1000 / profile.getProfileSettingFloat('fill_density')) if profile.getProfileSettingFloat('fill_density') > 0 else -1, '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')), 'fanOnLayerNr': int(profile.getProfileSettingFloat('fan_layer')), '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(60), 'supportEverywhere': int(1) if profile.getProfileSetting('support') == 'Everywhere' else int(0), 'supportLineWidth': int(profile.getProfileSettingFloat('support_rate') * profile.calculateEdgeWidth() * 1000 / 100), 'retractionAmount': int(profile.getProfileSettingFloat('retraction_amount') * 1000) if profile.getProfileSetting('retraction_enable') == 'True' else 0, 'retractionSpeed': int(profile.getProfileSettingFloat('retraction_speed')), 'retractionAmountExtruderSwitch': int(profile.getProfileSettingFloat('retraction_dual_amount') * 1000), '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.getPreferenceFloat('extruder_offset_x1') * 1000), 'extruderOffset[1].Y': int(profile.getPreferenceFloat('extruder_offset_y1') * 1000), 'extruderOffset[2].X': int(profile.getPreferenceFloat('extruder_offset_x2') * 1000), 'extruderOffset[2].Y': int(profile.getPreferenceFloat('extruder_offset_y2') * 1000), 'extruderOffset[3].X': int(profile.getPreferenceFloat('extruder_offset_x3') * 1000), 'extruderOffset[3].Y': int(profile.getPreferenceFloat('extruder_offset_y3') * 1000), 'fixHorrible': 0, } 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['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')) 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 return settings
def mcTempUpdate(self, temp, bedTemp, targetTemp, bedTargetTemp): if self._wizardState == 1: self._wizardState = 2 wx.CallAfter( self.infoBox.SetAttention, 'Adjust the front left screw of your printer bed\nSo the nozzle just hits the bed.' ) wx.CallAfter(self.resumeButton.Enable, True) elif self._wizardState == 3: self._wizardState = 4 wx.CallAfter( self.infoBox.SetAttention, 'Adjust the back left screw of your printer bed\nSo the nozzle just hits the bed.' ) wx.CallAfter(self.resumeButton.Enable, True) elif self._wizardState == 5: self._wizardState = 6 wx.CallAfter( self.infoBox.SetAttention, 'Adjust the back right screw of your printer bed\nSo the nozzle just hits the bed.' ) wx.CallAfter(self.resumeButton.Enable, True) elif self._wizardState == 7: self._wizardState = 8 wx.CallAfter( self.infoBox.SetAttention, 'Adjust the front right screw of your printer bed\nSo the nozzle just hits the bed.' ) wx.CallAfter(self.resumeButton.Enable, True) elif self._wizardState == 9: if temp < profile.getProfileSettingFloat('print_temperature') - 5: wx.CallAfter( self.infoBox.SetInfo, 'Heating up printer: %d/%d' % (temp, profile.getProfileSettingFloat('print_temperature'))) else: self._wizardState = 10 wx.CallAfter( self.infoBox.SetInfo, 'Printing a square on the printer bed at 0.3mm height.') feedZ = profile.getProfileSettingFloat('max_z_speed') * 60 feedPrint = profile.getProfileSettingFloat('print_speed') * 60 feedTravel = profile.getProfileSettingFloat( 'travel_speed') * 60 w = profile.getPreferenceFloat('machine_width') d = profile.getPreferenceFloat('machine_depth') filamentRadius = profile.getProfileSettingFloat( 'filament_diameter') / 2 filamentArea = math.pi * filamentRadius * filamentRadius ePerMM = (profile.calculateEdgeWidth() * 0.3) / filamentArea eValue = 0.0 gcodeList = [ 'G1 Z2 F%d' % (feedZ), 'G92 E0', 'G1 X%d Y%d F%d' % (5, 5, feedTravel), 'G1 Z0.3 F%d' % (feedZ) ] eValue += 5 gcodeList.append( 'G1 E%f F%d' % (eValue, profile.getProfileSettingFloat('retraction_speed') * 60)) for i in xrange(0, 3): dist = 5.0 + 0.4 * i eValue += (d - 2 * dist) * ePerMM gcodeList.append('G1 X%d Y%d E%f F%d' % (dist, d - dist, eValue, feedPrint)) eValue += (w - 2 * dist) * ePerMM gcodeList.append('G1 X%d Y%d E%f F%d' % (w - dist, d - dist, eValue, feedPrint)) eValue += (d - 2 * dist) * ePerMM gcodeList.append('G1 X%d Y%d E%f F%d' % (w - dist, dist, eValue, feedPrint)) eValue += (w - 2 * dist) * ePerMM gcodeList.append('G1 X%d Y%d E%f F%d' % (dist, dist, eValue, feedPrint)) gcodeList.append('M400') self.comm.printGCode(gcodeList)
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, 'sparseInfillLineDistance': int(100 * profile.calculateEdgeWidth() * 1000 / profile.getProfileSettingFloat('fill_density')) if profile.getProfileSettingFloat('fill_density') > 0 else -1, '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')), 'fanOnLayerNr': int(profile.getProfileSettingFloat('fan_layer')), '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(60), 'supportEverywhere': int(1) if profile.getProfileSetting('support') == 'Everywhere' else int(0), 'supportLineWidth': int( profile.getProfileSettingFloat('support_rate') * profile.calculateEdgeWidth() * 1000 / 100), 'retractionAmount': int(profile.getProfileSettingFloat('retraction_amount') * 1000) if profile.getProfileSetting('retraction_enable') == 'True' else 0, 'retractionSpeed': int(profile.getProfileSettingFloat('retraction_speed')), 'retractionAmountExtruderSwitch': int( profile.getProfileSettingFloat('retraction_dual_amount') * 1000), '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.getPreferenceFloat('extruder_offset_x1') * 1000), 'extruderOffset[1].Y': int(profile.getPreferenceFloat('extruder_offset_y1') * 1000), 'extruderOffset[2].X': int(profile.getPreferenceFloat('extruder_offset_x2') * 1000), 'extruderOffset[2].Y': int(profile.getPreferenceFloat('extruder_offset_y2') * 1000), 'extruderOffset[3].X': int(profile.getPreferenceFloat('extruder_offset_x3') * 1000), 'extruderOffset[3].Y': int(profile.getPreferenceFloat('extruder_offset_y3') * 1000), 'fixHorrible': 0, } 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['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')) 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 return settings