Hi Stig,
The probing would be started from a user button, so to exit the script, would that be done by using "return;"? Would the correct way to do this be like this?
That should work.
I'm planning, for now, to set up the probing screen to allow me to find each side, each corner or find center of stock by clicking one of nine buttons. Is there a way to pass a variable to the script, or some other way, to find out which button was pressed so I can have only one probing script instead of 9 different scripts?
Screen Script Buttons don't have a means of identifying which button was pushed. You might make 9 different C Programs where each just defines which button it is and then includes the main probing code. So for example the "Middle" Button could be:
Code:
enum {TOP_LEFT, TOP, TOP_RIGHT,
LEFT, MIDDLE, RIGHT,
BOT_LEFT, BOT, BOT_RIGHT};
int Button = MIDDLE;
#include "ProbeMain.c"
With the ProbeMain.c common file something like:
Code:
#include "KMotionDef.h"
void main()
{
if (Button == MIDDLE)
printf("Middle Button Pushed\n");
else if (Button == TOP)
printf("Top Button Pushed\n");
}
Issuing a MDI("T99"); from the script would only select the tool, wouldn't it? Would I need to do a MDI("H99"); to activate the tool offset as well?
Actually "G43H99" would be needed to turn on Tool Length Compensation for Tool 99 in the Interpreter. But Jeremy's code doesn't use the Interpreter to do the movements. The movements are just made in raw machine counts. So you would need to factor in the Length that we described reading from the Tool Table in the previous post.
The Jeremy script seems to work in inches, while I work in metric. Is there a way to make the script units agnostic? I'll have a couple of edit boxes to input approx stock dimensions for the center-finding probe routine, so knowing if the numbers are in inches or metric would be kind of important... :-)
The GetMiscSettings(&Units, &TWORD, &HWORD, &DWORD); used in the previous example to get the Tool Length also returns the current Interpreter Units. So I would think you could use that. Such as:
if (Units==CANON_UNITS_INCHES)
...
else
...
I plan to share the screens and script when I'm finished. Otherwise I would just make everything in metric.
That would be very considerate. Thank you.
are the speeds in the script in motor pulses per second or units (in/mm) per second? From the size (1000 & 500) it looks like it is motor pulses per second.
Yes, they are in raw KFLOP units of counts/sec. But like Jeremy does with the distances, the resolutions can be factored in to use inches/sec, or also factor in another 25.4 to use mm/sec.
HTH