What's new
What's new

Milling pockets (letters) from user input?

Volitan

Hot Rolled
Joined
Sep 16, 2006
Location
Long Island, New York
I have to engrave engrave different letters on a few hundred different parts and was hoping to do it from user input.
These have to be pocketed out though, due to their size and complexity, and the customers wants with the font. The parts are all the same but the letters make each one a "one off"

Examples would be something like H29 or F100 or 2B....

I was hoping to have a sub to pocket each character, I can figure out the spacing, and have the operator punch in the number she needs for each piece. I'm stuck on how to do it from the operator punching the numbers in.

M109 seemed like a good bet, but on our control (a 2007 with version M15.xx software) it seems like it only takes one letter?

Is there a way maybe to "hack" into the G47 engraving cycle and point each letter to my own subprograms maybe?

We have an older Haas with an upgraded M17.xx control if that makes a difference. Didn't want to do it on that machine but I can.
 
Last edited:
There are some undocumented stuff in the old g47, but it would be worth a try. Do you have a copy of 0937?? It must place the string on the call stack and loop through it, because it works the way the code is set up on old machines. The only issue is if the newer software closed that option.
 
Engraving

M109 seemed like a good bet, but on our control (a 2007 with version M15.xx software) it seems like it only takes one letter?

Is there a way maybe to "hack" into the G47 engraving cycle and point each letter to my own subprograms maybe?

I don't think M109 will take more than one letter. But you could alias G47, and make your own subroutines. That way, when you call G47, it would call your programs, instead of the stock ones.
 
If I recall, it is something like g65 P9375 L10 (1234567890) and each time it calls 9375 it passes a param with the next character.
 
I have to engrave engrave different letters on a few hundred different parts and was hoping to do it from user input.
These have to be pocketed out though, due to their size and complexity, and the customers wants with the font. The parts are all the same but the letters make each one a "one off"

Examples would be something like H29 or F100 or 2B....

I was hoping to have a sub to pocket each character, I can figure out the spacing, and have the operator punch in the number she needs for each piece. I'm stuck on how to do it from the operator punching the numbers in.

M109 seemed like a good bet, but on our control (a 2007 with version M15.xx software) it seems like it only takes one letter?

Is there a way maybe to "hack" into the G47 engraving cycle and point each letter to my own subprograms maybe?

We have an older Haas with an upgraded M17.xx control if that makes a difference. Didn't want to do it on that machine but I can.

Yes, M109 only does one character but there's no reason you can't use multiple M109's with different variables. - #501, #502, etc.

G47 would be nice to use/modify to use your own subs, but the problem is G47 is special in how it parses the letters in parentheses. You can't do this with a regular G65, M98, M97.

Note on M109 - it stores the ASCII value in the variable. So for example, if you use:
M109 P501

Pressing the letter Y will store 89. in variable #501 (same as entering #501= 89.) That would be possible to then call a sub using that number. However, I wouldn't go this route first, as there isn't really a fool-proof way to verify the letters pressed, in case of fat-fingering. (ascii vals here http://ee.hawaii.edu/~tep/EE160/Book/chap4/_27721_table145.gif)


If the format is always letter first, then number (seems like that might not be the case however) depending on which letters you require, you may use a regular subcall, G65. However, you can't use letters G, L, N, O, P. In the sub, you could use some tests to see which letter was used, since the unused letters will return null value, #0.

Perhaps a second sub program for use with number first, then letter? Although you would still be limited to not using G, L, N, O, P. And it would need to be called letter first anyway, perhaps adding confusion.

I'd opt for the M109 route, but I can't think of a way to quickly verify the entered text mid-program, before cutting.
 
Great ideas, thanks!

I don't have a copy of O9375 (or O937??)

It's not in the backups, I only seem to have the O9999 and O9998 Quick Code stuff.

Is there a way to get it out? I'd really like to see how they parse the characters out of the (####).
 
Call Haas, they'll give it to you. It is O9876.

The gist of it is this.

Code:
%
09876
N1000 
M97 (M97 AUTO M99 AT END OF STRING) 
GOTO1000 

N125 
M99 

(SPACE) 
N126 
(SPACE CODE HERE)
M99 

N127 
(RESTORE ? before returning)
M99 

N1 
(!) 
(CODE FOR ! HERE)
M99 

N2 
(")

And so on
 
Yes, M109 only does one character but there's no reason you can't use multiple M109's with different variables. - #501, #502, etc.

G47 would be nice to use/modify to use your own subs, but the problem is G47 is special in how it parses the letters in parentheses. You can't do this with a regular G65, M98, M97.

Note on M109 - it stores the ASCII value in the variable. So for example, if you use:
M109 P501

Pressing the letter Y will store 89. in variable #501 (same as entering #501= 89.) That would be possible to then call a sub using that number. However, I wouldn't go this route first, as there isn't really a fool-proof way to verify the letters pressed, in case of fat-fingering. (ascii vals here http://ee.hawaii.edu/~tep/EE160/Book/chap4/_27721_table145.gif)


If the format is always letter first, then number (seems like that might not be the case however) depending on which letters you require, you may use a regular subcall, G65. However, you can't use letters G, L, N, O, P. In the sub, you could use some tests to see which letter was used, since the unused letters will return null value, #0.

Perhaps a second sub program for use with number first, then letter? Although you would still be limited to not using G, L, N, O, P. And it would need to be called letter first anyway, perhaps adding confusion.

I'd opt for the M109 route, but I can't think of a way to quickly verify the entered text mid-program, before cutting.


All the letter/number combinations I'll have to do are either 2,3,4 or 5 characters long. I could just tell the operator to run all the two-digit ones, then three etc.. and loop the M109 the appropriate number of times? Sounds like it should work.

Another option may be to take advantage of the fact they're giving me the engraving schedule in a spreadsheet, maybe I could whip up something in excel to parse the characters in each cell and make a main program for each one that calls the appropriate sub (which would exist on the machine).

I think I like G47 or M109 better so far...
 
All the letter/number combinations I'll have to do are either 2,3,4 or 5 characters long. I could just tell the operator to run all the two-digit ones, then three etc.. and loop the M109 the appropriate number of times? Sounds like it should work.

Another option may be to take advantage of the fact they're giving me the engraving schedule in a spreadsheet, maybe I could whip up something in excel to parse the characters in each cell and make a main program for each one that calls the appropriate sub (which would exist on the machine).

I think I like G47 or M109 better so far...

When I use M109, usually it is several in a row to collect the digits of a number I want to input. Then, the number is calculated and displayed in one of the counters so I can see what I typed in.

A final M109 asks if it is correct, pressing Y continues the program, N starts over, and any other key just loops back to this question.

But adding letters to the mix, I don't know how you can verify what you entered.

Perhaps your excel idea will work well enough to figure what subs you need to run.

I'd suggest two sub programs, one for letters, one for numbers. If you need to engrave F100, you may use:

G65 P1 A6.
G65 P2 A1.
G65 P2 A0.
G65 P2 A0.

Program 1 have A-Z, program 2 have 0-9. Program it all incremental and after each letter move to the start of where the next letter would be.

Prog 1 or 2 would look like:
Code:
%
O1
GOTO#1
N1 (A)
..
M99

N2 (B)
..
M99
etc
%
 
When I use M109, usually it is several in a row to collect the digits of a number I want to input. Then, the number is calculated and displayed in one of the counters so I can see what I typed in.

A final M109 asks if it is correct, pressing Y continues the program, N starts over, and any other key just loops back to this question.

But adding letters to the mix, I don't know how you can verify what you entered.

Perhaps your excel idea will work well enough to figure what subs you need to run.

I'd suggest two sub programs, one for letters, one for numbers. If you need to engrave F100, you may use:

G65 P1 A6.
G65 P2 A1.
G65 P2 A0.
G65 P2 A0.

Program 1 have A-Z, program 2 have 0-9. Program it all incremental and after each letter move to the start of where the next letter would be.

Prog 1 or 2 would look like:
Code:
%
O1
GOTO#1
N1 (A)
..
M99

N2 (B)
..
M99
etc
%


Awesome, thank you very much! I'm going to try this one right now.

I'm waiting for the local HFO to call me back on the listing of the engraving program that friesen mentioned.
 
But adding letters to the mix, I don't know how you can verify what you entered.

After reading up on Haas macro programming and trying some things this morning I see what you mean about getting letters back for the user to verify what they entered. Tricky.


We have the control model in the picture here, see that blank white box? Anyone know if that's a place to put custom labels or messages?

40472.jpg
 
I think if this was me doing it, I'd rather set up a custom subprogram, perhaps based on the HAAS letter code, then call it from the main program like:

G54
G65 P1234 (AB1)
M0(Next item)
G65 P1234 (AB2)
M0(Next item)

and so on...

Rather than have the operator enter every one. This way, you can set up the whole run in one program, or a number of programs if you want.
 
G65 P7000 A5.
.
calls program 7000 and the 5. sets local variable A which is #1 to 5. (got to have decimal point or it might read it as .0005)
.
in program 7000 if you got a
GOTO #1
.
it reads variable #1 which is 5. and goes to N5
if that section after N5 engraves a letter in incremental and ends in a M99 it will return to main program. with tool at Z0.1 tool starts and ends at center of letter/number. that way easier to control spacing in numbers/letters
G65 P7000 A5.
G91 G1 X1. F10.
G65 P7000 A6.
.
the shift between numbers is adjustable in case you want 56 34 or extra space between or
56
34
like start numbers on next line down
 
I do exactly this with a macro I wrote. I just put variables at the beginning for what letter is going in each pocket on the fixture. You could do the same thing using G52 to offset the letter spacing. I typed what's below from memory. Be warned

#601=101 (101 = lower case a, 102=b ETC)
#602=201 (201 = upper case A)
#603=300 (300 = number 0)

G154 P1


G52XYZ
#600 = #601 (CALLS CURRENT LETTER)
M97 P1000 L1 (CALL LOGO CODE)

G52 X0 Y-1. Z0 (OFFSETS TO NEXT PART)
#600 = #602 (CALLS CURRENT LETTER)
M97 P1000 L1 (CALL LOGO CODE)

G52 X0 Y-2. Z0 (OFFSETS TO NEXT PART)
#600 = #603 (CALLS CURRENT LETTER)
M97 P1000 L1 (CALL LOGO CODE)




M30
%

N1000 (NON LETTER PART OF ENGRAVING)
[CODE FOR STUFF THAT GOES ON EVERY PART]
M98 P2 L1 (ENGRAVES THE LETTER FOR THAT PART)
M99


Program 2 has every letter needed in the font with N# of the letter: 26 lower, 26 upper, 10 numbers, and all the symbols. I just created a new post and output each one and saved in the same file with N#s to match the letter/number/symbol

GOTO#600 (jumps to current letter)
M99

N101 (lower a)
code for lower a
m99

N202 (Upper B)
code for upper B
m99
 
Last edited:
Thanks to everyone who responded. I ended up using M109, but I'm going to read over the other suggestions when I have time later.

It's a bit clunky looking, but the job is almost done and everyones happy with it.


It's something like:

Code:
(GET USER INPUT) 
M109 P501 (MILL 1ST #1-4) 
M109 P502 (MILL 2ND #0-9) 
M109 P503 (MILL 3RD A-N) 

(LET USER VERIFY WHAT THEY ENTERED IS WHAT THEY WANT) 
M97 P101 (ROUTINE TO VERIFY 1ST NUMBER INPUT) 
M97 P102 (ROUTINE TO VERIFY 2ND NUMBER INPUT) 
M97 P103 (ROUTINE TO VERIFY LETTER INPUT) 


(LET USER CHANGE THEIR MIND) 
M109 P516 (OK to proceed Y/N?) 

(GO BACK TO BEGINING IF ANSWER) 
(IS ANYTHING BUT 'Y') 
IF [ #516 NE 89 ] GOTO1 

Goes on to main from here...



and:

Code:
N101 (OPERATOR VERIFY 1ST NUMBERS PUT IN) 
(1) 
IF [ #501 EQ 49. ] #3006= 101 (1st # is 1) 
(2) 
IF [ #501 EQ 50. ] #3006= 101 (1st # is 2) 
(3) 
IF [ #501 EQ 51. ] #3006= 101 (1st # is 3) 
(4) 
IF [ #501 EQ 52. ] #3006= 101 (1st # is 4) 
M99

etc... then it calls the appropriate sub. Since the variable is the ASCII equivalent of the keypress, I numbered the sub programs the same to make it easier.
 








 
Back
Top