Mach Discussion > VB and the development of wizards

Auto tool zero motor stalls

(1/1)

MuseumOfSand:
Hi. Had to change computers due to broken hard drive - got the XML with the old settings though. But now I can not for the life of me get the auto tool zero to work. Tried 3 different scripts already. They all act a bit different but the Z-axis always freezes up after contact. Video: https://drive.google.com/file/d/1YswAtNembgnRSUEW5D_2YsZVZ17peHRv/view?usp=sharing .
With one more complicated script even the rotary axis moved a bit for some reason. Please help.

JohnHaine:
I can't make out what the video is doing at all.  Post your code?

MuseumOfSand:

--- Quote from: JohnHaine on September 16, 2023, 03:21:10 PM ---I can't make out what the video is doing at all.  Post your code?

--- End quote ---

All 4 of them? The last one I tried was by CNCnutz:


REM Updated 11 Feb 2018
REM Request Material Thickness offset
Offset  = InputBox("Enter Material Thickness offset          Hint: To probe from the Spoilboard surface, enter the nominal thickness of the material. Enter '0' or leave blank if probing from the material surface", "Material Offset", "") 

Rem Auto Tool Zero Z- Metric Single pass Version

PlateThickness = 30 'Enter Z-plate thickness here
DownStroke = -33 'Set the down stroke to find probe
DownFeedRate = 20 'Set the down FeedRate
RetractStroke = 10 'Set the retract Stroke
RetractFeedRate = 155 'Set the retract FeedRate


CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state


If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31 Z" &DownStroke &" F" &DownFeedRate 'probing move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, PlateThickness - offset) 'set the Z axis DRO to whatever is set as plate thickness less the offset value
Code "G4 P0.25" 'Pause for Dro to update.
Code "G1 Z" &PlateThickness + RetractStroke &" F" &RetractFeedRate 'retract
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar   
Else
Code "G0 Z0" 'retract to start pos
While IsMoving ()
Wend
Code "(Z-Plate not found, check connection or stroke and try again)" 'puts this message in the status bar
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
Code "F" &CurrentFeed 'Returns to prior feed rate
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Exit Sub   

TPS:
try this code:

--- Code: ---REM Updated 11 Feb 2018
REM Request Material Thickness offset
Offset  = InputBox("Enter Material Thickness offset          Hint: To probe from the Spoilboard surface, enter the nominal thickness of the material. Enter '0' or leave blank if probing from the material surface", "Material Offset", "")

Rem Auto Tool Zero Z- Metric Single pass Version

PlateThickness = 30 'Enter Z-plate thickness here
DownStroke = -33 'Set the down stroke to find probe
DownFeedRate = 20 'Set the down FeedRate
RetractStroke = 10 'Set the retract Stroke
RetractFeedRate = 155 'Set the retract FeedRate


CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state


If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31 Z" &DownStroke &" F" &DownFeedRate 'probing move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
Code "G1 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, PlateThickness - offset) 'set the Z axis DRO to whatever is set as plate thickness less the offset value
Code "G4 P0.25" 'Pause for Dro to update.
Code "G1 Z" &PlateThickness + RetractStroke &" F" &RetractFeedRate 'retract
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar   
Else
Code "G1 Z0" 'retract to start pos
While IsMoving ()
Wend
Code "(Z-Plate not found, check connection or stroke and try again)" 'puts this message in the status bar
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If

Code "F" &CurrentFeed 'Returns to prior feed rate
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Exit Sub   

--- End code ---

it is a bit modifiyed what you have posted.

Navigation

[0] Message Index

Go to full version