584,800 active members*
4,822 visitors online*
Register for free
Login
Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2011
    Posts
    68

    Gcode for 4th axis

    Looking for a gcode file to make the 4th axis turn constantly in mach4 , until a stop command is given . Ideally it would be a macro / script , that can be activated by a button on the Mach4 screen , if not a file that can be inserted in my PP. The idea is to use the axis as a lathe and run a simple gcode profile while it is turning. I know there are wrapping PP , but they are so slow , i can hear my beard grow!

    Hope someone can help

    ED

  2. #2
    Join Date
    Apr 2011
    Posts
    68

    Re: Gcode for 4th axis

    Is there someone who can create this gcode , or macro / script for Mach 4??.


    Ed

  3. #3
    Join Date
    Apr 2004
    Posts
    5728

    Re: Gcode for 4th axis

    I don't think G-code works that way. Usually, a positional command will only execute once the previous command is finished. It sounds like you're trying to turn your mill or router into a lathe, which works the way you describe. Why not substitute a regular induction motor for the stepper that's powering your rotary table? Once that's set up, all you'll have to do is switch it on and run the code for your profile using the Z and X axes, just like a CNC lathe.
    Andrew Werby
    Website

  4. #4
    Join Date
    Nov 2008
    Posts
    644

    Re: Gcode for 4th axis

    The question is how much 4th axis control does your CAM software provide? How complex is your part?
    Say you started with a long square and want to turn it round. That’s either a lathe package or some custom (or hand written) Gcode in a milling package. Same part over and over the custom write it. Create a stool spindle and that’s more complicated. Vectric software is designed to do some of this but it’s complicated.
    You just want to turn the 4th axis while moving the spindle, you could drive the stepper driver separately from the controller using a few different methods.


    Sent from my iPhone using Tapatalk

  5. #5
    Join Date
    Dec 2013
    Posts
    5717

    Re: Gcode for 4th axis

    Is there way in Mach4 to have a second spindle set up? You might be able to call your 4th axis a spindle and then just turn it on with a ''M'' command.
    Jim Dawson
    Sandy, Oregon, USA

  6. #6
    Join Date
    Apr 2011
    Posts
    68

    Re: Gcode for 4th axis

    There in lies the problem ! How to set that up in Mach4 ??


    Ed

  7. #7
    Join Date
    Nov 2008
    Posts
    644

    Re: Gcode for 4th axis

    You can drive a stepper with step (a frequency) and direction signal. Something as simple as an arduino can generate those signals. M codes drive relays like spindle and flood, and others. Those M codes from your controller can control the arduino, which powers the stepper driver.

    This works great for turn it on and let it run during the entire cut. Not so useful if you want to stop-start it and change direction while cutting.


    Sent from my iPhone using Tapatalk

  8. #8
    Join Date
    Dec 2013
    Posts
    5717

    Re: Gcode for 4th axis

    Quote Originally Posted by edcross View Post
    There in lies the problem ! How to set that up in Mach4 ??


    Ed
    Maybe this would be a starting point. https://warp9td.com/index.php/faq/faq-mach4#ObSpindle
    Jim Dawson
    Sandy, Oregon, USA

  9. #9
    Join Date
    Apr 2011
    Posts
    68

    Re: Gcode for 4th axis

    G53 A 9000 , will make my A axis turn continuously until it completes 9000 degrees at the motor velocity in the motor setup . How can i put this line in my gcode and have it stay active until the end of the gcode file ??


    Ed

  10. #10
    Join Date
    Nov 2008
    Posts
    644

    Re: Gcode for 4th axis

    A command like that would be handy but gcode doesn’t work like that. If you move X then Y it will wait for X to complete before moving Y. If the command has both an X and Y then they will move at the same time.
    So each new line of Gcode executes when the line above it completes.


    Sent from my iPhone using Tapatalk

Similar Threads

  1. 4th-Axis GCode Programming
    By twehr in forum G-Code Programing
    Replies: 10
    Last Post: 02-19-2023, 11:02 AM
  2. How to handle 4th axis offset , is there a Gcode or ?
    By phucrobusl in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 0
    Last Post: 03-22-2018, 11:44 PM
  3. Bobcad version for 4th axis true 4th axis machining?
    By Tormachmaster in forum BobCad-Cam
    Replies: 34
    Last Post: 12-18-2015, 01:37 AM
  4. home made 4th axis looking for an easy gcode to try
    By minicncuser in forum Chinese Machines
    Replies: 2
    Last Post: 05-29-2015, 10:49 AM
  5. 4th gcode axis problem
    By fabconv in forum Visual Mill
    Replies: 1
    Last Post: 08-29-2009, 01:39 PM

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
  •