private void border_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            Z += ((float)e.Delta) / 300;
            GCode gcode = new GCode("G1", double.NaN, double.NaN, Z, 50000);

            RenderGCode(gcode);
        }
 private void RenderGCode(GCode gcode)
 {
     serial.Send(gcode.ToString());
     if (recording)
     {
         recordList.Add(gcode);
     }
 }
Beispiel #3
0
 public GCode(GCode gcode, double offsetX, double offsetY)
 {
     Command = gcode.Command;
     if (gcode.X != double.NaN)
         X = gcode.X + offsetX;
     else
         X = double.NaN;
     if (gcode.Y != double.NaN)
         Y = gcode.Y + offsetY;
     else
         Y = double.NaN;
     Z = gcode.Z;
     F = gcode.F;
 }
        private void Border_MouseMove(object sender, MouseEventArgs e)
        {
            if (isDrag)
            {
                //Point endPoint = ((Control)sender).PointToScreen(e.GetPosition());

                //int width = endPoint.X - startPoint.X;
                //int height = endPoint.Y - startPoint.Y;

                //var transform = PresentationSource.FromVisual(this).CompositionTarget.TransformFromDevice;
                //var mouse = transform.Transform(GetMousePosition());
                var   mouse        = e.GetPosition(border);
                Point printerPoint = new Point((mouse.X - (border.ActualWidth / 2)) / 10, (-mouse.Y + (border.ActualHeight / 2)) / 10);
                label1.Content = printerPoint.X.ToString();
                label2.Content = printerPoint.Y.ToString();

                GCode gcode = new GCode("G1", printerPoint.X, printerPoint.Y, double.NaN, 50000);
                RenderGCode(gcode);
            }
        }
        private void Border_MouseMove(object sender, MouseEventArgs e)
        {
            if (isDrag)
            {

                //Point endPoint = ((Control)sender).PointToScreen(e.GetPosition());

                //int width = endPoint.X - startPoint.X;
                //int height = endPoint.Y - startPoint.Y;

                //var transform = PresentationSource.FromVisual(this).CompositionTarget.TransformFromDevice;
                //var mouse = transform.Transform(GetMousePosition());
                var mouse = e.GetPosition(border);
                Point printerPoint = new Point((mouse.X - (border.ActualWidth / 2)) / 10, (-mouse.Y + (border.ActualHeight / 2)) / 10);
                label1.Content = printerPoint.X.ToString();
                label2.Content = printerPoint.Y.ToString();

                GCode gcode = new GCode("G1", printerPoint.X, printerPoint.Y, double.NaN, 50000);
                RenderGCode(gcode);
            }
        }
Beispiel #6
0
 public GCode(GCode gcode, double offsetX, double offsetY)
 {
     Command = gcode.Command;
     if (gcode.X != double.NaN)
     {
         X = gcode.X + offsetX;
     }
     else
     {
         X = double.NaN;
     }
     if (gcode.Y != double.NaN)
     {
         Y = gcode.Y + offsetY;
     }
     else
     {
         Y = double.NaN;
     }
     Z = gcode.Z;
     F = gcode.F;
 }
 private void border_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     Z += ((float)e.Delta) / 300;
     GCode gcode = new GCode("G1", double.NaN, double.NaN, Z, 50000);
     RenderGCode(gcode);
 }
 private void RenderGCode(GCode gcode)
 {
     serial.Send(gcode.ToString());
     if (recording)
         recordList.Add(gcode);
 }