Hi,

I'm trying to park the tool dynamically after the machine ends cutting, so if the Y axis reaches a maximum machine coordinate, of say 1000mm during the cutting process, I'd like the tool to be parked at this position with a little bit of room (+600 or +450mm) to ease material unload.

I found the MaxY() function, which returns the Machine coordinates of an axis from a gcode. I don't know if it's appropiate for this.

Problem is, this macro is evaluated only while the tool path is generated, that is, before actually cutting. So if I zero my axis after loading the cut file, the final move is not where I expected it.

Could you please help my out with this? Thanks.



Here's my macro:

'Define the axes
Dim Xaxis As Integer
Xaxis = 0
Dim Yaxis As Integer
Yaxis = 1
Dim Zaxis As Integer
Zaxis = 2

'Define the X&Y work dimensions
Dim X_axis_length As Double
X_axis_length = 1300.0
Dim Y_axis_length As Double
Y_axis_length = 2550.0

'Define variables to store the machine position for the Y axis
Dim Y_MaxReachedMachinePos As Double

'Get Y Axis max reached value of machine coordinates during the cut
Y_MaxReachedMachinePos = MaxY()




' Move Z axis to Safe_Z position
GotoSafeZ()
While IsMoving()
Wend

'Compare which of the 3 table areas the tool reached to know how far it can be moved in the Y direction after job finished.
If Y_MaxReachedMachinePos <= (Y_axis_length/3) Then
Code "G0G53 X20.0 Y" & Y_MaxReachedMachinePos+600.0 'Move the tool 60cm in the Y direction



ElseIf Y_MaxReachedMachinePos > (Y_axis_length/3) And Y_MaxReachedMachinePos <= (Y_axis_length*2/3) Then
Code "G0G53 X20.0 Y" & Y_MaxReachedMachinePos 'Move the tool 45cm in the Y direction


ElseIf (Y_MaxReachedMachinePos+450.0) < Y_axis_length Then
Code "G0G53 X20.0 Y" & Y_MaxReachedMachinePos 'Move the tool 45cm in the Y direction


Else
Code "G0G53 X20.0 Y" & Y_axis_length 'Move the tool all the way back in the Y direction


End If

Y_MaxReachedMachinePos=0

Similar Threads: