Sub Main()
Begin Dialog GroupSample 31,32,120,96,"Selección Eje"
OKButton 38,75,40,14
GroupBox 12,8,96,62,"Sel. Eje a Calibrar",.GroupBox1
OptionGroup .OptionGroup1
OptionButton 20,24,40,8,"Eje X",.OptionButton1
OptionButton 20,40,40,8,"Eje Y",.OptionButton2
OptionButton 20,56,40,8,"Eje Z",.OptionButton3
OptionButton 67,24,40,8,"Eje A",.OptionButton4
OptionButton 67,40,40,8,"Eje B",.OptionButton5
OptionButton 67,56,40,8,"Eje C",.OptionButton6
End Dialog
Dim Dlg1 As GroupSample
Button = Dialog (Dlg1)
If Button = 0 Then
Exit Sub
End If
AxisNum = Dlg1.OptionGroup1
Select Case AxisNum
Case 0 'HSS
Axis = "StepsPerAxisX"
Axis_Letter = "X"
Case 1 'HSStin
Axis = "StepsPerAxisY"
Axis_Letter =" Y"
Case 2 'Carbide
Axis = "StepsPerAxisZ"
Axis_Letter = "Z"
Case 3 'Carbide
Axis = "StepsPerAxisA"
Axis_Letter = "A"
Case 4 'Carbide
Axis = "StepsPerAxisB"
Axis_Letter = "B"
Case 5 'Carbide
Axis = "StepsPerAxisC"
Axis_Letter = "C"
End Select
Com_Move = Question ("Cuánto desea mover el Eje " & Axis_Letter & " ?")
If COM_Move = 0 Then
MsgBox "No puedo Mover de Zero, Cálculo Eje abortado."
Exit Sub
End If
Code "G0 G91 " & Axis_Letter & Com_Move
While Ismoving()
Wend
Code "G4 P0.5"
Act_Move = Question("Cuánto movió el Eje " & Axis_Letter & " ? (Valor Medido)")
If Act_Move = 0 Then
MsgBox "No puedo Mover de Zero, Cálculo Eje abortado."
Exit Sub
End If
Old_PPR = GetParam(Axis)
New_PPR = Abs((Com_Move/Act_Move) * Old_PPR)
Response = MsgBox ( "Eje " & Axis_Letter & " fue Seteado a " & New_PPR & " Steps x Uni. Acepta el valor ?", 4 , "Set Steps x Uni.")
If Response = 6 Then ' User chose Yes.
Call SetParam(Axis, New_PPR)
MsgBox ("Eje " & Axis_Letter & " fue Seteado")
Else ' User chose No.
MsgBox ("Eje " & Axis_Letter & " NO fue Seteado")
End If
End Sub
Main