diff --git a/SkeinPyPy/newui/mainWindow.py b/SkeinPyPy/newui/mainWindow.py index 9088888..65ca69b 100644 --- a/SkeinPyPy/newui/mainWindow.py +++ b/SkeinPyPy/newui/mainWindow.py @@ -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') diff --git a/SkeinPyPy/newui/preview3d.py b/SkeinPyPy/newui/preview3d.py index 8bdcc22..14d3b0e 100644 --- a/SkeinPyPy/newui/preview3d.py +++ b/SkeinPyPy/newui/preview3d.py @@ -343,12 +343,13 @@ class PreviewGLCanvas(glcanvas.GLCanvas): for i in xrange(0, len(path['list'])-1): v0 = path['list'][i] v1 = path['list'][i+1] + + # Calculate line width from ePerDistance (needs layer thickness and filament diameter) dist = (v0 - v1).vsize() if dist > 0 and layerThickness > 0: extrusionMMperDist = (v1.e - v0.e) / (v0 - v1).vsize() lineWidth = extrusionMMperDist * filamentArea / layerThickness / 2 - #TODO: Calculate line width from ePerDistance (needs layer thickness, steps_per_E and filament diameter) normal = (v0 - v1).cross(util3d.Vector3(0,0,1)) normal.normalize() v2 = v0 + normal * lineWidth diff --git a/SkeinPyPy/newui/validators.py b/SkeinPyPy/newui/validators.py index d9d141a..7a2bedb 100644 --- a/SkeinPyPy/newui/validators.py +++ b/SkeinPyPy/newui/validators.py @@ -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, '' +