21
General Mach Discussion / Re: VB Script
« on: October 07, 2018, 08:15:27 AM »
Just tested the above script and I am getting "Scripter Compile Error" it could well be something that I have done wrong, but am unsure ?
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.
here a simple sxript for XCode: [Select]'simple X-center script
Sub Main()
SetOEMDro(800,0)
'do the X- probe
Message ("probe X- ")
Code "G31 X-100 F150"
While IsMoving()
x = GetOEMDRO(800) 'X actpos
If x <= -100 Then
DoOEMButton(1003) 'Stop too far no probe hit
MsgBox ("Probe X- canceled , no probe hit!" )
Exit Sub
End If
Wend
'get the exact probepos
ProbeX- = GetVar(2000)
'do the X+ probe
Message ("probe X+ ")
Code "G31 X200 F150"
While IsMoving()
x = GetOEMDRO(800) 'X actpos
If x >= 200 Then
DoOEMButton(1003) 'Stop too far no probe hit
MsgBox ("Probe X+ canceled , no probe hit!" )
Exit Sub
End If
Wend
'get the exact probepos
ProbeX+ = GetVar(2000)
'goto the center
middle = ProbeX- + ((ProbeX+ - ProbeX-)/2)
Code "G90 G01 Y" + CStr(middle)
SetOEMDro(800,0)
End Sub
be careful, not tested, just written down.
z-axis has to be in probe hight.
Take a screen of the part with the pocket operation open on the heights tab. You probably have the contour at the top of the pocket or the heights set incorrectly