From e88ec459741fdda96ba3b48bc01cec949b660063 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 1 May 2017 09:52:50 +0000 Subject: [PATCH] =?UTF-8?q?OmagCUT=201.8d5=20:=20-=20corretta=20gestione?= =?UTF-8?q?=20Next=20in=20SplitPageUC=20-=20aggiunta=20possibilit=C3=A0=20?= =?UTF-8?q?di=20impostare=20ritardo=20tra=20reset=20e=20invio=20programma?= =?UTF-8?q?=20a=20controllo=20NUM=20Flexium=20-=20migliorata=20gestione=20?= =?UTF-8?q?gocciolatoio=20-=20selezione=20pezzo=20in=20nesting=20produce?= =?UTF-8?q?=20selezione=20dello=20stesso=20in=20VeinMatching.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CNCommunication.vb | 2 +- CamAuto.vb | 32 +++++++------- CompoDimensionUC.xaml.vb | 2 + ConstMachIni.vb | 3 ++ CurrentMachine.vb | 17 ++++++-- DrawPageUC.xaml.vb | 10 ++++- ImportPageUC.xaml.vb | 25 +++++++---- My Project/AssemblyInfo.vb | 4 +- NestPageUC.xaml.vb | 47 +++++++++++---------- RawPartPageUC.xaml.vb | 1 + SideAngleUc.xaml.vb | 57 +++++++++++++++---------- SplitPageUC.xaml.vb | 4 +- VacuumCups.vb | 2 +- VeinMatchingWindow.xaml | 2 +- VeinMatchingWindow.xaml.vb | 85 +++++++++++++++++++++++++++++++++----- 15 files changed, 206 insertions(+), 87 deletions(-) diff --git a/CNCommunication.vb b/CNCommunication.vb index 991d5f7..4ba1ca6 100644 --- a/CNCommunication.vb +++ b/CNCommunication.vb @@ -497,7 +497,7 @@ Public Class CNCommunication m_CN.DGeneralFunctions_Reset() End If ' Attesa opportuna - System.Threading.Thread.Sleep(1000) + System.Threading.Thread.Sleep(m_MainWindow.m_CurrentMachine.nResetSendDelay) If m_nNCType = 1 Then ' Cancellazione eventuale file già presente con lo stesso nome (ignoro eventuale errore) m_CN.Delete_NC_prog(sNumProg) diff --git a/CamAuto.vb b/CamAuto.vb index fb97bd3..2d692e8 100644 --- a/CamAuto.vb +++ b/CamAuto.vb @@ -101,22 +101,24 @@ Friend Module CamAuto EgtSetCurrPhase(EgtGetPhaseCount()) Dim nRawId As Integer = EgtGetFirstRawPart() While nRawId <> GDB_ID.NULL - Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId) - While nPartId <> GDB_ID.NULL - ' reset eventuali vecchie informazioni - RemoveOneMoveInfo(nPartId) - ' se ci sono tagli da sotto nel pezzo si processa - If EgtGetGroupObjs(EgtGetFirstNameInGroup(nPartId, NAME_DRIPCUT)) > 0 Then - Dim rmData As New RawMoveData - If PutVacuumCupsOnPart(nPartId, rmData) Then - SaveOneMoveInfo(nPartId, rmData) - Else - bOk = False - EgtOutLog("Error on UpdateVacuumsForDrip in Part " & nPartId.ToString()) + If EgtVerifyRawPartCurrPhase(nRawId) Then + Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId) + While nPartId <> GDB_ID.NULL + ' reset eventuali vecchie informazioni + RemoveOneMoveInfo(nPartId) + ' se ci sono tagli da sotto nel pezzo si processa + If EgtGetGroupObjs(EgtGetFirstNameInGroup(nPartId, NAME_DRIPCUT)) > 0 Then + Dim rmData As New RawMoveData + If PutVacuumCupsOnPart(nPartId, rmData) Then + SaveOneMoveInfo(nPartId, rmData) + Else + bOk = False + EgtOutLog("Error on UpdateVacuumsForDrip in Part " & nPartId.ToString()) + End If End If - End If - nPartId = EgtGetNextPartInRawPart(nPartId) - End While + nPartId = EgtGetNextPartInRawPart(nPartId) + End While + End If nRawId = EgtGetNextRawPart(nRawId) End While ' Scarico le ventose diff --git a/CompoDimensionUC.xaml.vb b/CompoDimensionUC.xaml.vb index 2a3a3d2..aa5f8dc 100644 --- a/CompoDimensionUC.xaml.vb +++ b/CompoDimensionUC.xaml.vb @@ -69,11 +69,13 @@ Public Class CompoDimensionUC Friend Sub ShowAddRemoveBtn(value As Boolean) If value Then m_DrawPage.SideAngleBtn.Visibility = Windows.Visibility.Hidden + m_DrawPage.DripBtn.Visibility = Windows.Visibility.Hidden m_DrawPage.BackBtn.Visibility = Windows.Visibility.Hidden AddBtn.Visibility = Windows.Visibility.Visible CancelBtn.Visibility = Windows.Visibility.Visible Else m_DrawPage.SideAngleBtn.Visibility = Windows.Visibility.Visible + m_DrawPage.DripBtn.Visibility = Windows.Visibility.Visible m_DrawPage.BackBtn.Visibility = Windows.Visibility.Visible AddBtn.Visibility = Windows.Visibility.Hidden CancelBtn.Visibility = Windows.Visibility.Hidden diff --git a/ConstMachIni.vb b/ConstMachIni.vb index 8115f5b..521a06e 100644 --- a/ConstMachIni.vb +++ b/ConstMachIni.vb @@ -34,6 +34,9 @@ Public Const K_COMM_NAME As String = "CommName" Public Const K_PATH_HMI As String = "PathHmi" + Public Const S_NCNUM As String = "NcNUM" + Public Const K_RESETSENDDELAY As String = "ResetSendDelay" + Public Const S_NCDATA As String = "NcData" Public Const K_COMM As String = "Comm" Public Const K_REFRESH As String = "Refresh" diff --git a/CurrentMachine.vb b/CurrentMachine.vb index aea0656..ab9885f 100644 --- a/CurrentMachine.vb +++ b/CurrentMachine.vb @@ -21,6 +21,9 @@ Public Class CurrentMachine ' Incremento da dare all'asse C per far coincidere la linea della lama con l'asse X Private m_dDeltaC As Double = 0 + ' Ritardo tra reset e invio programma per NUM + Private m_nResetSendDelay As Integer = 1000 + ' Dati su linea di produzione Private m_bProdLine As Boolean = False Private m_sVarProg1 As String = "E80021" @@ -92,7 +95,7 @@ Public Class CurrentMachine Private m_ManualToolChanger As New List(Of ToolChangerPos) ' Lista dei materiali - Private m_Materials As New observablecollection(Of Material) + Private m_Materials As New ObservableCollection(Of Material) ' Massimo id della lista materiali nel file ini Private m_MaxIdMat As Integer = 0 @@ -150,6 +153,12 @@ Public Class CurrentMachine End Get End Property + Friend ReadOnly Property nResetSendDelay As Integer + Get + Return m_nResetSendDelay + End Get + End Property + Friend ReadOnly Property bProdLine As Boolean Get Return m_bProdLine @@ -603,11 +612,13 @@ Public Class CurrentMachine m_sMachDir = m_MainWindow.GetMachinesRootDir & "\" & sMachineName ' Impostazione path MachIni file m_sMachIniFile = m_MainWindow.GetMachinesRootDir & "\" & sMachineName & "\" & sMachineName & ".ini" - ' Leggo flag incremento asse C - m_dDeltaC = GetPrivateProfileDouble(S_AXES, K_DELTA_C, 0.0, sMachIniFile) ' Leggo estensione del file programma pezzo GetPrivateProfileString(S_PARTPROGRAM, K_EXTENSION, "xpi", m_sIsoFileExt, sMachIniFile) If m_sIsoFileExt(0) <> "." Then m_sIsoFileExt = "." & m_sIsoFileExt + ' Leggo flag incremento asse C + m_dDeltaC = GetPrivateProfileDouble(S_AXES, K_DELTA_C, 0.0, sMachIniFile) + ' Leggo ritardo tra reset e send per NUM + m_nResetSendDelay = GetPrivateProfileInt(S_NCNUM, K_RESETSENDDELAY, 1000, sMachIniFile) ' Leggo se linea di produzione e parametri relativi m_bProdLine = (GetPrivateProfileInt(S_PRODUCTIONLINE, K_ACTIVE, 0, sMachIniFile) <> 0) If m_bProdLine And Not m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.PROCUCTION_LINE) Then diff --git a/DrawPageUC.xaml.vb b/DrawPageUC.xaml.vb index 5324c47..a2646f3 100644 --- a/DrawPageUC.xaml.vb +++ b/DrawPageUC.xaml.vb @@ -545,7 +545,10 @@ Public Class DrawPageUC m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nId2, True) ' Se richiesto posizionamento diretto, lo eseguo If bDirect Then - m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2) + If m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2) Then + ' Eventuale notifica al VeinMatching + VeinMatching.OnInsertPartInRaw(nId2) + End If End If Next Return True @@ -649,7 +652,10 @@ Public Class DrawPageUC m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nId2, True) ' Se richiesto posizionamento diretto, lo eseguo If bDirect Then - m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2) + If m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2) Then + ' Eventuale notifica al VeinMatching + VeinMatching.OnInsertPartInRaw(nId2) + End If End If Next ' Cancello il file diff --git a/ImportPageUC.xaml.vb b/ImportPageUC.xaml.vb index 00e3201..6f0e0a6 100644 --- a/ImportPageUC.xaml.vb +++ b/ImportPageUC.xaml.vb @@ -145,6 +145,8 @@ Public Class ImportPageUC ResetBtn.Visibility = Windows.Visibility.Hidden SideAngleBtn.Visibility = Windows.Visibility.Hidden End If + mmBtn.IsEnabled = True + inchBtn.IsEnabled = True ' imposto misura m_bMM = EgtUiUnitsAreMM() @@ -330,8 +332,8 @@ Public Class ImportPageUC End Function Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles ImportScene.OnMouseDownScene - ' Solo se in modalità angoli su lati esterni - If Not SideAngleBtn.IsChecked() Then Return + ' Solo se in modalità angoli o gocciolatoio su lati esterni + If Not (SideAngleBtn.IsChecked() Or DripBtn.IsChecked()) Then Return ' Solo con il tasto sinistro e se stato NULL If e.Button <> Windows.Forms.MouseButtons.Left Or Not ImportScene.IsStatusNull() Then Return ' Verifico se selezionato indicativo di pezzo @@ -363,8 +365,8 @@ Public Class ImportPageUC End Sub Private Sub Me_SelectedPartChanged(nPartId As Integer) Handles Me.SelectedPartChanged - ' Se sono in modalità inclinazioni calcolo lati inclinabili e creo testi - If SideAngleBtn.IsChecked() Then + ' Se sono in modalità inclinazioni o gocciolatoio calcolo lati inclinabili e creo testi + If SideAngleBtn.IsChecked() Or DripBtn.IsChecked() Then m_SideAngleUC.ReLoadSideAnglePage() End If End Sub @@ -552,7 +554,10 @@ Public Class ImportPageUC VeinMatching.AddPart(sTmpfile, nId2) ' Se richiesto posizionamento diretto, lo eseguo If bDirect Then - m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2) + If m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2) Then + ' Eventuale notifica al VeinMatching + VeinMatching.OnInsertPartInRaw(nId2) + End If End If ' Cancello il file My.Computer.FileSystem.DeleteFile(sTmpfile) @@ -596,12 +601,16 @@ Public Class ImportPageUC Private Sub ImportPage_Unloaded(sender As Object, e As RoutedEventArgs) ' Salvo direttorio corrente WritePrivateProfileString(S_FLATPARTS, K_FLPCURRDIR, m_sCurrDir, m_MainWindow.GetIniFile()) - ' Tolgo pagina inclinazioni se attiva - If SideAngleBtn.IsChecked() Then + ' Tolgo pagina inclinazioni/gocciolatoi se attiva + If SideAngleBtn.IsChecked() Or DripBtn.IsChecked() Then FilePathTxBl.Visibility = Windows.Visibility.Visible FileListBox.Visibility = Windows.Visibility.Visible LeftGrid.Children.Remove(m_SideAngleUC) - SideAngleBtn.IsChecked = False + If SideAngleBtn.IsChecked() Then + SideAngleBtn.IsChecked = False + Else + DripBtn.IsChecked() = False + End If End If End Sub diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index c18aca5..a3ccef5 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/NestPageUC.xaml.vb b/NestPageUC.xaml.vb index 02edbb4..cfd2e44 100644 --- a/NestPageUC.xaml.vb +++ b/NestPageUC.xaml.vb @@ -261,14 +261,20 @@ Public Class NestPageUC If (bPartInTable And m_nPartPos = PART_POS.OUT_TABLE) Or (Not bPartInTable And m_nPartPos = PART_POS.IN_TABLE) Then EgtDeselectAll() + ' Aggiornamento eventuale VeinMatching + VeinMatching.OnDeselectAll() End If ' Eseguo la selezione EgtSelectObj(m_nIdToSel) + ' Eventuale aggiornamento VeinMatching + VeinMatching.OnSelectPart(m_nIdToSel) ' Set flag posizione selezionati m_nPartPos = If(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE) ' Se deselezione da eseguire ElseIf m_nIdToDesel <> GDB_ID.NULL Then EgtDeselectObj(m_nIdToDesel) + ' Eventuale aggiornamento VeinMatching + VeinMatching.OnDeselectPart(m_nIdToDesel) End If ' Reset m_bDrag = False @@ -478,7 +484,12 @@ Public Class NestPageUC ' Recupero successivo selezionato Dim nNextId = EgtGetNextSelectedObj() ' Lo metto in tavola, se possibile - InsertOnePart(nId) + If InsertOnePart(nId) Then + ' Eventuale notifica al VeinMatching + VeinMatching.OnInsertPartInRaw(nId) + Else + VeinMatching.OnDeselectPart(nId) + End If ' Costringo ad aggiornare UI UpdateUI() ' Passo al successivo selezionato @@ -527,8 +538,6 @@ Public Class NestPageUC If bFit Then ' Eventuale aggiunta solido per taglio da sotto UpdateSolidForDrip(nId) - ' Eventuale notifica al VeinMatching - VeinMatching.OnInsertPartInRaw(nId) Return True Else EraseMachinings(nId) @@ -540,17 +549,6 @@ Public Class NestPageUC Return False End Function - Private Sub SetAllPreviewsStatus(bShow As Boolean) - Dim nPartId = EgtGetFirstPartInRawPart(m_nRawId) - While nPartId <> GDB_ID.NULL - ' Recupero il layer preview del pezzo e ne imposto lo stato di visualizzazione - Dim nPvId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_PREVIEW) - EgtSetStatus(nPvId, If(bShow, GDB_ST.ON_, GDB_ST.OFF)) - ' Passo al pezzo successivo - nPartId = EgtGetNextPartInRawPart(nPartId) - End While - End Sub - Private Sub StorePartBtn_Click(sender As Object, e As RoutedEventArgs) Handles StorePartBtn.Click EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) ' Ciclo di parcheggio dei pezzi selezionati @@ -560,7 +558,7 @@ Public Class NestPageUC Dim nNextId = EgtGetNextSelectedObj() ' Metto in parcheggio, se in grezzo StoreOnePart(nId) - ' Eventuale notifica al VeinMatching + ' Eventuale notifiche al VeinMatching VeinMatching.OnRemovePartFromRaw(nId) ' Passo al successivo selezionato nId = nNextId @@ -678,22 +676,27 @@ Public Class NestPageUC Private Sub SelectAllBtn_Click(sender As Object, e As RoutedEventArgs) Handles SelectAllBtn.Click EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) - ' Se già selezionati in tavola o non ci sono selezionati - If m_nPartPos = PART_POS.IN_TABLE Or m_nPartPos = PART_POS.NONE_TABLE Then + ' Numero dei pezzi in tavola + Dim nPartTab As Integer = EgtGetPartInRawPartCount(m_nRawId) + ' Se già selezionati in tavola o non ci sono selezionati e pezzi in tavola + If m_nPartPos = PART_POS.IN_TABLE Or + (m_nPartPos = PART_POS.NONE_TABLE And nPartTab > 0) Then ' Seleziono tutti i pezzi in tavola Dim nPartId As Integer = EgtGetFirstGroupInGroup(m_nRawId) While nPartId <> GDB_ID.NULL - EgtSetStatus(nPartId, GDB_ST.SEL) + EgtSelectObj(nPartId) + VeinMatching.OnSelectPart(nPartId) nPartId = EgtGetNextGroup(nPartId) End While ' Aggiorno flag m_nPartPos = If(EgtGetSelectedObjCount() > 0, PART_POS.IN_TABLE, PART_POS.NONE_TABLE) - ' Se già selezionati in parcheggio - ElseIf m_nPartPos = PART_POS.OUT_TABLE Then + ' Altrimenti + Else ' Seleziono tutti i pezzi in parcheggio Dim nPartId As Integer = EgtGetFirstPart() While nPartId <> GDB_ID.NULL - EgtSetStatus(nPartId, GDB_ST.SEL) + EgtSelectObj(nPartId) + VeinMatching.OnSelectPart(nPartId) nPartId = EgtGetNextPart(nPartId) End While End If @@ -705,6 +708,8 @@ Public Class NestPageUC EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) ' Eseguo EgtDeselectAll() + ' Eventuale notifica al VeinMatching + VeinMatching.OnDeselectAll() ' Imposto flag posizione pezzi m_nPartPos = PART_POS.NONE_TABLE ' Aggiorno vista diff --git a/RawPartPageUC.xaml.vb b/RawPartPageUC.xaml.vb index c66e677..cdd4b26 100644 --- a/RawPartPageUC.xaml.vb +++ b/RawPartPageUC.xaml.vb @@ -175,6 +175,7 @@ Public Class RawPartPageUC HideParkedParts() ' Deseleziono pezzi EgtDeselectAll() + VeinMatching.OnDeselectAll() ' Cancello tutte le lavorazioni EraseMachinings(GDB_ID.NULL) ' Visualizzo eventuale foto diff --git a/SideAngleUc.xaml.vb b/SideAngleUc.xaml.vb index defb454..83bfc75 100644 --- a/SideAngleUc.xaml.vb +++ b/SideAngleUc.xaml.vb @@ -76,12 +76,11 @@ Public Class SideAngleUC ElseIf m_CallingPage = MainWindow.Pages.Import Then ' Imposto contesto corrente EgtSetCurrentContext(m_MainWindow.m_ImportPageUC.ImportScene.GetCtx()) - If m_Mode = ModeOpt.SIDEANGLE Then - DeleteSideAngle() - ' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno) - InitSides() - RefreshSideAngleText() - End If + ' Inizializzo + DeleteSideAngle() + ' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno) + InitSides() + RefreshSideAngleText() End If ' Gestisco Checkbox e nomi in base al numero di lati inclinabili @@ -101,11 +100,9 @@ Public Class SideAngleUC ' Aggiorno valori If m_Mode = ModeOpt.SIDEANGLE Then - If String.IsNullOrWhiteSpace(Parameter1TxBx.Text) Then - Dim sVal As String = String.Empty - GetPrivateProfileString(S_SIDES, K_SIDEANGLE, "45", sVal, m_MainWindow.GetIniFile()) - Parameter1TxBx.Text = sVal - End If + Dim sVal As String = String.Empty + GetPrivateProfileString(S_SIDES, K_SIDEANGLE, "45", sVal, m_MainWindow.GetIniFile()) + Parameter1TxBx.Text = sVal Else m_dDripOffset = GetPrivateProfileDouble(S_SIDES, K_DRIPOFFSET, 20, m_MainWindow.GetIniFile()) m_dDripDepth = GetPrivateProfileDouble(S_SIDES, K_DRIPDEPTH, 10, m_MainWindow.GetIniFile()) @@ -326,31 +323,40 @@ Public Class SideAngleUC Dim nEntityIndex As Integer = 1 ' Ciclo che verifica se possibile inclinare la linea corrente fino alla penultima While NextLine <> GDB_ID.NULL - If VerifyIsSideAnglePossible(LastLine, CurrLine, NextLine) Then - If m_Mode = ModeOpt.SIDEANGLE Then + If m_Mode = ModeOpt.SIDEANGLE Then + If VerifyIsSideAnglePossible(LastLine, CurrLine, NextLine) Then ' Aggiungo il lato alla lista di quelli inclinabili e ne azzero l'inclinazione AddSideAngle(CurrLine, TextLayer, dBBoxRad, nEntityIndex) - Else + nEntityIndex += 1 + End If + Else + If VerifyIsSideDripPossible(LastLine, CurrLine, NextLine) Then ' Aggiungo il lato alla lista di quelli su cui è possibile mettere il gocciolatoio AddDripSide(CurrLine, TextLayer, dBBoxRad, nEntityIndex) + nEntityIndex += 1 End If - nEntityIndex += 1 End If LastLine = CurrLine CurrLine = NextLine NextLine = EgtGetNext(CurrLine) End While - ' Verifico se possibile inclinare l'ultima linea + ' Verifico ultima linea NextLine = EgtGetFirstInGroup(OutLoop) - If VerifyIsSideAnglePossible(LastLine, CurrLine, NextLine) Then - If m_Mode = ModeOpt.SIDEANGLE Then + If m_Mode = ModeOpt.SIDEANGLE Then + If VerifyIsSideAnglePossible(LastLine, CurrLine, NextLine) Then ' Aggiungo il lato alla lista di quelli inclinabili e ne azzero l'inclinazione AddSideAngle(CurrLine, TextLayer, dBBoxRad, nEntityIndex) - Else + nEntityIndex += 1 + End If + Else + If VerifyIsSideDripPossible(LastLine, CurrLine, NextLine) Then ' Aggiungo il lato alla lista di quelli su cui è possibile mettere il gocciolatoio AddDripSide(CurrLine, TextLayer, dBBoxRad, nEntityIndex) + nEntityIndex += 1 End If End If + + ' Aggiorno interfaccia If m_CallingPage = MainWindow.Pages.Import Then If m_Mode = ModeOpt.SIDEANGLE Then For Each Entity In m_SideAngleEntityList @@ -406,7 +412,7 @@ Public Class SideAngleUC ' verifico che sia nulla o quasi bLastOk = Not vtDiff.IsSmall() Else - EgtOutLog("Error in Compo Outloop: find an entity that is not a line or a arc") + EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc") End If ' Verifico se curva successiva mi permette di inclinare @@ -426,7 +432,7 @@ Public Class SideAngleUC ' verifico che sia nulla o quasi bNextOk = Not vtDiff.IsSmall() Else - EgtOutLog("Error in Compo Outloop: find an entity that is not a line or a arc") + EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc") End If ' Se entrambe me lo permettono restituisco vero @@ -437,6 +443,15 @@ Public Class SideAngleUC End Function + ' Funzione che verifica se alla linea corrente è associabile un canalino + Private Function VerifyIsSideDripPossible(LastLine As Integer, CurrLine As Integer, NextLine As Integer) As Boolean + ' Verifico se CurrLine è una linea + If EgtGetType(CurrLine) <> GDB_TY.CRV_LINE Then + Return False + End If + Return True + End Function + ' Funzione che gestisce le operazioni sull'entità da inclinare Private Sub AddSideAngle(CurrLine As Integer, TextLayer As Integer, dBBoxRad As Double, nEntityIndex As Integer) ' Se sono in importa diff --git a/SplitPageUC.xaml.vb b/SplitPageUC.xaml.vb index 15030c1..155a2b6 100644 --- a/SplitPageUC.xaml.vb +++ b/SplitPageUC.xaml.vb @@ -803,11 +803,11 @@ Public Class SplitPageUC ' Ci deve essere almeno 1 taglio disabilitato e almeno 1 passante oppure fase successiva alla prima NextBtn.IsEnabled = GetDisabledCutsCount() > 0 And (GetSplitCutsCount() > 0 Or m_nCurrPhase > 1) End If + ' Se sto solo visualizzando + NextBtn.IsEnabled = (m_nCurrPhase < EgtGetPhaseCount()) Else NextBtn.IsEnabled = False End If - ' Se sto solo visualizzando - If m_nCurrPhase < EgtGetPhaseCount() Then NextBtn.IsEnabled = True ' Per bottone MODIFY ModifyBtn.IsEnabled = m_bShow ' Per bottone AUTO diff --git a/VacuumCups.vb b/VacuumCups.vb index 297722a..839039e 100644 --- a/VacuumCups.vb +++ b/VacuumCups.vb @@ -314,7 +314,7 @@ Module VacuumCups ' Determino la rotazione, allineando il lato lungo delle ventose con quello del grezzo ptRotCen = b3Vac.Center() Dim frMinRect As New Frame3d - If EgtCurveMinAreaRectangleXY(nOutlineId, nOutlineId, frMinRect) Then + If EgtCurveMinAreaRectangleXY(nOutlineId, GDB_ID.ROOT, frMinRect) Then Dim dLen, dAngVertDeg, dAngOrizzDeg As Double frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg) dRotAngDeg = dAngOrizzDeg diff --git a/VeinMatchingWindow.xaml b/VeinMatchingWindow.xaml index 836b332..82c00d8 100644 --- a/VeinMatchingWindow.xaml +++ b/VeinMatchingWindow.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" TextBlock.FontFamily="./Resources/Fonts/#Century Gothic" - Height="500" Width="500" ShowInTaskbar="False" Topmost="True" Initialized="Window_Initialized" MinWidth="300" MinHeight="300"> + Height="500" Width="500" ShowInTaskbar="False" Initialized="Window_Initialized" MinWidth="300" MinHeight="300"> diff --git a/VeinMatchingWindow.xaml.vb b/VeinMatchingWindow.xaml.vb index 673a571..35b6c5e 100644 --- a/VeinMatchingWindow.xaml.vb +++ b/VeinMatchingWindow.xaml.vb @@ -213,18 +213,17 @@ Friend Module VeinMatching Return True End Function - Friend Function OnInsertPartInRaw(nPartId As Integer) As Boolean + Friend Function OnInsertPartInRaw(nPartId As Integer, Optional bDeselect As Boolean = True) As Boolean ' Verifico esista il contesto del VeinMatching If m_nVeinCtx = 0 Then Return True ' Recupero il contesto corrente (principale) Dim nMainCtx = EgtGetCurrentContext() ' Se non c'è la fotografia, esco Dim nPhotoId As Integer = m_MainWindow.m_CurrentProjectPageUC.GetPhoto() - If nPhotoId = GDB_ID.NULL Then Return True + If nPhotoId = GDB_ID.NULL Then Return If(bDeselect, OnDeselectPart(nPartId), True) ' Recupero il nome originale del pezzo Dim nOriId As Integer = nPartId EgtGetInfo(nPartId, KEY_ORI_ID, nOriId) - ' Verifico se esiste già la foto del progetto corrente nel VeinMatching Dim sPhoto As String = String.Empty EgtGetPhotoPath(nPhotoId, sPhoto) @@ -234,7 +233,6 @@ Friend Module VeinMatching If String.Compare(sPhoto, sVeinPhoto, True) <> 0 Then If Not CopyPhoto(nPhotoId) Then Return False End If - ' Recupero il pezzo nel VeinMatching EgtSetCurrentContext(m_nVeinCtx) Dim nId = GetVeinPartId(nOriId) @@ -250,10 +248,11 @@ Friend Module VeinMatching ' Sistemo il colore Dim colWhite As New Color3d(255, 255, 255, 100) EgtSetColor(nRegId, colWhite) + ' Se richiesto, eseguo deselezione + If bDeselect Then EgtDeselectObj(nId) End If EgtDraw() EgtSetCurrentContext(nMainCtx) - Return True End Function @@ -268,7 +267,6 @@ Friend Module VeinMatching ' Recupero il nome originale del pezzo Dim nOriId As Integer = nPartId EgtGetInfo(nPartId, KEY_ORI_ID, nOriId) - ' Recupero il pezzo nel VeinMatching EgtSetCurrentContext(m_nVeinCtx) Dim nId = GetVeinPartId(nOriId) @@ -282,22 +280,20 @@ Friend Module VeinMatching End If EgtDraw() EgtSetCurrentContext(nMainCtx) - Return True End Function - Friend Function OnRemovePartFromRaw(nPartId As Integer) As Boolean + Friend Function OnRemovePartFromRaw(nPartId As Integer, Optional bDeselect As Boolean = True) As Boolean ' Verifico esista il contesto del VeinMatching If m_nVeinCtx = 0 Then Return True ' Recupero il contesto corrente (principale) Dim nMainCtx = EgtGetCurrentContext() ' Se non c'è la fotografia, esco Dim nPhotoId As Integer = m_MainWindow.m_CurrentProjectPageUC.GetPhoto() - If nPhotoId = GDB_ID.NULL Then Return True + If nPhotoId = GDB_ID.NULL Then Return If(bDeselect, OnDeselectPart(nPartId), True) ' Recupero il nome originale del pezzo Dim nOriId As Integer = nPartId EgtGetInfo(nPartId, KEY_ORI_ID, nOriId) - ' Tolgo la texture dal pezzo EgtSetCurrentContext(m_nVeinCtx) Dim nId As Integer = GetVeinPartId(nOriId) @@ -309,10 +305,79 @@ Friend Module VeinMatching ' Sistemo il colore Dim colAqua As New Color3d(0, 255, 255, 25) EgtSetColor(nRegId, colAqua) + ' Se richiesto, eseguo deselezione + If bDeselect Then EgtDeselectObj(nId) End If EgtDraw() EgtSetCurrentContext(nMainCtx) + Return True + End Function + Friend Function OnSelectPart(nPartId As Integer) As Boolean + ' Verifico esista il contesto del VeinMatching + If m_nVeinCtx = 0 Then Return True + ' Recupero il contesto corrente (principale) + Dim nMainCtx = EgtGetCurrentContext() + ' Recupero il nome originale del pezzo + Dim nOriId As Integer = nPartId + EgtGetInfo(nPartId, KEY_ORI_ID, nOriId) + ' Recupero il pezzo nel VeinMatching + EgtSetCurrentContext(m_nVeinCtx) + Dim nId = GetVeinPartId(nOriId) + Dim bFound As Boolean = nId <> GDB_ID.NULL + ' Lo seleziono + If bFound Then EgtSelectObj(nId) + ' Aggiorno visualizzazione e ritorno al contesto originale + EgtDraw() + EgtSetCurrentContext(nMainCtx) + Return bFound + End Function + + Friend Function OnDeselectPart(nPartId As Integer) As Boolean + ' Verifico esista il contesto del VeinMatching + If m_nVeinCtx = 0 Then Return True + ' Recupero il contesto corrente (principale) + Dim nMainCtx = EgtGetCurrentContext() + ' Recupero il nome originale del pezzo + Dim nOriId As Integer = nPartId + EgtGetInfo(nPartId, KEY_ORI_ID, nOriId) + ' Recupero il pezzo nel VeinMatching + EgtSetCurrentContext(m_nVeinCtx) + Dim nId = GetVeinPartId(nOriId) + Dim bFound As Boolean = nId <> GDB_ID.NULL + ' Lo seleziono + If bFound Then EgtDeselectObj(nId) + ' Aggiorno visualizzazione e ritorno al contesto originale + EgtDraw() + EgtSetCurrentContext(nMainCtx) + Return bFound + End Function + + Friend Function OnSelectAll() As Boolean + ' Verifico esista il contesto del VeinMatching + If m_nVeinCtx = 0 Then Return True + ' Imposto VeinMatching context + Dim nCurrCtx = SetVeinContext() + If nCurrCtx = 0 Then Return False + ' Eseguo selezione di tutti i pezzi + EgtSelectAll() + EgtDraw() + ' Se necessario, ripristino il contesto originale + If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx) + Return True + End Function + + Friend Function OnDeselectAll() As Boolean + ' Verifico esista il contesto del VeinMatching + If m_nVeinCtx = 0 Then Return True + ' Imposto VeinMatching context + Dim nCurrCtx = SetVeinContext() + If nCurrCtx = 0 Then Return False + ' Eseguo deselezione di tutti i pezzi + EgtDeselectAll() + EgtDraw() + ' Se necessario, ripristino il contesto originale + If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx) Return True End Function