585,759 active members*
3,904 visitors online*
Register for free
Login
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2017
    Posts
    82

    C code for button

    I am trying to do c code when adding a button. I want to add three buttons one to move x to 0 one to move y to 0 and one to move z to -.75. I tried the move command but when I move to my zero position and reset the zero then the move command to zero moves the amount i zeroed out not back to the new zero position. Tried other commands and get undeclared error messages.

    This should be easy i move axis to zero location with arrow buttons then press zero for all axis then after machine runs a program I want the user buttons to bring x and z back to zero. I use a .75 block to adjust z zero then move off the work piece and lower the z .75 and reset zero. I would like a button so I don't have to use the arrow buttons 12 times.

    Joe

  2. #2
    Join Date
    May 2006
    Posts
    4045

    Re: C code for button

    Hi Joe,

    I am trying to do c code when adding a button. I want to add three buttons one to move x to 0 one to move y to 0 and one to move z to -.75. I tried the move command but when I move to my zero position and reset the zero then the move command to zero moves the amount i zeroed out not back to the new zero position. Tried other commands and get undeclared error messages.
    To move to GCode Coordinates rather than Machine Coordinate zero you might use GCode instead of C Code. Create a GCode file (MoveToZero.ngc) something like this:

    G0Z-0.75
    G0X0Y0
    M30

    Then configure the User Button to run that GCode File with:

    Attachment 432584


    I use a .75 block to adjust z zero then move off the work piece and lower the z .75 and reset zero. I would like a button so I don't have to use the arrow buttons 12 times.
    You shouldn't really need to move to zero to set the origin instead simply set the GCode position to 0.75. You could do that with GCode to set the G92 Offset similar to above with:

    G92Z.75
    M30

    If you want to also move to the new zero for some reason you could also do this with:

    G92Z.75
    G0X0
    M30


    HTH
    TK
    http://dynomotion.com

  3. #3
    Join Date
    May 2017
    Posts
    82
    Quote Originally Posted by mirocha View Post
    I am trying to do c code when adding a button. I want to add three buttons one to move x to 0 one to move y to 0 and one to move z to -.75. I tried the move command but when I move to my zero position and reset the zero then the move command to zero moves the amount i zeroed out not back to the new zero position. Tried other commands and get undeclared error messages.

    This should be easy i move axis to zero location with arrow buttons then press zero for all axis then after machine runs a program I want the user buttons to bring x and z back to zero. I use a .75 block to adjust z zero then move off the work piece and lower the z .75 and reset zero. I would like a button so I don't have to use the arrow buttons 12 times.

    Joe
    Works great setup 4 buttons thanks
    Joe

  4. #4
    Join Date
    May 2006
    Posts
    4045

    Re: C code for button

    Hi Joe,

    Great. Thanks for taking the time to post back
    TK
    http://dynomotion.com

Similar Threads

  1. Replies: 2
    Last Post: 10-18-2019, 12:12 PM
  2. Accidentally deleted script code from set Z button...help?
    By canman77 in forum Mach Software (ArtSoft software)
    Replies: 3
    Last Post: 09-12-2018, 05:57 AM
  3. Think I need a better placed RED Button
    By rdsi in forum Tormach PathPilot™
    Replies: 3
    Last Post: 02-05-2017, 08:29 PM
  4. Momentary Button OEM Code
    By DrivenMachines in forum Mach Wizards, Macros, & Addons
    Replies: 4
    Last Post: 04-22-2016, 04:31 AM
  5. Help with button code please
    By tmead in forum Mach Wizards, Macros, & Addons
    Replies: 4
    Last Post: 10-30-2008, 02:43 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
  •