diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb index 9dd23e94..d8d41f2d 100644 --- a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb @@ -794,7 +794,8 @@ Public Class LeftPanelVM EgtSetMode(nDuploId, GDB_MD.STD) nPartDuploIdList.Add(nDuploId) Next - ''salvo lista info + '' salvo lista info + Dim saveInfoBeamList As MyMachGroupVM = BeamMachGroup 'Dim saveInfoBeamList As New List(Of PartVM) 'For Each info As PartVM In BeamMachGroup.PartVMList ' saveInfoBeamList.Add(info) @@ -858,15 +859,34 @@ Public Class LeftPanelVM Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt" If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then EgtOutLog("Fallito inserimento grezzo nella barra in AddPartToBeam") + + ' elimino duplo + For Each nDuploId In nPartDuploIdList + EgtErase(nDuploId) + EgtRemoveRawPart(nDuploId) + Next + + ' rimuovo info duplo e aggiorno info grezzo + nPartIndex = 0 + For nIndex = 0 To BeamMachGroup.PartVMList.Count - 1 + If nPartIndex < nPartDuploIdList.Count() AndAlso BeamMachGroup.PartVMList(nIndex).dL > PartsToAdd(0).dL Then + EgtRemoveInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1) + nPartIndex += 1 + ElseIf nPartIndex < nPartDuploIdList.Count() AndAlso BeamMachGroup.PartVMList(nIndex).dL < PartsToAdd(0).dL Then + EgtRemoveInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1) + nPartIndex += 1 + End If + EgtRemoveInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + nPartIndex + 1) + EgtSetInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1, BeamMachGroup.PartVMList(nIndex).nPartId & "," & DoubleToString(BeamMachGroup.PartVMList(nIndex).dPOSX, 3)) + Next + ' elimino vecchio grezzo ed eseguo script creazione nuovo nRawId = EgtGetFirstRawPart() While nRawId <> GDB_ID.NULL EgtRemoveRawPart(nRawId) nRawId = EgtGetFirstRawPart() End While - 'For Each info As PartVM In saveInfoBeamList - ' BeamMachGroup.PartVMList.Add(info) - 'Next + If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then EgtOutLog("Fallita esecuzione ExecBeam. ERRORE") End If @@ -878,7 +898,11 @@ Public Class LeftPanelVM ' aggiorno lista pezzi BeamMachGroup.MyMachGroupM.RefreshPartList() ' seleziono pezzo aggiunto - If BeamMachGroup.PartVMList.Count > nInsertIndex Then BeamMachGroup.SelPart = BeamMachGroup.PartVMList(nInsertIndex) + If BeamMachGroup.PartVMList.Count > nInsertIndex Then + BeamMachGroup.SelPart = BeamMachGroup.PartVMList(nInsertIndex) + Else + BeamMachGroup.SelPart = BeamMachGroup.PartVMList(nInsertIndex - 1) + End If Return True End Function