Hello Guest it is March 28, 2024, 08:42:42 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - alexzkter

Pages: 1
1
Hi,

I'm trying to park the tool dynamically after the machine ends cutting and I came upon the MaxY() function, which returns the Machine coordinates of an axis from a gcode.

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, because the tool path took into account the old zeros.

Code: [Select]
'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
'While IsMoving()
'Sleep 100
'Wend


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
'While IsMoving()
'Sleep 100
'Wend


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

Else
Code "G0G53 X20.0 Y" & Y_axis_length 'Move the tool all the way back in the Y direction
'While IsMoving()
'Sleep 100
'Wend

End If

Y_MaxReachedMachinePos=0

Is there a way to accomplish this? Like, executing the macro only after the machine starts cutting, for isntance?
Enabling "Ignore M calls while loading" didn't work.


Thanks in advance, Alejandro.

Pages: 1