import platform
import wx, wx.lib.stattext, types
+from wx.lib.agw import floatspin
from Cura.util import validators
from Cura.util import profile
self.ctrl = wx.TextCtrl(panel, -1, getSettingFunc(configName))
self.ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange)
flag = wx.EXPAND
+ elif isinstance(defaultValue, types.FloatType):
+ digits = 0
+ while 1 / pow(10, digits) > defaultValue:
+ digits += 1
+ self.ctrl = floatspin.FloatSpin(panel, -1, value=float(getSettingFunc(configName)), increment=defaultValue, digits=digits, min_val=0.0)
+ self.ctrl.Bind(floatspin.EVT_FLOATSPIN, self.OnSettingChange)
+ flag = wx.EXPAND
elif isinstance(defaultValue, types.BooleanType):
self.ctrl = wx.CheckBox(panel, -1, style=wx.ALIGN_RIGHT)
self.SetValue(getSettingFunc(configName))
self.ctrl.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
self.ctrl.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseExit)
-
- self.defaultBGColour = self.ctrl.GetBackgroundColour()
+ if isinstance(self.ctrl, floatspin.FloatSpin):
+ self.ctrl.GetTextCtrl().Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
+ self.ctrl.GetTextCtrl().Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseExit)
+ self.defaultBGColour = self.ctrl.GetTextCtrl().GetBackgroundColour()
+ else:
+ self.defaultBGColour = self.ctrl.GetBackgroundColour()
panel.main.settingControlList.append(self)
result = res
if res != validators.SUCCESS:
msgs.append(err)
+ ctrl = self.ctrl
+ if isinstance(ctrl, floatspin.FloatSpin):
+ ctrl = ctrl.GetTextCtrl()
if result == validators.ERROR:
- self.ctrl.SetBackgroundColour('Red')
+ ctrl.SetBackgroundColour('Red')
elif result == validators.WARNING:
- self.ctrl.SetBackgroundColour('Yellow')
+ ctrl.SetBackgroundColour('Yellow')
else:
- self.ctrl.SetBackgroundColour(self.defaultBGColour)
- self.ctrl.Refresh()
+ ctrl.SetBackgroundColour(self.defaultBGColour)
+ ctrl.Refresh()
self.validationMsg = '\n'.join(msgs)
self.panel.main.UpdatePopup(self)
self.ctrl.SetValue(str(value) == "True")
elif isinstance(self.ctrl, wx.ColourPickerCtrl):
self.ctrl.SetColour(value)
+ elif isinstance(self.ctrl, floatspin.FloatSpin):
+ try:
+ self.ctrl.SetValue(float(value))
+ except ValueError:
+ pass
else:
self.ctrl.SetValue(value)
self.switchToNormalMenuItem = i
self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i)
toolsMenu.AppendSeparator()
- i = toolsMenu.Append(-1, 'Batch run...')
- self.Bind(wx.EVT_MENU, self.OnBatchRun, i)
- self.normalModeOnlyItems.append(i)
i = toolsMenu.Append(-1, 'Project planner...')
self.Bind(wx.EVT_MENU, self.OnProjectPlanner, i)
self.normalModeOnlyItems.append(i)
+ i = toolsMenu.Append(-1, 'Batch run...')
+ self.Bind(wx.EVT_MENU, self.OnBatchRun, i)
+ self.normalModeOnlyItems.append(i)
# i = toolsMenu.Append(-1, 'Open SVG (2D) slicer...')
# self.Bind(wx.EVT_MENU, self.OnSVGSlicerOpen, i)
if minecraftImport.hasMinecraft():
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)
validators.warningAbove(c, lambda : (float(profile.getProfileSetting('nozzle_size')) * 3.0 / 4.0), "A bottom layer of more then %.2fmm (3/4 nozzle size) usually give bad results and is not recommended.")
+ c = configBase.SettingRow(right, "Cut off object bottom (mm)", 'object_sink', 0.05, '...')
+ validators.validFloat(c, 0.0)
+ configBase.settingNotify(c, lambda : self.GetParent().GetParent().GetParent().preview3d.Refresh())
c = configBase.SettingRow(right, "Duplicate outlines", 'enable_skin', False, 'Skin prints the outer lines of the prints twice, each time with half the thickness. This gives the illusion of a higher print quality.')
self.SizeLabelWidths(left, right)
wx.CallAfter(self.Refresh)
glPushMatrix()
- glTranslate(self.parent.machineCenter.x, self.parent.machineCenter.y, 0)
+ glTranslate(self.parent.machineCenter.x, self.parent.machineCenter.y, -profile.getProfileSettingFloat('object_sink'))
for obj in self.parent.objectList:
if obj.mesh is None:
continue
glColor3f(1.0,1.0,1.0)
glPushMatrix()
- glTranslate(self.parent.machineCenter.x, self.parent.machineCenter.y, 0)
+ glTranslate(self.parent.machineCenter.x, self.parent.machineCenter.y, -profile.getProfileSettingFloat('object_sink'))
for obj in self.parent.objectList:
if obj.mesh is None:
continue
'ObjectMatrix': storedSetting("object_matrix"),
'CenterX': lambda setting: profile.getProfileSettingFloat('object_center_x'),
'CenterY': lambda setting: profile.getProfileSettingFloat('object_center_y'),
+ 'ObjectSink': storedSetting("object_sink"),
'AlternativeCenterFile': storedSetting("alternative_center"),
},'scale': {
'Activate_Scale': "False",
self.centerX = settings.FloatSpin().getFromValue(0.0, 'CenterX', self, 1000.0, 0.0);
self.centerY = settings.FloatSpin().getFromValue(0.0, 'CenterY', self, 1000.0, 0.0);
+ self.objectSink = settings.FloatSpin().getFromValue(0.0, 'ObjectSink', self, 1000.0, 0.0)
self.matrix = settings.StringSetting().getFromValue('ObjectMatrix', self, '1,0,0,0,1,0,0,0,1')
self.alternativeCenter = settings.StringSetting().getFromValue('AlternativeCenterFile', self, '')
minSize = carving.getCarveCornerMinimum()
maxSize = carving.getCarveCornerMaximum()
for v in carving.vertexes:
- v.z -= minZ
+ v.z -= minZ + repository.objectSink.value
v.x -= minSize.x + (maxSize.x - minSize.x) / 2
v.y -= minSize.y + (maxSize.y - minSize.y) / 2
v.x += repository.centerX.value
'plugin_config': '',
'object_center_x': '-1',
'object_center_y': '-1',
+ 'object_sink': '0.0',
'gcode_extension': 'gcode',
'alternative_center': '',