gclib  528
Communications API for Galil controllers and PLCs
contour_example.cs
Go to the documentation of this file.
1 
10 using System;
11 using System.Linq;
12 
13 namespace examples
14 {
18 
28  {
39  public static int Main(string[] args)
40  {
41  gclib gclib = new gclib();
42  int rc = Examples.GALIL_EXAMPLE_OK;
43 
44  if (args.Count() != 3)
45  {
46  Console.WriteLine("Incorrect number of arguments provided");
47  Console.WriteLine("Usage: record_position_example.exe <ADDRESS> <FILE A> <FILE B>");
48 
49  Console.Write("\nPress any key to close the example");
50  Console.ReadKey();
52  }
53 
54  try
55  {
56  string address = args[0]; //Retrieve address from command line
57  string fileA = args[1]; //Retrieve filepath from command line
58  string fileB = args[2]; //Retrieve filepath from command line
59 
60  gclib.GOpen(address); //Opens connection at the provided address
61 
62  //Record user's training and play back training through contour mode
63  rc = Examples.Contour(gclib, fileA, fileB);
64  }
65  catch(Exception ex)
66  {
67  Examples.PrintError(gclib, ex);
69  }
70  finally
71  {
72  gclib.GClose();
73  }
74 
75  Console.Write("\nPress any key to close the example");
76  Console.ReadKey();
77 
78  return rc;
79  }
80 
81  }
83 }
84 
const int GALIL_EXAMPLE_OK
Examples success code.
Definition: examples.cs:29
static int Main(string[] args)
Main function for the contour example.
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:15
const int GALIL_EXAMPLE_ERROR
Examples error code.
Definition: examples.cs:30
static int Contour(gclib gclib, string fileA, string fileB)
Record user's training and plays back training through contour mode.
Definition: contour.cs:32
Record user's training and plays back training through contour mode.