EgtCAM5 :
- Migliorie lavorazioni.
This commit is contained in:
+94
-10
@@ -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
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
@@ -145,7 +220,16 @@ Namespace EgtCAM5
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
|
||||
Reference in New Issue
Block a user