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 }
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; }
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); }
// 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); }
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); } } }
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); }
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)); }
public bool withinLimits(xyzPoint actualMachine, xyzPoint actualWorld) { return(withinLimits(actualMachine, minx - actualWorld.X, miny - actualWorld.Y) && withinLimits(actualMachine, maxx - actualWorld.X, maxy - actualWorld.Y)); }
public xyPoint(xyzPoint tmp) { X = tmp.X; Y = tmp.Y; }