Imports System.ComponentModel Imports System.IO Imports EgtUILib Public Module MachineModel #Region "Machining" Friend Sub LoadMachiningListByType(MachiningList As List(Of String), nType As MCH_MY) MachiningList.Clear() Dim MachiningName As String = String.Empty EgtMdbGetFirstMachining(nType, MachiningName) While Not String.IsNullOrWhiteSpace(MachiningName) MachiningList.Add(MachiningName) EgtMdbGetNextMachining(nType, MachiningName) End While End Sub Friend Sub LoadMachiningListByType(MachiningList As List(Of String), nMachiningType As MCH_MY, nToolType As MCH_TF, Optional bClearList As Boolean = True) If bClearList Then MachiningList.Clear() Dim MachiningName As String = String.Empty EgtMdbGetFirstMachining(nMachiningType, MachiningName) While Not String.IsNullOrWhiteSpace(MachiningName) ' se il tipo di utensile è nullo, prendo tutte le lavorazioni If IsNothing(nToolType) OrElse nToolType = 0 Then MachiningList.Add(MachiningName) Else ' recupero l'utensile utilizzato EgtMdbSetCurrMachining(MachiningName) Dim sCurrTool As String = String.Empty Dim sTUUID As String = String.Empty EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID) EgtTdbGetToolFromUUID(sTUUID, sCurrTool) EgtTdbSetCurrTool(sCurrTool) Dim ToolType As Integer = MCH_TY.NONE EgtTdbGetCurrToolParam(MCH_TP.TYPE, ToolType) ' se il tipo di utensile coincide, aggiungo la lavorazione If (ToolType And nToolType) <> 0 Then MachiningList.Add(MachiningName) End If End If EgtMdbGetNextMachining(nMachiningType, MachiningName) End While End Sub ''' ''' Structure that represent a tool's family, containing family type and family name ''' Public Class MachiningsType Implements INotifyPropertyChanged Friend TypeId As MCH_MY Private m_TypeName As String Public Property TypeName As String Get Return m_TypeName End Get Set(value As String) m_TypeName = value End Set End Property Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged Public Sub NotifyPropertyChanged(propName As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) End Sub End Class #End Region ' Machining #Region "Tool" ''' ''' Structure that represent a tool's family, containing family type and family name ''' Friend Class ToolsFamily Private m_FamilyId As MCH_TF Public ReadOnly Property FamilyId As MCH_TF Get Return m_FamilyId End Get End Property Private m_FamilyName As String Public ReadOnly Property FamilyName As String Get Return m_FamilyName End Get End Property Sub New(nFamilyId As MCH_TF, sFamilyName As String) m_FamilyId = nFamilyId m_FamilyName = sFamilyName End Sub End Class #End Region ' Tool End Module