Can I change X,Y,Z zero mid program?


Results 1 to 20 of 20

Thread: Can I change X,Y,Z zero mid program?

  1. #1

    Default Can I change X,Y,Z zero mid program?

    Hi,
    I often machine identical parts and would like to machine several of them at the same time. I could secure them to the table then probe the datums and copt/translate my toolpaths in the CAM package, post process and run but this is rather time consuming (500K lines of code). What I would like to do is probe the datums of each work piece and enter them into a script that will change the X,Y,X zero values after cutting the first part then run the program again etc. Even adding gcode at the end of the program then pasting a copy of the program below would do.

    Any ideas anyone?

    Thanks

    Similar Threads:


  2. #2
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    G54, G55, G56, ...

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  3. #3

    Default Re: Can I change X,Y,Z zero mid program?

    Quote Originally Posted by ger21 View Post
    G54, G55, G56, ...
    Thanks, obviously I am quite new to this but did manage to find the G54,G55 etc

    So if I set XYZ to zero at fixture datum #1
    G54 0 0 0
    G55 at distance from datum #1 to datum #2

    will this code work?
    G21
    G90
    G91 G28 X0 Y0 Z0 M05
    (T1 End Mill D8 )
    G90 M6 T0101
    (----------------------------------------------------------------- )
    M03 S2400
    G00 X-4.1200 Y89.0000 F1000
    G00 Z1.0000 F400
    G01 Z-1.5000
    G01 Y0.0000
    G01 X-4.0000
    etc
    G01 Y0.0000
    G01 X-4.0000
    G01 Y89.0000
    G00 Z-5.2500
    G00 X-4.1200
    G01 Z10.0000 F1000


    G55

    repeat G code


    G91 G28 X0 Y0 Z0 M05
    G90
    M30



  4. #4
    Member
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    4252
    Downloads
    4
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    You do not mention what size CNC you have, nor what controller you have (eg Mach3). This info is usually needed.

    I have machined up to 20 units at a time, in a 3x6 or 2x10 grid, using the G54/etc codes.
    Can I change X,Y,Z zero mid program?-5406-jpg

    Or you can simply do the maths yourself in your code. Um - if you are using a dum CAM package, that might be more difficult. I write my own programs by hand.

    Cheers
    Roger



  5. #5

    Default Re: Can I change X,Y,Z zero mid program?

    Quote Originally Posted by RCaffin View Post
    You do not mention what size CNC you have, nor what controller you have (eg Mach3). This info is usually needed.

    I have machined up to 20 units at a time, in a 3x6 or 2x10 grid, using the G54/etc codes.
    Can I change X,Y,Z zero mid program?-5406-jpg

    Or you can simply do the maths yourself in your code. Um - if you are using a dum CAM package, that might be more difficult. I write my own programs by hand.

    Cheers
    Roger
    Sorry. I am using Mach 3. The machine is an old Denford which has been modified by a previous owner.



  6. #6
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    Quote Originally Posted by luremaker View Post
    Thanks, obviously I am quite new to this but did manage to find the G54,G55 etc

    So if I set XYZ to zero at fixture datum #1
    G54 0 0 0
    G55 at distance from datum #1 to datum #2

    will this code work?
    G21
    G90
    G91 G28 X0 Y0 Z0 M05
    (T1 End Mill D8 )
    G90 M6 T0101
    (----------------------------------------------------------------- )
    M03 S2400
    G00 X-4.1200 Y89.0000 F1000
    G00 Z1.0000 F400
    G01 Z-1.5000
    G01 Y0.0000
    G01 X-4.0000
    etc
    G01 Y0.0000
    G01 X-4.0000
    G01 Y89.0000
    G00 Z-5.2500
    G00 X-4.1200
    G01 Z10.0000 F1000


    G55

    repeat G code


    G91 G28 X0 Y0 Z0 M05
    G90
    M30
    Yes that can work but a simple X---- Y------ move to the next position is all that is needed will work also

    Mactec54


  7. #7

    Default Re: Can I change X,Y,Z zero mid program?

    Quote Originally Posted by mactec54 View Post
    Yes that can work but a simple X---- Y------ move to the next position is all that is needed will work also
    So I could just replace the G55 with a G00 x,y,z?

    I am assuming that Mach 3 uses the G55 XYZ set in Mach3 when add a line ust saying M55?

    Either way I think I would prefer too use the G55 as that makes it easier to write a basic program for multiple part machining.



  8. #8
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    Quote Originally Posted by luremaker View Post
    So I could just replace the G55 with a G00 x,y,z?

    I am assuming that Mach 3 uses the G55 XYZ set in Mach3 when add a line ust saying M55?

    Either way I think I would prefer too use the G55 as that makes it easier to write a basic program for multiple part machining.
    Yes correct except you never use a Z axes move when Doing a X Y move, a Z move should always be on a line before a X Y Axes move for obvious reasons

    No it can't be a M55 the control would not know what to do with that

    Mactec54


  9. #9

    Default Re: Can I change X,Y,Z zero mid program?

    Whoops - I did mean G55 not M55.

    I will have a play tomorrow with G55 as if I get it eorking it will be a great help as I will be able to machine 4 parts overnight.

    Last edited by luremaker; 08-19-2019 at 06:28 PM.


  10. #10
    Member
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    4252
    Downloads
    4
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    Be warned: there is a slight problem in Mach3 with G54.
    When you load a program which is written using several instances of G54, the on-screen display of the cutter path at Load Time is correct, but the Run-Time display is not. The run-time display SW forgets all about the offsets. This is clearly a display bug in Mach3 as a) the load-time display is correct and b) the actual path machined is correct. One gets used to this ... (I think it was an error by the original author: Art Fenerty.)

    So why didn't Artsoft fix this? Two reasons: not enough loud complaints about it, and then they decided to go for Mach4 instead. One day, someone is going to get hold of the source code for Mach3, strip the LPT driver stuff right out (ie rely on the ESS), and fix the bugs. That may take some doing ...

    Cheers
    Roger



  11. #11

    Default Re: Can I change X,Y,Z zero mid program?

    Well had a go today with a small program.

    Set G54 to datum of first part and G55 to datum of the second and it ran OK.

    BUT I then set G54 and G55 to 0,0,0 loaded a workpiece and set the datum and ran my program and at about line 19,000 the machine decides to go to machine 0,0,0 then back to the workpiece and carried on cutting. There were no lines in the gcode calling for this move so it beats me.



  12. #12
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    Mach3 has lots of little bugs that only show up on occasion. And different versions may have different bugs.

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  13. #13
    Member
    Join Date
    Sep 2005
    Location
    United States
    Posts
    1740
    Downloads
    0
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    Thats why I went to Mach4, too many little unexplained glitches.

    1000x750 Workbee CNC - Mach4 - PMDX USB - Windows 10 Pro


  14. #14
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    Quote Originally Posted by luremaker View Post
    Well had a go today with a small program.

    Set G54 to datum of first part and G55 to datum of the second and it ran OK.

    BUT I then set G54 and G55 to 0,0,0 loaded a workpiece and set the datum and ran my program and at about line 19,000 the machine decides to go to machine 0,0,0 then back to the workpiece and carried on cutting. There were no lines in the gcode calling for this move so it beats me.
    If you just cut and pasted the first program then called it G55 then yes it will have a start position at the first part in it, and will go back to the first part, you have to be careful when you cut and paste in programs as this will happen nothing to do with the control it's doing what you are telling it to do

    Mactec54


  15. #15
    Member
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    4252
    Downloads
    4
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    Mactec is right. Doing a cut&paste without checking the guts of the file is going to fail 99.99% of the time.

    How many CAM programs can handle anything beyond G0-G3 and simple drilling? Rather few I think.

    Cheers
    Roger



  16. #16
    Member routalot's Avatar
    Join Date
    Dec 2003
    Posts
    1206
    Downloads
    0
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    Quote Originally Posted by RCaffin View Post
    Mactec is right. Doing a cut&paste without checking the guts of the file is going to fail 99.99% of the time.

    How many CAM programs can handle anything beyond G0-G3 and simple drilling? Rather few I think.

    Cheers
    Roger

    Here's one that handles a few LinuxCNC "G-Code" Quick Reference . Not heavily promoted and not from Artsoft,so maybe out of place here.Its also free so you can try it for absolutely nothing.



  17. #17

    Default Re: Can I change X,Y,Z zero mid program?

    Thanks for all the help folks it is really appreciated.

    Am I correct that G54 is the default datum in mach3 and if this is the datum for the first part, would I be correct that if I add a G54 line to my code after the last cut then when load anther program it should start with the correct datum for the first part?

    I do modify my code for several reasons and to ensure the correct datum is used I add the following lines at the start of each program after the tool change

    G00 X0.0000Y0.0000
    (Check X and Y datum, press Cycle Start to continue)
    M00
    G01 Z10.000 F500
    (Z is at +10mm , press Cycle Start to continue)

    Also mactec54 why "never use a Z axes move when Doing a X Y move, a Z move should always be on a line before a X Y Axes move for obvious reasons"? Most of my work is 3D surfaces so a lot of the code has x,y,z moves on the same line. If anything I would expect it to be safer to move in X and Y then plunge in Z unless cutting flat bottomed pockets.



  18. #18
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    Quote Originally Posted by luremaker View Post
    Thanks for all the help folks it is really appreciated.

    Am I correct that G54 is the default datum in mach3 and if this is the datum for the first part, would I be correct that if I add a G54 line to my code after the last cut then when load anther program it should start with the correct datum for the first part?

    I do modify my code for several reasons and to ensure the correct datum is used I add the following lines at the start of each program after the tool change

    G00 X0.0000Y0.0000
    (Check X and Y datum, press Cycle Start to continue)
    M00
    G01 Z10.000 F500
    (Z is at +10mm , press Cycle Start to continue)

    Also mactec54 why "never use a Z axes move when Doing a X Y move, a Z move should always be on a line before a X Y Axes move for obvious reasons"? Most of my work is 3D surfaces so a lot of the code has x,y,z moves on the same line. If anything I would expect it to be safer to move in X and Y then plunge in Z unless cutting flat bottomed pockets.
    3D surfaces have nothing to do with X Y Z rapid moves to the start of a part, or a new position move, the Z axes is always moved first then a X Y move the reason you move the Z first is so you don't crash into your work piece as X and Y will move first then Z axes which In most cases is to late the crash has happened

    G54 is the default in all machines controls until you change it in your program

    Only your first part would be at G54 X0.0 Y0.0 you next part work offset would be the distance to the start of the next part G55 X----Y0.0 one or both of the axes X and Y will have a different start point than the first part the Z axes does not change unless the work height changes

    Mactec54


  19. #19

    Default Re: Can I change X,Y,Z zero mid program?

    Well all is going well using G55 and as RCaffin says the run time display sometimes forgets that G55 has been used and displays the cuts s though G54 was used.
    I am now machining up to 4 parts all with different Z datums. I load all the parts and probe their X,Y datums (G54,G5 etc) with a 4mm dowel in the collet, the correct tool is loaded and usng a macro Z is probed on all parts and the program run.
    In order to save time I would like to ust load the next tool and have Mach3 automatically probe Z on all the parts. I have found out (or led to believe) Mach3 cant call macros so does anyone know of a solution?



  20. #20
    Member
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    4252
    Downloads
    4
    Uploads
    0

    Default Re: Can I change X,Y,Z zero mid program?

    I have found out (or led to believe) Mach3 cant call macros
    That is totally and utterly FALSE.

    In fact, the G73 instruction is actually executed by a called macro.
    Probing is always done with a rather large Macro call: there are many versions.

    In essence, Mach3 using Crystal Basic, which is someone's implementation of Basic as an linkable library.
    If you can do it in Basic, you can do it in Mach3.
    Mach4 uses LUA instead - I don't know why Artsoft changed. But basically (sorry!) it's the same thing.

    For a start, you want the Mach3 V3 Programmers Reference manual, for Mach3-specific calls. Two flavours: V3 and V3.x
    Next, you want the VBScript_Commands.pdf file by Crystal Basic for some deeper info.
    Mach_VB_Parameteres.doc is an essential guide to accessing Mach3 variables in Basic.
    Cypress Basic.pdf is obviously going to be useful.
    All these are to be found on the Artsoft web site somewhere. They do have a lot of doco support for you.
    There is a doc called Coordinate Spaces: a Guide, at Coordinate Spaces - a Guide (I wrote it).
    You can also search the CNCZone web site for other docos. There is a lot around the web.

    If you are coming from a Fanuc world, please note that Mach3 allows you to call g-code subroutines anywhere: I believe they are the same thing as Fanuc's Macros.

    For all that some people pooh-pooh Mach3 in favour of Mach4, it is still an extremely powerful tool for running a CNC. It has a few bugs, sadly, but many people make a living from Mach3.

    Cheers



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Can I change X,Y,Z zero mid program?

Can I change X,Y,Z zero mid program?