Aiuto per script (trova centro di un pieno)
Moderatore: Junior Admin
-
orbscan
- TRA NON MOLTO PASSO AL TORNIO
- Messaggi: 256
- Iscritto il: gio feb 02, 2012 00:04
- Località: ROMA
Aiuto per script (trova centro di un pieno)
Serve per trovare il centro di un tondo pieno.
Quando lo lancio mi dà errore...
Probabilmente la soluzione sta nelle prime quattro righe qui sotto (lo script è sicuramente funzionante).
Non capisco cosa vuol dire che devo linkare un bottone...
Poi ancora non capisco cosa devo "engaggiare"...
Grazie a chiunque avrà la cortesia di rispondermi.
Carlo
This is the "Shaft" extract
To run it you have to link to a user button or include in yours other functions.
Take care, when you run the shaft procedure, a check is made to be sure that the gauge is not already engaged, than to continue the operation you must engage it (ground it like a push button).
'find shaft center and calculate diameter
Sub Shaft
Option Explicit
Dim TS As Single
Dim FeedCurrent, Xcurrent, Ycurrent , Zcurrent As Single
Dim XCenter, YCenter, XPos1, XPos2, YPos1, YPos2, XNew, YNew, ZNew, ZPos1,ZSafe As Single
Dim responce As Integer
Dim Max_move , Shaft_D As Double
Const ZClear = 10 'Safe Z
Const XMove = 4 'Max probe search
Const YMove = 4 'Max probe search
Const FSlow = 50 'edje search speed
Const Tout = 15 'Time out in seconds
Const Probe_Radius = 3.15 '
If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
Code "(Probe grounded, check connection and try again)"
responce = MsgBox ("Probe grounded, check connection and try again" , 0 , "Probe **ERROR**" )
Exit Sub
End If
Rem VBScript To shaft center
Max_move = Question ("Enter max shaft diameter, min value 1 mm")
If Max_move < 1 Then
Code "(Diameter < 1, Function abort)"
Exit Sub
End If
If Touch ("(Touch the Probe to start Shaft center function)") Then Exit Sub
Code "F" & FSlow
Rem Probe up
YNew = YCurrent + Max_move
Code "G31 Y" &YNew
While IsMoving()
sleep 100
Wend
YPos1 = GetVar(2001)
YNew = YPos1 - 0.5
Code "G0 Y" &YNew
ZNew = ZCurrent + ZClear
Code "G0 Z" &ZNew
YNew = YPos1 + Max_move + (Probe_Radius * 2) + 2
Code "G0 Y" &YNew
Code "G0 Z" &ZCurrent
Rem Probe down
YNew = YNew - Max_move - Probe_Radius
Code "G31 Y" &YNew
While IsMoving()
sleep 100
Wend
YPos2 = GetVar(2001)
YNew = YPos2 + 0.5
Code "G0 Y" &YNew
ZNew = ZCurrent + ZClear
Code "G0 Z" &ZNew
YCenter = (YPos1 + YPos2) / 2
Code "G0 Y" &YCenter
Rem Probe Left
XNew = XCurrent - Max_move - (Probe_Radius * 2) 'probe to left
Code "G0 X" &XNew
Code "G0 Z" &ZCurrent
XNew = XNew + Max_move + Probe_Radius
Code "G31 X" &XNew
While IsMoving() 'wait for the move to finish
sleep 100
Wend
XPos1 = GetVar(2000) 'get the probe touch location
XNew = XPos1 - 0.5
Code "G0 X" &XNew
ZNew = ZCurrent + ZClear
Code "G0 Z" &ZNew
Rem Probe Right
XNew = XPos1 + Max_move + (Probe_Radius * 2) + 2 'probe to right
Code "G0 X" &XNew
Code "G0 Z" &ZCurrent
XNew = XNew - Max_move - Probe_Radius
Code "G31 X" &XNew
While IsMoving()
sleep 100
Wend
XPos2 = GetVar(2000)
XNew = XPos2 + 0.5
Code "G0 X" &XNew
ZNew = ZCurrent + ZClear
Code "G0 Z" &ZNew
XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
Code "G0 X" &XCenter 'rapid move to the x center location
While IsMoving ()
sleep 100
Wend
Shaft_D = (XPos2 - XPos1) - (2 * Probe_Radius)
Code "(Shaft diameter = " & Shaft_D & " mm)"
Code "F" &FeedCurrent 'restore starting feed rate
End Sub
'Wait for a probe touch - untouch
Function Touch (Tshow As String) As Integer
Code Tshow
'wait probe touch
TS = Timer
Do
If Timer - TS > Tout Then
Code "(Function Time Out, no probe touch detected)"
responce = MsgBox ("Function Time Out, no probe touch detected" , 0 , "Probe **ERROR**" )
Touch = 1
Exit Function
End If
sleep 100
Loop Until GetOemLed (825) <> 0
'short delay
sleep 1000 'let user to untouch probe
'Wait for probe untouch
TS = Timer
Do
If Timer - TS > 2 Then
Code "(Function Time Out, continuous probe touch detected)"
responce = MsgBox ("Function Time Out, continuous probe touch detected" , 0 , "Probe **ERROR**" )
Touch = 1
Exit Function
End If
sleep 100
Loop Until GetOemLed (825) = 0
Touch = 0
End Function
Quando lo lancio mi dà errore...
Probabilmente la soluzione sta nelle prime quattro righe qui sotto (lo script è sicuramente funzionante).
Non capisco cosa vuol dire che devo linkare un bottone...
Poi ancora non capisco cosa devo "engaggiare"...
Grazie a chiunque avrà la cortesia di rispondermi.
Carlo
This is the "Shaft" extract
To run it you have to link to a user button or include in yours other functions.
Take care, when you run the shaft procedure, a check is made to be sure that the gauge is not already engaged, than to continue the operation you must engage it (ground it like a push button).
'find shaft center and calculate diameter
Sub Shaft
Option Explicit
Dim TS As Single
Dim FeedCurrent, Xcurrent, Ycurrent , Zcurrent As Single
Dim XCenter, YCenter, XPos1, XPos2, YPos1, YPos2, XNew, YNew, ZNew, ZPos1,ZSafe As Single
Dim responce As Integer
Dim Max_move , Shaft_D As Double
Const ZClear = 10 'Safe Z
Const XMove = 4 'Max probe search
Const YMove = 4 'Max probe search
Const FSlow = 50 'edje search speed
Const Tout = 15 'Time out in seconds
Const Probe_Radius = 3.15 '
If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
Code "(Probe grounded, check connection and try again)"
responce = MsgBox ("Probe grounded, check connection and try again" , 0 , "Probe **ERROR**" )
Exit Sub
End If
Rem VBScript To shaft center
Max_move = Question ("Enter max shaft diameter, min value 1 mm")
If Max_move < 1 Then
Code "(Diameter < 1, Function abort)"
Exit Sub
End If
If Touch ("(Touch the Probe to start Shaft center function)") Then Exit Sub
Code "F" & FSlow
Rem Probe up
YNew = YCurrent + Max_move
Code "G31 Y" &YNew
While IsMoving()
sleep 100
Wend
YPos1 = GetVar(2001)
YNew = YPos1 - 0.5
Code "G0 Y" &YNew
ZNew = ZCurrent + ZClear
Code "G0 Z" &ZNew
YNew = YPos1 + Max_move + (Probe_Radius * 2) + 2
Code "G0 Y" &YNew
Code "G0 Z" &ZCurrent
Rem Probe down
YNew = YNew - Max_move - Probe_Radius
Code "G31 Y" &YNew
While IsMoving()
sleep 100
Wend
YPos2 = GetVar(2001)
YNew = YPos2 + 0.5
Code "G0 Y" &YNew
ZNew = ZCurrent + ZClear
Code "G0 Z" &ZNew
YCenter = (YPos1 + YPos2) / 2
Code "G0 Y" &YCenter
Rem Probe Left
XNew = XCurrent - Max_move - (Probe_Radius * 2) 'probe to left
Code "G0 X" &XNew
Code "G0 Z" &ZCurrent
XNew = XNew + Max_move + Probe_Radius
Code "G31 X" &XNew
While IsMoving() 'wait for the move to finish
sleep 100
Wend
XPos1 = GetVar(2000) 'get the probe touch location
XNew = XPos1 - 0.5
Code "G0 X" &XNew
ZNew = ZCurrent + ZClear
Code "G0 Z" &ZNew
Rem Probe Right
XNew = XPos1 + Max_move + (Probe_Radius * 2) + 2 'probe to right
Code "G0 X" &XNew
Code "G0 Z" &ZCurrent
XNew = XNew - Max_move - Probe_Radius
Code "G31 X" &XNew
While IsMoving()
sleep 100
Wend
XPos2 = GetVar(2000)
XNew = XPos2 + 0.5
Code "G0 X" &XNew
ZNew = ZCurrent + ZClear
Code "G0 Z" &ZNew
XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
Code "G0 X" &XCenter 'rapid move to the x center location
While IsMoving ()
sleep 100
Wend
Shaft_D = (XPos2 - XPos1) - (2 * Probe_Radius)
Code "(Shaft diameter = " & Shaft_D & " mm)"
Code "F" &FeedCurrent 'restore starting feed rate
End Sub
'Wait for a probe touch - untouch
Function Touch (Tshow As String) As Integer
Code Tshow
'wait probe touch
TS = Timer
Do
If Timer - TS > Tout Then
Code "(Function Time Out, no probe touch detected)"
responce = MsgBox ("Function Time Out, no probe touch detected" , 0 , "Probe **ERROR**" )
Touch = 1
Exit Function
End If
sleep 100
Loop Until GetOemLed (825) <> 0
'short delay
sleep 1000 'let user to untouch probe
'Wait for probe untouch
TS = Timer
Do
If Timer - TS > 2 Then
Code "(Function Time Out, continuous probe touch detected)"
responce = MsgBox ("Function Time Out, continuous probe touch detected" , 0 , "Probe **ERROR**" )
Touch = 1
Exit Function
End If
sleep 100
Loop Until GetOemLed (825) = 0
Touch = 0
End Function
- onorino
- CAPO OFFICINA
- Messaggi: 41550
- Iscritto il: mar mar 23, 2010 22:18
- Località: Artena(Roma)
- Contatta:
Re: Aiuto per script (trova centro di un pieno)
passo , ma credo che ti chieda di portare il tastatore in posizione e poi lanciare il programma .
la democrazia funziona fino a quando fate quello che dico io!
Mc Mazzafrusten meccanico mannaro
il riparatore di riparazioni
er robin hood de no'antri
tagliatore scelto di puntarelle
http://www.lievitoedintorni.it/phpbb/index.php
Mc Mazzafrusten meccanico mannaro
il riparatore di riparazioni
er robin hood de no'antri
tagliatore scelto di puntarelle
http://www.lievitoedintorni.it/phpbb/index.php
Re: Aiuto per script (trova centro di un pieno)
Meno male che ha risposto Rino altrimenti cancellavo il messaggio pensando fosse SPAM 
McMax
“None of us can change the things we’ve done. But we can all change what we do next.” – Fred Johnson
fulminato in tenera età
“None of us can change the things we’ve done. But we can all change what we do next.” – Fred Johnson
fulminato in tenera età
- onorino
- CAPO OFFICINA
- Messaggi: 41550
- Iscritto il: mar mar 23, 2010 22:18
- Località: Artena(Roma)
- Contatta:
Re: Aiuto per script (trova centro di un pieno)
la democrazia funziona fino a quando fate quello che dico io!
Mc Mazzafrusten meccanico mannaro
il riparatore di riparazioni
er robin hood de no'antri
tagliatore scelto di puntarelle
http://www.lievitoedintorni.it/phpbb/index.php
Mc Mazzafrusten meccanico mannaro
il riparatore di riparazioni
er robin hood de no'antri
tagliatore scelto di puntarelle
http://www.lievitoedintorni.it/phpbb/index.php
-
orbscan
- TRA NON MOLTO PASSO AL TORNIO
- Messaggi: 256
- Iscritto il: gio feb 02, 2012 00:04
- Località: ROMA
Re: Aiuto per script (trova centro di un pieno)
Io questi scherzi non li capisco...
Come è possibile pensare che sia spam?
Come è possibile pensare che sia spam?
Re: Aiuto per script (trova centro di un pieno)
Forse ti è sfuggito che Max scherzava...
- ing.orso
- TORNITORE E FRESATORE
- Messaggi: 1193
- Iscritto il: mar set 16, 2008 17:13
- Località: Provincia di Parma
Re: Aiuto per script (trova centro di un pieno)
secondo me voleva solo dire che il testo gli era incomprensibile.
finalmente ho filmato il nostro ing.orso[url=http://avatars.jurko.net][img]http://img1.jurko.net/dancing_bear.gif[/img][/url]
avc
avc
Re: Aiuto per script (trova centro di un pieno)
Esatto 
McMax
“None of us can change the things we’ve done. But we can all change what we do next.” – Fred Johnson
fulminato in tenera età
“None of us can change the things we’ve done. But we can all change what we do next.” – Fred Johnson
fulminato in tenera età
-
orbscan
- TRA NON MOLTO PASSO AL TORNIO
- Messaggi: 256
- Iscritto il: gio feb 02, 2012 00:04
- Località: ROMA
Re: Aiuto per script (trova centro di un pieno)
A chi posso chiedere aiuto?
Probabilmente lo script è giusto.
Io quando lo lancio ottengo il messaggio errore di compilazione...
Non so a chi posso rivolgermi...
Qualche consiglio?
Grazie
Carlo
Probabilmente lo script è giusto.
Io quando lo lancio ottengo il messaggio errore di compilazione...
Non so a chi posso rivolgermi...
Qualche consiglio?
Grazie
Carlo
- onorino
- CAPO OFFICINA
- Messaggi: 41550
- Iscritto il: mar mar 23, 2010 22:18
- Località: Artena(Roma)
- Contatta:
Re: Aiuto per script (trova centro di un pieno)
spiega come hai fatto?
la democrazia funziona fino a quando fate quello che dico io!
Mc Mazzafrusten meccanico mannaro
il riparatore di riparazioni
er robin hood de no'antri
tagliatore scelto di puntarelle
http://www.lievitoedintorni.it/phpbb/index.php
Mc Mazzafrusten meccanico mannaro
il riparatore di riparazioni
er robin hood de no'antri
tagliatore scelto di puntarelle
http://www.lievitoedintorni.it/phpbb/index.php
-
orbscan
- TRA NON MOLTO PASSO AL TORNIO
- Messaggi: 256
- Iscritto il: gio feb 02, 2012 00:04
- Località: ROMA
Re: Aiuto per script (trova centro di un pieno)
E' stato un massacro.
Non sapevo a chi chiedere e nessuno mi rispondeva sul forum...
Poi casualmente girando su un forum americano ho trovato uno che mi ha aiutato!
Qui sotto è spiegato tutto
http://finance.groups.yahoo.com/group/t ... ssage/4327
Quanto è brutto avere un problema e non trovare aiuto...
Per fortuna questo è solo un hobby...
Non sapevo a chi chiedere e nessuno mi rispondeva sul forum...
Poi casualmente girando su un forum americano ho trovato uno che mi ha aiutato!
Qui sotto è spiegato tutto
http://finance.groups.yahoo.com/group/t ... ssage/4327
Quanto è brutto avere un problema e non trovare aiuto...
Per fortuna questo è solo un hobby...