11 using System.Collections.Generic;
14 using System.Threading;
18 public static partial class Examples
32 public static int Contour(gclib gclib,
string fileA,
string fileB)
36 List<string> positions_A = File.ReadAllText(fileA).Split(
',').ToList();
37 List<string> positions_B = File.ReadAllText(fileB).Split(
',').ToList();
39 gclib.GCommand(
"SH AB");
40 gclib.GCommand(
"PA 0, 0");
41 gclib.GMotionComplete(
"AB");
42 gclib.GCommand(
"CM AB");
43 gclib.GCommand(
"DT -1");
44 gclib.GCommand(
"CD 0,0");
45 gclib.GCommand(
"CD 0,0");
46 gclib.GCommand(
"CD 0,0");
47 gclib.GCommand(
"DT 1");
52 if (positions_A.Count() != positions_B.Count())
54 Console.WriteLine(
"Error: The two datasets are not the same size");
64 capacity = gclib.GCmdI(
"CM?");
65 }
while (Load_Buffer(gclib, positions_A, positions_B, capacity, ref cmd));
67 gclib.GCommand(
"CD 0,0=0");
72 private static bool Load_Buffer(gclib gclib, List<string> positions_A, List<string> positions_B,
73 int capacity, ref
int cmd)
75 for (; capacity > 0; capacity--)
77 if (cmd + 1 < positions_A.Count())
80 double cdA =
double.Parse(positions_A[cmd + 1]) -
double.Parse(positions_A[cmd]);
83 double cdB =
double.Parse(positions_B[cmd + 1]) -
double.Parse(positions_B[cmd]);
85 gclib.GCommand($
"CD {cdA},{cdB}");
const int GALIL_EXAMPLE_OK
Examples success code.
Provides a class of shared constants and methods for gclib's example projects.
static int Record_Position(gclib gclib, string fileA, string fileB)
Record user's training and saves to a text file.
const int GALIL_EXAMPLE_ERROR
Examples error code.
static int Contour(gclib gclib, string fileA, string fileB)
Record user's training and plays back training through contour mode.