Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Sequential serial numbers - Heidenhain


DavidB
 Share

Recommended Posts

hi david,

here is a more complete answer than provided on Facebook 🙂 I haven't tested it on the control as i just threw it together upon seeing your post here. it's a good start on a basic structure.  QS1 does, in fact, increment by 1 every cycle running in simulator.

0  BEGIN PGM serial-numer INCH 
1  FN 11: IF +QR2 GT +Q1 GOTO LBL "ENGRAVE"
2  QR1 = 1 ;STARTING NUMBER
3  QR2 = QR1
4  LBL "ENGRAVE"
5  QS1 = TOCHAR( DAT+QR2 DECIMALS0 )
6  ;
7  STOP ; PRESS Q AND CHECK QS1
8  ;
9  CYCL DEF 225 ENGRAVING ~
    QS500= QS1     ;ENGRAVING TEXT ~
    Q513=+0.5  ;CHARACTER HEIGHT ~
    Q514=+0    ;SPACE FACTOR ~
    Q515=+0    ;FONT ~
    Q516=+0    ;TEXT ARRANGEMENT ~
    Q374=+0    ;ANGLE OF ROTATION ~
    Q517=+2    ;CIRCLE RADIUS ~
    Q207=+200  ;FEED RATE FOR MILLNG ~
    Q201=-0.08 ;DEPTH ~
    Q206=+60   ;FEED RATE FOR PLNGNG ~
    Q200=+0.08 ;SET-UP CLEARANCE ~
    Q203=+0    ;SURFACE COORDINATE ~
    Q204=+2    ;2ND SET-UP CLEARANCE
10 QR2 = QR1 + 1
11 END PGM serial-numer INCH
  • Like 2
Link to comment
Share on other sites
On 5/26/2020 at 2:20 AM, mkd said:

hi david,

here is a more complete answer than provided on Facebook 🙂 I haven't tested it on the control as i just threw it together upon seeing your post here. it's a good start on a basic structure.  QS1 does, in fact, increment by 1 every cycle running in simulator.

Thank you

Link to comment
Share on other sites
  • 1 month later...
1 hour ago, DavidB said:

Im trying to engrave just a sequential serial number.

The number must be 3 digits.

001, 002, 003, 004 etc.

I can get sequential numbers working 1, 2, 3, 4 etc. but how can I get the leading zero's?

Thank you

Have you tried changing the QR1 to 001?  Might have to find a leading name for the TOCHAR the example above is using DECMIAL0 and I think you might have to find a LEADING2 or something similar for defing that needed to be be before the 1 and not after it. Like we what don with fmt in a post. 

Link to comment
Share on other sites
On 5/26/2020 at 3:50 PM, pro grammer said:

I wrote a mastercam program to do this a while back.

Can I get some more info on that?  I've done it before using a macro, and individual subprograms for each digit.  It works, but incorporating it into the MC file might be a bit cleaner.

Link to comment
Share on other sites
2 minutes ago, JB7280 said:

Can I get some more info on that?  I've done it before using a macro, and individual subprograms for each digit.  It works, but incorporating it into the MC file might be a bit cleaner.

Pro gramer it seems has been banned...

Link to comment
Share on other sites
10 hours ago, DavidB said:

If I chnge it to .001 and Decimals3 it engraves 0.001

That was not what I thinking. No decimal and two leading Zeros before the 1. If not then like I said need to find something that will force leading Zeros in the TOCHAR definition to control the output format for the serialization. Push comes to shove then you define the two zeros and then use the above after it to cheat it in on the control. Have the two Zeros defined in a sub program for 1-9, then have one zero defined for the sub for 10-99 and then when you get to 100 I assume you don't need leading zero's anymore. A little bit of logic loop process would need to be written so that when the process is less than < 10 it uses the two zero sub program and when it is greater than > 10, but less than < 100 it uses the one zero sub program. How you get the two sub programs on that control to interact with each other and work would take me some time standing in front of the control and playing and not sure I could figure it out. Might end up making a Mastercam file with 001 to 099 defined and make a program for each one. That process could be easily controlled to call the correct sub program. Use a Number in the program name for the correct program and use a loop counter. Once it runs the 1st part then loop the counter that calls the sub program for each number. Then once you get past the first 99 the above starting at 100 should get you moving part that point. 

Link to comment
Share on other sites

1  BLK FORM 0.1 Z X-50 Y-100 Z-50
2  BLK FORM 0.2  X+50  Y+100  Z+0
3  TOOL CALL "6MM" Z S10000 F500
4  M3
5  Q10 = - 0
6  Q11 = 93
7  Q1000 = 1
8  LBL 1
9  Q990 = Q1000
10 Q990 = Q990 / 100
11 Q990 = INT Q990
12 QS1 = TOCHAR( DAT+Q990 DECIMALS0 )
13 Q991 = Q1000
14 Q991 = Q991 / 10
15 Q991 = INT Q991
16 Q991 = Q991 % 10
17 QS2 = TOCHAR( DAT+Q991 DECIMALS0 )
18 Q992 = Q1000
19 Q992 = Q992 % 10
20 Q992 = INT Q992
21 QS3 = TOCHAR( DAT+Q992 DECIMALS0 )
22 QS4 = QS1 || QS2 || QS3
23 Q1000 = Q1000 + 1
24 CYCL DEF 225 ENGRAVING ~
    QS500= QS4     ;ENGRAVING TEXT ~
    Q513=+6    ;CHARACTER HEIGHT ~
    Q514=+0    ;SPACE FACTOR ~
    Q515=+0    ;FONT ~
    Q516=+0    ;TEXT ARRANGEMENT ~
    Q374=+0    ;ANGLE OF ROTATION ~
    Q517=+50   ;CIRCLE RADIUS ~
    Q207=+500  ;FEED RATE FOR MILLNG ~
    Q201=-0.5  ;DEPTH ~
    Q206=+150  ;FEED RATE FOR PLNGNG ~
    Q200=+2    ;SET-UP CLEARANCE ~
    Q203=+0    ;SURFACE COORDINATE ~
    Q204=+50   ;2ND SET-UP CLEARANCE ~
    Q367=+0    ;TEXT POSITION ~
    Q574=+0    ;TEXT LENGTH
25 L  X+Q10
26 L  Y+Q11
27 L  Z+2 FMAX M99
28 Q11 = Q11 - 7
29 CALL LBL 1 REP25
30 END PGM BRIDGES MM 

 

  • Like 1
Link to comment
Share on other sites

David, I looked at the TNC 640 892905-28 User's Manual for Cycle Programming and for 225 there is a %count3 would give you the 001 you are after. I looked everywhere else and this is all I could find. 

Here from Page 387

Quote

Engraving the counter reading
You can engrave the current counter reading found in the MOD
menu with Cycle 225.
For this purpose program Cycle 225 as usual and enter e.g. the
following for the text to be engraved: %count2
The number after %count indicates how many digits the control will
engrave. The maximum is of nine digits.
Example: If you program %count9 in the cycle with a momentary
counter reading of 3, the control will engrave the following:
000000003

For anyone need their manuals here is a link:

Heidenhain Manuals

Link to comment
Share on other sites
  • 2 years later...

Hi Guys thanks for all the help, I ended up getting it to Engrave S.N 230001 and sequential increasing by 1 each cycle start.

The engraving was done on a Tilted plane.

 

200 ;TOOLPLANE NAME - ENGRAVE
201 TOOL CALL 14 Z S15000
202 ;2MM STANDARD LENGTH BN  TOOL - 14  DIA. OFF. - 14  LEN. - 14  DIA. - 2.
203 ;HOLDER - SK DIA 3 SHRINK FIT X 120
204 TOOL DEF 15
205 CYCL DEF 247 PRESETTING ~
    Q339=+1    ;PRESET NUMBER
206 L  Z-0.1 R0 FMAX M91
207 ;
208 FN 11: IF +QR2 GT +QR1 GOTO LBL "ENGRAVE"
209 QR1 = 230001 ;START VALUE
210 QR2 = QR1
211 LBL "ENGRAVE"
212 QS4 = TOCHAR( DAT+QR2 DECIMALS0 )
213 CYCL DEF 32.0 TOLERANCE
214 CYCL DEF 32.1 T0.05
215 CYCL DEF 32.2 HSC-MODE:0 TA1
216 M3
217 PLANE SPATIAL SPA+0 SPB+56 SPC+180 STAY SEQ+ TABLE ROT
218 L  B+Q121  C+Q122 FMAX
219 L  X+21.5  Y-30 FMAX
220 L  Z+185 FMAX
221 M8
222 CYCL DEF 225 ENGRAVING ~
    QS500="S.N"  ;ENGRAVING TEXT ~
    Q513=+7    ;CHARACTER HEIGHT ~
    Q514=+0    ;SPACE FACTOR ~
    Q515=+0    ;FONT ~
    Q516=+0    ;TEXT ARRANGEMENT ~
    Q374=+90   ;ANGLE OF ROTATION ~
    Q517=+50   ;CIRCLE RADIUS ~
    Q207=+800  ;FEED RATE MILLING ~
    Q201=-0.15 ;DEPTH ~
    Q206=+400  ;FEED RATE FOR PLNGNG ~
    Q200=+2    ;SET-UP CLEARANCE ~
    Q203=+172  ;SURFACE COORDINATE ~
    Q204=+175  ;2ND SET-UP CLEARANCE ~
    Q367=+0    ;TEXT POSITION ~
    Q574=+0    ;TEXT LENGTH
223 L M99
224 L  X+21.5  Y-10 FMAX
225 CYCL DEF 225 ENGRAVING ~
    QS500= QS4     ;ENGRAVING TEXT ~
    Q513=+7    ;CHARACTER HEIGHT ~
    Q514=+0    ;SPACE FACTOR ~
    Q515=+0    ;FONT ~
    Q516=+0    ;TEXT ARRANGEMENT ~
    Q374=+90   ;ANGLE OF ROTATION ~
    Q517=+50   ;CIRCLE RADIUS ~
    Q207=+800  ;FEED RATE MILLING ~
    Q201=-0.15 ;DEPTH ~
    Q206=+400  ;FEED RATE FOR PLNGNG ~
    Q200=+2    ;SET-UP CLEARANCE ~
    Q203=+172  ;SURFACE COORDINATE ~
    Q204=+175  ;2ND SET-UP CLEARANCE ~
    Q367=+0    ;TEXT POSITION ~
    Q574=+0    ;TEXT LENGTH
226 QR2 = QR2 + 1
227 L M99
228 LBL 0
229 CYCL DEF 32.0 TOLERANCE
230 CYCL DEF 32.1
231 M9
232 M5
233 M140 MB MAX
234 PLANE RESET STAY
235 L  Z-0.1 R0 FMAX M91
236 M1

  • Like 1
Link to comment
Share on other sites
18 hours ago, DavidB said:

Hi Guys thanks for all the help, I ended up getting it to Engrave S.N 230001 and sequential increasing by 1 each cycle start.

The engraving was done on a Tilted plane.

 

200 ;TOOLPLANE NAME - ENGRAVE
201 TOOL CALL 14 Z S15000
202 ;2MM STANDARD LENGTH BN  TOOL - 14  DIA. OFF. - 14  LEN. - 14  DIA. - 2.
203 ;HOLDER - SK DIA 3 SHRINK FIT X 120
204 TOOL DEF 15
205 CYCL DEF 247 PRESETTING ~
    Q339=+1    ;PRESET NUMBER
206 L  Z-0.1 R0 FMAX M91
207 ;
208 FN 11: IF +QR2 GT +QR1 GOTO LBL "ENGRAVE"
209 QR1 = 230001 ;START VALUE
210 QR2 = QR1
211 LBL "ENGRAVE"
212 QS4 = TOCHAR( DAT+QR2 DECIMALS0 )
213 CYCL DEF 32.0 TOLERANCE
214 CYCL DEF 32.1 T0.05
215 CYCL DEF 32.2 HSC-MODE:0 TA1
216 M3
217 PLANE SPATIAL SPA+0 SPB+56 SPC+180 STAY SEQ+ TABLE ROT
218 L  B+Q121  C+Q122 FMAX
219 L  X+21.5  Y-30 FMAX
220 L  Z+185 FMAX
221 M8
222 CYCL DEF 225 ENGRAVING ~
    QS500="S.N"  ;ENGRAVING TEXT ~
    Q513=+7    ;CHARACTER HEIGHT ~
    Q514=+0    ;SPACE FACTOR ~
    Q515=+0    ;FONT ~
    Q516=+0    ;TEXT ARRANGEMENT ~
    Q374=+90   ;ANGLE OF ROTATION ~
    Q517=+50   ;CIRCLE RADIUS ~
    Q207=+800  ;FEED RATE MILLING ~
    Q201=-0.15 ;DEPTH ~
    Q206=+400  ;FEED RATE FOR PLNGNG ~
    Q200=+2    ;SET-UP CLEARANCE ~
    Q203=+172  ;SURFACE COORDINATE ~
    Q204=+175  ;2ND SET-UP CLEARANCE ~
    Q367=+0    ;TEXT POSITION ~
    Q574=+0    ;TEXT LENGTH
223 L M99
224 L  X+21.5  Y-10 FMAX
225 CYCL DEF 225 ENGRAVING ~
    QS500= QS4     ;ENGRAVING TEXT ~
    Q513=+7    ;CHARACTER HEIGHT ~
    Q514=+0    ;SPACE FACTOR ~
    Q515=+0    ;FONT ~
    Q516=+0    ;TEXT ARRANGEMENT ~
    Q374=+90   ;ANGLE OF ROTATION ~
    Q517=+50   ;CIRCLE RADIUS ~
    Q207=+800  ;FEED RATE MILLING ~
    Q201=-0.15 ;DEPTH ~
    Q206=+400  ;FEED RATE FOR PLNGNG ~
    Q200=+2    ;SET-UP CLEARANCE ~
    Q203=+172  ;SURFACE COORDINATE ~
    Q204=+175  ;2ND SET-UP CLEARANCE ~
    Q367=+0    ;TEXT POSITION ~
    Q574=+0    ;TEXT LENGTH
226 QR2 = QR2 + 1
227 L M99
228 LBL 0
229 CYCL DEF 32.0 TOLERANCE
230 CYCL DEF 32.1
231 M9
232 M5
233 M140 MB MAX
234 PLANE RESET STAY
235 L  Z-0.1 R0 FMAX M91
236 M1

I like that you went with PLANE SPATIAL verses CYCLE 19.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...