activer ou desactiver macropump.m1s
2 participants
Page 1 sur 1
activer ou desactiver macropump.m1s
bonjour
je voudrais activer ou desactiver macropump.m1s avec un bouton
j'ai mis le code ci-dessus dans un bouton, celui-ci marche mais la macropump est toujours active
peut on remplacer
par le code OEM 13. ??
++
gilles
- Code:
ActivateSignal(OUTPUT1)
If IsActive(OUTPUT1) Then
MsgBox “OUTPUT #1 active”
Else
MsgBox “OUTPUT #1 inactive”
End If
je voudrais activer ou desactiver macropump.m1s avec un bouton
j'ai mis le code ci-dessus dans un bouton, celui-ci marche mais la macropump est toujours active
peut on remplacer
- Code:
MsgBox “OUTPUT #1 active”
par le code OEM 13. ??
++
gilles
gilles974- acharné du forum
- Messages : 446
Points : 669
Date d'inscription : 31/10/2011
Age : 65
Localisation : La Réunion
Re: activer ou desactiver macropump.m1s
Salut,
Je n'ai rien trouvé qui permette de gérer la MacroPump via les scripts, par contre il existe des fonctions permettant de gérer un script périodique, le mettre en marche, l’arrêter, tester si il est actif. Apparemment c'est indépendant de la MacroPump.
StartPeriodicScript
Function StartPeriodicScript(ByVal ScriptQFN as String, ByVal UpdatePeriod as Double) as Integer
This function causes Mach to start a script that will be invoked with the specified periodicity.
Arguments:
ScriptQFN: the string of the Qualified File Name (QFN) for the script to be run.
The qualified path name is relative to the Mach install directory. The QFN does not include the script extension. Mach will look first for ScriptQFN.mcc and if
not found, then ScriptQFN.m1s.
If the QFN is the name of a script already started by a previous call to StartPeriodicScript(), an error condition is returned. Mach does not support multiple periodic instances of a single script.
UpdatePeriod: The length of the time period between runs of the script.
The time units are seconds. The minimum value is 5ms, any value less than 5ms will be ignored and the minimum value of 5ms will be used for the UpdatePeriod.
It is recommended that periodic scripts be run with the longest UpdatePeriod appropriate for the script’s task. This will help minimize the load on the machine
from multiple periodic scripts.
Return Value:
0 = requested function was performed successfully (script is now running).
< 0 = error, requested function was not successful (script is not running).
Error Return Values:
Example:
----------------
StopPeriodicScript
Function StopPeriodicScript(ByVal ScriptQFN as String) as Integer
This function is used to stop a previously started periodic script.
A periodic script only stops at the end of one of the script’s UpdatePeriod time quanta (as set by StartPeriodicScript) cycles. For example if a script is running with a 5 minute UpdatePeriod, and the stop request is issued 2 minutes into the cycle, the script will not stop until the current 5 minute cycle expires.
Arguments:
ScriptQFN: the string of the Qualified File Name (QFN) for the script to be stopped. The QFN is relative to the Mach install directory.
The QFN passed must be identical to the QFN used to start the periodic script.
Attempts to stop a script that has not been started by StartPeriodicScript are ignored (this is not an error condition as the script is “stopped” upon return from
the call).
Return Value:
0 = requested function was performed successfully (script is now running).
< 0 = error, requested function was not successful (script is not running).
Error Values:
Example:
---------
IsPeriodicScriptRunning
Function IsPeriodicScriptRunning(ByVal ScriptQFN as String) as Boolean
This function is used to determine if a periodic script has been started.
Arguments:
ScriptQFN: the string of the Qualified File Name (QFN) for the script to check.
The QFN is relative to the Mach install directory.
The QFN passed must be identical to the QFN used to start the periodic script.
Return Value:
True = the Script is running.
False = the script is not running.
Example:
https://www.machsupport.com/forum/index.php?topic=21918.0
++
David
Je n'ai rien trouvé qui permette de gérer la MacroPump via les scripts, par contre il existe des fonctions permettant de gérer un script périodique, le mettre en marche, l’arrêter, tester si il est actif. Apparemment c'est indépendant de la MacroPump.
StartPeriodicScript
Function StartPeriodicScript(ByVal ScriptQFN as String, ByVal UpdatePeriod as Double) as Integer
This function causes Mach to start a script that will be invoked with the specified periodicity.
Arguments:
ScriptQFN: the string of the Qualified File Name (QFN) for the script to be run.
The qualified path name is relative to the Mach install directory. The QFN does not include the script extension. Mach will look first for ScriptQFN.mcc and if
not found, then ScriptQFN.m1s.
If the QFN is the name of a script already started by a previous call to StartPeriodicScript(), an error condition is returned. Mach does not support multiple periodic instances of a single script.
UpdatePeriod: The length of the time period between runs of the script.
The time units are seconds. The minimum value is 5ms, any value less than 5ms will be ignored and the minimum value of 5ms will be used for the UpdatePeriod.
It is recommended that periodic scripts be run with the longest UpdatePeriod appropriate for the script’s task. This will help minimize the load on the machine
from multiple periodic scripts.
Return Value:
0 = requested function was performed successfully (script is now running).
< 0 = error, requested function was not successful (script is not running).
Error Return Values:
Example:
- Code:
‘ Initialize a script that runs the way oiler every 30 minutes
If StartPeriodicScript(“OilerScript”, 30*60*1000) then
Msgbox “Oiler periodic script is running”
Else
Msgbox “Oiler script was not started”
End If
----------------
StopPeriodicScript
Function StopPeriodicScript(ByVal ScriptQFN as String) as Integer
This function is used to stop a previously started periodic script.
A periodic script only stops at the end of one of the script’s UpdatePeriod time quanta (as set by StartPeriodicScript) cycles. For example if a script is running with a 5 minute UpdatePeriod, and the stop request is issued 2 minutes into the cycle, the script will not stop until the current 5 minute cycle expires.
Arguments:
ScriptQFN: the string of the Qualified File Name (QFN) for the script to be stopped. The QFN is relative to the Mach install directory.
The QFN passed must be identical to the QFN used to start the periodic script.
Attempts to stop a script that has not been started by StartPeriodicScript are ignored (this is not an error condition as the script is “stopped” upon return from
the call).
Return Value:
0 = requested function was performed successfully (script is now running).
< 0 = error, requested function was not successful (script is not running).
Error Values:
Example:
- Code:
‘ Stop a the running way oiler script
If StopPeriodicScript(“OilerScript”) then
Msgbox “Oiler periodic script has been stopped”
Else
Msgbox “Error, Oiler script was not stopped, check the QFN passed.”
End If
---------
IsPeriodicScriptRunning
Function IsPeriodicScriptRunning(ByVal ScriptQFN as String) as Boolean
This function is used to determine if a periodic script has been started.
Arguments:
ScriptQFN: the string of the Qualified File Name (QFN) for the script to check.
The QFN is relative to the Mach install directory.
The QFN passed must be identical to the QFN used to start the periodic script.
Return Value:
True = the Script is running.
False = the script is not running.
Example:
- Code:
‘ check if the oiler has been started
If IsPeriodicScriptRunning(“OilerScript”) then
Msgbox “Oiler script is running.”
Else
Msgbox “Oiler script is not running.”
End If
https://www.machsupport.com/forum/index.php?topic=21918.0
++
David
_________________
Traduction Française de CamBam et de sa documentation.
Re: activer ou desactiver macropump.m1s
salut David
effectivement, j'ai vu cela dans la doc, je vais essayé de voir comment mettre en place cette solution
j'ai juste un relais à ouvrir et fermer
c'est plus pratique que d'utiliser macropump qui est toujours actif
je te tiens au courant des avancées
++
gilles
effectivement, j'ai vu cela dans la doc, je vais essayé de voir comment mettre en place cette solution
j'ai juste un relais à ouvrir et fermer
c'est plus pratique que d'utiliser macropump qui est toujours actif
je te tiens au courant des avancées
++
gilles
gilles974- acharné du forum
- Messages : 446
Points : 669
Date d'inscription : 31/10/2011
Age : 65
Localisation : La Réunion
Re: activer ou desactiver macropump.m1s
salut David
Aprés une journée passée à lire et tester j'ai finis par faire tourner PeriodicScript
j'ai créée une macro M300 qui ferme le relais et le script de periodicité
suivant de j'usine de l'alu ou du plexi, je colle à la fin du fichier GCode la ligne M300
j'ai fait la macro lub.m1s qui me permet d'allumer et d'eteindre le relais de la sortie #4
à intervalle déterminé
sur un bouton j'installe le script de lancement periodique fixe à 15 secondes (à regler) avec une led clignotante portant le code OEM = 77
c'est une ebauche qui demande à être modifier (je debute) , si tu vois des erreurs ou des tests manquants
n'hesite pas
apparemment le code M6 n'est pas apprécier par le script
++
gilles
Aprés une journée passée à lire et tester j'ai finis par faire tourner PeriodicScript
j'ai créée une macro M300 qui ferme le relais et le script de periodicité
- Code:
DoSpinStop()
StopPeriodicScript("macros\Mach3Mill\lub")
If StopPeriodicScript("macros\Mach3Mill\lub") then
Msgbox "Script de periodicité fermé"
Else
Msgbox "Erreur, Le script de periodicité ne c'est pas fermé correctement"
End If
Do While IsOutputActive(OUTPUT4) = true
DeActivateSignal(OUTPUT4)
Sleep(100)
Msgbox "Relais #4 de lubrification fermé"
Loop
suivant de j'usine de l'alu ou du plexi, je colle à la fin du fichier GCode la ligne M300
j'ai fait la macro lub.m1s qui me permet d'allumer et d'eteindre le relais de la sortie #4
à intervalle déterminé
- Code:
Const OEMButtonFloodToggleOnOff = 113
dim ouvert,ferme
ouvert = 10000
ferme = 5000
ActivateSignal (OUTPUT4)
Sleep(500)
If IsPeriodicScriptRunning("macros\Mach3Mill\lub") then
do
DoOEMButton(OEMButtonFloodToggleOnOff)
Sleep(ferme)
message "ouvert pendant : " & ouvert ' message debug
DoOEMButton(OEMButtonFloodToggleOnOff)
Sleep(ouvert)
message "ferme pendant : " & ferme ' message debug
loop until IsPeriodicScriptRunning("macros\Mach3Mill\lub") = true
End If
sur un bouton j'installe le script de lancement periodique fixe à 15 secondes (à regler) avec une led clignotante portant le code OEM = 77
- Code:
StartPeriodicScript("macros\Mach3Mill\lub", 15)
If StartPeriodicScript("macros\Mach3Mill\lub", 15) Then
message "Script de periodicité pour la lubrification activé"
Else
StopPeriodicScript("macros\Mach3Mill\lub")
message "Script de periodicité pour la lubrification désactivé"
End If
c'est une ebauche qui demande à être modifier (je debute) , si tu vois des erreurs ou des tests manquants
n'hesite pas
apparemment le code M6 n'est pas apprécier par le script
++
gilles
gilles974- acharné du forum
- Messages : 446
Points : 669
Date d'inscription : 31/10/2011
Age : 65
Localisation : La Réunion
Re: activer ou desactiver macropump.m1s
apparemment le code M6 n'est pas apprécier par le script
Oui, rien d'étonnant vu que le M6 attend un clic de l'utilisateur pour continuer.
++
David
_________________
Traduction Française de CamBam et de sa documentation.
Re: activer ou desactiver macropump.m1s
effectivement vu sous cette angle
gilles974- acharné du forum
- Messages : 446
Points : 669
Date d'inscription : 31/10/2011
Age : 65
Localisation : La Réunion
Page 1 sur 1
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum