I am using a webacm attached to a CNC machine to provide the user a view of the part to be machined. As they jog around the area I want to allow them to record the X & Y co-ordinates of points of interest.
These points are read from internal system registers called Xmachpos and Ymachpos then written to a CSV file.
When I try to run the macro I get a CS1513 for missing "}" and a CS1022 name space EOF error but cannot see what I am missing.
Any help much appreciated
using System;
using System.IO;
using System.Windows.Forms;
class Program
{
static void Main(string[] args)
{
string filePath = @"C:\dxf.txt";
int Xpos, Ypos;
//Check if file exists and create it if not
if (!File.Exists(filePath))
{
File.Create(filePath).Close();
}
//Write Xpos and Ypos values to file and prompt user to enter more values
do
{
Xpos = exec.GetXmachpos();
Ypos = exec.GetYmachpos();
using (StreamWriter writer = File.AppendText(filePath))
{
writer.WriteLine(Xpos.ToString() + "," + Ypos.ToString());
}
} while (PromptUser());
MessageBox.Show("Values written to file. Click OK to exit.");
}
static bool PromptUser()
{
DialogResult result = MessageBox.Show("Do you want to enter more values?", "Enter Values", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
return (result == DialogResult.Yes);
}
}
Also tried the system vendor forum pages but no luck there