Hello Guest it is March 28, 2024, 09:49:10 PM

Author Topic: Stopping macro VB script  (Read 8608 times)

0 Members and 1 Guest are viewing this topic.

Stopping macro VB script
« on: July 16, 2012, 06:46:55 AM »
Hi

I am trying to carry out a protected move macro so if i move the machine and the probe hit something it will stop.

I have got the macro to work by comparing the target position and the g31 triggered position but cannot get the macro to stop exicuting

i have tried

code "m0" and Dooembutton(3)

if i do the second i cannot gcode program to load when loading.

I am trying to get the cycle to work in this manor

#100=0 (x position)
#101=0 (y position)
#102=0 (z position)
M1000 (is the protected move macro)

thanks

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Stopping macro VB script
« Reply #1 on: July 16, 2012, 11:48:58 AM »
There is no protected move mode in MACH3. AND in its current state I don't think you can create it in CB macros.

First you would need to be able to SEE when you were in G0 mode and then create a macropump or brain to stop when in G0 mode AND the Probe LED goes active.


Just a thought, (;-) TP
Re: Stopping macro VB script
« Reply #2 on: July 16, 2012, 02:15:48 PM »
I am created the protected move by using a g31 X Y Z
then comparing the current position with the target position.

if the difference between the target is greater than 0.1mm for example you know that the probe has been triggered

so then i want to stop the macro

i have tried

message "path obstrujected"
code "M0"

but this seams not to work and the M0 is ignored.

I have tried

STOP

but then nothing happened

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Stopping macro VB script
« Reply #3 on: July 16, 2012, 02:35:16 PM »
But you are not creating a protected move as in the real world you do NOT know what the actual value of the move should be you just probe in a direction with overrun to make sure you get to the intended target.

A protected move would be during a  G00 move and the probe HIT something THEN you want the motion to stop.

What you are doing is a Compare to know values +/- .

Post your macro code.

(;-) TP
Re: Stopping macro VB script
« Reply #4 on: July 16, 2012, 02:46:16 PM »
i have not got the code here but this is how it works

set #100#101 #102 to the xyz position you want to go to.

then call the macro EG M1000

in M1000

get #100 #101 #102

code "g31x" #100 "y" #101 "z" #102 "f1000"

then i compare the finished position with the DRO position

if the error on any axis is >100um then you can assume the probe has hit some thing.

so if the target = the dro then continue
else

STOP THE process.
Re: Stopping macro VB script
« Reply #5 on: July 16, 2012, 02:52:02 PM »
All i want to do is stop the macro process and gcode program with it stopping the pre processing

I have already have the protected moves working.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Stopping macro VB script
« Reply #6 on: July 16, 2012, 03:09:28 PM »
Something along these lines will work. The #2000 Var is set for testing ONLY. Please Note that the probe STOPPED axis dro position will never be the same as the trip position(#2000) so it is best to use the trip position to compare. Also note that IF you did not calibrate the probe then the trip position is NOT the same as the actual touch point. it will be OFF by the switch travel to trip value.


'Macro to Probe, Compare values to stop
SetVar(2000,.4)
SetVar(100,1)
SetVar(200,1)
Code"G31 X#100 Y#200 F20"
While Ismoving()
Wend
If GetVar(2000) >= GetVar(100)  Then
Message" Target Missed Mach3 will stop "
DoButton(3)
End
End If

If GetVar(2000) < (GetVar(100)-.5) Then
Message " Premature Target Strike Mach3 will Stop"
DoButton(3)
End If
End


(;-) TP
« Last Edit: July 16, 2012, 03:19:12 PM by BR549 »
Re: Stopping macro VB script
« Reply #7 on: July 16, 2012, 03:18:08 PM »
Great so not

STOP

But

END

Thanks