Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: ch_porchet on January 10, 2012, 05:23:36 PM

Title: execute a function with "input 1"
Post by: ch_porchet on January 10, 2012, 05:23:36 PM
Hello
 can you tell me, how to make the "input1" I stop moving the Z axis, are a contact.
 mach3 and keeps track of the value of Z.
 It is to a height sensor for my CNC tool does not support "G31" :'(

 thank you














Title: Re: execute a function with "input 1"
Post by: ch_porchet on January 12, 2012, 07:38:06 AM
hello
 we can say that people familiar with the programming of macro mach3, at least not this command
Title: Re: execute a function with "input 1"
Post by: stirling on January 12, 2012, 10:35:59 AM
LOL - there's nothing like a little poke yes?

It's probably because your post isn't too clear about your problem. I think maybe you need to explain why your "CNC tool does not support G31"
Title: Re: execute a function with "input 1"
Post by: ch_porchet on January 12, 2012, 11:11:10 AM
Hello
 my cnc does not take the G31 because it is connected to the PC via a USB port for now is that the driver of pluging it does not support the G31.
 That's why I want a solution with  "input1" to mach3
Title: Re: execute a function with "input 1"
Post by: stirling on January 12, 2012, 12:14:10 PM
You probably want to get onto your hardware supplier and ask them why they haven't implemented G31.

Unfortunately I don't think you can do what you want very elegantly. It's pretty easy to write a macro that will record your Z value when an input goes active but your problem is going to be in stopping Z during a programed move. The only way I can think of you doing this is to decrement Z by a small amount in a loop and break out of the loop when the input activates. It's not a good solution and that's why I think you should complain to your hardware vendor about their lack of G31 support.
Title: Re: execute a function with "input 1"
Post by: ch_porchet on January 12, 2012, 03:34:15 PM

OK,
but it is possible to trigger a pause (or stop) with Gcode by a input1 in a macro.

 what do you mean by a loop














Title: Re: execute a function with "input 1"
Post by: Tony Bullard on January 12, 2012, 04:06:01 PM

OK,
but it is possible to trigger a pause (or stop) with Gcode by a input1 in a macro.

 what do you mean by a loop

These can be put in a macropump

If IsActive(Input1)Then
    
DoOemButton(1003)      'Stop
DoOemButton(1001)      'Pause or feed hold
'DoOemButton(218)      ‘Z-inhibit ON
'DoOemButton(219)      ‘Z-inhibit OFF
DoOembutton(252)           'Disable movement on axis Z, this is a toggel
End if

Tony
















Title: Re: execute a function with "input 1"
Post by: Tony Bullard on January 12, 2012, 04:35:14 PM
You could also put some code like this in either a macropump or macro in the the Gcode.
   'Do probe down to establish torch height
code"g31 z-2 "      'G31 = streight probe
While ismoving()
Sleep 100
Wend
z= getvar(2002) 'this gets value when
      'switch hit.
You'd have to wight you're own code for what you are trying to do and put you're probe switch on Probe input instead of Input 1.
Title: Re: execute a function with "input 1"
Post by: ch_porchet on January 12, 2012, 05:05:23 PM
Hello Tony
the problem is that G31 does not work with my driver UBS
so if I write

If IsActive (input1) Then
     DoOembutton(252)
     Code "G4 P1" or Sleep (60)
     ZProbePos = GetVar(2002)
Else
     Code "F40 G53 Z-70"
Wend
Title: Re: execute a function with "input 1"
Post by: ger21 on January 12, 2012, 05:23:04 PM
G4 P1 is the same as Sleep(1000)

and I believe GetVar(2002) will only work if you use G31.

From the manual in the G31 section:

Quote
After successful probing, parameters 2000 to 2005 will be set to the coordinates of the
location of the controlled point at the time the probe tripped
Title: Re: execute a function with "input 1"
Post by: ch_porchet on January 12, 2012, 05:36:51 PM
ok
 so I can put what, remember the Z value at that time
Title: Re: execute a function with "input 1"
Post by: Tony Bullard on January 13, 2012, 07:35:32 AM
CH, I guess I have no idea of what you are trying to do. Can you tell us in detail what you want the machine to do it you could use G31? This is probably as clear as mud also.

Tony
Title: Re: execute a function with "input 1"
Post by: stirling on January 13, 2012, 08:21:18 AM
Tony, I think the issue here is that the OP's usb motion card doesn't support G31 which is sadly not a unique situation. Why hardware is released that doesn't fully function is a mystery to me but that's another topic I guess.

Anyway, I think the name of the game here is to try to "reproduce" G31's functionality via some other means - macro - gcode whatever. However, it's not something I think is really achievable. A lot depends on the accuracy of the "trip point" that the OP requires. You can get a "close-ish" approximation quite easilly with either a macro or gcode but it's not elegant and I very much doubt it's possible to get the "step perfect" trip point like a "proper" G31 does.

We've had many similar posts to this - I remember one quite recently involving Ajax cards inability to do G31 where the poster was trying to do exactly the same thing. He was advised to approach the hardware vendor and get it fixed - just like I've advised here.

Ian
Title: Re: execute a function with "input 1"
Post by: Tony Bullard on January 13, 2012, 09:39:35 AM
Thanks Ian, I guess I can't help.

Tony
Title: Re: execute a function with "input 1"
Post by: ch_porchet on January 13, 2012, 10:20:51 AM
hello
 I know it's not practical, but I is not the choice
 do you think it is possible to do that (input1) silk a maximum limit of Z
Title: Re: execute a function with "input 1"
Post by: ch_porchet on January 14, 2012, 03:46:10 AM
So the question is
  Is it possible to stop the Z-axis moving with "input1"
because "input1" maximum limit as Z is not terrible
Title: Re: execute a function with "input 1"
Post by: stirling on January 14, 2012, 05:32:48 AM
does your system support G28.1?
Title: Re: execute a function with "input 1"
Post by: ch_porchet on January 14, 2012, 07:18:52 AM
I think so, because the G31 is a matter of usb driver, while it's Gcode
Title: Re: execute a function with "input 1"
Post by: stirling on January 14, 2012, 07:53:36 AM
Well both G31 and G28.1 are usually IMPLEMENTED in the driver or external card but anyway read up on G28.1 - I think it will do what you want.
Title: Re: execute a function with "input 1"
Post by: ch_porchet on January 26, 2012, 02:08:48 AM
hello
 I arrived with this macro
Sorry I put the legend in french

'Lancement de la commande de probe rapide vers le bas
SetOEMDRO(1000, 2) ' Numéro de l'axe ou faire le probe (0=X, 1=Y, 2=Z)
SetOEMDRO(1001, -90) ' Course maxi (le signe indique le sens de déplacement)
SetOEMDRO(1002, 20) ' Feed rate
SetOEMDRO(1003, 9) ' Numéro de l'entré de plapage (1 à 16
SetOEMDRO(1004, 1) ' état de l'entrée attendu (0 ou 1)
NotifyPlugins(3000)
' Attente fin de probe descente
While (GetOEMDRO(1000) = 0)
Sleep(10)
Wend
'Si succès, lancement de probe lent ver le haut
If (GetOEMDRO(1000) = 1) Then
SetOEMDRO(1000, 2) ' Numéro de l'axe ou faire le probe (0=X, 1=Y, 2=Z)
SetOEMDRO(1001,+10) ' Remontée en Z
SetOEMDRO(1002, 1) ' Feed rate
SetOEMDRO(1003, 9) ' Numéro de l'entré de plapage (1 à 16
SetOEMDRO(1004, 0) ' Attente re-laché de l'entrée 9
NotifyPlugins(3000)
' Attente fin de probe
While (GetOEMDRO(1000) = 0)
Sleep(10)
Wend
If (GetOEMDRO(1000) = 1) Then
ZProbe = GetOEMDRO(1001) ' Lecture de la position de palpage
Z = GetOEMDRO(85) ' Lecture positionactuelle
HPalpeur = 30 ' Déclaration hauteur palpeur
Zero = Z - ZProbe + HPalpe ' Distance erreur liée à deceleration
SetDRO(2, Zero) ' Initialisation zero pièce
Sleep(100)
NewZPos = Zero + 10 ' dégagement 10mm au dessus du
capteur
Code "G0 Z"&NewZPos
While IsMoving()
Wend
Else
'Message ("Fin de probe avec erreur palpage lent")
End If
Else
'Message ("Fin de probe avec erreur palpage rapide")
End If