Sequential Serial Number Engraving?

More
12 Jan 2018 21:10 #104359 by helmholtz
I was looking for a subroutine that can engrave sequential serial numbers but having a hard time finding one that was written for LinuxCNC. I have some work experience with Fanuc macro programming but you use a lot of GOTO statements there and that doesn't seem to work in LinuxCNC, in addition to a lot of other syntax changes, that are making it hard to even get started. I'm a machinist by trade and have ZERO computer programming experience outside of industrial machine controls and even then pretty limited on the macro side.

I have a Tormach mill at home and using Pathpilot but I would imagine the subroutine would be the same as in LinuxCNC? and yes, I'm aware they have a little conversational screen to engrave a single serial number, but I need to engrave 25-50 parts per cycle. Also their program only works along the X-axis, and lastly it doesn't seem to even support G68 commands, so I'm really dead in the water here.

If anyone has a sample program that would be relevant to help me with the basic structure and syntax it would be really helpful.
More
12 Jan 2018 21:44 #104361 by andypugh
Not a perfect fit, but something a bit like this might work:

forum.linuxcnc.org/20-g-code/27169-g-cod...linders?limitstart=0

It has a subroutine to engrave each digit, and then another bit o G-code works out which digit to engrave in each position.
The following user(s) said Thank You: helmholtz
More
12 Jan 2018 21:54 #104364 by Todd Zuercher
If you can make a Fanuc custom macro code that can do it, post it here and someone could help you convert it.

True Linuxcnc doesn't use GOTOs or line numbers. But most any thing you could do with them in Fanuc's custom macro, the equivalent can be achieved with O-codes in Linuxcnc. But it takes a little bit different way of looking at the problem, and if you are used to doing it the other way, it might be difficult.
The pertinant section of the Linuxcnc manual is here.
linuxcnc.org/docs/html/gcode/o-code.html

The only G-code examples I personally have on hand are examples of grid array repeats, and I'm not sure how much help that would be to you. If you rummage around in the examples in the nc_files folder that comes with Linuxcnc, there are a number of files that are examples of parametric programming, subprogram calls, and o-codes.
The following user(s) said Thank You: helmholtz
More
13 Jan 2018 21:01 #104398 by helmholtz
I got started on writing my own macro based on the above example but ultimately determined everything I was looking for is buried in PathPilot and just not very well documented.

To engrave a serial number from a command line:
G47 X0.0 Y0.0000 Z-0.0030 P0.050 Q0.070 R.10000

This would engrave the serial number based on the settings provided in the conversational engraving screen and then increment that number after each G47 line. So you can easily incorporate this into a subroutine for engraving serial numbers, in sequence, by just calling the G47 and using like incremental (g91) moves in-between. It is limited in that it only works with numbers 0-9 and will only increment by 1 but should work for most needs.

This only will engrave a serial number from left to right along the X axis. But, there's a fix for that too:

G10 L2 P1 R90

This will rotate the G54 WCS origin by 90 degrees. so now you can engrave along the Y axis. 'R-90' along the Y axis from the other direction, 'R45' at a 45 degree angle, etc. Why this is a parameter of G10 and not implemented as G68 is beyond me, but I'm a machinist and not a developer.

So hopefully this will help someone out as I did not find this thoroughly documented anywhere. I only have used it in PathPilot and have no idea if any of this is also available to users of LinuxCNC but it made my life a lot easier!
Time to create page: 0.062 seconds
Powered by Kunena Forum