1761
General Mach Discussion / Re: Probing - what would i need?
« on: April 12, 2018, 02:19:22 PM »
i will also Trigger CS about the soft Limit Thing, maybe ...
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.
In what manual? In the mach 3 page 30-31, according to PDF numbering, doesn't say anything. A-1 Has description, but seem cryptic to me.
I guess I need to ask, the ARC on the Proma THC, is it an output going to mach or an input from mach.
Sub Main()
'***Y+ Probing Macro
'***Written by and for DD Metal Products Ltd 2018
'***Metric units only in use
'***Using CSLABS Controller M31 macro code
'***Axis scaling not expected or handled
'***Probe offset must be calibrated at "Slow Feedrate" value and set in "Probe Tip Dia" DRO first
'***Probe Z axis position is set by user first to correct height
'***Probe Y position must be within the value set in "Max Distance" DRO
Dim FeedFast, FeedSlow
Dim ProbeOffset
Dim MaxDistance
Dim X_SENSE As Double
Dim Y_SENSE As Double
Dim Z_SENSE As Double
Dim CurrentAbsInc
'***Load Variables From Screen DRO's
FeedFast = GetUserDRO(1821)
FeedSlow = GetUserDRO(1822)
MaxDistance = GetUserDRO(1823)
ProbeOffset = GetUserDRO(1829)
'TPS i do not have the DRO
FeedFast = 50
FeedSlow = 5
MaxDistance = 30
ProbeOffset = 5
'***Error checks
If GetOemLed(16)<>0 Then '***Check for machine coordinates setting
Message "Please Change To Working Coordinates"
Exit Sub
End If
If GetOemLed(825)<>0 Then '***Probe is not connected or cable broken
Message "Probe Connection Error"
Exit Sub
End If
'***Get the current G90/G91 state
CurrentAbsInc = GetOemLED(48)
'***Start Probing
Message "Probing In Y+ Direction"
Sleep (1000)
Code "F" & Feedfast
SetUserDRO(1511, 0) '***X Axis
SetUserDRO(1512, MaxDistance) '***Y Axis
SetUserDRO(1513, 0) '***Z Axis
Call ProbeSurface()
X_SENSE = GetVar(2000)
Y_SENSE = GetVar(2001)
Z_SENSE = GetVar(2002)
Code "G91 G0 Y-3" '***Step back
While IsMoving()
Sleep(50)
Wend
Code "F" & FeedSlow
SetUserDRO(1511, 0) '***X Axis
SetUserDRO(1512, 5) '***Y Axis - Must be within 5mm of travel
SetUserDRO(1513, 0) '***Z Axis
Call ProbeSurface()
X_SENSE = GetVar(2000)
Y_SENSE = GetVar(2001)
Z_SENSE = GetVar(2002)
'***Step back to release the probe
Code "G91 G0 Y-5"
While IsMoving()
Sleep(50)
Wend
'***Raise the spindle to clear part
Code "G91 G0 Z10"
While IsMoving()
Sleep(50)
Wend
'***Move Y axis to edge and zero the DRO
Code "G90 G0 Y" & Y_SENSE + ProbeOffset
While IsMoving()
Sleep(50)
Wend
SetOemDRO(801,0)
'***Retract the spindle fully
'Code "G53 G0 Z0"
'While IsMoving()
' Sleep(50)
'Wend
'***If G91 was in effect before then return to it
If CurrentAbsInc = 0 Then
Code "G91"
Else
Code "G90"
End If
Message "Y+ Probing Complete"
End Sub
Sub ProbeSurface()
'*** turn soflimit's off if they are on
Dim SoftLimitswhereon As Boolean
If GetOEMLed(23) Then
DoOEMButton(119)
SoftLimitswhereon = True
End If
Sleep(250)'***Needed or UserDRO's fail to update
NotifyPlugins(10103)
SetUserDRO(1510, 0)
While(GetUserDRO(1510) = 0)
Sleep(50)
NotifyPlugins(10104)
Wend
If(GetUserDRO(1510) = 2) Then '***Probing error - no detection in distance = abort
Message "Probing Error - No Surface Found"
End If
'*** turn soflimit's back on if they where on
Sleep(500)
If ((Not GetOEMLed(23)) And (SoftLimitswhereon = True)) Then
DoOEMButton(119)
End If
End Sub