Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 01:24:46 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Probe macro
Pages: 1   Go Down
Print
Author Topic: Probe macro  (Read 1672 times)
0 Members and 2 Guests are viewing this topic.
rhtuttle
Active Member

Offline Offline

Posts: 22


View Profile
« on: May 08, 2008, 12:58:22 PM »

This is my first attempt at writing a macro for Mach3.

All suggestions welcomed.

My approach is to take my home made probe that has 3 contact points, one on each side on one for the top.
The probe straddles the workpiece which is narrow.
I will be using the A-axis limit input to determine when the probe has made contact



sub Main
  dim yStart,yMin,ymax,yMid,z as double;

  rem get the yAxis value
  rem increment until probe connects

  yStart=getOEMdro(86)
  yMax=yStart
  while not getOemLed(837) do
    yMax=yMax+0.0001
    Code "g0 y"&yMax
  wend;

rem reset and go the initial yAxis value
rem decrement until probe connects

  yMin=yStart
  code "g0 y"&yStart
  while not getOemLed(838) do
    yMin=yMin-0.0001
    Code "g0 y"&yMin
  wend;

rem calculate midpoint and move to it
rem set yDro to 0

  yMid=yMax-yMin
  code "g0 y"&yMid
  setOEMDro(801,0)

rem get the zaxis value and plunge until probe connects

  z=getOemDro(802)  ' zDRO value
  while not getOemLed(839) do
    z=z-0.0001
    Code "g0 y"&z
  wend;

rem Set the z dro to the standard's height

  setOEMdro(802,1)
end sub

Logged
Ron Ginger
V4 Screen Contributor

Offline Offline

Posts: 568



View Profile WWW
« Reply #1 on: May 09, 2008, 07:34:35 PM »

why not use the built in probe function, G31. Thats what it for.

Here is a probe in Z macro:

CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
PlateThickness = 0.062 'plate thickness
ProbeFeed = 1.0 'probing feedrate


Code "G90 F" &ProbeFeed

If GetOemLed (825)=0 Then
'Code "G4 P5" Time to get to the z-plate
Code "G31Z-1 F" &ProbeFeed
While IsMoving()
Wend
Code "G4 P0.25"
ZProbePos = GetVar(2002)
Code "G0 Z" &ZProbePos
While IsMoving ()
Wend
Call SetDro (2, PlateThickness)
Code "G4 P0.5" 'Pause for Dro to update.
Code "G0 Z 0.1" 'Change the Z retract height here
Code "(Z axis is now zeroed)"
Code "F" &CurrentFeed
Else
Code "(Plate is grounded, check connection and try again)"
Exit Sub
End If 
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!