/* public int Where(StageAxis axis, ref double[] where) * { * string command = GetStageString(axis); * string precision = stagePrecision; * * return 0; * }*/ public int SetSpeed(StageAxis axis, Int32[] speeds) { string command = GetStageString(axis); string precision = "H"; string numbers = ""; if (axis == StageAxis.Z) { numbers = "Z=" + speeds[0].ToString(); } else if (axis == StageAxis.XY) { numbers = "X=" + speeds[0].ToString() + " Y=" + speeds[1].ToString(); } command += precision + "S " + numbers; MainGUI.LogLine(command); if (sp.IsOpen) { string old = sp.ReadExisting(); sp.Write(command + "\r"); } string result = WaitForNewLine(standardTimeout); MainGUI.LogLine(result); return(0); }
public double[] GetStagePosition(StageAxis axis) { string command = GetStageString(axis); string precision = "H"; command += precision + "W "; string whichaxis = ""; if (axis == StageAxis.Z) { whichaxis = "Z"; } else if (axis == StageAxis.XY) { whichaxis = "X Y"; } command += whichaxis; MainGUI.LogLine(command); if (sp.IsOpen) { string old = sp.ReadExisting(); sp.Write(command + "\r"); } string result = WaitForNewLine(standardTimeout); if (result.Length <= 3) { result = WaitForNewLine(standardTimeout); } if (result == "Unknown") { return(null); } double[] retInt = null; if (axis == StageAxis.Z) { double zpos = 0; string zpart = result.Substring(2); zpos = Convert.ToDouble(zpart); retInt = new double[] { zpos }; } else if (axis == StageAxis.XY) { double xpos = 0, ypos = 0; string zpart = result.Substring(3);//remove :A_ string[] nums = zpart.Split(' '); xpos = Convert.ToDouble(nums[0]); ypos = Convert.ToDouble(nums[1]); retInt = new double[] { xpos, ypos }; } return(retInt); }
private string GetStageString(StageAxis axis) { if (axis == StageAxis.Z) { return("1"); } else { return("2"); } }
private string GetStageString(StageAxis axis) { if (axis == StageAxis.Z) return "1"; else return "2"; }
/* public int Where(StageAxis axis, ref double[] where) { string command = GetStageString(axis); string precision = stagePrecision; return 0; }*/ public int SetSpeed(StageAxis axis, Int32[] speeds) { string command = GetStageString(axis); string precision = "H"; string numbers = ""; if (axis == StageAxis.Z) numbers = "Z=" + speeds[0].ToString(); else if (axis == StageAxis.XY) numbers = "X=" + speeds[0].ToString() + " Y=" + speeds[1].ToString(); command += precision + "S " + numbers; MainGUI.LogLine(command); if (sp.IsOpen) { string old = sp.ReadExisting(); sp.Write(command + "\r"); } string result = WaitForNewLine(standardTimeout); MainGUI.LogLine(result); return 0; }
public double[] GetStagePosition(StageAxis axis) { string command = GetStageString(axis); string precision = "H"; command += precision + "W "; string whichaxis = ""; if (axis == StageAxis.Z) whichaxis = "Z"; else if (axis == StageAxis.XY) whichaxis = "X Y"; command += whichaxis; MainGUI.LogLine(command); if (sp.IsOpen) { string old = sp.ReadExisting(); sp.Write(command + "\r"); } string result = WaitForNewLine(standardTimeout); if (result.Length <= 3) result = WaitForNewLine(standardTimeout); if (result == "Unknown") return null; double[] retInt = null; if (axis == StageAxis.Z) { double zpos = 0; string zpart = result.Substring(2); zpos = Convert.ToDouble(zpart); retInt = new double[] { zpos }; } else if (axis == StageAxis.XY) { double xpos = 0, ypos = 0; string zpart = result.Substring(3);//remove :A_ string[] nums = zpart.Split(' '); xpos = Convert.ToDouble(nums[0]); ypos = Convert.ToDouble(nums[1]); retInt = new double[] { xpos, ypos }; } return retInt; }