diff --git a/CSVPage.xaml.vb b/CSVPage.xaml.vb index a3a88df..009103b 100644 --- a/CSVPage.xaml.vb +++ b/CSVPage.xaml.vb @@ -484,8 +484,6 @@ Public Class CSVPage End Sub Private Function RemoveOnePart(nId As Integer) As Boolean - ' Verifico sia nel grezzo - If EgtGetParent(nId) <> m_nRawId Then Return False ' Recupero identificativi da Info Dim sCsvPath As String = String.Empty EgtGetInfo(nId, INFO_CSV_PATH, sCsvPath) @@ -497,10 +495,13 @@ Public Class CSVPage For i = 1 To m_CsvPartList.Count() Dim CurrPart As CsvPart = m_CsvPartList(i - 1) If String.Compare(sName, CurrPart.m_sName, True) = 0 Then - ' Rimuovo le lavorazioni - EraseMachinings(nId) - ' Rimuovo dal grezzo - EgtRemovePartFromRawPart(nId) + ' Se nel grezzo + If EgtGetParent(nId) = m_nRawId Then + ' Rimuovo le lavorazioni + EraseMachinings(nId) + ' Rimuovo dal grezzo + EgtRemovePartFromRawPart(nId) + End If ' Cancello il pezzo EgtErase(nId) ' Aggiorno il contatore diff --git a/CurrentMachine.vb b/CurrentMachine.vb index ab9885f..7d531eb 100644 --- a/CurrentMachine.vb +++ b/CurrentMachine.vb @@ -597,6 +597,19 @@ Public Class CurrentMachine End Set End Property + Public Function SetCurrMatByName(sMatName As String) As Boolean + ' Se stringa vuota + If String.IsNullOrWhiteSpace(sMatName) Then Return False + ' Cerco il nome nella lista dei materiali + For Index = 0 To Materials.Count - 1 + If String.Compare(Materials(Index).sName, sMatName, True) = 0 Then + CurrMat = Materials(Index) + End If + Next + Return False + End Function + + Friend ReadOnly Property bHasRawProbe As Boolean Get Return m_HasRawProbe diff --git a/CurrentProjectPageUC.xaml.vb b/CurrentProjectPageUC.xaml.vb index 8c60213..d60c603 100644 --- a/CurrentProjectPageUC.xaml.vb +++ b/CurrentProjectPageUC.xaml.vb @@ -315,6 +315,8 @@ Public Class CurrentProjectPageUC ' aggiorno spessore grezzo m_dRawHeight = GetRawHeight() UpdateHeightTxBx() + ' aggiorno materiale + m_MainWindow.m_CurrentMachine.SetCurrMatByName(GetProjectMaterial()) ' Dichiaro progetto non modificato EgtResetModified() Return True @@ -601,6 +603,13 @@ Public Class CurrentProjectPageUC Return EgtSetInfo(nMarkId, INFO_PROJMAT, m_MainWindow.m_CurrentMachine.CurrMat.sName) End Function + Friend Function GetProjectMaterial() As String + Dim nMarkId As Integer = AddProjectMark() + Dim sName As String = String.Empty + EgtGetInfo(nMarkId, INFO_PROJMAT, sName) + Return sName + End Function + Friend Function SetProjectNcProgSent(nNcProg As Integer) As Boolean Dim nMarkId As Integer = AddProjectMark() Return EgtSetInfo(nMarkId, INFO_NCPROGSENT, nNcProg) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index e5367a1..4513fd1 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -60,5 +60,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/RawPartPageUC.xaml.vb b/RawPartPageUC.xaml.vb index cdd4b26..4d23043 100644 --- a/RawPartPageUC.xaml.vb +++ b/RawPartPageUC.xaml.vb @@ -164,20 +164,11 @@ Public Class RawPartPageUC EgtOutLog("Error : TableMin e TableRef1 are different") End If End If - ' Parcheggio pezzi presenti nel grezzo e li tolgo da VeinMatcing - Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId) - While nPartId <> GDB_ID.NULL - m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nPartId) - VeinMatching.OnRemovePartFromRaw(nPartId) - nPartId = EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId) - End While ' Nascondo eventuali pezzi in parcheggio HideParkedParts() ' Deseleziono pezzi EgtDeselectAll() VeinMatching.OnDeselectAll() - ' Cancello tutte le lavorazioni - EraseMachinings(GDB_ID.NULL) ' Visualizzo eventuale foto m_MainWindow.m_CurrentProjectPageUC.ShowPhoto(True) Dim bHeightModified As Boolean = False @@ -582,6 +573,34 @@ Public Class RawPartPageUC WritePrivateProfileString(S_RAWPART, K_RAWOFFSX, DoubleToString(m_RawOffsX, 2), m_MainWindow.GetIniFile()) WritePrivateProfileString(S_RAWPART, K_RAWOFFSY, DoubleToString(m_RawOffsY, 2), m_MainWindow.GetIniFile()) WritePrivateProfileString(S_RAWPART, K_RAWKERF, DoubleToString(m_RawKerf, 2), m_MainWindow.GetIniFile()) + ' Se ci sono pezzi nel grezzo + If EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId) <> GDB_ID.NULL Then + ' Cancello tutte le lavorazioni + EraseMachinings(GDB_ID.NULL) + ' Se progetto con pezzi piani + Dim nPrjType As Integer = m_CurrProjPage.GetCurrentProjectType() + If nPrjType = CurrentProjectPageUC.PRJ_TYPE.FLATS Then + ' Reinserisco tutte le lavorazioni piane + AddMachinings(GDB_ID.NULL, True, False) + ' Aggiorno regioni per nesting + m_MainWindow.m_CadCutPageUC.m_NestPage.UpdateNestRegions() + ' Verifico ogni singolo pezzo + Dim bReducedCut As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_REDUCEDCUT, 0, m_MainWindow.GetMachIniFile()) <> 0) + Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId) + While nPartId <> GDB_ID.NULL + Dim nNextPartId = EgtGetNextPartInRawPart(nPartId) + If Not EgtVerifyPart(nPartId, bReducedCut) Then + m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nPartId) + VeinMatching.OnRemovePartFromRaw(nPartId) + End If + nPartId = nNextPartId + End While + ' Se altrimenti progetto con cornici + ElseIf nPrjType = CurrentProjectPageUC.PRJ_TYPE.FRAMES Then + ' Reinserisco tutte le lavorazioni delle cornici + AddFrameMachinings(m_MainWindow.m_FrameCutPageUC.m_dStartTrim, m_MainWindow.m_FrameCutPageUC.m_dEndTrim) + End If + End If Return True Else Return False @@ -939,20 +958,43 @@ Public Class RawPartPageUC Return ' se da cancellare ElseIf m_RawHeight < EPS_SMALL Then + ' Se ci sono pezzi + If EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId) <> GDB_ID.NULL Then + ' Parcheggio pezzi presenti nel grezzo e li tolgo da VeinMatcing + Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId) + While nPartId <> GDB_ID.NULL + Dim nNextPartId As Integer = EgtGetNextPartInRawPart(nPartId) + m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nPartId) + VeinMatching.OnRemovePartFromRaw(nPartId) + nPartId = nNextPartId + End While + ' Cancello tutte le lavorazioni + EraseMachinings(GDB_ID.NULL) + ' Nascondo i pezzi parcheggiati + HideParkedParts() + End If + ' Elimino il grezzo EgtRemoveRawPart(m_CurrProjPage.m_nRawId) m_CurrProjPage.m_nRawId = GDB_ID.NULL ' altrimenti da aggiornare Else + ' Salvo vecchia altezza + Dim dOldHeight As Double = GetRawHeight() ' Aggiorno solido EgtModifyRawPartHeight(m_CurrProjPage.m_nRawId, m_RawHeight) + ' Vettore spostamento + Dim vtMove As New Vector3d(0, 0, m_RawHeight - dOldHeight) ' Aggiorno quota kerf Dim nKerfId As Integer = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, NAME_KERF) If nKerfId <> GDB_ID.NULL Then - Dim ptStart As Point3d - EgtStartPoint(nKerfId, GDB_ID.ROOT, ptStart) - Dim dKerfHeight = ptStart.z - m_ptTableMin.z - m_CurrentMachine.dAdditionalTable - EgtMove(nKerfId, New Vector3d(0, 0, m_RawHeight - dKerfHeight)) + EgtMove(nKerfId, vtMove) End If + ' Se ci sono pezzi ne aggiorno la quota + Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId) + While nPartId <> GDB_ID.NULL + EgtMovePartInRawPart(nPartId, vtMove) + nPartId = EgtGetNextPartInRawPart(nPartId) + End While End If ' Aggiorno spessore in progetto corrente m_CurrProjPage.m_dRawHeight = m_RawHeight