private void Abort() { ModelPrint = Visibility.Collapsed; ModelPrintDone = Visibility.Collapsed; if (RotateX != 0 || RotateY != 0 || RotateZ != 0) { CurrentModelPath = CurrentModelPath.Substring(0, CurrentModelPath.IndexOf("_rotated.stl")) + ".stl"; } }
private void GenerateGCODE() { rotatorManipulatorX.Visibility = Visibility.Collapsed; rotatorManipulatorY.Visibility = Visibility.Collapsed; rotatorManipulatorZ.Visibility = Visibility.Collapsed; ScaleXYZ.Visibility = Visibility.Collapsed; adp.HasFinished = false; ModelPrint = Visibility.Visible; ProgressString = adp.ProgressOutput = ""; ProgressValue = adp.ProgressValue = 0; AllowUIToUpdate(); adp.Config = PrintConfig; PrintConfig.ExtraConfiguration["scale"] = (ScaleFactor / 100).ToString(); if (RotateX == 0 && RotateY == 0 && RotateZ == 0) { } else { AdmeshAdapter.Rotate(CurrentModelPath, RotateX, RotateY, RotateZ); CurrentModelPath = CurrentModelPath.Substring(0, CurrentModelPath.IndexOf('.')) + "_rotated.stl"; } ThreadPool.QueueUserWorkItem((state) => { Thread.Sleep(200); while (adp.HasFinished == false) { ProgressString = adp.ProgressOutput; ProgressValue = adp.ProgressValue; AllowUIToUpdate(); } ProgressString = adp.ProgressOutput; ProgressValue = adp.ProgressValue; AllowUIToUpdate(); }); ThreadPool.QueueUserWorkItem((state) => { adp.GenerateGcode(); ModelPrintDone = Visibility.Visible; }); }