예제 #1
0
 public static void getPosition(string text, ref xyzPoint position)
 {
     string[] dataField = text.Split(':');
     string[] dataValue = dataField[1].Split(',');
     //            axisA = false; axisB = false; axisC = false;
     axisCount = 0;
     if (dataValue.Length > 2)
     {
         Double.TryParse(dataValue[0], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out position.X);
         Double.TryParse(dataValue[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out position.Y);
         Double.TryParse(dataValue[2], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out position.Z);
         axisCount = 3;
     }
     if (dataValue.Length > 3)
     {
         Double.TryParse(dataValue[3], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out position.A);
         axisA = true; axisCount++;
     }
     if (dataValue.Length > 4)
     {
         Double.TryParse(dataValue[4], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out position.B);
         axisB = true; axisCount++;
     }
     if (dataValue.Length > 5)
     {
         Double.TryParse(dataValue[5], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out position.C);
         axisC = true; axisCount++;
     }
     //axisA = true; axisB = true; axisC = true;     // for test only
 }
예제 #2
0
 public PosEventArgs(xyzPoint world, xyzPoint machine, grblState stat, mState msg, pState last, string sraw)
 {
     posWorld   = world;
     posMachine = machine;
     status     = stat;
     statMsg    = msg;
     lastCmd    = last;
     raw        = sraw;
 }
예제 #3
0
        public static xyzPoint operator -(xyzPoint b, xyzPoint c)
        {
            xyzPoint a = new xyzPoint();

            a.X = b.X - c.X;
            a.Y = b.Y - c.Y;
            a.Z = b.Z - c.Z;
            a.A = b.A - c.A;
            a.B = b.B - c.B;
            a.C = b.C - c.C;
            return(a);
        }
예제 #4
0
        // Overload + operator
        public static xyzPoint operator +(xyzPoint b, xyzPoint c)
        {
            xyzPoint a = new xyzPoint();

            a.X = b.X + c.X;
            a.Y = b.Y + c.Y;
            a.Z = b.Z + c.Z;
            a.A = b.A + c.A;
            a.B = b.B + c.B;
            a.C = b.C + c.C;
            return(a);
        }
예제 #5
0
        public static void setCoordinates(string id, string value)
        {
            xyzPoint tmp     = new xyzPoint();
            string   allowed = "PRBG54G55G56G57G58G59G28G30G92";

            if (allowed.Contains(id))
            {
                getPosition("abc:" + value, ref tmp);
                if (coordinates.ContainsKey(id))
                {
                    coordinates[id] = tmp;
                }
                else
                {
                    coordinates.Add(id, tmp);
                }
            }
        }
예제 #6
0
        public bool withinLimits(xyzPoint actualMachine, double tstx, double tsty)
        {
            double minlx = (double)Properties.Settings.Default.machineLimitsHomeX;
            double maxlx = minlx + (double)Properties.Settings.Default.machineLimitsRangeX;
            double minly = (double)Properties.Settings.Default.machineLimitsHomeY;
            double maxly = minly + (double)Properties.Settings.Default.machineLimitsRangeY;

            tstx += actualMachine.X;
            tsty += actualMachine.Y;
            if ((tstx < minlx) || (tstx > maxlx))
            {
                return(false);
            }
            if ((tsty < minly) || (tsty > maxly))
            {
                return(false);
            }
            return(true);
        }
예제 #7
0
 public static bool AlmostEqual(xyzPoint b, xyzPoint c)
 {
     return((Math.Abs(b.X - c.X) <= grbl.resolution) && (Math.Abs(b.Y - c.Y) <= grbl.resolution) && (Math.Abs(b.Z - c.Z) <= grbl.resolution));
 }
예제 #8
0
 public bool withinLimits(xyzPoint actualMachine, xyzPoint actualWorld)
 {
     return(withinLimits(actualMachine, minx - actualWorld.X, miny - actualWorld.Y) && withinLimits(actualMachine, maxx - actualWorld.X, maxy - actualWorld.Y));
 }
예제 #9
0
 public xyPoint(xyzPoint tmp)
 {
     X = tmp.X; Y = tmp.Y;
 }