コード例 #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;
 }