Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: amnon on March 19, 2015, 04:05:41 PM
-
Hej,
I have been trying to set material X0 by means of some macro, but when my macro reach the line with code
Code "G91 G0 X" &X0 - 3
Abnormal Condition turns on, I don't know why.
Rem VBScript For probing In the x+ direction
If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
Code "(Probe plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Else
Code "G4 P1" 'Pause 1 second to give time to position probe plate
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
Code "F4"
Rem Probe Right
XNew = GetDro(0) + 3 'probe to current position + 3 mm
Code "G31 X" &XNew
While IsMoving() 'wait for prob move to complete
Wend
X0 = SetDRO(0,(-1)*(GetUserDRO(1300))+(-1)*(GetUserDRO(1301)/2)) ' UserDRO(1300) - probe diameter; UserDRO(1301) - plate thickness;
Rem move back adding plate thickness
Code "G91 G0 X" &X0 - 3
While IsMoving ()
Wend
Code "F" &CurrentFeed 'restore original feed rate
End If
I don't know either how to move my probe back.
Amnon
-
Hi Amnon,
what are you trying to do here
X0 = SetDRO(0,(-1)*(GetUserDRO(1300))+(-1)*(GetUserDRO(1301)/2)) ' UserDRO(1300) - probe diameter; UserDRO(1301) - plate thickness;
think this should work better
X0 = (-1)*(GetUserDRO(1300))+(-1)*(GetUserDRO(1301)/2) ' UserDRO(1300) - probe diameter; UserDRO(1301) - plate thickness;
SetDRO(0,X0) ' Set X Dro to calculated value
Thomas
-
Hi,
for a exact probing you should also add the following
XNew = GetDro(0) + 3 'probe to current position + 3 mm
Code "G31 X" &XNew
While IsMoving() 'wait for prob move to complete
Wend
Xprobepos = getvar(2002) 'get the position where we hit the probe
Code "g1 x" &Xprobepos 'go back to this position
While ismoving()
Wend
Thomas