diff --git a/CadCuts/SplitPageUC.xaml.vb b/CadCuts/SplitPageUC.xaml.vb index 5e2742c..ff3229b 100644 --- a/CadCuts/SplitPageUC.xaml.vb +++ b/CadCuts/SplitPageUC.xaml.vb @@ -1,6 +1,7 @@ Imports System.Collections.ObjectModel Imports System.ComponentModel Imports System.Reflection +Imports System.Security.Cryptography Imports EgtUILib Public Class SplitPageUC @@ -1298,7 +1299,6 @@ Public Class SplitPageUC Return nIndexTwinCut End Function - ' Ok: gestione info 'IdTwinCut' per tagli FinalCut Private Function AdjustBothCuts(nI As Integer, Optional bAllForced As Boolean = False, Optional bAccForced As Boolean = False) As Boolean @@ -1390,7 +1390,6 @@ Public Class SplitPageUC Return True End Function - ' Ok: gestione info 'IdTwinCut' per tagli FinalCut Private Function AdjustStartCut(nI As Integer, Optional bAllForced As Boolean = False, Optional bAccForced As Boolean = False) As Boolean @@ -1455,7 +1454,6 @@ Public Class SplitPageUC Return True End Function - ' Ok: gestione info 'IdTwinCut' per tagli FinalCut Private Function AdjustEndCut(nI As Integer, Optional bAllForced As Boolean = False, Optional bAccForced As Boolean = False) As Boolean @@ -1519,85 +1517,68 @@ Public Class SplitPageUC Return True End Function - ' Ok: gestione info 'IdTwinCut' per tagli FinalCut Private Sub OutCenStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles OutCenStartBtn.Click If m_CurrFirstInd = -1 Then Return Dim bGenModif As Boolean = False For Index As Integer = m_CurrFirstInd To m_CurrLastInd - Dim nIndexTwinCut As Integer = -1 - ' Indice di controllo LOOP: se > 10 allora il ciclo è potenzialmente infinito! - Dim nCount As Integer = 0 - Dim CurrIndex = Index - If Not m_ItemList(CurrIndex).IsSelected Then - Continue For - End If + Dim CurrIndex As Integer = Index + If Not m_ItemList(CurrIndex).IsSelected Then Continue For - Do - nCount = nCount + 1 + For nCount As Integer = 1 To 2 Dim nI As Integer = m_ItemList(CurrIndex).Ind - If m_MachiningList(nI).m_sLay = NAME_OUTLOOP Then + ' se non è loop esterno non posso modificare + If m_MachiningList(nI).m_sLay <> NAME_OUTLOOP Then + Exit For + End If + ' se ho forzato il tipo di ingresso da CamAuto qui non posso modificarlo! + If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then + EgtOutLog("L'ingresso di taglio associato all'entita' " & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama") + Exit For + End If + ' Eseguo + EgtSetCurrMachining(m_MachiningList(nI).m_nId) + Dim nLiPrev As Integer + EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev) + If nLiPrev = MCH_SAW_LI.OUT Then + ' accorcio + EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT) + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT) + ' ri-verifico interferenza + EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) + ElseIf nLiPrev = MCH_SAW_LI.EXT_OUT Then + ' accorcio + EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT) + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT) + ElseIf nLiPrev = MCH_SAW_LI.CENT Then + ' allungo + EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT) + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT) + ' ri-verifico interferenza + EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) + ElseIf nLiPrev = MCH_SAW_LI.EXT_CENT Then + ' allungo + EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT) + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT) + End If + ColorMachining(m_MachiningList(nI)) + ColorNumberArrow(nI) + bGenModif = True - ' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo! - If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then - EgtOutLog("L'ingresso di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama") + ' Se primo ciclo, cerco eventuale taglio associato + If nCount = 1 Then + Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False) + If nIndexTwinCut > -1 AndAlso Not m_ItemList(nIndexTwinCut).IsSelected Then + CurrIndex = nIndexTwinCut Else - - EgtSetCurrMachining(m_MachiningList(nI).m_nId) - Dim nLiPrev As Integer - EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev) - If nLiPrev = MCH_SAW_LI.OUT Then - ' accorcio - EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT) - UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) - ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT) - ' ri-verifico interferenza - EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) - ElseIf nLiPrev = MCH_SAW_LI.EXT_OUT Then - ' accorcio - EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT) - UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) - ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT) - ElseIf nLiPrev = MCH_SAW_LI.CENT Then - ' allungo - EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT) - UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) - ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT) - ' ri-verifico interferenza - EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) - ElseIf nLiPrev = MCH_SAW_LI.EXT_CENT Then - ' allungo - EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT) - UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) - ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT) - End If - ColorMachining(m_MachiningList(nI)) - ColorNumberArrow(nI) - bGenModif = True - - ' Recupero il taglio TwinCut associato (Optional: False -> non controllo se è FinalCut) - nIndexTwinCut = GetIndexTwinCut(nI, False) - If nIndexTwinCut > -1 Then - ' Se non è stato selezionato allora devo modificarlo, alrtimenti resetto l'indice - If m_ItemList(nIndexTwinCut).IsSelected Then - nIndexTwinCut = -1 - Else - CurrIndex = nIndexTwinCut - End If - End If - + Exit For End If End If - - If nCount > 10 Then - EgtOutLog("! FATAL ERROR ! In function 'OutCenEndBtn' cycle 'Do Loop Until' is potentially infinte") - ' Forzo l'uscita dal ciclo - nIndexTwinCut = -1 - End If - Loop Until nIndexTwinCut < 0 - - ' ---- FINE ----- metodo per mofica paramtri - + Next Next ' Se modificato qualcosa If bGenModif Then @@ -1606,7 +1587,6 @@ Public Class SplitPageUC End If End Sub - ' Ok: anche per tagli TwinCut con affondament ridotto Private Sub AllOutStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllOutStartBtn.Click For nI As Integer = 0 To m_MachiningList.Count() - 1 EgtSetCurrMachining(m_MachiningList(nI).m_nId) @@ -1633,7 +1613,6 @@ Public Class SplitPageUC m_bModified = True End Sub - ' Ok: anche per tagli TwinCut con affondament ridotto Private Sub AllCenStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllCenStartBtn.Click For nI As Integer = 0 To m_MachiningList.Count() - 1 @@ -1669,84 +1648,68 @@ Public Class SplitPageUC m_bModified = True End Sub - ' Ok: gestione info 'IdTwinCut' per tagli FinalCut Private Sub OutCenEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles OutCenEndBtn.Click If m_CurrFirstInd = -1 Then Return Dim bGenModif As Boolean = False For Index As Integer = m_CurrFirstInd To m_CurrLastInd - Dim nIndexTwinCut As Integer = -1 - ' Indice di controllo LOOP: se > 10 allora il ciclo è potenzialmente infinito! - Dim nCount As Integer = 0 - Dim CurrIndex = Index - If Not m_ItemList(CurrIndex).IsSelected Then - Continue For - End If + Dim CurrIndex As Integer = Index + If Not m_ItemList(CurrIndex).IsSelected Then Continue For - Do - nCount = nCount + 1 + For nCount As Integer = 1 To 2 Dim nI As Integer = m_ItemList(CurrIndex).Ind - If m_MachiningList(nI).m_sLay = NAME_OUTLOOP Then + ' se non è loop esterno non posso modificare + If m_MachiningList(nI).m_sLay <> NAME_OUTLOOP Then + Exit For + End If + ' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo! + If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then + EgtOutLog("L'uscita di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama") + Exit For + End If + ' Eseguo + EgtSetCurrMachining(m_MachiningList(nI).m_nId) + Dim nLoPrev As Integer + EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev) + If nLoPrev = MCH_SAW_LO.OUT Then + ' accorcio + EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT) + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT) + ' ri-verifico interferenza + EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) + ElseIf nLoPrev = MCH_SAW_LO.EXT_OUT Then + ' accorcio + EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT) + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT) + ElseIf nLoPrev = MCH_SAW_LO.CENT Then + ' allungo + EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT) + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT) + ' ri-verifico interferenza + EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) + ElseIf nLoPrev = MCH_SAW_LO.EXT_CENT Then + ' allungo + EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT) + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT) + End If + ColorMachining(m_MachiningList(nI)) + ColorNumberArrow(nI) + bGenModif = True - ' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo! - If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then - EgtOutLog("L'uscita di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama") + ' Se primo ciclo, cerco eventuale taglio associato + If nCount = 1 Then + Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False) + If nIndexTwinCut > -1 AndAlso Not m_ItemList(nIndexTwinCut).IsSelected Then + CurrIndex = nIndexTwinCut Else - - EgtSetCurrMachining(m_MachiningList(nI).m_nId) - Dim nLoPrev As Integer - EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev) - If nLoPrev = MCH_SAW_LO.OUT Then - ' accorcio - EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT) - UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) - ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT) - ' ri-verifico interferenza - EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) - ElseIf nLoPrev = MCH_SAW_LO.EXT_OUT Then - ' accorcio - EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT) - UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) - ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT) - ElseIf nLoPrev = MCH_SAW_LO.CENT Then - ' allungo - EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT) - UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) - ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT) - ' ri-verifico interferenza - EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) - ElseIf nLoPrev = MCH_SAW_LO.EXT_CENT Then - ' allungo - EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT) - UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) - ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT) - End If - ColorMachining(m_MachiningList(nI)) - ColorNumberArrow(nI) - bGenModif = True - - ' Recupero il taglio TwinCut associato (Optional: False -> non controllo se è FinalCut) - nIndexTwinCut = GetIndexTwinCut(nI, False) - If nIndexTwinCut > -1 Then - ' Se non è stato selezionato allora devo modificarlo, alrtimenti resetto l'indice - If m_ItemList(nIndexTwinCut).IsSelected Then - nIndexTwinCut = -1 - Else - CurrIndex = nIndexTwinCut - End If - End If - + Exit For End If End If - - If nCount > 10 Then - EgtOutLog("! FATAL ERROR ! In function 'OutCenEndBtn' cycle 'Do Loop Until' is potentially infinte") - ' Forzo l'uscita dal ciclo - nIndexTwinCut = -1 - End If - Loop Until nIndexTwinCut < 0 - - + Next Next ' Se modificato qualcosa If bGenModif Then @@ -1755,7 +1718,6 @@ Public Class SplitPageUC End If End Sub - ' Ok: anche per tagli TwinCut con affondament ridotto Private Sub AllOutEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllOutEndBtn.Click For nI As Integer = 0 To m_MachiningList.Count() - 1 EgtSetCurrMachining(m_MachiningList(nI).m_nId) @@ -1782,7 +1744,6 @@ Public Class SplitPageUC m_bModified = True End Sub - ' Ok Private Sub AllCenEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllCenEndBtn.Click For nI As Integer = 0 To m_MachiningList.Count() - 1 @@ -1818,7 +1779,6 @@ Public Class SplitPageUC m_bModified = True End Sub - ' Ok Private Sub AllExtendBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllExtendBtn.Click Dim bModif As Boolean = False For nI As Integer = 0 To m_MachiningList.Count() - 1 @@ -1840,7 +1800,6 @@ Public Class SplitPageUC EnableButtons() End Sub - ' Ok Private Sub AllReduceBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllReduceBtn.Click Dim bModif As Boolean = False For nI As Integer = 0 To m_MachiningList.Count() - 1 @@ -1862,7 +1821,6 @@ Public Class SplitPageUC EnableButtons() End Sub - ' Ok Private Sub ModifStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles ModifStartBtn.Click Dim bLen As Boolean = True ' abilito la finestra per inserire i valori solo per il primo elemento della lista (di default tutti gli altri oggetti assumono lo stesso valore) @@ -1871,7 +1829,6 @@ Public Class SplitPageUC Dim bFirstWJ As Boolean = True ' elenco delle variabili : MCH_MY.SAWING/MCH_MY.MILLING Dim dUsal As Double = 0 - ' elenco delle variabili : MCH_MY.WATERJETTING Dim dWJAddLen As Double = 0 Dim bWJLiHole As Boolean = True @@ -1883,14 +1840,8 @@ Public Class SplitPageUC If m_CurrFirstInd = -1 Then Return Dim bGenModif As Boolean = False For Index As Integer = m_CurrFirstInd To m_CurrLastInd - Dim nIndexTwinCut As Integer = -1 Dim CurrIndex As Integer = Index - ' Indice di controllo LOOP: se > 10 allora il ciclo è potenzialmente infinito! - Dim nCount As Integer = 0 - - If Not m_ItemList(CurrIndex).IsSelected Then - Continue For - End If + If Not m_ItemList(CurrIndex).IsSelected Then Continue For Dim nI As Integer = m_ItemList(CurrIndex).Ind Dim nOperId As Integer = m_MachiningList(nI).m_nId @@ -1899,27 +1850,18 @@ Public Class SplitPageUC ' Se taglio con lama If nMachiningType = MCH_MY.SAWING Then - Do + For nCount As Integer = 1 To 2 ' Riassegno i valori dell'indice corrente nI = m_ItemList(CurrIndex).Ind nOperId = m_MachiningList(nI).m_nId - - nCount = nCount + 1 + ' se non è retta o ... If Not (m_MachiningList(nI).m_bIsLine Or m_MachiningList(nI).m_dPrevAng > FL_ARC_ANG_MIN Or m_MachiningList(nI).m_sLay = NAME_ONPATH) Then - Continue For - End If - - nIndexTwinCut = GetIndexTwinCut(nI, False) - If Not (m_MachiningList(nI).m_bCanStartAll Or nIndexTwinCut > -1) Then - EgtOutLog("Il taglio non puo' essere allungato all'interno del pezzo") - ' Passo al prossimo indice disponibile - Continue For + Exit For End If ' leggo il valore salvato nella geometria Dim dOrigUsal As Double = 0 EgtGetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal) - ' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------ If bFirstInd Then ' Dialogo richiesta valore @@ -1932,6 +1874,15 @@ Public Class SplitPageUC bFirstInd = False End If ' ------------------ FINE PREPARAZIONE TASTIERINO VIRTUALE ------------------ + ' recupero allungamento corrente + EgtSetCurrMachining(nOperId) + Dim dAddLen As Double = 0 + EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen) + ' non eseguo modifica se su angolo interno + If Not m_StartEndModifyOnIntCorner And (dAddLen - dOrigUsal < -10 * EPS_SMALL) Then + Exit For + End If + ' Eseguo Dim bRepeat As Boolean = False Do ' Se c'è limite alla lunghezza libera @@ -1949,51 +1900,43 @@ Public Class SplitPageUC End If End If ' Modifica della lavorazione - EgtSetCurrMachining(nOperId) - Dim dAddLen As Double = 0 - EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen) - ' verifico che non sia sull'angolo interno (altrimenti vieto la modifica) - If Not m_StartEndModifyOnIntCorner And (dAddLen - dOrigUsal < -10 * EPS_SMALL) Then - ' Passo al prossimo indice disponibile - Continue For - Return - End If EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal) EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal) bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) If bRepeat Then - EgtSetMachiningParam(MCH_MP.STARTADDLEN, dOrigUsal) + EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen) EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal) dUsal = dOrigUsal End If - Loop Until Not bRepeat + Loop While bRepeat - ' verifico interferenza + ' controllo ammissibilità allungamento + Dim nInterf As Integer = FMI_TYPE.NONE + If EgtVerifyMachining(m_MachiningList(nI).m_nId, nInterf) AndAlso nInterf = FMI_TYPE.LI Then + EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen) + EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal) + dUsal = dOrigUsal + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + End If + + ' verifica finale interferenza EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) ColorMachining(m_MachiningList(nI)) ColorNumberArrow(nI) bGenModif = True - ' Recupero il taglio TwinCut associato (Optional: False -> non controllo se è FinalCut) - nIndexTwinCut = GetIndexTwinCut(nI, False) - If nIndexTwinCut > -1 Then - ' Se non è stato selezionato allora devo modificarlo, alrtimenti resetto l'indice - If m_ItemList(nIndexTwinCut).IsSelected Then - nIndexTwinCut = -1 - Else + ' Se primo ciclo, cerco eventuale taglio associato + If nCount = 1 Then + Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False) + If nIndexTwinCut > -1 AndAlso Not m_ItemList(nIndexTwinCut).IsSelected Then CurrIndex = nIndexTwinCut + Else + Exit For End If End If + Next - If nCount > 10 Then - EgtOutLog("! FATAL ERROR ! In function 'ModifStartBtn' cycle 'Do Loop Until' is potentially infinte") - ' Forzo l'uscita dal ciclo - nIndexTwinCut = -1 - End If - - Loop Until nIndexTwinCut < 0 - - ' se altrimenti fresatura sopra + ' se altrimenti fresatura sopra ElseIf nMachiningType = MCH_MY.MILLING And m_MachiningList(nI).m_sLay = NAME_ONPATH Then ' leggo il valore salvato nella geometria @@ -2024,7 +1967,7 @@ Public Class SplitPageUC UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) bGenModif = True - ' se altrimenti getto d'acqua + ' se altrimenti getto d'acqua ElseIf nMachiningType = MCH_MY.WATERJETTING Then ' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------ @@ -2088,7 +2031,6 @@ Public Class SplitPageUC End If End Sub - ' Ok Private Sub ModifEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles ModifEndBtn.Click Dim bLen As Boolean = True ' abilito la finestra per inserire i valori solo per il primo elemento della lista (di default tutti gli altri oggetti assumono lo stesso valore) @@ -2097,8 +2039,7 @@ Public Class SplitPageUC Dim bFirstWJ As Boolean = True ' elenco delle variabili : MCH_MY.SAWING/MCH_MY.MILLING Dim dUeal As Double = 0 - - ' Recupero i valori attuali della lavorazione + ' elenco delle variabili : MCH_MY.WATERJETTING Dim dWJAddLen As Double = 0 Dim WJLeadOutType As Integer = 0 Dim nWJTangDist As Double = 0 @@ -2108,14 +2049,8 @@ Public Class SplitPageUC If m_CurrFirstInd = -1 Then Return Dim bGenModif As Boolean = False For Index As Integer = m_CurrFirstInd To m_CurrLastInd - Dim nIndexTwinCut As Integer = -1 Dim CurrIndex As Integer = Index - ' Indice di controllo LOOP: se > 10 allora il ciclo è potenzialmente infinito! - Dim nCount As Integer = 0 - - If Not m_ItemList(Index).IsSelected Then - Continue For - End If + If Not m_ItemList(Index).IsSelected Then Continue For Dim nI As Integer = m_ItemList(Index).Ind Dim nOperId As Integer = m_MachiningList(nI).m_nId @@ -2124,25 +2059,18 @@ Public Class SplitPageUC ' Se taglio con lama If nMachiningType = MCH_MY.SAWING Then - Do + For nCount As Integer = 1 To 2 ' Riassegno i valori dell'indice corrente nI = m_ItemList(CurrIndex).Ind nOperId = m_MachiningList(nI).m_nId - - nCount = nCount + 1 + ' se non è retta o ... If Not (m_MachiningList(nI).m_bIsLine Or m_MachiningList(nI).m_dNextAng > FL_ARC_ANG_MIN Or m_MachiningList(nI).m_sLay = NAME_ONPATH) Then - Continue For - End If - - nIndexTwinCut = GetIndexTwinCut(nI, False) - If Not (m_MachiningList(nI).m_bCanEndAll Or nIndexTwinCut > -1) Then - EgtOutLog("Il taglio non puo' essere allungato all'interno del pezzo") - Return + Exit For End If + ' leggo il valore salvato nella geometria Dim dOrigUeal As Double = 0 EgtGetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal) - ' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------ If bFirstInd Then ' Dialogo richiesta valore @@ -2153,6 +2081,14 @@ Public Class SplitPageUC bFirstInd = False End If ' ------------------ FINE PREPARAZIONE TASTIERINO VIRTUALE ------------------ + ' recupero allungamento corrente + EgtSetCurrMachining(nOperId) + Dim dAddLen As Double = 0 + EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen) + If Not m_StartEndModifyOnIntCorner And (dAddLen - dOrigUeal < -10 * EPS_SMALL) Then + Exit For + End If + ' Eseguo Dim bRepeat As Boolean = False Do ' Se c'è limite alla lunghezza libera @@ -2169,24 +2105,26 @@ Public Class SplitPageUC dUeal = Math.Min(dUeal, m_MachiningList(nI).m_dEndFreeLen - dDT - dCornerSafety) End If End If - ' Modifica della lavorazione - EgtSetCurrMachining(nOperId) - Dim dAddLen As Double = 0 - EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen) - If Not m_StartEndModifyOnIntCorner And (dAddLen - dOrigUeal < -10 * EPS_SMALL) Then - Return - End If EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUeal - dOrigUeal) EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal) UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) If bRepeat Then - EgtSetMachiningParam(MCH_MP.ENDADDLEN, dOrigUeal) + EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen) EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal) dUeal = dOrigUeal End If - Loop Until Not bRepeat + Loop While bRepeat + + ' controllo ammissibilità allungamento + Dim nInterf As Integer = FMI_TYPE.NONE + If EgtVerifyMachining(m_MachiningList(nI).m_nId, nInterf) AndAlso nInterf = FMI_TYPE.LO Then + EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen) + EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal) + dUeal = dOrigUeal + UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) + End If ' verifico interferenza EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf) @@ -2194,25 +2132,18 @@ Public Class SplitPageUC ColorNumberArrow(nI) bGenModif = True - ' Recupero il taglio TwinCut associato (Optional: False -> non controllo se è FinalCut) - nIndexTwinCut = GetIndexTwinCut(nI, False) - If nIndexTwinCut > -1 Then - ' Se non è stato selezionato allora devo modificarlo, alrtimenti resetto l'indice - If m_ItemList(nIndexTwinCut).IsSelected Then - nIndexTwinCut = -1 - Else + ' Se primo ciclo, cerco eventuale taglio associato + If nCount = 1 Then + Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False) + If nIndexTwinCut > -1 AndAlso Not m_ItemList(nIndexTwinCut).IsSelected Then CurrIndex = nIndexTwinCut + Else + Exit For End If End If + Next - If nCount > 10 Then - EgtOutLog("! FATAL ERROR ! In function 'ModifStartBtn' cycle 'Do Loop Until' is potentially infinte") - ' Forzo l'uscita dal ciclo - nIndexTwinCut = -1 - End If - Loop Until nIndexTwinCut < 0 - - ' se altrimenti fresatura sopra + ' se altrimenti fresatura sopra ElseIf nMachiningType = MCH_MY.MILLING And m_MachiningList(nI).m_sLay = NAME_ONPATH Then Dim dOrigUeal As Double = 0 @@ -2235,7 +2166,8 @@ Public Class SplitPageUC EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal) UpdateMachiningPreview(m_MachiningList(nI).m_nId, True) bGenModif = True - ' se altrimenti getto d'acqua + + ' se altrimenti getto d'acqua ElseIf nMachiningType = MCH_MY.WATERJETTING Then If bFirstWJ Then diff --git a/Project/StartLauncheWD.xaml.vb b/Project/StartLauncheWD.xaml.vb index 0155b69..8d2b303 100644 --- a/Project/StartLauncheWD.xaml.vb +++ b/Project/StartLauncheWD.xaml.vb @@ -102,7 +102,7 @@ Public Class StartLauncherWD m_RecentFileList.Add(New FileNameLsBxItem(sFileName, File.GetLastAccessTime(sFileName))) m_RecentFileList.Add(New FileNameLsBxItem(sFileName, File.GetLastAccessTime(sFileName))) Else - MruFileListRemove.Add(ItemFile) + MruFileListRemove.Add(sFileName) End If Next @@ -111,7 +111,7 @@ Public Class StartLauncherWD EgtOutLog(" WARNING: File " & ItemFileRemove & " does not exist or is not accessible, it's been removed from MruFiles list") Next - ' posiziono la fistra in centro alla pagina + ' posiziono la finestra in centro alla pagina Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2 Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2