chiark / gitweb /
Add bottom layer thickness. Fix bug with line with in 3D preview (was not calculated...
authordaid <daid303@gmail.com>
Thu, 5 Apr 2012 14:50:59 +0000 (16:50 +0200)
committerdaid <daid303@gmail.com>
Thu, 5 Apr 2012 14:50:59 +0000 (16:50 +0200)
Cura/cura_sf/fabmetheus_utilities/settings.py
Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/speed.py
Cura/gui/mainWindow.py
Cura/gui/preview3d.py
Cura/gui/printWindow.py
Cura/gui/simpleMode.py
Cura/util/profile.py
Cura/util/sliceRun.py

index aeb64c154cf876821be8dc0e1db2314c29dabd03..61cc77f388cd95e4195fc56a144d3bf4e4ada8a3 100644 (file)
@@ -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,
index 370a315dc6eef3305ca3c0f6f9c39b9ce63f60de..cac112ef34f846477ea86d7ad857ad22f8012edf 100644 (file)
@@ -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
index 870e02df86d98ca2d1fda740cc9e8e03f6636e71..d602ce40263b1d97825aede01f8057369209080d 100644 (file)
@@ -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.
index 935cef7be51794e7fd54f28775adbe80b8c0e5cc..3d36bcdc97df66962ebc81824b6c0844e9156fb8 100644 (file)
@@ -439,10 +439,13 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
                                layerThickness = 0.0\r
                                filamentRadius = float(profile.getProfileSetting('filament_diameter')) / 2\r
                                filamentArea = math.pi * filamentRadius * filamentRadius\r
-                               lineWidth = float(profile.getProfileSetting('nozzle_size')) / 2\r
+                               lineWidth = float(profile.getProfileSetting('nozzle_size')) / 2 / 10\r
                                \r
                                curLayerNum = 0\r
                                for layer in self.parent.gcode.layerList:\r
+                                       curLayerZ = layer[0].list[1].z\r
+                                       layerThickness = curLayerZ - prevLayerZ\r
+                                       prevLayerZ = layer[-1].list[-1].z\r
                                        for path in layer:\r
                                                c = 1.0\r
                                                if curLayerNum != self.parent.layerSpin.GetValue():\r
index b48650aded03a07400094876e53248d97af0b148..46c7152bc6a572853381d74953d2c19590970a6f 100644 (file)
@@ -199,7 +199,7 @@ class printWindow(wx.Frame):
                                self.temp = float(re.search("[0-9\.]*", line.split('T:')[1]).group(0))\r
                                wx.CallAfter(self.UpdateProgress)\r
                        if self.printIdx == None:\r
-                               if line == '':  #When we have a communication "timeout" and we're not sending gcode read the temperature.\r
+                               if line == '':  #When we have a communication "timeout" and we're not sending gcode, then read the temperature.\r
                                        self.machineCom.sendCommand("M105")\r
                        else:\r
                                if line.startswith("ok"):\r
index 1b498be714622b0117f7b054d94a6d9c580983fc..ece6ffaa2794fa4f1a1aca53673ef68c5d4a4cad 100644 (file)
@@ -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)
index 213c57a519975572558791700f9433613f74d12d..e39d9257ea61610367ce6bfa10181a4c35af1277 100644 (file)
@@ -61,6 +61,7 @@ profileDefaultSettings = {
        'raft_margin': '5',\r
        'raft_base_material_amount': '100',\r
        'raft_interface_material_amount': '100',\r
+       'bottom_thickness': '0.0',\r
 }\r
 preferencesDefaultSettings = {\r
        'wizardDone': 'False',\r
index 4813f359f2cdbcb38390edf6a5b93f4e00fe5660..0bc157fa1e88be44a9b977ad3ea19a79afd625f6 100644 (file)
@@ -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'),