Regular Expressions
Michael,
Thanks for the input...I aplogize for not clearly defining my problem.
Let's try again...
We are having an apparently random problem with our CNC posts when posting
out lather programs.
I am looking for errors in the "Facing Cycle" (G72)
A type facing cycle should include something very similar to:
N27 G72 W.05 R.05
N28 G72 P29 Q31 U0. W.01 F.014
N29 G0 Z0. S600
N30 G1 X.8
This can appear anywhere within the program.
The N## numbers are merely line numbers and may or may not be present.
Either way, it doesn't matter.
The G72 is the code for a facing cycle.
We should have two (2) consecutive lines including G72 instruction.
The next line following should be a G0 instruction (Rapid positioning).
The next line following should then be a G1 instruction (Linear feed).
The program then continues on as necessary.
The problem arises when there are arbitrary lines of code placed between my
G0 and G1 instruction lines (N29 and N30 in my example).
When this occurs, we may end up with something similar to:
N27 G72 W.05 R.05
N28 G72 P29 Q31 U0. W.01 F.014
N29 G0 Z0. S600
N30 X.8 Z0.
N31 G1 X.8
In the preceding example, the N30 line is out of place and causes an error
on the production floor.
I need to be able to detect such an error and send an alert to the
programmer.
As far as using a RegEx, I am not married to the idea. I just thought it
might serve our purpose. I am always open to suggestions.
Anyway, I hope I have not been to long-winded, but that I have explained my
problem fully.
Again, thanks a million for any help.
- Jeff
|