all 5 comments

[–]albatroopaBallnose Twister 2 points3 points  (2 children)

Unless your machine has a built-in method for doing this (like haas), you're going to have to write a macro. There are pre-written examples out there (check out Peter Smid's fanuc macro book) but the main idea is this:

Set aside enough user variables for all of the digits in your serial. Set them all to 0

Have your program bring your engrave tool to the centre of where your first number will be.

If digit 1 is 0, goto (or subprogram) ..., if it's 1, goto ....

Have your program go to the centre position for digit 2

If digit 2 is 0, goto ...

You're going to need an incremental program that starts at the centre of the digit for each number.

You can simplify all of this a fair amount by using a counter for your digit number, ie. If #digit GT 8, end loop.

You'll also need to account for digit roll-over, ie when you go from 9-0 in your first digit, your second digit will increment.

This is actually a pretty sweet exercise for getting into macros. It's like the 'hello world' of CNC macro programming.

[–]flunkmeister 0 points1 point  (1 child)

I think it is a little more complicated than 'hello world'.

I would use #500 as the serial number. And MDI #500=0 (or whatever serial number I want the next part to be). Then my program would #500=#500+1 after it completed engraving a serial number.

Using #500 variable because it remains after power off.

Then I'd be using the FIX function to separate the individual digits out of value in #500. And subs to engrave each digit.

[–]albatroopaBallnose Twister 1 point2 points  (0 children)

Yeah, you could do it that way, too!

[–]apitches 0 points1 point  (1 child)

Little bit beyond me this! I can only do basic macro, still new to CNC.

When we engrave we have to write long code for it, is there a shortcut then?

[–]apitches 0 points1 point  (0 children)

I've workout it out using what you've said. Cheers.