diff --git a/Application.xaml.vb b/Application.xaml.vb
index 579098c..0c8babb 100644
--- a/Application.xaml.vb
+++ b/Application.xaml.vb
@@ -156,6 +156,7 @@ Class Application
' MachiningOptionPanel
' MachiningTreeViewExpander
Friend Const MACHININGTREEVIEWEXPANDERISENABLED As String = "MachiningTreeViewExpanderIsEnabled"
+ Friend Const NEWMACHININGMODEISACTIVE As String = "NewMachiningModeIsActive"
' StatusBar messages
Friend Const STATUSGRIDCOMMAND As String = "StatusGridCommand"
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb
index f36579c..064a01b 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb
@@ -76,9 +76,26 @@ Namespace EgtCAM5
Public Sub TreeViewDoubleClick(ByVal param As Object)
If TypeOf param Is MachiningTreeViewExpanderItem Then
Dim Machining As MachiningTreeViewExpanderItem = DirectCast(param, MachiningTreeViewExpanderItem)
- Dim x = EgtAddMachining(MachiningTypeToString(DirectCast(Machining.Type, MCH_MY)) & "_1", Machining.Name)
+ ' Creo nuova lavorazione(operazione) con la lavorazione selezionata
+ Dim MachiningId As Integer = EgtAddMachining(MachiningTypeToString(DirectCast(Machining.Type, MCH_MY)) & "_1", Machining.Name)
+ ' Recupero geometria correntemente selezionata e la metto in un vettore
+ Dim SelectedEntities As New List(Of Integer)
+ Dim EntityId As Integer = EgtGetFirstSelectedObj()
+ While EntityId <> GDB_ID.NULL
+ SelectedEntities.Add(EntityId)
+ EntityId = EgtGetNextSelectedObj()
+ End While
+ ' Imposto l'operazione appena creata come corrente
+ EgtSetCurrMachining(MachiningId)
+ ' Imposto il vettore come geometria di lavorazione
+ EgtSetMachiningGeometry(SelectedEntities.ToArray)
+ ' Calcolo la lavorazione con la nuova geometria
+ EgtApplyMachining(True)
+ EgtDraw()
+ ' Ricarico la lista operazioni per avere quella nuova
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST)
- Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, False)
+ ' disabilito la modalità nuova lavorazione
+ Application.Msn.NotifyColleagues(Application.NEWMACHININGMODEISACTIVE, False)
End If
End Sub
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml
index 2d47ba8..4fb267b 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml
@@ -12,7 +12,7 @@
+ MaxHeight="400" x:Name="OperationList" IsEnabled="{Binding IsEnabledOperationList}">
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb
index 4bb052a..c84d8e6 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb
@@ -6,8 +6,42 @@ Namespace EgtCAM5
Public Class OperationExpanderViewModel
Inherits ViewModelBase
+ ' Modalità di aggiunta attiva/disattiva
+ Private m_NewMachining As Boolean = False
+ Public Property NewMachining As Boolean
+ Get
+ Return m_NewMachining
+ End Get
+ Set(value As Boolean)
+ If value <> m_NewMachining Then
+ If value Then
+ ' Smarco la geometria eventualmente marcata
+ If Not IsNothing(m_LastMarkedOperationId) Then EgtResetMark(m_LastMarkedOperationId)
+ ' Deseleziono eventuali geometrie selezionate
+ EgtDeselectAll()
+ EgtDraw()
+ ' Blocco la lista operazioni
+ IsEnabledOperationList = False
+ ' Abilito ed apro l'expander con l'albero delle lavorazioni
+ Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, True)
+ Else
+ ' Deseleziono eventuali geometrie selezionate
+ EgtDeselectAll()
+ EgtDraw()
+ ' Sblocco la lista operazioni
+ IsEnabledOperationList = True
+ ' Disbilito e chiudo l'expander con l'albero delle lavorazioni
+ Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, False)
+ End If
+ m_NewMachining = value
+ End If
+ End Set
+ End Property
+ Private m_NewPositioning As Boolean = False
+
' Ultima lavorazione evidenziata
Private m_LastMarkedOperationId As Integer = GDB_ID.NULL
+
Private m_IsExpanded As Boolean
Public Property IsExpanded As Boolean
Get
@@ -20,6 +54,20 @@ Namespace EgtCAM5
End If
End Set
End Property
+
+ Private m_IsEnabledOperationList As Boolean = True
+ Public Property IsEnabledOperationList As Boolean
+ Get
+ Return m_IsEnabledOperationList
+ End Get
+ Set(value As Boolean)
+ If value <> m_IsEnabledOperationList Then
+ m_IsEnabledOperationList = value
+ OnPropertyChanged("IsEnabledOperationList")
+ End If
+ End Set
+ End Property
+
Private m_OperationList As New ObservableCollection(Of OperationListBoxItem)
Public Property OperationList As ObservableCollection(Of OperationListBoxItem)
Get
@@ -37,14 +85,38 @@ Namespace EgtCAM5
End Get
Set(value As OperationListBoxItem)
If value IsNot m_SelectedOperation Then
- 'EgtSetCurrMachining(value.Id)
+ ' Verifico se c'è l'operazione precedente
If m_LastMarkedOperationId <> GDB_ID.NULL Then
+ ' La deevidenzio
EgtResetMark(m_LastMarkedOperationId)
+ ' Ne deseleziono la geometria
+ EgtDeselectAll()
+ End If
+ ' Verifico se l'operazione è una disposizione
+ If EgtGetOperationType(value.Id) = MCH_OY.DISP Then
+
+ ' L'operazione è una lavorazione
+ Else
+ ' Imposto come corrente la lavorazione(operazione) selezionata
+ EgtSetCurrMachining(value.Id)
+ ' Evidenzio la lavorazione(operazione) selezionata
+ EgtSetMark(value.Id)
+ EgtDraw()
+ ' Seleziono la geometria della lavorazione
+ Dim CountIndex = 0
+ 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
+ Dim x = EgtSelectObj(EntityIndex)
+ End If
+ CountIndex += 1
+ End While
+ ' La salvo come ultima operazione selezionata
+ m_LastMarkedOperationId = value.Id
+ ' Notifico l'operazione selezionata all'expander dei parametri operazione
+ Application.Msn.NotifyColleagues(Application.SELECTEDOPERATION, value)
End If
- EgtSetMark(value.Id)
- m_LastMarkedOperationId = value.Id
- EgtDraw()
- Application.Msn.NotifyColleagues(Application.SELECTEDOPERATION, value)
m_SelectedOperation = value
End If
End Set
@@ -62,8 +134,12 @@ Namespace EgtCAM5
Application.Msn.Register(Application.REMOVEMARKFROMLASTOPERATION, Sub()
EgtResetMark(m_LastMarkedOperationId)
End Sub)
+ Application.Msn.Register(Application.NEWMACHININGMODEISACTIVE, Sub(bValue As Boolean)
+ NewMachining = bValue
+ End Sub)
End Sub
+
#Region "COMMANDS"
#Region "NewMachiningCommand"
@@ -74,7 +150,7 @@ Namespace EgtCAM5
Public ReadOnly Property NewMachiningCommand As ICommand
Get
If m_cmdNewMachining Is Nothing Then
- m_cmdNewMachining = New RelayCommand(AddressOf NewMachining, AddressOf CanNewMachining)
+ m_cmdNewMachining = New RelayCommand(AddressOf NewMachiningCmd, AddressOf CanNewMachining)
End If
Return m_cmdNewMachining
End Get
@@ -83,9 +159,8 @@ Namespace EgtCAM5
'''
''' Execute the Point. This method is invoked by the PointCommand.
'''
- Public Sub NewMachining(ByVal param As Object)
- EgtDeselectAll()
- Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, True)
+ Public Sub NewMachiningCmd(ByVal param As Object)
+ NewMachining = True
End Sub
'''
@@ -145,7 +220,16 @@ Namespace EgtCAM5
''' Execute the Point. This method is invoked by the PointCommand.
'''
Public Sub CancelOperation(ByVal param As Object)
-
+ If m_NewMachining Then
+ NewMachining = False
+ Else
+ If Not IsNothing(SelectedOperation) Then
+ ' Rimuovo l'operazione selezionata
+ EgtRemoveOperation(SelectedOperation.Id)
+ ' Ricarico la lista delle operazioni
+ Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST)
+ End If
+ End If
End Sub
'''