941
Screen designer tips and tutorials / Re: Is there a way to make an OEM DRO read-only?
« on: May 03, 2020, 04:07:21 AM »
put a transparent button with no code over the dro.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Sub Main()
If GetOEMLED(804) Then ' is run
If IsActive(INPUT1)And (GetLed(116) = true) Then
DoOemButton(1004) ' 1004 DoOemButton stop
End If
End If
End Sub
Dim Num_Tools As Integer
Dim Ang_Move As Integer
Dim Req_Tool As Integer
Dim Current_Tool As Integer
Dim Lock_Move As Integer
Dim CW_Feed As Integer
Dim CCW_Feed As Integer
Dim Moves As Integer
Num_Tools = 12 'number of tools on turret
Ang_Move = 360/Num_Tools 'angular rotation per tool
Req_Tool = GetSelectedTool()
Current_Tool = GetCurrentTool()
Lock_Move = 15 'distance to move back onto paw to lock
CW_Feed = 100
CCW_Feed = 50
'Start tool change
If Req_Tool < 1 Then
Message"Tool number too low"
Code "M30"
End If
If Req_Tool = Current_Tool Then
'do nothing
Else
'do tool change
If Req_Tool > Current_Tool Then
Moves = (Req_Tool - Current_Tool) * Ang_Move
End If
If Req_Tool < Current_Tool Then
Moves = (Num_Tools - Current_Tool + Req_Tool) * Ang_Move
End If
End If
'move to safe position
Code "G0 G53 X-.25 Z-.25"
Code "G04 P0.5"
'index turret
Code "G91 G94"
Code "G01 A" & Moves + 10 & "F" & CW_Feed
Code "G01 A-" & Lock_Move & "F" & CCW_Feed
While IsMoving()
Sleep(10)
Wend
SetCurrentTool Req_Tool
SetUserDRO 1500 , Req_tool
Code "G90"
Code "F" & Current_Feed
GageH = 15.0 'OEMDRO(1001)=Gage Block Height
ToolRadius = GetOemDRO(1112)/2 'custom tool diameter DRO
PlateOffset = 20 'X and Y offset
PlateThickness = 15 'Z offset
CurrentFeed = GetOemDRO(818)
CurrentAbsInc = GetOemLED(48)
CurrentGmode = GetOemDRO(819)
CurrentFeedOverride = GetOEMDRO(821)
'X 1st Pass at fast rate
Message "X axis 1st pass"
Sleep 2000
If GetOemLed (825) = 0 Then
DoOemButton (1008)
Sleep(250)
SetOemDRO (821,100)
Code "G90 G31 X20 F600"
While IsMoving()
Wend
Sleep(250)
XProbePos = GetVar(2000)
If Abs(XprobePos) <= Abs(20) - 0.1 Then
Code "G0 X" &XProbePos
While IsMoving()
Wend
Call SetDro (0,0)
Sleep(250)
Code "G1 X-1 F1000"
While IsMoving()
Wend
Message "X axis 2nd pass"
Sleep(250)
Else
Code "G53 G0 X" &x
While IsMoving()
Wend
Message "Material not found, check connection and try again"
Code "F" &CurrentFeed
SetOemDRO (821,CurrentFeedOverride)
If CurrentAbsInc = 0 Then Code "G91"
If CurrentGMode = 0 Then Code "G0"
Sleep(250)
Exit Sub
End If
Else
Message "Probe is grounded, check connection and try again"
Code "F" &CurrentFeed
SetOemDRO (821,CurrentFeedOverride)
If CurrentAbsInc = 0 Then Code "G91"
If CurrentGMode = 0 Then Code "G0"
Sleep(250)
Exit Sub
End If
'X 2nd pass at slow rate
DoOEMButton (1008)
Sleep(250)
Code "G31 X2 F30"
While IsMoving()
Wend
Sleep(250)
XProbePos = GetVar(2000)
If Abs(XprobePos) <= Abs(2) - 0.1 Then
Code "G0 X" &XProbePos
While IsMoving()
Wend
Call SetDro (0,ToolRadius)
Sleep(250)
Message "X axis is now zeroed"
Sleep(250)
Code "G91 G0 X-10"
Code "G0 Y-20"
Code "G0 X20"
While IsMoving()
Wend
Sleep(250)
Else
Code "G53 G0 X" &x
While IsMoving()
Wend
Message "Material not found, check connection and try again"
Code "F" &CurrentFeed
SetOemDRO (821,CurrentFeedOverride)
If CurrentAbsInc = 0 Then Code "G91"
If CurrentGMode = 0 Then Code "G0"
Sleep(250)
Exit Sub
End If
'Y 1st Pass at fast rate
Message "(Y axis 1st pass)"
If GetOemLed (825) = 0 Then
DoOemButton (1009)
Sleep(250)
Code "G90 G31 Y20 F600"
While IsMoving()
Wend
Sleep(250)
YProbePos = GetVar(2001)
If Abs(YprobePos) <= Abs(20) - 0.1 Then
Code "G0 Y" &YProbePos
While IsMoving()
Wend
Call SetDro (1,0)
Sleep(250)
Code "G1 Y-1 F1000"
While IsMoving()
Wend
Message "Y axis 2nd pass"
Sleep(250)
Else
Code "G53 G0 Z0"
Code "G53 G0 Y" & y & "X" & x
Code "G53 G0 Z" & z
While IsMoving()
Wend
Message "Material not found, check connection and try again"
Code "F" &CurrentFeed
SetOemDRO (821,CurrentFeedOverride)
If CurrentAbsInc = 0 Then Code "G91"
If CurrentGMode = 0 Then Code "G0"
Sleep(250)
Exit Sub
End If
Else
Message "Probe is grounded, check connection and try again"
Code "F" &CurrentFeed
SetOemDRO (821,CurrentFeedOverride)
If CurrentAbsInc = 0 Then Code "G91"
If CurrentGMode = 0 Then Code "G0"
Sleep(250)
Exit Sub
End If
'Y 2nd pass at slow rate
DoOEMButton (1009)
Sleep(250)
Code "G31 Y2 F30"
While IsMoving()
Wend
Sleep(250)
YProbePos = GetVar(2001)
If Abs(YprobePos) <= Abs(2) - 0.1 Then
Code "G0 Y" &YProbePos
While IsMoving()
Wend
Call SetDro (1,ToolRadius)
Sleep(250)
Message "Y axis is now zeroed"
Code "G91 G0 Y-5"
Code "G0 Z20"
Code "G90 G0 X20 Y20"
While IsMoving()
Wend
Else
Code "G53 G0 Z0"
Code "G53 G0 Y" & y & "X" & x
Code "G53 G0 Z" & z
While IsMoving()
Wend
Message "Material not found, check connection and try again"
Code "F" &CurrentFeed
SetOemDRO (821,CurrentFeedOverride)
If CurrentAbsInc = 0 Then Code "G91"
If CurrentGMode = 0 Then Code "G0"
Sleep(250)
Exit Sub
End If
Code "G92.2"
'Call SetDRO(24,0)
Call SetDRO(2, ABS(GetOEMDRO(1001)))
Tool_Num = GetDRO (24)
If Tool_Num <>0 then
Z_Shift = GetOEMDRO (1002)
Z_Offset = GetOEMDRO ( 49 )
Axis_Pos = GetOEMDRO(85)
Tool_Offset = Axis_Pos - Z_Offset -Z_Shift
Call setOEMDRO(42, Tool_Offset)
End if