def __init__(self, parent): self._parent = parent self._result = None self._enabled = False self._gcodeLoadProgress = 0 self._resultLock = threading.Lock() self._layerVBOs = [] self._layer20VBOs = [] self.layerSelect = openglGui.glSlider(self._parent, 10000, 0, 1, (-1,-2), lambda : self._parent.QueueRefresh())
def __init__(self, parent): self._parent = parent self._result = None self._enabled = False self._singleLayer = False self._gcodeLoadProgress = 0 self._resultLock = threading.Lock() self._layerVBOs = [] self._layer20VBOs = [] self.layerSelect = openglGui.glSlider(self._parent, 10000, 1, 1, (-1,-2), lambda : self._parent.QueueRefresh()) self.singleLayerToggle = openglGui.glButton(self._parent, 23, _("Single Layer"), (-1,-1.5), self.OnSingleLayerToggle, 0.5) #stay half size of the base size
def __init__(self, parent): self._parent = parent self._result = None self._enabled = False self._singleLayer = False self._gcodeLoadProgress = 0 self._resultLock = threading.Lock() self._layerVBOs = [] self._layer20VBOs = [] self.layerSelect = openglGui.glSlider( self._parent, 10000, 1, 1, (-1, -2), lambda: self._parent.QueueRefresh()) self.singleLayerToggle = openglGui.glButton( self._parent, 27, _("Single Layer"), (-1.1, -1.4), self.OnSingleLayerToggle, 0.75) #stay at 75% size of the base size
def __init__(self, parent): super(previewPanel, self).__init__(parent,-1) self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DDKSHADOW)) self.SetMinSize((440,320)) self.objectList = [] self.errorList = [] self.gcode = None self.objectsMinV = None self.objectsMaxV = None self.objectsBoundaryCircleSize = None self.loadThread = None self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height')) self.machineCenter = util3d.Vector3(self.machineSize.x / 2, self.machineSize.y / 2, 0) self.glCanvas = PreviewGLCanvas(self) #Create the popup window self.warningPopup = wx.PopupWindow(self, flags=wx.BORDER_SIMPLE) self.warningPopup.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)) self.warningPopup.text = wx.StaticText(self.warningPopup, -1, 'Reset scale, rotation and mirror?') self.warningPopup.yesButton = wx.Button(self.warningPopup, -1, 'yes', style=wx.BU_EXACTFIT) self.warningPopup.noButton = wx.Button(self.warningPopup, -1, 'no', style=wx.BU_EXACTFIT) self.warningPopup.sizer = wx.BoxSizer(wx.HORIZONTAL) self.warningPopup.SetSizer(self.warningPopup.sizer) self.warningPopup.sizer.Add(self.warningPopup.text, 1, flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1) self.warningPopup.sizer.Add(self.warningPopup.yesButton, 0, flag=wx.EXPAND|wx.ALL, border=1) self.warningPopup.sizer.Add(self.warningPopup.noButton, 0, flag=wx.EXPAND|wx.ALL, border=1) self.warningPopup.Fit() self.warningPopup.Layout() self.warningPopup.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnHideWarning, self.warningPopup.timer) self.Bind(wx.EVT_BUTTON, self.OnWarningPopup, self.warningPopup.yesButton) self.Bind(wx.EVT_BUTTON, self.OnHideWarning, self.warningPopup.noButton) parent.Bind(wx.EVT_MOVE, self.OnMove) parent.Bind(wx.EVT_SIZE, self.OnMove) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.glCanvas, 1, flag=wx.EXPAND) self.SetSizer(sizer) self.checkReloadFileTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnCheckReloadFile, self.checkReloadFileTimer) self.checkReloadFileTimer.Start(1000) group = [] self.rotateToolButton = openglGui.glRadioButton(self.glCanvas, 1, 'Rotate', (0,-1), group, self.OnToolSelect) self.scaleToolButton = openglGui.glRadioButton(self.glCanvas, 2, 'Scale', (1,-1), group, self.OnToolSelect) self.mirrorToolButton = openglGui.glRadioButton(self.glCanvas, 12, 'Mirror', (2,-1), group, self.OnToolSelect) self.resetRotationButton = openglGui.glButton(self.glCanvas, 4, 'Reset rotation', (0,-2), self.OnRotateReset) self.layFlatButton = openglGui.glButton(self.glCanvas, 5, 'Lay flat', (0,-3), self.OnLayFlat) self.resetScaleButton = openglGui.glButton(self.glCanvas, 8, 'Scale reset', (1,-2), self.OnScaleReset) self.scaleMaxButton = openglGui.glButton(self.glCanvas, 9, 'Scale to machine size', (1,-3), self.OnScaleMax) self.mirrorXButton = openglGui.glButton(self.glCanvas, 12, 'Mirror X', (2,-2), lambda : self.OnMirror(0)) self.mirrorYButton = openglGui.glButton(self.glCanvas, 13, 'Mirror Y', (2,-3), lambda : self.OnMirror(1)) self.mirrorZButton = openglGui.glButton(self.glCanvas, 14, 'Mirror Z', (2,-4), lambda : self.OnMirror(2)) self.openFileButton = openglGui.glButton(self.glCanvas, 3, 'Load model', (0,0), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(1)) self.sliceButton = openglGui.glButton(self.glCanvas, 6, 'Prepare model', (1,0), lambda : self.GetParent().GetParent().GetParent().OnSlice(None)) self.printButton = openglGui.glButton(self.glCanvas, 7, 'Print model', (2,0), lambda : self.GetParent().GetParent().GetParent().OnPrint(None)) extruderCount = int(profile.getPreference('extruder_amount')) if extruderCount > 1: openglGui.glButton(self.glCanvas, 3, 'Load dual model', (0,1), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(2)) if extruderCount > 2: openglGui.glButton(self.glCanvas, 3, 'Load triple model', (0,2), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(3)) if extruderCount > 3: openglGui.glButton(self.glCanvas, 3, 'Load quad model', (0,3), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(4)) self.scaleForm = openglGui.glFrame(self.glCanvas, (2, -3)) openglGui.glGuiLayoutGrid(self.scaleForm) openglGui.glLabel(self.scaleForm, 'Scale X', (0,0)) self.scaleXctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,0), lambda value: self.OnScaleEntry(value, 0)) openglGui.glLabel(self.scaleForm, 'Scale Y', (0,1)) self.scaleYctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,1), lambda value: self.OnScaleEntry(value, 1)) openglGui.glLabel(self.scaleForm, 'Scale Z', (0,2)) self.scaleZctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,2), lambda value: self.OnScaleEntry(value, 2)) openglGui.glLabel(self.scaleForm, 'Size X (mm)', (0,4)) self.scaleXmmctrl = openglGui.glNumberCtrl(self.scaleForm, '0.0', (1,4), lambda value: self.OnScaleEntryMM(value, 0)) openglGui.glLabel(self.scaleForm, 'Size Y (mm)', (0,5)) self.scaleYmmctrl = openglGui.glNumberCtrl(self.scaleForm, '0.0', (1,5), lambda value: self.OnScaleEntryMM(value, 1)) openglGui.glLabel(self.scaleForm, 'Size Z (mm)', (0,6)) self.scaleZmmctrl = openglGui.glNumberCtrl(self.scaleForm, '0.0', (1,6), lambda value: self.OnScaleEntryMM(value, 2)) openglGui.glLabel(self.scaleForm, 'Uniform scale', (0,8)) self.scaleUniform = openglGui.glCheckbox(self.scaleForm, True, (1,8), None) self.viewSelection = openglGui.glComboButton(self.glCanvas, 'View mode', [0,1,2,3,4], ['3D Model', 'Transparent', 'X-Ray', 'Overhang', 'Layers'], (-1,0), self.OnViewChange) self.layerSelect = openglGui.glSlider(self.glCanvas, 0, 0, 100, (-1,-2), self.OnLayerNrChange) self.OnViewChange() self.OnToolSelect() self.returnToModelViewAndUpdateModel() self.matrix = numpy.matrix(numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((3,3,)))
def __init__(self, parent): super(SceneView, self).__init__(parent) self._yaw = 30 self._pitch = 60 self._zoom = 300 self._scene = objectScene.Scene() self._gcode = None self._gcodeVBOs = [] self._gcodeFilename = None self._gcodeLoadThread = None self._objectShader = None self._objectLoadShader = None self._focusObj = None self._selectedObj = None self._objColors = [None,None,None,None] self._mouseX = -1 self._mouseY = -1 self._mouseState = None self._viewTarget = numpy.array([0,0,0], numpy.float32) self._animView = None self._animZoom = None self._platformMesh = meshLoader.loadMeshes(resources.getPathForMesh('ultimaker_platform.stl'))[0] self._platformMesh._drawOffset = numpy.array([0,0,2.5], numpy.float32) self._isSimpleMode = True self._viewport = None self._modelMatrix = None self._projMatrix = None self.tempMatrix = None self.openFileButton = openglGui.glButton(self, 4, 'Load', (0,0), self.showLoadModel) self.printButton = openglGui.glButton(self, 6, 'Print', (1,0), self.OnPrintButton) self.printButton.setDisabled(True) group = [] self.rotateToolButton = openglGui.glRadioButton(self, 8, 'Rotate', (0,-1), group, self.OnToolSelect) self.scaleToolButton = openglGui.glRadioButton(self, 9, 'Scale', (1,-1), group, self.OnToolSelect) self.mirrorToolButton = openglGui.glRadioButton(self, 10, 'Mirror', (2,-1), group, self.OnToolSelect) self.resetRotationButton = openglGui.glButton(self, 12, 'Reset', (0,-2), self.OnRotateReset) self.layFlatButton = openglGui.glButton(self, 16, 'Lay flat', (0,-3), self.OnLayFlat) self.resetScaleButton = openglGui.glButton(self, 13, 'Reset', (1,-2), self.OnScaleReset) self.scaleMaxButton = openglGui.glButton(self, 17, 'To max', (1,-3), self.OnScaleMax) self.mirrorXButton = openglGui.glButton(self, 14, 'Mirror X', (2,-2), lambda button: self.OnMirror(0)) self.mirrorYButton = openglGui.glButton(self, 18, 'Mirror Y', (2,-3), lambda button: self.OnMirror(1)) self.mirrorZButton = openglGui.glButton(self, 22, 'Mirror Z', (2,-4), lambda button: self.OnMirror(2)) self.rotateToolButton.setExpandArrow(True) self.scaleToolButton.setExpandArrow(True) self.mirrorToolButton.setExpandArrow(True) self.scaleForm = openglGui.glFrame(self, (2, -2)) openglGui.glGuiLayoutGrid(self.scaleForm) openglGui.glLabel(self.scaleForm, 'Scale X', (0,0)) self.scaleXctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,0), lambda value: self.OnScaleEntry(value, 0)) openglGui.glLabel(self.scaleForm, 'Scale Y', (0,1)) self.scaleYctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,1), lambda value: self.OnScaleEntry(value, 1)) openglGui.glLabel(self.scaleForm, 'Scale Z', (0,2)) self.scaleZctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,2), lambda value: self.OnScaleEntry(value, 2)) openglGui.glLabel(self.scaleForm, 'Size X (mm)', (0,4)) self.scaleXmmctrl = openglGui.glNumberCtrl(self.scaleForm, '0.0', (1,4), lambda value: self.OnScaleEntryMM(value, 0)) openglGui.glLabel(self.scaleForm, 'Size Y (mm)', (0,5)) self.scaleYmmctrl = openglGui.glNumberCtrl(self.scaleForm, '0.0', (1,5), lambda value: self.OnScaleEntryMM(value, 1)) openglGui.glLabel(self.scaleForm, 'Size Z (mm)', (0,6)) self.scaleZmmctrl = openglGui.glNumberCtrl(self.scaleForm, '0.0', (1,6), lambda value: self.OnScaleEntryMM(value, 2)) openglGui.glLabel(self.scaleForm, 'Uniform scale', (0,8)) self.scaleUniform = openglGui.glCheckbox(self.scaleForm, True, (1,8), None) self.viewSelection = openglGui.glComboButton(self, 'View mode', [7,19,11,15,23], ['Normal', 'Overhang', 'Transparent', 'X-Ray', 'Layers'], (-1,0), self.OnViewChange) self.layerSelect = openglGui.glSlider(self, 10000, 0, 1, (-1,-2), lambda : self.QueueRefresh()) self.notification = openglGui.glNotification(self, (0, 0)) self._slicer = sliceEngine.Slicer(self._updateSliceProgress) self._sceneUpdateTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self._onRunSlicer, self._sceneUpdateTimer) self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave) self.OnViewChange() self.OnToolSelect(0) self.updateToolButtons() self.updateProfileToControls()
def __init__(self, parent): super(previewPanel, self).__init__(parent, -1) self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DDKSHADOW)) self.SetMinSize((440, 320)) self.objectList = [] self.errorList = [] self.gcode = None self.objectsMinV = None self.objectsMaxV = None self.objectsBoundaryCircleSize = None self.loadThread = None self.machineSize = util3d.Vector3( profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height')) self.machineCenter = util3d.Vector3(self.machineSize.x / 2, self.machineSize.y / 2, 0) self.glCanvas = PreviewGLCanvas(self) #Create the popup window self.warningPopup = wx.PopupWindow(self, flags=wx.BORDER_SIMPLE) self.warningPopup.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)) self.warningPopup.text = wx.StaticText( self.warningPopup, -1, 'Reset scale, rotation and mirror?') self.warningPopup.yesButton = wx.Button(self.warningPopup, -1, 'yes', style=wx.BU_EXACTFIT) self.warningPopup.noButton = wx.Button(self.warningPopup, -1, 'no', style=wx.BU_EXACTFIT) self.warningPopup.sizer = wx.BoxSizer(wx.HORIZONTAL) self.warningPopup.SetSizer(self.warningPopup.sizer) self.warningPopup.sizer.Add(self.warningPopup.text, 1, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=1) self.warningPopup.sizer.Add(self.warningPopup.yesButton, 0, flag=wx.EXPAND | wx.ALL, border=1) self.warningPopup.sizer.Add(self.warningPopup.noButton, 0, flag=wx.EXPAND | wx.ALL, border=1) self.warningPopup.Fit() self.warningPopup.Layout() self.warningPopup.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnHideWarning, self.warningPopup.timer) self.Bind(wx.EVT_BUTTON, self.OnWarningPopup, self.warningPopup.yesButton) self.Bind(wx.EVT_BUTTON, self.OnHideWarning, self.warningPopup.noButton) parent.Bind(wx.EVT_MOVE, self.OnMove) parent.Bind(wx.EVT_SIZE, self.OnMove) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.glCanvas, 1, flag=wx.EXPAND) self.SetSizer(sizer) self.checkReloadFileTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnCheckReloadFile, self.checkReloadFileTimer) self.checkReloadFileTimer.Start(1000) group = [] self.rotateToolButton = openglGui.glRadioButton( self.glCanvas, 8, 'Rotate', (0, -1), group, self.OnToolSelect) self.scaleToolButton = openglGui.glRadioButton(self.glCanvas, 9, 'Scale', (1, -1), group, self.OnToolSelect) self.mirrorToolButton = openglGui.glRadioButton( self.glCanvas, 10, 'Mirror', (2, -1), group, self.OnToolSelect) self.resetRotationButton = openglGui.glButton(self.glCanvas, 12, 'Reset', (0, -2), self.OnRotateReset) self.layFlatButton = openglGui.glButton(self.glCanvas, 16, 'Lay flat', (0, -3), self.OnLayFlat) self.resetScaleButton = openglGui.glButton(self.glCanvas, 13, 'Reset', (1, -2), self.OnScaleReset) self.scaleMaxButton = openglGui.glButton(self.glCanvas, 17, 'To max', (1, -3), self.OnScaleMax) self.mirrorXButton = openglGui.glButton(self.glCanvas, 14, 'Mirror X', (2, -2), lambda: self.OnMirror(0)) self.mirrorYButton = openglGui.glButton(self.glCanvas, 18, 'Mirror Y', (2, -3), lambda: self.OnMirror(1)) self.mirrorZButton = openglGui.glButton(self.glCanvas, 22, 'Mirror Z', (2, -4), lambda: self.OnMirror(2)) self.openFileButton = openglGui.glButton( self.glCanvas, 4, 'Load', (0, 0), lambda: self.GetParent().GetParent().GetParent( )._showModelLoadDialog(1)) self.sliceButton = openglGui.glButton( self.glCanvas, 5, 'Prepare', (1, 0), lambda: self.GetParent().GetParent().GetParent().OnSlice(None)) self.printButton = openglGui.glButton( self.glCanvas, 6, 'Print', (2, 0), lambda: self.GetParent().GetParent().GetParent().OnPrint(None)) self.rotateToolButton.setExpandArrow(True) self.scaleToolButton.setExpandArrow(True) self.mirrorToolButton.setExpandArrow(True) extruderCount = int(profile.getPreference('extruder_amount')) if extruderCount > 1: openglGui.glButton( self.glCanvas, 4, 'Load dual', (0, 1), lambda: self.GetParent( ).GetParent().GetParent()._showModelLoadDialog(2)) if extruderCount > 2: openglGui.glButton( self.glCanvas, 4, 'Load triple', (0, 2), lambda: self. GetParent().GetParent().GetParent()._showModelLoadDialog(3)) if extruderCount > 3: openglGui.glButton( self.glCanvas, 4, 'Load quad', (0, 3), lambda: self.GetParent( ).GetParent().GetParent()._showModelLoadDialog(4)) self.scaleForm = openglGui.glFrame(self.glCanvas, (2, -2)) openglGui.glGuiLayoutGrid(self.scaleForm) openglGui.glLabel(self.scaleForm, 'Scale X', (0, 0)) self.scaleXctrl = openglGui.glNumberCtrl( self.scaleForm, '1.0', (1, 0), lambda value: self.OnScaleEntry(value, 0)) openglGui.glLabel(self.scaleForm, 'Scale Y', (0, 1)) self.scaleYctrl = openglGui.glNumberCtrl( self.scaleForm, '1.0', (1, 1), lambda value: self.OnScaleEntry(value, 1)) openglGui.glLabel(self.scaleForm, 'Scale Z', (0, 2)) self.scaleZctrl = openglGui.glNumberCtrl( self.scaleForm, '1.0', (1, 2), lambda value: self.OnScaleEntry(value, 2)) openglGui.glLabel(self.scaleForm, 'Size X (mm)', (0, 4)) self.scaleXmmctrl = openglGui.glNumberCtrl( self.scaleForm, '0.0', (1, 4), lambda value: self.OnScaleEntryMM(value, 0)) openglGui.glLabel(self.scaleForm, 'Size Y (mm)', (0, 5)) self.scaleYmmctrl = openglGui.glNumberCtrl( self.scaleForm, '0.0', (1, 5), lambda value: self.OnScaleEntryMM(value, 1)) openglGui.glLabel(self.scaleForm, 'Size Z (mm)', (0, 6)) self.scaleZmmctrl = openglGui.glNumberCtrl( self.scaleForm, '0.0', (1, 6), lambda value: self.OnScaleEntryMM(value, 2)) openglGui.glLabel(self.scaleForm, 'Uniform scale', (0, 8)) self.scaleUniform = openglGui.glCheckbox(self.scaleForm, True, (1, 8), None) self.viewSelection = openglGui.glComboButton( self.glCanvas, 'View mode', [7, 11, 15, 19, 23], ['Normal', 'Transparent', 'X-Ray', 'Overhang', 'Layers'], (-1, 0), self.OnViewChange) self.layerSelect = openglGui.glSlider(self.glCanvas, 0, 0, 100, (-1, -2), lambda: self.Refresh()) self.OnViewChange() self.OnToolSelect() self.updateModelTransform() self.matrix = numpy.matrix( numpy.array(profile.getObjectMatrix(), numpy.float64).reshape(( 3, 3, )))