Пример #1
0
        void BtnUseClick(object sender, EventArgs e)
        {
            if (_cancelTokenSource != null)
            {
                btnStartStop.Text = "Start";
                _alg.Running      = false;
                _cancelTokenSource.Cancel();
            }

            // first sort by z-order
            var    sortedBestPath = GCodeUtils.SortBlocksByZDepth(_alg.BestPath, _points);
            string gCode          = GCodeUtils.GetGCode(sortedBestPath, _points);

            _plotter.ParseGCodeString(gCode);
            this.Close();
        }
Пример #2
0
        void BtnSaveClick(object sender, EventArgs e)
        {
            string newFileName = Path.GetFileNameWithoutExtension(QuickSettings.Get["LastOpenedFile"]) + "_optimized.gcode";

            sfdSaveDialog.FileName = newFileName;
            var result = sfdSaveDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                // save original
                //GCodeUtils.SaveGCode(_alg.BestPath, _points, sfdSaveDialog.FileName + "_orig.gcode");

                // first sort by z-order
                var sortedBestPath = GCodeUtils.SortBlocksByZDepth(_alg.BestPath, _points);

                // then save
                GCodeUtils.SaveGCode(sortedBestPath, _points, sfdSaveDialog.FileName);
            }
        }