Hello Guest it is March 28, 2024, 08:53:01 AM

Author Topic: macro to call g54 and g55, etc  (Read 1780 times)

0 Members and 1 Guest are viewing this topic.

macro to call g54 and g55, etc
« on: December 27, 2019, 05:31:40 PM »
Hi, how are you ?, I have built a machine that has two heads, one fixed with a laser and the other with a z-axis and tangential (A-axis).
I would like to know if you can create a macro that when you read a tool change in the g-code, the macro calls the offset on the X and Y axes of that tool.
I tried but I don't understand any programming and I haven't found something like that on the web. I've seen videos of machines that do it but I can't do it.
Thanks a lot
best regards

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: macro to call g54 and g55, etc
« Reply #1 on: December 28, 2019, 03:04:37 AM »
witch toolchange macro depends on your Settings Config->General Config->Tool Change

if Stop spindle. Wait for cycle Start is selected M6Start.m1s will be excecute when M6 is called in GCode and M6End.M1s
will be started after pressing Cycles Start after Toolchange is fineshed.

if Auto Tool Changer is selected only M6Start.M1s will be exceuted.

in one of this macro you can do your own code, f.e.
Code: [Select]
        'get new tool number
newtool = GetSelectedTool()

       'select Offset by toolnumber
       If newtool = 1 then
           Code "G54"
       Else
           Code "G55"
       End If
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: macro to call g54 and g55, etc
« Reply #2 on: December 28, 2019, 02:46:52 PM »
Hello TPS, the macro worked perfect !!!, once the tangential has done its job, when it detects the new tool automatically applies the g55 which is the offset of the laser pointer.
I ask you another question, you may know.
When you start cutting with the laser pointer, I have electrically deactivated the Z axis and the A with the M07 since the laser pointer is fixed and operated by the M03.The problem is that when the M07 command falls, both the Z and A move a little when reconnected by the relay, losing the original position
The path I generate with sheetcam and the post is mach3 tangential.
Do you know how in a trajectory to ignore the Z and A axis without editing the code g?
I thank you for your help,
Then I will record a small video and upload it.
best regards ?

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: macro to call g54 and g55, etc
« Reply #3 on: December 28, 2019, 08:20:13 PM »
Why do you have to deactivate the Z and A axis?

If they are not commanded in the g-code they will not move anyway
Without engineers the world stops

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: macro to call g54 and g55, etc
« Reply #4 on: December 29, 2019, 04:25:07 AM »
you can use:

Code: [Select]
   DoOEMButton(252) 'disable Z-axis
   DoOEMButton(253) 'disable A-axis

a second call off OEMButtons will enable them again

to check wether thay are enabled/disabled you can use OEMLed's

Code: [Select]
  If GetOEMLed(88) Then
    MSGBox "Z-Axis is disabled"
  End If

  If NOT GetOEMLed(88) Then
    MSGBox "Z-Axis is enabled"
  End If

  If GetOEMLed(89) Then
    MSGBox "A-Axis is disabled"
  End If

  If NOT GetOEMLed(89) Then
    MSGBox "A-Axis is enabled"
  End If
 

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.