From 1ed18177165b18a71da74c643e97c33ae4cd8fae Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 8 Dec 2016 16:40:39 +0000 Subject: [PATCH] EgtCAM5 1.6x1 : - modifiche in gestione lavorazioni per selezione faccia di superficie. --- Application.xaml.vb | 3 --- IniFile.vb | 3 +++ My Project/AssemblyInfo.vb | 4 ++-- .../MachiningTreeExpanderViewModel.vb | 9 +++----- .../MachiningParameterExpanderViewModel.vb | 22 ++++++++++++------- .../OperationExpanderViewModel.vb | 5 ++--- ProjectPage/ProjectViewModel.vb | 2 +- 7 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Application.xaml.vb b/Application.xaml.vb index 7913885..1b709bc 100644 --- a/Application.xaml.vb +++ b/Application.xaml.vb @@ -21,9 +21,6 @@ Class Application #Region "Messages" - ' Temporary - Friend Const LASTSUBENTITYID As String = "LastSubEntityId" - ' Generic messages Friend Const MAINWINDOW_CONTENTRENDERED As String = "MainWindow_ContentRendered" Friend Const MAINWINDOW_ACTIVATED As String = "MainWindow_Activated" diff --git a/IniFile.vb b/IniFile.vb index a7e49bb..3c84db8 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -3,6 +3,9 @@ Imports EgtUILib Public Module IniFile + ' Temporary + Friend m_LastSubEntityId As Integer + Friend EgaltechBlue1 As New SolidColorBrush(Color.FromArgb(255, 77, 132, 196)) Friend ReferenceContactColRed As New Color3d(255, 0, 0) Friend ReferenceContactColGreen As New Color3d(0, 255, 0) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index f75bf50..57d8262 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -70,5 +70,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb index 80d4c81..dc0e5e9 100644 --- a/ProjectPage/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb +++ b/ProjectPage/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb @@ -63,9 +63,6 @@ Namespace EgtCAM5 Application.Msn.Register(Application.SELECTEDOPERATION, Sub(SelectedOperation As OperationListBoxItem) m_nSelectedOperationId = SelectedOperation.Id End Sub) - Application.Msn.Register(Application.LASTSUBENTITYID, Sub(nLastSubEntityId As Integer) - LastSubEntityId = nLastSubEntityId - End Sub) End Sub #End Region @@ -86,8 +83,6 @@ Namespace EgtCAM5 End Get End Property - Private LastSubEntityId As Integer = GDB_ID.NULL - ''' ''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand. ''' @@ -111,7 +106,9 @@ Namespace EgtCAM5 ' Imposto l'operazione appena creata come corrente EgtSetCurrMachining(MachiningId) If SelectedEntities.Count = 1 AndAlso EgtGetType(SelectedEntities(0)) = GDB_TY.SRF_MESH Then - Dim SubEntityArray As Integer() = {LastSubEntityId} + Dim nF As Integer = EgtSurfTmFacetFromTria(SelectedEntities(0), IniFile.m_LastSubEntityId) + If nF < 0 Then nF = 0 + Dim SubEntityArray As Integer() = {nF} EgtSetMachiningGeometry(SelectedEntities.ToArray, SubEntityArray) Else ' Imposto il vettore come geometria di lavorazione diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb index 68e5cf2..b2c918e 100644 --- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb +++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb @@ -2623,9 +2623,6 @@ Namespace EgtCAM5 Sub New(ByRef m_UpdateParamValues As Action) m_UpdateParamValues = AddressOf ReadMachiningParam - Application.Msn.Register(Application.LASTSUBENTITYID, Sub(nLastSubEntityId As Integer) - LastSubEntityId = nLastSubEntityId - End Sub) End Sub Private Function ConvertTypeToImage(Type As Integer) As String @@ -2665,8 +2662,6 @@ Namespace EgtCAM5 End Get End Property - Private LastSubEntityId As Integer = GDB_ID.NULL - ''' ''' Ricalcola una lavorazione. ''' @@ -2683,10 +2678,21 @@ Namespace EgtCAM5 EntityIndex = EgtGetNextSelectedObj() End While Dim ModifiedGeometry As Boolean = False + ' Gestione speciale provvisoria per una sola superficie con identificazione faccia If SelectedGeometry.Count = 1 AndAlso EgtGetType(SelectedGeometry(0)) = GDB_TY.SRF_MESH Then - Dim SubEntityArray As Integer() = {LastSubEntityId} - ModifiedGeometry = True - EgtSetMachiningGeometry(SelectedGeometry.ToArray, SubEntityArray) + ' Verifico se la superficie è cambiata + Dim SubEntityIndex As Integer = 0 + If Not (EgtGetMachiningGeometry(0, EntityIndex, SubEntityIndex) And + EntityIndex = SelectedGeometry(0) And + SubEntityIndex = IniFile.m_LastSubEntityId And + Not EgtGetMachiningGeometry(1, EntityIndex, SubEntityIndex)) Then + Dim nF As Integer = EgtSurfTmFacetFromTria(SelectedGeometry(0), IniFile.m_LastSubEntityId) + If nF < 0 Then nF = 0 + Dim SubEntityArray As Integer() = {nF} + ModifiedGeometry = True + EgtSetMachiningGeometry(SelectedGeometry.ToArray, SubEntityArray) + End If + ' Gestione standard per curve Else ' Verifico se la geometria è cambiata, confrontando selezione attuale con geometria di lavorazione Dim CountIndex As Integer = 0 diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb index c8415ca..8f15ef2 100644 --- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb +++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb @@ -265,9 +265,8 @@ Namespace EgtCAM5 Dim EntityIndex As Integer = 0 Dim SubEntityIndex As Integer = 0 ' Nell'interfaccia non si usa ma devo comunque definirla perchè la funzione la restituisce obbligatoriamente While EgtGetMachiningGeometry(CountIndex, EntityIndex, SubEntityIndex) - If SubEntityIndex = GDB_ID.NULL Then - EgtSelectObj(EntityIndex) - End If + EgtSelectObj(EntityIndex) + IniFile.m_LastSubEntityId = SubEntityIndex CountIndex += 1 End While ' La salvo come ultima operazione selezionata diff --git a/ProjectPage/ProjectViewModel.vb b/ProjectPage/ProjectViewModel.vb index fd46402..4db469a 100644 --- a/ProjectPage/ProjectViewModel.vb +++ b/ProjectPage/ProjectViewModel.vb @@ -1212,7 +1212,7 @@ Namespace EgtCAM5 Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) Handles m_ProjectScene.OnMousePointFromSelection m_Controller.SetPointFromSelection(nId, PtP, nAux) - Application.Msn.NotifyColleagues(Application.LASTSUBENTITYID, nAux) + IniFile.m_LastSubEntityId = nAux End Sub Private Sub OnMouseDone(ByVal sender As Object) Handles m_ProjectScene.OnMouseDone