Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: PCH on February 24, 2021, 02:41:50 PM
-
I know my vb script is good. I have changed out a gecko servo drive and now my z axis is not traveling down to touch plate even though I have 4" of travel. I goes down various depths but will not go down to touch plate. It does retract to the designated height though. Not sure what to do. Any help is appreciated.
-
So, show us your script. Maybe it is not quite good.
-
Here is my VB script:
It was working fine before I changed out my drive and now it will not go down to touch plate. Stops a various depths
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 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-4. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, .250) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
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
-
My z axis is just retracting to set height. It will not go down to touchplate. My VB file is set to travel 4" before it gives up. When I go to diagnostics and clip on line to router before initiate the zero button the digitizer flashes on intermitently. .I do not think this should be happening. Any suggestions would be great. I am out of options. Please help
-
Is this a new set up and macro or an old one that is now failing.
-
The way the script is written it uses G90 G31 so if you have offsets or have changed the z datum point the 4" move is relative to that. Also if a tool offset is active with a height offset not equal to zero that can also change the distance.
In most cases probing is done in G91 moves.
-
Well it a new gecko 30x servo drive. A newer version of the one I replaced. And it is the VB script I have used all along which worked great until now.
Here is the script:
Code "G90 G31Z-4. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, .250) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
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
-
So if I change the G90 to G91 in script that would do it?
Code "G90 G31Z-4. F4" 'probing move, can set the feed rate here as well as how far to move
-
where would the z datum be that I would have inadvertently changed.
-
also...thanks for getting back to me.
-
but your new drive will drive 4" if youd do G91 Z-4 f10 for example in MDI Input
-
Will give this a try this morning
-
Yes the string worked and the z axis went down 4".....how do I edit the VB script to initiate this downward movement..thank you
-
Change:
Code "G90 G31 Z-4. F4" 'probing move, can set the feed rate here as well as how far to move
to:
Code "G91 G31 Z-4. F4" 'probing move, can set the feed rate here as well as how far to move
-
NOPE...STILL MOVES UPWARD WHEN I INITIATE THE AUTO ZERO TOOL...what can I try next
btw in diagnostics my digitizer led is flashing intermittently ....not sure why
-
pls put this code at the beginning of your macro:
'probe already active ?
If GetOEMLed(825) Then
DoOEMButton(1003)
MsgBox "probe input activ",vbOK + vbCritical ,"error !"
End If
if a box with "probe input activ" is comming up you have to check your probe Input/wiring
-
getting script error message....how critical is the text with respect to spacing....can you put it in the script I posted so I know exactly where it goes. thanks
-
pls post your complete code.
-
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 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-4. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, .250) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
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
-
this code is running here:
Sub Main()
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
Sleep(3000) ' this delay gives me time to get from computer to hold probe in place
Code "G31 Z-4. F4" ' probing move, can set the feed rate here as well as how far to move
While IsMoving() ' wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, .250) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 ' Pause for Dro to update.
Code "G1 Z1. F50" ' put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Message "Z-Plate is grounded, check connection and try again" 'this goes in the status bar if applicable
End If
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
End Sub
and z-axis is going down.
-
nope....its like its ignoring every line of code until it gets to this one: Code "G1 Z1. F50" ' put the Z retract height you want here, must be greater than the touch plate thickness
-
- open Main Menue -> Operator -> VB Script Editor
- copy/paste into the Editor
- use >|| button to excecute code line by line
- see what code is doing
as sayed code was working here
-
Is this what I put in the macro and where?
>|| button to excecute code line by line
-
1. open Main Menue -> Operator -> VB Script Editor
2. copy/paste the complete code into the Editor
3. use >|| button to excecute code line by line
4. see what code is doing
-
Ok...I have discovered the my macro will run if I do connect my wires to the breakout board. But as soon as I connect them the after starting the auto zero script the z axis stops and then retracts to said height of 1 inch that is in the macro.
So befuttled. Been at this for 2 days. Must be a wiring issue I think. Just about ready to get a new breakout board...maybe its a grounding issue. Very frustrating..Need Help!!!
-
there are a few possibilities for the failue:
-wiring
-electric noise on your wiring
-defective BOB
-
Yep....ordered new breakout board and power supply. Will do some rewiring. Hope this works. Thank you