Non che serva amolto, l'ho fatta più che altro per capire la logica di Mach3.
Con qualche semplice modifica però si può utilizzare per il taglio automatico dei bordi.
Secondo voi potrebbe servire il taglio automatico dei bordi?
'Condizioni iniziali
If ((MinY=0 And MinX=0 And MaxY=0 And MaxX=0) Or (MaxX>9990 And MaxY>9990)) Then
Message "Niente da testare"
End
End If
If (GetOEMLED(34)=-1) Then
Message "Interruttori di limite attivati !"
End
End If
If (GetOEMLED(23)=0) Then DoOEMButton (119)
If (GetOEMLED(23)=0) Then
Message "Machine out of limits for SoftLimit Activation."
End
End If
'Scambio degli assi e del Workoffset + Softlimits + G92 x i ritagli in base allo spost. angolare.
SoftXmin = GetOEMDRO(156)
SoftXmax = GetOEMDRO(150)
SoftYmin = GetOEMDRO(157)
SoftYmax = GetOEMDRO(151)
Xoffset = GetOEMDRO(47) + GetOEMDRO(16)
Yoffset = GetOEMDRO(48) + GetOEMDRO(17)
Ang = GetOEMDRO(118)
If (Ang=90 Or Ang=-270) Then
Xmin = MinY
Xmax = MaxY
Ymin = -MaxX
Ymax = -MinX
Xoffs = Yoffset
Yoffs = -Xoffset
CutXmin= SoftYmin
CutXmax= SoftYmax
CutYmin=-SoftXmax
CutYmax=-SoftXmin
Else
If (Ang=-90 Or Ang=270) Then
Xmin = -MaxY
Xmax = -MinY
Ymin = MinX
Ymax = MaxX
Xoffs = -Yoffset
Yoffs = Xoffset
CutXmin=-SoftYmax
CutXmax=-SoftYmin
CutYmin=SoftXmin
CutYmax=SoftXmax
Else
If (Ang=180 Or Ang=-180) Then
Xmin = -MaxX
Xmax = -MinX
Ymin = -MaxY
Ymax = -MinY
Xoffs = -Xoffset
Yoffs = -Yoffset
CutXmin=-SoftXmax
CutXmax=-SoftXmin
CutYmin=-SoftYmax
CutYmax=-SoftYmin
Else
If (Ang=0 Or Ang=360) Then
Xmin = MinX
Xmax = MaxX
Ymin = MinY
Ymax = MaxY
Xoffs = Xoffset
Yoffs = Yoffset
CutXmin = SoftXmin
CutXmax = SoftXmax
CutYmin = SoftYmin
CutYmax = SoftYmax
Else
Message "Test possibile solo per spostamenti angolari multipli di 90°"
End
End If
End If
End If
End If
' Ritaglia secondo l'area di lavoro
SoftZmin = GetOEMDRO(158)
SoftZmax = GetOEMDRO(152)
Zmin = GetOEMDRO(6)
Zmax = GetOEMDRO(12)
Zoffs = GetOEMDRO(49) + GetOEMDRO(18)
If (Xmin>CutXmax-Xoffs Or Xmax<CutXmin-Xoffs Or Ymin>CutYmax-Yoffs Or Ymax<CutYmin-Yoffs Or Zmin>SoftZmax-Zoffs Or Zmax<SoftZmin-Zoffs) Then
Message "Progetto fuori dall'area di lavoro"
End
End If
If (Ymax>CutYmax-Yoffs) Then Ymax=CutYmax-Yoffs
If (Ymin<CutYmin-Yoffs) Then Ymin=CutYmin-Yoffs
If (Xmax>CutXmax-Xoffs) Then Xmax=CutXmax-Xoffs
If (Xmin<CutXmin-Xoffs) Then Xmin=CutXmin-Xoffs
If (Zmin<SoftZmin-Zoffs) Then Zmin=SoftZmin-Zoffs
If (Zmax>SoftZmax-Zoffs) Then Zmax=SoftZmax-Zoffs
'Movimento assi X-Y TEST
x = GetABSPosition(0)
y = GetABSPosition(1)
z = GetABSPosition(2)
SafeZ = GetSafeZ( )
GotoSafeZ()
Code"G0 X" & Xmin & "Y" & Ymin
While IsMoving()
Sleep(100)
If (GetABSPosition(0)=SoftXmin) Then Message "Limite X Inferiore raggiunto!"
If (GetABSPosition(1)=SoftYmin) Then Message "Limite Y Inferiore raggiunto!"
Wend
Code"G0 Y" & Ymax
While IsMoving()
Sleep(100)
If (GetABSPosition(1)=SoftYmax) Then Message "Limite Y superiore raggiunto!"
Wend
Code"G0 X" & Xmax
While IsMoving()
Sleep(100)
If (GetABSPosition(0)=SoftXmax) Then Message "Limite X superiore raggiunto!"
Wend
Code"G0 Y" & Ymin
While IsMoving()
Sleep(100)
If (GetABSPosition(1)=SoftYmin) Then Message "Limite Y inferiore raggiunto!"
Wend
Code"G0 X" & Xmin
While IsMoving()
Sleep(100)
If (GetABSPosition(0)=SoftXmin) Then Message "Limite X inferiore raggiunto!"
Wend
Sleep(1000)
'Movimento asse Z TEST
If (Zmax<SafeZ) Then
msg =MsgBox ("Il limite superiore del programma è inferiore all'altezza di sicurezza. Continuare?",52,"")
If (msg = 7) Then
Code"G53 G0 X" & x & "Y" & y & "Z" & z
End
End If
End If
Code"G0 Z" & Zmax
While IsMoving()
Sleep(100)
If (GetABSPosition(2)=SoftZmax) Then Message "Limite Y superiore raggiunto!"
Wend
Sleep(2000)
If (Zmin<SafeZ) Then
msg =MsgBox ("Il limite inferiore del programma è inferiore all'altezza di sicurezza. Continuare?",52,"")
If (msg = 7) Then
Code"G53 G0 X" & x & "Y" & y & "Z" & z
End
End If
End If
Code"G0 Z" & Zmin
While IsMoving()
Sleep(100)
If (GetABSPosition(2)=SoftZmin) Then Message "Limite Y inferiore raggiunto!"
Wend
Sleep(2000)
Code"G53 G0 X" & x & "Y" & y & "Z" & z