| gclib 2.0.7 Communications API for Galil controllers and PLCs |

vector_mode_example.cs
Go to the documentation of this file.
1
10 using System;
11 using System.Linq;
12
13 namespace examples
14 {
25
26 class Vector_Mode_Example
27 {
35 public static int Main(string[] args)
36 {
37 gclib gclib = new gclib();
38 int rc = Examples.GALIL_EXAMPLE_OK;
39
40 try
41 {
42 if (args.Count() != 2)
43 {
44 Console.WriteLine("Incorrect number of arguments provided");
45 Console.WriteLine("Usage: Vector_Example.exe <ADDRESS> <FILE>");
46
47 Console.Write("\nPress any key to close the example");
48 Console.ReadKey();
49 return Examples.GALIL_EXAMPLE_ERROR;
50 }
51
52 string file = args[1]; //Retrieve file from command line
53 string address = args[0]; //Retrieve address from command line
54 gclib.GOpen(address); //Open a connection at the provided address
55
56 rc = Examples.Vector_Mode(gclib, file);
57 }
58 catch(Exception ex)
59 {
60 Examples.PrintError(gclib, ex);
61 rc = Examples.GALIL_EXAMPLE_ERROR;
62 }
63 finally
64 {
65 gclib.GClose();
66 }
67
68 Console.Write("\nPress any key to close the example");
69 Console.ReadKey();
70 return rc;
71 }
72 }
74 }
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.Vector_Mode_Example.Main
static int Main(string[] args)
Main function for the vector mode example.
Definition: vector_mode_example.cs:35
examples.Vector_Mode_Example
Takes a path to a file at the command line holding vector commands for the controller....
Definition: vector_mode_example.cs:27
gclib.GOpen
void GOpen(string address)
Used to open a connection to Galil hardware.
Definition: gclib.cs:445
gclib.GClose
void GClose()
Used to close a connection to Galil hardware.
Definition: gclib.cs:239
gclib
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
Definition: gclib.cs:68
examples.Examples.Vector_Mode
static int Vector_Mode(gclib gclib, string file)
Puts controller into Vector Mode and accepts a file defining vector points.
Definition: vector_mode.cs:45
examples
Definition: commands.cs:14