Exemplo n.º 1
0
        private void OnApplyCalibrationOffset()
        {
            PrinterObject selectedPrinter = m_oSpoolerConnection.SelectedPrinter;

            if (selectedPrinter == null)
            {
                m_oMessagebox.AddMessageToQueue("You must connect a printer first.");
            }
            else
            {
                var num1 = 2f;
                var num2 = -1f;
                if (!float.TryParse(m_oebwCalibrationOffset_edit.Text, out var result))
                {
                    m_oMessagebox.AddMessageToQueue("Sorry, but the 'Calibration Offset' is not a number. Please try again.");
                }
                else if (num2 > (double)result || num1 < (double)result)
                {
                    m_oMessagebox.AddMessageToQueue(string.Format("Sorry. The 'Calibration Offset' must be between {0} and {1} mm.", num2, num1));
                }
                else
                {
                    var num3 = (int)selectedPrinter.AcquireLock(new M3D.Spooling.Client.AsyncCallback(SetCalibrationOffsetAfterLock), new AdvancedCalibrationTab.CalibrationDetails(selectedPrinter, result));
                }
            }
        }
Exemplo n.º 2
0
        private void SetNozzleSize(PrinterObject printer, int iNozzleSizeMicrons)
        {
            if (printer == null || !printer.IsConnected())
            {
                return;
            }

            var num = (int)printer.AcquireLock(new M3D.Spooling.Client.AsyncCallback(ProcessCommandsToPrinter), new NozzlePage.SetNozzleParameters(printer, iNozzleSizeMicrons, false));
        }
Exemplo n.º 3
0
 public override void OnUpdate()
 {
     if (Visible)
     {
         PrinterObject selectedPrinter = MainWindow.GetSelectedPrinter();
         if (selectedPrinter == null)
         {
             MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page0_StartupPage, new Mangage3DInkStageDetails(Manage3DInkMainWindow.Mode.None));
             return;
         }
         if ((selectedPrinter.Info.Status == PrinterStatus.Firmware_Ready || selectedPrinter.Info.Status == PrinterStatus.Firmware_Idle || selectedPrinter.Info.Status == PrinterStatus.Firmware_PrintingPaused) && !selectedPrinter.WaitingForCommandToComplete && ((CurrentDetails.waitCondition != null ? (CurrentDetails.waitCondition() ? 1 : 0) : 1) != 0 && !finishedWaiting))
         {
             if (CurrentDetails.pageAfterWait == Manage3DInkMainWindow.PageID.Page0_StartupPage)
             {
                 if (selectedPrinter.LockStatus == PrinterLockStatus.Unlocked)
                 {
                     finishedWaiting = true;
                     var num = (int)selectedPrinter.AcquireLock(new AsyncCallback(DoStartUpSequenceCallsAfterLock), selectedPrinter);
                 }
                 else if (selectedPrinter.LockStatus == PrinterLockStatus.WeOwnLocked)
                 {
                     finishedWaiting = true;
                     DoStartUpSequence(selectedPrinter);
                 }
                 else
                 {
                     MainWindow.ActivateFrame(CurrentDetails.pageAfterWait, CurrentDetails);
                 }
             }
             else
             {
                 finishedWaiting = true;
                 MainWindow.ActivateFrame(CurrentDetails.pageAfterWait, CurrentDetails);
             }
         }
         else if (!selectedPrinter.WaitingForCommandToComplete && CurrentDetails.waitCondition == null)
         {
             MainWindow.ActivateFrame(CurrentDetails.pageAfterWait, CurrentDetails);
         }
         else if (selectedPrinter.Info.Status == PrinterStatus.Firmware_Idle)
         {
             if (!m_osIdleStopwatchTimer.IsRunning)
             {
                 m_osIdleStopwatchTimer.Restart();
             }
             else if (m_osIdleStopwatchTimer.ElapsedMilliseconds > 3000L)
             {
                 var num = (int)selectedPrinter.BreakLock(null, null);
                 finishedWaiting = true;
             }
         }
     }
     base.OnUpdate();
 }
Exemplo n.º 4
0
        private void ApplyCalibrationSettings(PrinterObject printer, Calibration newSettings, bool releaselock)
        {
            var entireZHeightOffset   = newSettings.ENTIRE_Z_HEIGHT_OFFSET;
            var frontRightOffset      = newSettings.CORNER_HEIGHT_FRONT_RIGHT_OFFSET;
            var heightFrontLeftOffset = newSettings.CORNER_HEIGHT_FRONT_LEFT_OFFSET;
            var heightBackRightOffset = newSettings.CORNER_HEIGHT_BACK_RIGHT_OFFSET;
            var heightBackLeftOffset  = newSettings.CORNER_HEIGHT_BACK_LEFT_OFFSET;

            if (printer == null)
            {
                return;
            }

            var num = (int)printer.AcquireLock(new AsyncCallback(SetBedOffsetsAfterLock), new CatScreenTab.BedInfoCallbackData(printer, new BedOffsets(heightBackLeftOffset, heightBackRightOffset, frontRightOffset, heightFrontLeftOffset, entireZHeightOffset), releaselock));
        }
Exemplo n.º 5
0
        private void OnApplyBacklashSettings()
        {
            PrinterObject selectedPrinter = m_oSpoolerConnection.SelectedPrinter;

            if (selectedPrinter == null)
            {
                m_oMessagebox.AddMessageToQueue("You must connect a printer first.");
            }
            else
            {
                var fastestPossible = selectedPrinter.MyPrinterProfile.SpeedLimitConstants.FastestPossible;
                var result1         = -1f;
                var result2         = -1f;
                var result3         = -1f;
                if (!float.TryParse(m_oebwBacklashX_edit.Text, out result1))
                {
                    m_oMessagebox.AddMessageToQueue("Sorry, but the X backlash is not a number. Please try again.");
                }
                else if (result1 < 0.0 || result1 > 3.0)
                {
                    m_oMessagebox.AddMessageToQueue("Sorry. Backlash X values must be between 0 mm and " + 3f + " mm");
                }
                else if (!float.TryParse(m_oebwBacklashY_edit.Text, out result2))
                {
                    m_oMessagebox.AddMessageToQueue("Sorry, but the Y backlash is not a number. Please try again.");
                }
                else if (result2 < 0.0 || result2 > 3.0)
                {
                    m_oMessagebox.AddMessageToQueue("Sorry. Backlash Y values must be between 0 mm and " + 3f + " mm");
                }
                else if (!float.TryParse(m_oebwBacklashSpeed_edit.Text, out result3))
                {
                    m_oMessagebox.AddMessageToQueue("Sorry, but the backlash speed is not a number. Please try again.");
                }
                else if (result3 < 500.0 || result3 > (double)fastestPossible)
                {
                    m_oMessagebox.AddMessageToQueue(string.Format("Sorry. Backlash speed must be between {0} and {1} mm/min.", 500f, fastestPossible));
                }
                else
                {
                    var num = (int)selectedPrinter.AcquireLock(new M3D.Spooling.Client.AsyncCallback(SetBacklashAfterLock), new AdvancedCalibrationTab.BacklashDetails(selectedPrinter, result1, result2, result3));
                }
            }
        }
Exemplo n.º 6
0
        public void TemperatureEditEnterCallback(EditBoxWidget edit)
        {
            PrinterObject selectedPrinter = MainWindow.GetSelectedPrinter();

            if (selectedPrinter == null)
            {
                return;
            }

            if (int.TryParse(custom_temperature_edit.Text.ToString(), out var result))
            {
                var min  = (int)FilamentConstants.Temperature.MaxMinForFilamentType(CurrentDetails.current_spool.filament_type).Min;
                var num1 = 260;
                if (result >= min && result <= num1)
                {
                    messagebox.AddMessageToQueue(string.Format("Changing the current temperature settings from {0} to {1}.", CurrentDetails.current_spool.filament_temperature, custom_temperature_edit.Text), PopupMessageBox.MessageBoxButtons.OK);
                    var filamentSpool = new FilamentSpool(CurrentDetails.current_spool)
                    {
                        filament_temperature = result
                    };
                    CurrentDetails.current_spool           = filamentSpool;
                    CurrentDetails.waitCondition           = new Mangage3DInkStageDetails.WaitCondition(WaitCondition);
                    CurrentDetails.pageAfterWait           = Manage3DInkMainWindow.PageID.Page0_StartupPage;
                    FilamentWaitingPage.CurrentWaitingText = "Please wait. The printer is busy perfoming the requested actions.";
                    settingsManager.FilamentDictionary.AddCustomTemperature(filamentSpool.filament_type, (FilamentConstants.ColorsEnum)Enum.ToObject(typeof(FilamentConstants.ColorsEnum), filamentSpool.filament_color_code), filamentSpool.filament_temperature);
                    MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page8_WaitingPage, CurrentDetails);
                    var num2 = (int)selectedPrinter.AcquireLock(new M3D.Spooling.Client.AsyncCallback(SetFilamentAfterLock), selectedPrinter);
                }
                else
                {
                    messagebox.AddMessageToQueue(new SpoolerMessage(MessageType.UserDefined, "Please enter a temperature from " + min + " to " + num1));
                }
            }
            else
            {
                messagebox.AddMessageToQueue(new SpoolerMessage(MessageType.UserDefined, "Please enter a valid temperature value"));
            }
        }
Exemplo n.º 7
0
 public void LockPrinterAndGotoPage(PrinterObject printer, Manage3DInkMainWindow.PageID page, Mangage3DInkStageDetails details)
 {
     var num = (int)printer.AcquireLock(new AsyncCallback(GotoPageAfterOperation), new Manage3DInkMainWindow.PageAfterLockDetails(printer, page, details));
 }
Exemplo n.º 8
0
 private void DoPrinterOperation(SDCardFrame.Operation op, PrinterObject printer, string file)
 {
     var num = (int)printer.AcquireLock(new M3D.Spooling.Client.AsyncCallback(DoOperationOnLock), new SDCardFrame.OnLockOperationData(op, printer, file));
 }
Exemplo n.º 9
0
        public void MyButtonCallback(ButtonWidget button)
        {
            PrinterObject printer = m_oSpoolerConnection.SelectedPrinter;

            switch (button.ID)
            {
            case 2:
                if (printer == null || printer.Info.InBootloaderMode)
                {
                    break;
                }

                var num1 = (int)printer.AcquireLock(ar =>
                {
                    if (ar.CallResult == CommandResult.Failed_PrinterAlreadyLocked)
                    {
                        m_oMessagebox.AddMessageToQueue("Unable to calibrate the printer because it is being used by another process.");
                    }
                    else if (ar.CallResult != CommandResult.Success_LockAcquired)
                    {
                        m_oMessagebox.AddMessageToQueue("There was a problem sending data to the printer. Please try again");
                    }
                    else
                    {
                        printer.CalibrateBed(new M3D.Spooling.Client.AsyncCallback(ReleaseAfterOperation), (object)printer, PrinterObject.CalibrationType.CalibrateQuick_G30);
                    }
                }, printer);
                break;

            case 3:
                if (printer == null || printer.Info.InBootloaderMode)
                {
                    break;
                }

                var num2 = (int)printer.AcquireLock(ar =>
                {
                    if (ar.CallResult == CommandResult.Failed_PrinterAlreadyLocked)
                    {
                        m_oMessagebox.AddMessageToQueue("Unable to calibrate the printer because it is being used by another process.");
                    }
                    else if (ar.CallResult != CommandResult.Success_LockAcquired)
                    {
                        m_oMessagebox.AddMessageToQueue("There was a problem sending data to the printer. Please try again");
                    }
                    else
                    {
                        printer.CalibrateBed(new M3D.Spooling.Client.AsyncCallback(ReleaseAfterOperation), (object)printer, PrinterObject.CalibrationType.CalibrateFull_G32);
                    }
                }, printer);
                break;

            case 4:
                var fileName = Paths.DebugLogPath(DateTime.Now.Ticks / 10000L);
                Form1.debugLogger.Print(fileName);
                break;

            case 5:
                if (printer.GetCurrentFilament() == null)
                {
                    m_oMessagebox.AddMessageToQueue("Please insert filament into your printer.");
                    break;
                }
                if (!printer.Info.extruder.Z_Valid || !printer.Info.calibration.Calibration_Valid)
                {
                    m_oMessagebox.AddMessageToQueue(Locale.GlobalLocale.T("T_PrinterViewError_NotCalibrated"));
                }

                ShowBusyIfPrinterIsWorking(true);
                var num3 = (int)printer.AcquireLock(new M3D.Spooling.Client.AsyncCallback(DoTestBorderPrintOnLock), printer);
                break;

            case 6:
                ShowGantryCalibrationG32Page();
                break;

            case 10:
                OnApplyBacklashSettings();
                break;

            case 11:
                if (printer == null || printer.Info.InBootloaderMode)
                {
                    break;
                }

                m_oebwBacklashSpeed_edit.Text = printer.MyPrinterProfile.SpeedLimitConstants.DefaultBacklashSpeed.ToString();
                break;

            case 12:
                if (printer == null || printer.Info.InBootloaderMode)
                {
                    break;
                }

                m_oebwBacklashSpeed_edit.Text = printer.MyPrinterProfile.SpeedLimitConstants.FastestPossible.ToString();
                break;

            case 13:
                ShowBasicCalibrationPage(printer);
                break;

            case 16:
                OnApplyCalibrationOffset();
                break;
            }
        }
Exemplo n.º 10
0
        public void diagnosticsFrameButtonCallback(ButtonWidget button)
        {
            PrinterObject selectedPrinter = spooler_connection.SelectedPrinter;

            if (selectedPrinter == null || !selectedPrinter.IsConnected())
            {
                return;
            }

            switch (button.ID)
            {
            case 1000:
                var num1 = (int)selectedPrinter.SendEmergencyStop(null, null);
                break;

            case 1020:
                var num2 = (int)selectedPrinter.DoFirmwareUpdate();
                break;

            case 1021:
                selectedPrinter.SendCommandAutoLockRelease(new M3D.Spooling.Client.AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, "G28");
                break;

            case 1022:
                var num3 = (int)selectedPrinter.AcquireLock(new M3D.Spooling.Client.AsyncCallback(FastRecenterOnLock), selectedPrinter);
                break;

            case 1023:
                List <string> xspeedTest = TestGeneration.CreateXSpeedTest(selectedPrinter.MyPrinterProfile);
                selectedPrinter.SendCommandAutoLockRelease(new M3D.Spooling.Client.AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, xspeedTest.ToArray());
                break;

            case 1024:
                List <string> yspeedTest = TestGeneration.CreateYSpeedTest(selectedPrinter.MyPrinterProfile);
                selectedPrinter.SendCommandAutoLockRelease(new M3D.Spooling.Client.AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, yspeedTest.ToArray());
                break;

            case 1025:
                var num4 = (int)selectedPrinter.AcquireLock(new M3D.Spooling.Client.AsyncCallback(DoBacklashPrintOnLock), selectedPrinter);
                break;

            case 1026:
                List <string> xskipTestMinus = TestGeneration.CreateXSkipTestMinus(selectedPrinter.MyPrinterProfile);
                selectedPrinter.SendCommandAutoLockRelease(new M3D.Spooling.Client.AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, xskipTestMinus.ToArray());
                break;

            case 1027:
                List <string> xskipTestPlus = TestGeneration.CreateXSkipTestPlus(selectedPrinter.MyPrinterProfile);
                selectedPrinter.SendCommandAutoLockRelease(new M3D.Spooling.Client.AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, xskipTestPlus.ToArray());
                break;

            case 1028:
                List <string> yskipTestMinus = TestGeneration.CreateYSkipTestMinus(selectedPrinter.MyPrinterProfile);
                selectedPrinter.SendCommandAutoLockRelease(new M3D.Spooling.Client.AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, yskipTestMinus.ToArray());
                break;

            case 1029:
                List <string> yskipTestPlus = TestGeneration.CreateYSkipTestPlus(selectedPrinter.MyPrinterProfile);
                selectedPrinter.SendCommandAutoLockRelease(new M3D.Spooling.Client.AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, yskipTestPlus.ToArray());
                break;
            }
        }