Gocator Snapshot Sensors: User Manual
Gocator Web Interface • 261
double HoleZ = Measurement_Value(2);
/* Retrieve 3D coordinate from StudBase X, Y and Z tools (assumes these tools have been
configured as ID 3, ID 4 and ID 5 respectively) */
double StudX = Measurement_Value(3);
double StudY = Measurement_Value(4);
double StudZ = Measurement_Value(5);
/* Calculate distance between points in 3D space */
double Distance = sqrt((HoleX - StudX)*(HoleX - StudX) + (HoleY - StudY)*(HoleY - StudY)
+ (HoleZ - StudZ)*(HoleZ - StudZ));
/* Min and Max Decision Limits */
/* Note that measurement values are in the unit of thousands of a millimeter in the
script */
/* In this example the distance is considered good if it's between 17.9 mm and 18.1 mm */
double MinDecisionLimit = 17.900;
double MaxDecisionLimit = 18.100;
if (Distance > MinDecisionLimit && Distance < MaxDecisionLimit)
{
Output_Set(Distance, 1);
}
else
{
Output_Set(Distance, 0);
}