squarewave
06-24-2005, 06:36 AM
I have the following simple Macro that is intended to read a 2D profile on a Wire EDM. Relay #60 goes to 0 when the wire touches the part.
[[Find Profile]]
[Wire On] 'Turn Wire on so Contact Function works
\10=.02 'Increment in Y
\11=5 'Number of points
\12=0 'Counter
\13=1 'maximum X move
SLEEP 3 'Wait for wire to get up to speed
IF #60=0 THEN MESSAGE INITIAL CONTACT ERROR:[Wire Off]:EXIT 'check for initial contact
MACHHOME1 \677:MACHHOME2 \678 'store starting position
:FINDXEDGE
FEEDRATE 5
'find edge in X
POSITION 1;{\677+\13} :WAITUNTIL #60=0 :STOP
FEEDRATE .5
'back off edge slowly
POSITION 1;{\677} :WAITUNTIL #60=1 :STOP
TEACH 'Writes current position to teach.xyz file
FEEDRATE 20
'return to starting X
POSITION 1;{\677} :WAITUNTIL STOP
:INCREMENTY
\12=\12+1 :IF \12>=\11 THEN GOTO :FININCREMENTY
POSITION 2;{\678+(\12*\10)} :GOTO :FINDXEDGE
:FININCREMENTY
TEACH OFF
[Wire Off] 'Turn Wire Off
MESSAGE PROFILE FINISHED FILE CLOSED
It all works exactly like I want, except each time the TEACH command is executed, I get an "Unrecognized Command" error. I hit OK, and the program resumes. This continues until the loop is complete.
The way I interpret the manual, it is supposed to write the current location to a TEACH.XYZ file in the AS3000\WORK directory. I checked for the file and it didn't exist, so I created a blank one and re-ran the program. Same error.
Are there other parameters or some modal that I need to set to get this command to work? Do I need to manually open the TEACH.XYZ file in the macro? I'll try creating a string variable and manually doing a FILEWRITE if I can't get TEACH to work - but it looks like it should do exactly what I want so I hate not to use it.
[[Find Profile]]
[Wire On] 'Turn Wire on so Contact Function works
\10=.02 'Increment in Y
\11=5 'Number of points
\12=0 'Counter
\13=1 'maximum X move
SLEEP 3 'Wait for wire to get up to speed
IF #60=0 THEN MESSAGE INITIAL CONTACT ERROR:[Wire Off]:EXIT 'check for initial contact
MACHHOME1 \677:MACHHOME2 \678 'store starting position
:FINDXEDGE
FEEDRATE 5
'find edge in X
POSITION 1;{\677+\13} :WAITUNTIL #60=0 :STOP
FEEDRATE .5
'back off edge slowly
POSITION 1;{\677} :WAITUNTIL #60=1 :STOP
TEACH 'Writes current position to teach.xyz file
FEEDRATE 20
'return to starting X
POSITION 1;{\677} :WAITUNTIL STOP
:INCREMENTY
\12=\12+1 :IF \12>=\11 THEN GOTO :FININCREMENTY
POSITION 2;{\678+(\12*\10)} :GOTO :FINDXEDGE
:FININCREMENTY
TEACH OFF
[Wire Off] 'Turn Wire Off
MESSAGE PROFILE FINISHED FILE CLOSED
It all works exactly like I want, except each time the TEACH command is executed, I get an "Unrecognized Command" error. I hit OK, and the program resumes. This continues until the loop is complete.
The way I interpret the manual, it is supposed to write the current location to a TEACH.XYZ file in the AS3000\WORK directory. I checked for the file and it didn't exist, so I created a blank one and re-ran the program. Same error.
Are there other parameters or some modal that I need to set to get this command to work? Do I need to manually open the TEACH.XYZ file in the macro? I'll try creating a string variable and manually doing a FILEWRITE if I can't get TEACH to work - but it looks like it should do exactly what I want so I hate not to use it.