Example #1
0
            protected override void OnClick(EventArgs e)
            {
                if (mDrawDisabled || !CustomButton.EnabledNow(Core))
                {
                    return;
                }

                string[] arr = cb.GCode.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
                foreach (string str in arr)
                {
                    string command = str;
                    if (command.Trim().Length > 0)
                    {
                        decimal left   = Core.LoadedFile != null && Core.LoadedFile.Range.MovingRange.ValidRange ? Core.LoadedFile.Range.DrawingRange.X.Min : 0;
                        decimal right  = Core.LoadedFile != null && Core.LoadedFile.Range.MovingRange.ValidRange ? Core.LoadedFile.Range.DrawingRange.X.Max : 0;
                        decimal top    = Core.LoadedFile != null && Core.LoadedFile.Range.MovingRange.ValidRange ? Core.LoadedFile.Range.DrawingRange.Y.Max : 0;
                        decimal bottom = Core.LoadedFile != null && Core.LoadedFile.Range.MovingRange.ValidRange ? Core.LoadedFile.Range.DrawingRange.Y.Min : 0;

                        decimal width  = right - left;
                        decimal height = top - bottom;

                        command = command.Replace("[left]", FormatNumber(left));
                        command = command.Replace("[right]", FormatNumber(right));
                        command = command.Replace("[top]", FormatNumber(top));
                        command = command.Replace("[bottom]", FormatNumber(bottom));

                        command = command.Replace("[width]", FormatNumber(width));
                        command = command.Replace("[height]", FormatNumber(height));

                        Core.EnqueueCommand(new GrblCommand(command));
                    }
                }
                base.OnClick(e);
            }
Example #2
0
 private void MnGoHome_Click(object sender, EventArgs e)
 {
     Core.EnqueueCommand(new GrblCommand("$H"));
 }
Example #3
0
 void TxtManualCommandCommandEntered(string command)
 {
     Core.EnqueueCommand(new GrblCommand(command));
 }
Example #4
0
 void BtnGoHomeClick(object sender, EventArgs e)
 {
     Core.EnqueueCommand(new GrblCommand("$H"));
 }