public ResumePrintingStream(GCodeFileStream internalStream, double percentDone)
		{
			this.internalStream = internalStream;
			this.percentDone = percentDone;

			queuedCommands = new QueuedCommandsStream(null);
		}
        public ResumePrintingStream(GCodeFileStream internalStream, double percentDone)
        {
            this.internalStream = internalStream;
            this.percentDone    = percentDone;

            queuedCommands = new QueuedCommandsStream(null);
        }
예제 #3
0
        public PrintRecoveryStream(GCodeFileStream internalStream, double percentDone)
        {
            this.internalStream = internalStream;
            this.percentDone    = percentDone;

            recoverFeedRate = ActiveSliceSettings.Instance.GetValue <double>(SettingsKey.recover_first_layer_speed);
            if (recoverFeedRate == 0)
            {
                recoverFeedRate = 10;
            }
            recoverFeedRate *= 60;

            queuedCommands = new QueuedCommandsStream(null);
        }
		public PrintRecoveryStream(GCodeFileStream internalStream, double percentDone)
		{
			this.internalStream = internalStream;
			this.percentDone = percentDone;

			recoverFeedRate = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.recover_first_layer_speed);
			if (recoverFeedRate == 0)
			{
				recoverFeedRate = 10;
			}
			recoverFeedRate *= 60;

			queuedCommands = new QueuedCommandsStream(null);
		}
예제 #5
0
        public ResumePrintingStream(GCodeFileStream internalStream, double percentDone)
        {
            this.internalStream = internalStream;
            this.percentDone    = percentDone;

            resumeFeedRate = ActiveSliceSettings.Instance.GetValue <double>("resume_first_layer_speed");
            if (resumeFeedRate == 0)
            {
                resumeFeedRate = 10;
            }
            resumeFeedRate *= 60;

            queuedCommands = new QueuedCommandsStream(null);
        }
        public PrintRecoveryStream(PrinterConfig printer, GCodeFileStream internalStream, double percentDone)
        {
            this.printer        = printer;
            this.internalStream = internalStream;
            this.percentDone    = percentDone;

            recoverFeedRate = printer.Settings.GetValue <double>(SettingsKey.recover_first_layer_speed);
            if (recoverFeedRate == 0)
            {
                recoverFeedRate = 10;
            }
            recoverFeedRate *= 60;

            queuedCommands = new QueuedCommandsStream(null);
        }
		private void loadGCodeWorker_DoWork(object sender, DoWorkEventArgs e)
		{
			totalGCodeStream?.Dispose();

			string gcodeFilename = e.Argument as string;
			loadedGCode = GCodeFile.Load(gcodeFilename);

			gCodeFileStream0 = new GCodeFileStream(loadedGCode);
			pauseHandlingStream1 = new PauseHandlingStream(gCodeFileStream0);
			queuedCommandStream2 = new QueuedCommandsStream(pauseHandlingStream1);
			relativeToAbsoluteStream3 = new RelativeToAbsoluteStream(queuedCommandStream2);
			printLevelingStream4 = new PrintLevelingStream(relativeToAbsoluteStream3);
			waitForTempStream5 = new WaitForTempStream(printLevelingStream4);
			babyStepsStream6 = new BabyStepsStream(waitForTempStream5);
			extrusionMultiplyerStream7 = new ExtrusionMultiplyerStream(babyStepsStream6);
			feedrateMultiplyerStream8 = new FeedRateMultiplyerStream(extrusionMultiplyerStream7);
			requestTemperaturesStream9 = new RequestTemperaturesStream(feedrateMultiplyerStream8);
			totalGCodeStream = requestTemperaturesStream9;
		}
		void CreateStreamProcessors(string gcodeFilename, bool recoveryEnabled)
		{
			totalGCodeStream?.Dispose();

			GCodeStream firstStream = null;
			if (gcodeFilename != null)
			{
				loadedGCode = GCodeFile.Load(gcodeFilename);
				gCodeFileStream0 = new GCodeFileStream(loadedGCode);

				if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.recover_is_enabled)
					&& activePrintTask != null) // We are resuming a failed print (do lots of interesting stuff).
				{
					pauseHandlingStream1 = new PauseHandlingStream(new PrintRecoveryStream(gCodeFileStream0, activePrintTask.PercentDone));
				}
				else
				{
					pauseHandlingStream1 = new PauseHandlingStream(gCodeFileStream0);
				}

				firstStream = pauseHandlingStream1;
			}
			else
			{
				firstStream = new NotPrintingStream();
			}

			queuedCommandStream2 = new QueuedCommandsStream(firstStream);
			relativeToAbsoluteStream3 = new RelativeToAbsoluteStream(queuedCommandStream2);
			printLevelingStream4 = new PrintLevelingStream(relativeToAbsoluteStream3, true);
			waitForTempStream5 = new WaitForTempStream(printLevelingStream4);
			babyStepsStream6 = new BabyStepsStream(waitForTempStream5);
			if (activePrintTask != null)
			{
				// make sure we are in the position we were when we stopped printing
				babyStepsStream6.Offset = new Vector3(activePrintTask.PrintingOffsetX, activePrintTask.PrintingOffsetY, activePrintTask.PrintingOffsetZ);
			}
			extrusionMultiplyerStream7 = new ExtrusionMultiplyerStream(babyStepsStream6);
			feedrateMultiplyerStream8 = new FeedRateMultiplyerStream(extrusionMultiplyerStream7);
			requestTemperaturesStream9 = new RequestTemperaturesStream(feedrateMultiplyerStream8);
			totalGCodeStream = requestTemperaturesStream9;
		}
		private void SaveGCodeToNewLocation(string gcodeFilename, string dest)
		{
			try
			{
				if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_enabled))
				{
					if (applyLeveling.Checked)
					{
						GCodeFile loadedGCode = GCodeFile.Load(gcodeFilename);
						GCodeFileStream gCodeFileStream0 = new GCodeFileStream(loadedGCode);
						PrintLevelingStream printLevelingStream4 = new PrintLevelingStream(gCodeFileStream0, false);
						// this is added to ensure we are rewriting the G0 G1 commands as needed
						FeedRateMultiplyerStream extrusionMultiplyerStream = new FeedRateMultiplyerStream(printLevelingStream4);

						using (StreamWriter file = new StreamWriter(dest))
						{
							string nextLine = extrusionMultiplyerStream.ReadLine();
							while (nextLine != null)
							{
								file.WriteLine(nextLine);
								nextLine = extrusionMultiplyerStream.ReadLine();
							}
						}
					}
					else
					{
						File.Copy(gcodeFilename, dest, true);
					}
				}
				else
				{
					File.Copy(gcodeFilename, dest, true);
				}
				ShowFileIfRequested(dest);
			}
			catch (Exception e)
			{
				UiThread.RunOnIdle (() => {
					StyledMessageBox.ShowMessageBox(null, e.Message, "Couldn't save file".Localize());
				});
			}
		}
		private void LoadGCodeToPrint(string gcodeFilename)
		{
			totalGCodeStream?.Dispose();

			loadedGCode = GCodeFile.Load(gcodeFilename);

			gCodeFileStream0 = new GCodeFileStream(loadedGCode);
			if(activePrintTask != null) // We are resuming a failed print (do lots of interesting stuff).
			{
				pauseHandlingStream1 = new PauseHandlingStream(new ResumePrintingStream(gCodeFileStream0, activePrintTask.PercentDone));
			}
			else
			{
				pauseHandlingStream1 = new PauseHandlingStream(gCodeFileStream0);
			}
			queuedCommandStream2 = new QueuedCommandsStream(pauseHandlingStream1);
			relativeToAbsoluteStream3 = new RelativeToAbsoluteStream(queuedCommandStream2);
			printLevelingStream4 = new PrintLevelingStream(relativeToAbsoluteStream3);
			waitForTempStream5 = new WaitForTempStream(printLevelingStream4);
			babyStepsStream6 = new BabyStepsStream(waitForTempStream5);
			if(activePrintTask != null)
			{
				// make sure we are in the position we were when we stopped printing
				babyStepsStream6.Offset = new Vector3(activePrintTask.PrintingOffsetX, activePrintTask.PrintingOffsetY, activePrintTask.PrintingOffsetZ);
			}
			extrusionMultiplyerStream7 = new ExtrusionMultiplyerStream(babyStepsStream6);
			feedrateMultiplyerStream8 = new FeedRateMultiplyerStream(extrusionMultiplyerStream7);
			requestTemperaturesStream9 = new RequestTemperaturesStream(feedrateMultiplyerStream8);
			totalGCodeStream = requestTemperaturesStream9;
		}