From: daid Date: Thu, 5 Apr 2012 14:50:59 +0000 (+0200) Subject: Add bottom layer thickness. Fix bug with line with in 3D preview (was not calculated... X-Git-Tag: RC3~100 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=835b7883caac609564e722e2613741ab5dc45502;p=cura.git Add bottom layer thickness. Fix bug with line with in 3D preview (was not calculated from layer thickness) --- diff --git a/Cura/cura_sf/fabmetheus_utilities/settings.py b/Cura/cura_sf/fabmetheus_utilities/settings.py index aeb64c15..61cc77f3 100644 --- a/Cura/cura_sf/fabmetheus_utilities/settings.py +++ b/Cura/cura_sf/fabmetheus_utilities/settings.py @@ -64,6 +64,27 @@ def calculateMultiplyDistance(setting): edgeWidth = calculateEdgeWidth(setting) return 10.0 / edgeWidth +def calcBottomLayerFlowRateRatio(setting): + bottomThickness = float(profile.getProfileSetting('bottom_thickness')) + layerThickness = float(profile.getProfileSetting('layer_height')) + if bottomThickness < layerThickness: + return 1.0 + return bottomThickness / layerThickness + +def calcExtraBottomThickness(setting): + bottomThickness = float(profile.getProfileSetting('bottom_thickness')) + layerThickness = float(profile.getProfileSetting('layer_height')) + if bottomThickness < layerThickness: + return 0.0 + return bottomThickness - layerThickness + +def calcLayerSkip(setting): + bottomThickness = float(profile.getProfileSetting('bottom_thickness')) + layerThickness = float(profile.getProfileSetting('layer_height')) + if bottomThickness < layerThickness: + return 0 + return int(math.ceil((bottomThickness - layerThickness) / layerThickness + 0.0001) - 1) + def getProfileInformation(): return { 'carve': { @@ -72,7 +93,7 @@ def getProfileInformation(): 'Extra_Decimal_Places_float': DEFSET, 'Import_Coarseness_ratio': DEFSET, 'Layer_Height_mm': storedSetting("layer_height"), - 'Layers_From_index': DEFSET, + 'Layers_From_index': calcLayerSkip, 'Layers_To_index': DEFSET, 'Correct_Mesh': DEFSET, 'Unproven_Mesh': DEFSET, @@ -90,7 +111,7 @@ def getProfileInformation(): },'bottom': { 'Activate_Bottom': DEFSET, 'Additional_Height_over_Layer_Thickness_ratio': DEFSET, - 'Altitude_mm': DEFSET, + 'Altitude_mm': calcExtraBottomThickness, 'SVG_Viewer': DEFSET, },'preface': { 'Meta': DEFSET, @@ -167,6 +188,7 @@ def getProfileInformation(): 'Perimeter_Feed_Rate_Multiplier_ratio': DEFSET, 'Perimeter_Flow_Rate_Multiplier_ratio': DEFSET, 'Travel_Feed_Rate_mm/s': storedSetting("travel_speed"), + 'Bottom_layer_flow_rate_ratio': calcBottomLayerFlowRateRatio, },'temperature': { 'Activate_Temperature': DEFSET,#ifSettingAboveZero('print_temperature'), 'Cooling_Rate_Celcius/second': DEFSET, diff --git a/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/speed.py b/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/speed.py index 370a315d..cac112ef 100644 --- a/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/speed.py +++ b/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/speed.py @@ -210,6 +210,8 @@ class SpeedRepository: settings.LabelSeparator().getFromRepository(self) self.travelFeedRatePerSecond = settings.FloatSpin().getFromValue( 2.0, 'Travel Feed Rate (mm/s):', self, 350.0, 250.0 ) self.executeTitle = 'Speed' + + self.bottomLayerFlowRateMultiplier = settings.FloatSpin().getFromValue(0.0, 'Bottom layer flow rate (ratio):', self, 10.0, 1.0) def execute(self): "Speed button has been clicked." @@ -246,6 +248,8 @@ class SpeedSkein: flowRate *= ((self.repository.objectFirstLayerFlowRatePerimeterMultiplier.value * (self.repository.objectFirstLayersLayerAmount.value - self.layerIndex)) + self.layerIndex) / self.repository.objectFirstLayersLayerAmount.value else: flowRate *= ((self.repository.objectFirstLayerFlowRateInfillMultiplier.value * (self.repository.objectFirstLayersLayerAmount.value - self.layerIndex)) + self.layerIndex) / self.repository.objectFirstLayersLayerAmount.value + if self.layerIndex == 0: + flowRate *= self.repository.bottomLayerFlowRateMultiplier.value if flowRate != self.oldFlowRate: self.distanceFeedRate.addLine('M108 S' + euclidean.getFourSignificantFigures(flowRate)) self.oldFlowRate = flowRate diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 870e02df..d602ce40 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -171,6 +171,10 @@ class mainWindow(configBase.configWindowBase): 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) + nb.AddPage(alterationPanel.alterationPanel(nb), "Start/End-GCode") # load and slice buttons. diff --git a/Cura/gui/preview3d.py b/Cura/gui/preview3d.py index 935cef7b..3d36bcdc 100644 --- a/Cura/gui/preview3d.py +++ b/Cura/gui/preview3d.py @@ -439,10 +439,13 @@ class PreviewGLCanvas(glcanvas.GLCanvas): layerThickness = 0.0 filamentRadius = float(profile.getProfileSetting('filament_diameter')) / 2 filamentArea = math.pi * filamentRadius * filamentRadius - lineWidth = float(profile.getProfileSetting('nozzle_size')) / 2 + lineWidth = float(profile.getProfileSetting('nozzle_size')) / 2 / 10 curLayerNum = 0 for layer in self.parent.gcode.layerList: + curLayerZ = layer[0].list[1].z + layerThickness = curLayerZ - prevLayerZ + prevLayerZ = layer[-1].list[-1].z for path in layer: c = 1.0 if curLayerNum != self.parent.layerSpin.GetValue(): diff --git a/Cura/gui/printWindow.py b/Cura/gui/printWindow.py index b48650ad..46c7152b 100644 --- a/Cura/gui/printWindow.py +++ b/Cura/gui/printWindow.py @@ -199,7 +199,7 @@ class printWindow(wx.Frame): self.temp = float(re.search("[0-9\.]*", line.split('T:')[1]).group(0)) wx.CallAfter(self.UpdateProgress) if self.printIdx == None: - if line == '': #When we have a communication "timeout" and we're not sending gcode read the temperature. + if line == '': #When we have a communication "timeout" and we're not sending gcode, then read the temperature. self.machineCom.sendCommand("M105") else: if line.startswith("ok"): diff --git a/Cura/gui/simpleMode.py b/Cura/gui/simpleMode.py index 1b498be7..ece6ffaa 100644 --- a/Cura/gui/simpleMode.py +++ b/Cura/gui/simpleMode.py @@ -214,6 +214,7 @@ class simpleModeWindow(configBase.configWindowBase): put('raft_margin', '5') put('raft_base_material_amount', '100') put('raft_interface_material_amount', '100') + put('bottom_thickness', '0.0') if self.printSupport.GetValue(): put('support', 'Exterior Only') @@ -234,6 +235,7 @@ class simpleModeWindow(configBase.configWindowBase): put('layer_height', '0.1') put('fill_density', '30') put('bottom_layer_speed', '15') + put('bottom_thickness', '0.2') elif self.printTypeJoris.GetValue(): put('wall_thickness', nozzle_size * 1.5) put('layer_height', '0.2') @@ -255,6 +257,7 @@ class simpleModeWindow(configBase.configWindowBase): put('enable_raft', 'True') put('skirt_line_count', '0') put('fan_layer', '1') + put('bottom_thickness', '0.0') #Create a progress panel and add it to the window. The progress panel will start the Skein operation. spp = sliceProgessPanel.sliceProgessPanel(self, self, self.filename) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 213c57a5..e39d9257 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -61,6 +61,7 @@ profileDefaultSettings = { 'raft_margin': '5', 'raft_base_material_amount': '100', 'raft_interface_material_amount': '100', + 'bottom_thickness': '0.0', } preferencesDefaultSettings = { 'wizardDone': 'False', diff --git a/Cura/util/sliceRun.py b/Cura/util/sliceRun.py index 4813f359..0bc157fa 100644 --- a/Cura/util/sliceRun.py +++ b/Cura/util/sliceRun.py @@ -89,7 +89,7 @@ def getSliceCommand(filename): '--solid-layers', str(profile.calculateSolidLayerCount()), '--fill-density', str(float(profile.getProfileSetting('fill_density'))/100), '--fill-angle', '45', - '--fill-pattern', 'rectilinear', + '--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'),