561
General Mach Discussion / Re: Macro in G-code pauses execution for 1 sec
« on: September 27, 2018, 02:43:42 PM »
if you Show us your M29 macro, somebody will be able to help you.
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.
Sub Main()
'get Parameter ------------------------------------------------------
Tool = Param1()
'--------------------------------------------------------------------------------
'ceck toolnumber----------------------------------------
If ((Tool < 1) or (Tool > 16)) then
Message ("toolnumber not valid")
GoTo Ende
End If
'--------------------------------------------------------------------------------
'load the tool
Code "M6 T" + cstr(Tool) + " M5"
'--------------------------------------------------------------------------------
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' PUT HERE SOME CODE TO DRIVE TO THE PROPBEPOSITIO
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'do the probing
ZM_in = 100 'max probing distance
Code "G31 Z100" + CStr(ZM_In) +"F50"
While IsMoving()
z = GetOEMDRO(802) 'act Z-pos
If z <= ZM_In Then
DoOEMButton(1003) 'Stop if too far
MsgBox ("probe not hit" )
GoTo Ende
End If
Wend
'et the probepos
ZProbePos = GetVar(2002)
'put the value into tooltable
SetToolParam(Tool,2, ZProbePos)
'save tooltable
DoOEMButton(316)
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' PUT HERE SOME CODE TO COME OUT OF THE PROBEPOS
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'unload the tool
Code "M6 T0"
Exit Sub
Ende:
Code "M30"
'Message ("error while probing")
End Sub