Threaded View
-
09-07-2019 #21
Her is one of my probe macros, there might be something in there to help, I tend to annotate a lot ;) Its for CSMIO IP/A under Mach3
Sub Main()
'***X- 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 ZClearance
Dim StepBack
Dim X_SENSE
Dim Y_SENSE
Dim Z_SENSE
'***Load Variables From Screen DROs
FeedFast = GetUserDRO(1821)
Sleep (100)
FeedSlow = GetUserDRO(1822)
Sleep (100)
MaxDistance = GetUserDRO(1823)
Sleep (100)
ProbeOffset = GetUserDRO(1829)
Sleep (100)
ZClearance = GetUserDRO(1830)
Sleep (100)
StepBack = GetUserDRO(1824)
Sleep (100)
'***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
If StepBack=0 Then '***Stepback not set
Message "Please enter a step-back value"
Exit Sub
End If
If ABS(GetOEMDRO(85))<ZClearance Then '***Z axis too high for retract
Message "Spindle too high for clearance move"
Exit Sub
End If
'***Start Probing
Message "Probing In X- Direction"
Sleep (100)
Code "F" & Feedfast
Sleep (100)
SetUserDRO(1511, 0-MaxDistance) '***X Axis
Sleep (100)
SetUserDRO(1512, 0) '***Y Axis
Sleep (100)
SetUserDRO(1513, 0) '***Z Axis
Sleep (100)
Call ProbeSurface()
X_SENSE = GetVar(2000)
Sleep (100)
'***Step back
Code "G91 G0 X" & StepBack
While IsMoving()
Sleep(50)
Wend
Code "F" & FeedSlow
Sleep (100)
SetUserDRO(1511, 0-(StepBack+2)) '***X Axis
Sleep (100)
SetUserDRO(1512, 0) '***Y Axis
Sleep (100)
SetUserDRO(1513, 0) '***Z Axis
Sleep (100)
Call ProbeSurface()
X_SENSE = GetVar(2000)
Sleep (100)
'***Step back
Code "G91 G0 X" & StepBack
While IsMoving()
Sleep(50)
Wend
'***Raise the spindle to clear part
Code "G91 G0 Z" & ZClearance
While IsMoving()
Sleep(50)
Wend
'***Move Y axis to edge and zero the DRO
Code "G90 G0 X" & X_SENSE - ProbeOffset
While IsMoving()
Sleep(50)
Wend
SetOemDRO(800,0)
Sleep(100)
'***Retract the spindle fully
'Code "G53 G0 Z0"
'While IsMoving()
' Sleep(50)
'Wend
'***Make sure we are in G90 again
Code "G90"
Message "X- Probing Complete"
End Sub
Sub ProbeSurface()
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
End If
End Sub
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
csmio/ip-m z probe
By charlieuk in forum CS-Lab (CSMIO)Replies: 0Last Post: 16-09-2017, 09:49 AM -
mach3 csmio ips errors
By Web Goblin in forum Artsoft Mach (3 & 4)Replies: 7Last Post: 07-01-2017, 10:47 PM -
Mach3 oem buttons with CSMIO-IP/S
By Web Goblin in forum Artsoft Mach (3 & 4)Replies: 2Last Post: 07-11-2016, 07:14 AM -
CSMIO-M Tool Probe Connection - +24v to earth
By Noplace in forum CS-Lab (CSMIO)Replies: 1Last Post: 10-04-2016, 09:17 PM -
Weird problem - stepped/staged deceleration on Huanyang 2.2kw Spindle
By glynster in forum Spindles & Drive MotorsReplies: 0Last Post: 25-01-2016, 01:39 PM
Bookmarks