Macro for G10


Results 1 to 9 of 9

Thread: Macro for G10

  1. #1
    Registered
    Join Date
    Apr 2012
    Location
    usa
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default Macro for G10

    Hello.

    I need to write a macro for using current machine coordinates and G10 to write G54. This is on a Yasnac MX3 control. I have enabled M54 and used O9030, and I can set the work coordinates to zero (G10 Q2 P1 X0 Y0). Problem is, I would like to not type work coordinates each time I pick up the part.

    I would like someone to explain how the variables work in this application. Is it as simple as:
    O9030
    G10 Q2 P1 X[#5021] Y[#5022];
    M99

    #5021=X axis current absolute machine position
    #5022=Y axis current absolute machine position

    This is my first time trying to program using a macro, so please be patient.
    Thank you
    Rick

    Similar Threads:


  2. #2
    Member
    Join Date
    Feb 2006
    Location
    india
    Posts
    1792
    Downloads
    0
    Uploads
    0

    Default Re: Macro for G10

    I have no experience with your control, but, on Fanuc, one does not need to use G10 at all if the machine is macro-enabled, and system variables are available.



  3. #3
    Member
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    1230
    Downloads
    0
    Uploads
    0

    Default Re: Macro for G10

    Quote Originally Posted by sinha_nsit View Post
    I have no experience with your control, but, on Fanuc, one does not need to use G10 at all if the machine is macro-enabled, and system variables are available.
    Hi Sinha;
    The same will apply for the Yasnac control as for the Fanuc. I also would rather use System Variables in a Macro Program than G10, but the structure of the Macro would be similar for each system.

    To frizi,
    I would expand on your application by calling the Macro with a Custom G or M Code and pass a number to specify which Workshift Offset to deal with rather than restricting the Macro to only being able to set G54. Example follows:

    G101 S1 (VALID NUMBER TO PASS - 1 TO 6) (MACRO CALL OF O9010)

    O9010
    IF [[#19 LT 1] OR [#19 GT 6]] GOTO100 (ERROR TRAP FOR INVALID WORK SHIFT NUMBER)
    #1 = #4003 (SAVE GROUP 03 G CODE)
    G90 G10 Q2 P#19 X[#5021] Y[#5022]
    G#1 (RESTORE GROUP 03 G CODE)
    GOTO900
    N100 #3000 = 1 (INVALID WORK SHIFT - FIX)
    N900
    M99

    Regards,

    Bill



  4. #4
    Registered
    Join Date
    Jan 2016
    Location
    United States
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Macro for G10

    Hello,
    I have been using yasnac manuals and internet resources to try and learn macro programing for I80 and J300 Matsurras. Today I made a macro to automate the process of using a edgefinder. I used G10 to set the work offsets with variables for the P and J value.I saw this thread before work and I borrowed this line for the error traps.

    IF [[#19 LT 1] OR [#19 GT 6]] GOTO100 (ERROR TRAP FOR INVALID WORK SHIFT NUMBER)

    It got me thinking of how would I check to make sure the value of #19 is a integer without six IF commands. It would be 28 for the J values.
    Now that I am thinking about it the answer probably involes making a DO WHILE loop. I can not post the code because I do not have internet access with work computers. I did manage to get my macro to work.
    I did not see reference to the OR command in the yasnac manual. Is the manual leaving out other commands I should know about?

    Regards,
    Jeff



  5. #5
    Registered
    Join Date
    Jan 2016
    Location
    United States
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Macro for G10

    Hello,
    I have been using yasnac manuals and internet resources to try and learn macro programing for I80 and J300 Matsurras. Today I made a macro to automate the process of using a edgefinder. I used G10 to set the work offsets with variables for the P and J value.I saw this thread before work and I borrowed this line for the error traps.

    IF [[#19 LT 1] OR [#19 GT 6]] GOTO100 (ERROR TRAP FOR INVALID WORK SHIFT NUMBER)

    It got me thinking of how would I check to make sure the value of #19 is a integer without six IF commands. It would be 28 for the J values.
    Now that I am thinking about it the answer probably involes making a DO WHILE loop. I can not post the code because I do not have internet access with work computers. I did manage to get my macro to work.
    I did not see reference to the OR command in the yasnac manual. Is the manual leaving out other commands I should know about?

    Regards,
    Jeff

    Last edited by Needshave; 02-11-2016 at 04:22 AM. Reason: Reposted by accident


  6. #6
    Member
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    1230
    Downloads
    0
    Uploads
    0

    Default Re: Macro for G10

    Quote Originally Posted by Needshave View Post
    Hello,
    I have been using yasnac manuals and internet resources to try and learn macro programing for I80 and J300 Matsurras. Today I made a macro to automate the process of using a edgefinder. I used G10 to set the work offsets with variables for the P and J value.I saw this thread before work and I borrowed this line for the error traps.

    IF [[#19 LT 1] OR [#19 GT 6]] GOTO100 (ERROR TRAP FOR INVALID WORK SHIFT NUMBER)

    It got me thinking of how would I check to make sure the value of #19 is a integer without six IF commands. It would be 28 for the J values.
    Now that I am thinking about it the answer probably involes making a DO WHILE loop. I can not post the code because I do not have internet access with work computers. I did manage to get my macro to work.
    I did not see reference to the OR command in the yasnac manual. Is the manual leaving out other commands I should know about?

    Regards,
    Jeff
    Hello Jeff,
    You could use FIX, or FUP to round the base variable down, or up respectively and then compare the value with the original number. For example, you could do something like the following:

    IF [FUP[#19] NE #19] GOTO200 (ERROR TRAP FOR NON INTEGER NUMBER)

    If the above Conditional Statement tests true, then #19 is NOT an integer.

    Regards,

    Bill



  7. #7
    Registered
    Join Date
    Jan 2016
    Location
    United States
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Macro for G10

    Thank you Bill. I did come up with a way after posting last night. It used a WHILE DO loop and is six lines of code. If the numbers matched it was going to GOTO out of the loop. I'm not sure if that is legal. Your way is much cleaner.



  8. #8
    Member
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    1230
    Downloads
    0
    Uploads
    0

    Default Re: Macro for G10

    Quote Originally Posted by Needshave View Post
    Thank you Bill. I did come up with a way after posting last night. It used a WHILE DO loop and is six lines of code. If the numbers matched it was going to GOTO out of the loop. I'm not sure if that is legal. Your way is much cleaner.
    Hello Jeff,
    Yes, its legal to exit a WHILE / DO loop before the conclusion of the Loop structure.

    Regards,

    Bill



  9. #9
    Member
    Join Date
    Feb 2006
    Location
    india
    Posts
    1792
    Downloads
    0
    Uploads
    0

    Default Re: Macro for G10

    But jumping inside a WHILE loop is illegal.
    There is one exception, however. If you jump outside, you are allowed jump inside after executing a few outside blocks.
    There would be no syntax error. It should only be logically correct.
    The control only does not like a standalone END block.

    I can recall a discussion with Stevo1 on this issue several years back. I still remember the analogy I gave: "It is like filing a divorce petition, and withdrawing it before the date of hearing!"

    Last edited by sinha_nsit; 02-12-2016 at 10:53 AM.


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

Macro for G10

Macro for G10