gclib 2.0.9
Communications API for Galil controllers and PLCs
 
Loading...
Searching...
No Matches
record_position_example.cs
Go to the documentation of this file.
1
10using System;
11using System.Linq;
12
13namespace examples
14{
26
28 {
38 public static int Main(string[] args)
39 {
41 gclib gclib = new gclib();
42
43 try
44 {
45 if(args.Count() != 3)
46 {
47 Console.WriteLine("Incorrect number of arguments provided");
48 Console.WriteLine("Usage: record_position_example.exe <ADDRESS> <FILE A> <FILE B>");
49
50 Console.Write("\nPress any key to close the example");
51 Console.ReadKey();
53 }
54
55 string address = args[0]; //Retrieve address from command line
56 string fileA = args[1]; //Retrieve filepath from command line
57 string fileB = args[2]; //Retrieve filepath from command line
58
59 gclib.GOpen(address); //Opens connection at the provided address
60
61 //Record user's training and saves to a text file
63 }
64 catch(Exception ex)
65 {
68 }
69 finally
70 {
71 gclib.GClose();
72 }
73
74 Console.Write("\nPress any key to close the example");
75 Console.ReadKey();
76
77 return rc;
78 }
79 }
81}
const int GALIL_EXAMPLE_OK
Examples success code.
Definition examples.cs:29
const int GALIL_EXAMPLE_ERROR
Examples error code.
Definition examples.cs:30
static void PrintError(gclib gclib, Exception ex)
Prints the exception to the console and queries the controller for the most recent error message.
Definition examples.cs:39
Provides a class of shared constants and methods for gclib's example projects.
Definition commands.cs:16
static int Main(string[] args)
Main function for the Record Position example.
Takes two file paths at the command line to hold positional data for Axis A and Axis B....
void GOpen(string address)
Used to open a connection to Galil hardware.
Definition gclib.cs:445
void GClose()
Used to close a connection to Galil hardware.
Definition gclib.cs:239
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
Definition gclib.cs:68
GReturn vector(GCon g, char *file)
Puts controller into Vector Mode and accepts a file defining vector points.
Definition vector.cpp:36
static int Record_Position(gclib gclib, string fileA, string fileB)
Record user's training and saves to a text file.