| gclib 1.35.5 Communications API for Galil controllers and PLCs |

record_position_example.cs
Go to the documentation of this file.
1
10 using System;
11 using System.Linq;
12
13 namespace examples
14 {
26
27 class Record_Position_Example
28 {
38 public static int Main(string[] args)
39 {
40 int rc = Examples.GALIL_EXAMPLE_OK;
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();
52 return Examples.GALIL_EXAMPLE_ERROR;
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
62 rc = Examples.Record_Position(gclib, fileA, fileB);
63 }
64 catch(Exception ex)
65 {
66 Examples.PrintError(gclib, ex);
67 return Examples.GALIL_EXAMPLE_ERROR;
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 }
examples.Examples.PrintError
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
examples.Examples
Provides a class of shared constants and methods for gclib's example projects.
Definition: commands.cs:16
examples.Examples.GALIL_EXAMPLE_OK
const int GALIL_EXAMPLE_OK
Examples success code.
Definition: examples.cs:29
examples.Examples.GALIL_EXAMPLE_ERROR
const int GALIL_EXAMPLE_ERROR
Examples error code.
Definition: examples.cs:30
examples.Record_Position_Example.Main
static int Main(string[] args)
Main function for the Record Position example.
Definition: record_position_example.cs:38
examples.Record_Position_Example
Takes two file paths at the command line to hold positional data for Axis A and Axis B....
Definition: record_position_example.cs:28
examples.Examples.Record_Position
static int Record_Position(gclib gclib, string fileA, string fileB)
Record user's training and saves to a text file.
Definition: record_position.cs:32
examples
Definition: commands.cs:14