chiark / gitweb /
Changed layer height warning to use nozzle size. Added max volume extrusion per secon...
authordaid <daid303@gmail.com>
Mon, 19 Mar 2012 10:45:40 +0000 (11:45 +0100)
committerdaid <daid303@gmail.com>
Mon, 19 Mar 2012 10:45:40 +0000 (11:45 +0100)
SkeinPyPy/newui/mainWindow.py
SkeinPyPy/newui/preview3d.py
SkeinPyPy/newui/validators.py

index 90888882d50f2306b3b5dd0e96114ef8b3c5bde3..65ca69ba5c94388d9d6f1c8f58fc7d2d2555b282 100644 (file)
@@ -84,7 +84,7 @@ class mainWindow(configBase.configWindowBase):
                configBase.TitleRow(left, "Accuracy")
                c = configBase.SettingRow(left, "Layer height (mm)", 'layer_height', '0.2', 'Layer height in millimeters.\n0.2 is a good value for quick prints.\n0.1 gives high quality prints.')
                validators.validFloat(c, 0.0)
-               validators.warningAbove(c, 0.31, "Thicker layers then 0.3mm usually give bad results and are not recommended.")
+               validators.warningAbove(c, lambda : (float(profile.getProfileSetting('nozzle_size')) * 80 / 100), "Thicker layers then %.2fmm (80%% nozzle size) usually give bad results and are not recommended.")
                c = configBase.SettingRow(left, "Wall thickness (mm)", 'wall_thickness', '0.8', 'Thickness of the walls.\nThis is used in combination with the nozzle size to define the number\nof perimeter lines and the thickness of those perimeter lines.')
                validators.validFloat(c, 0.0)
                validators.wallThicknessValidator(c)
@@ -105,6 +105,7 @@ class mainWindow(configBase.configWindowBase):
                c = configBase.SettingRow(right, "Print speed (mm/s)", 'print_speed', '50', 'Speed at which printing happens. A well adjusted Ultimaker can reach 150mm/s, but for good quality prints you want to print slower. Printing speed depends on a lot of factors. So you will be experimenting with optimal settings for this.')
                validators.validFloat(c, 1.0)
                validators.warningAbove(c, 150.0, "It is highly unlikely that your machine can achieve a printing speed above 150mm/s")
+               validators.printSpeedValidator(c)
                
                configBase.TitleRow(right, "Temperature")
                c = configBase.SettingRow(right, "Printing temperature", 'print_temperature', '0', 'Temperature used for printing. Set at 0 to pre-heat yourself')
index 8bdcc22e79940757fbd7ff34c7e3c75aba24858a..14d3b0e9d64e0143abe3263246147db4162f6fb0 100644 (file)
@@ -343,12 +343,13 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
                                                for i in xrange(0, len(path['list'])-1):\r
                                                        v0 = path['list'][i]\r
                                                        v1 = path['list'][i+1]\r
+\r
+                                                       # Calculate line width from ePerDistance (needs layer thickness and filament diameter)\r
                                                        dist = (v0 - v1).vsize()\r
                                                        if dist > 0 and layerThickness > 0:\r
                                                                extrusionMMperDist = (v1.e - v0.e) / (v0 - v1).vsize()\r
                                                                lineWidth = extrusionMMperDist * filamentArea / layerThickness / 2\r
 \r
-                                                       #TODO: Calculate line width from ePerDistance (needs layer thickness, steps_per_E and filament diameter)\r
                                                        normal = (v0 - v1).cross(util3d.Vector3(0,0,1))\r
                                                        normal.normalize()\r
                                                        v2 = v0 + normal * lineWidth\r
index d9d141a9d00362c94a67a9c6b82c7ed80128732e..7a2bedb56043acc7cf1da48aa1f51070a04857fc 100644 (file)
@@ -1,6 +1,9 @@
 from __future__ import absolute_import
 import __init__
 
+import types
+import math
+
 from newui import profile
 
 SUCCESS = 0
@@ -53,8 +56,12 @@ class warningAbove():
        def validate(self):
                try:
                        f = float(self.setting.GetValue())
-                       if f >= self.minValueForWarning:
-                               return WARNING, self.warningMessage
+                       if isinstance(self.minValueForWarning, types.FunctionType):
+                               if f >= self.minValueForWarning():
+                                       return WARNING, self.warningMessage % (self.minValueForWarning())
+                       else:
+                               if f >= self.minValueForWarning:
+                                       return WARNING, self.warningMessage
                        return SUCCESS, ''
                except ValueError:
                        #We already have an error by the int/float validator in this case.
@@ -86,3 +93,27 @@ class wallThicknessValidator():
                        #We already have an error by the int/float validator in this case.
                        return SUCCESS, ''
 
+class printSpeedValidator():
+       def __init__(self, setting):
+               self.setting = setting
+               self.setting.validators.append(self)
+
+       def validate(self):
+               try:
+                       nozzleSize = float(profile.getProfileSetting('nozzle_size'))
+                       layerHeight = float(profile.getProfileSetting('layer_height'))
+                       printSpeed = float(profile.getProfileSetting('print_speed'))
+                       
+                       printVolumePerMM = layerHeight * nozzleSize
+                       printVolumePerSecond = printVolumePerMM * printSpeed
+                       #Using 10mm3 per second with a 0.4mm nozzle (normal max according to Joergen Geerds)
+                       maxPrintVolumePerSecond = 10 / (math.pi*(0.2*0.2)) * (math.pi*(nozzleSize/2*nozzleSize/2))
+                       
+                       if printVolumePerSecond > maxPrintVolumePerSecond:
+                               return WARNING, 'You are trying to print more then %.1fmm^3 of filament per second. This might cause filament slipping.' % (maxPrintVolumePerSecond)
+                       
+                       return SUCCESS, ''
+               except ValueError:
+                       #We already have an error by the int/float validator in this case.
+                       return SUCCESS, ''
+