f47451a60f
- modifiche per aggiunta utensile di tipo Probe e lavorazione Probing.
209 lines
11 KiB
VB.net
209 lines
11 KiB
VB.net
Imports System.IO
|
|
Imports EgtUILib
|
|
|
|
Public Module MachineUtility
|
|
|
|
#Region "Machining"
|
|
|
|
Private m_bEnableAdvMachinings As Boolean = False
|
|
Public Property EnableAdvMachinings As Boolean
|
|
Get
|
|
Return m_bEnableAdvMachinings
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bEnableAdvMachinings = value
|
|
End Set
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Method that search the machines in the correct folder and add to the MachinesList those valid.
|
|
''' </summary>
|
|
Public Function ReadMachiningFamilies(sMachineIniPath As String) As MachiningsType()
|
|
Dim ActiveMachiningsFamiliesList As New List(Of MachiningsType)
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_PROBING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.PROBING, .Name = EgtMsg(31220)}) ' Tastatura
|
|
End If
|
|
' Se il materiale lavorato è Marmo l'ordine di lettura e inserimento di Foratura e Taglio di lama nelle famiglie di lavorazioni attive è invertito
|
|
If EgtWPFLib5.MachiningTreeViewItem.m_MatType = MaterialType.STONE Then
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SAWING, .Name = EgtMsg(31202)}) ' Taglio di lama
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_DRILLING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.DRILLING, .Name = EgtMsg(31201)}) ' Foratura
|
|
End If
|
|
Else
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_DRILLING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.DRILLING, .Name = EgtMsg(31201)}) ' Foratura
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SAWING, .Name = EgtMsg(31202)}) ' Taglio di lama
|
|
End If
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_MILLING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.MILLING, .Name = EgtMsg(31203)}) ' Fresatura
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_POCKETING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.POCKETING, .Name = EgtMsg(31204)}) ' Svuotatura
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_MORTISING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.MORTISING, .Name = EgtMsg(31205)}) ' Mortasatura
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWROUGHING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SAWROUGHING, .Name = EgtMsg(31206)}) ' Sgrossatura con lama
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWFINISHING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SAWFINISHING, .Name = EgtMsg(31207)}) ' Finitura con lama
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_GENMACHINING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.GENMACHINING, .Name = EgtMsg(31208)}) ' Lav. generica
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_CHISELING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.CHISELING, .Name = EgtMsg(31209)}) ' Scalpellatura
|
|
End If
|
|
If m_bEnableAdvMachinings AndAlso EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SURFROUGHING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SURFROUGHING, .Name = EgtMsg(31212)}) ' Sgrossatura superfici
|
|
End If
|
|
If m_bEnableAdvMachinings AndAlso EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SURFFINISHING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SURFFINISHING, .Name = EgtMsg(31211)}) ' Finitura superfici
|
|
End If
|
|
If m_bEnableAdvMachinings AndAlso EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_5AXMILLING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.FIVEAXISMILLING, .Name = EgtMsg(31213)}) ' Lav. 5 assi
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_WATERJETTING, 0, sMachineIniPath) <> 0 Then
|
|
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.WATERJETTING, .Name = EgtMsg(31210)}) ' Waterjetting
|
|
End If
|
|
Return ActiveMachiningsFamiliesList.ToArray
|
|
End Function
|
|
|
|
' Funzione che verifica l'esistenza e la connessione della cartella Machines
|
|
Public Function VerifyMachinesDir(sMachinesDirPath As String) As Boolean
|
|
' verifico l'esistenza della cartella Machines
|
|
If String.IsNullOrWhiteSpace(sMachinesDirPath) Then
|
|
Return False
|
|
End If
|
|
Return RecursiveVerifyMachinesDir(sMachinesDirPath)
|
|
End Function
|
|
|
|
Private Function RecursiveVerifyMachinesDir(sMachinesDirPath As String) As Boolean
|
|
If Directory.Exists(sMachinesDirPath) Then
|
|
Return True
|
|
Else
|
|
If MessageBox.Show(String.Format(EgtMsg(8113) & Environment.NewLine & EgtMsg(8114), sMachinesDirPath), EgtMsg(15001), MessageBoxButton.YesNo, MessageBoxImage.Error) = MessageBoxResult.Yes Then
|
|
'If EgtMessageBoxV.Show(Application.Current.MainWindow, String.Format(EgtMsg(8113) & Environment.NewLine & EgtMsg(8114), sMachinesDirPath), EgtMsg(15001), MessageBoxButton.YesNo, MessageBoxImage.Error) = MessageBoxResult.Yes Then ' Impossibile trovare la cartella delle macchine {0}. Se la cartella delle macchine è su un server, verificare che la connessione sia attiva. - Provare a ricaricare la macchina? - ERRORE
|
|
Return RecursiveVerifyMachinesDir(sMachinesDirPath)
|
|
End If
|
|
Return False
|
|
End If
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Structure that represent a machining's family, containing family type and family name
|
|
''' </summary>
|
|
Public Class MachiningsType
|
|
Inherits VMBase
|
|
|
|
Public Id As MCH_MY
|
|
|
|
Private m_Name As String
|
|
Public Property Name As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
Set(value As String)
|
|
m_Name = value
|
|
End Set
|
|
End Property
|
|
|
|
End Class
|
|
|
|
#End Region ' Machining
|
|
|
|
#Region "Tool"
|
|
|
|
''' <summary>
|
|
''' Method that search the machines in the correct folder and add to the MachinesList those valid.
|
|
''' </summary>
|
|
Public Function ReadToolFamilies(sMachineIniPath As String) As ToolsFamily()
|
|
Dim ActiveToolsFamiliesList As New List(Of ToolsFamily)
|
|
Dim ActiveMachiningsFamiliesList As New List(Of MachiningsType)
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_PROBE, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.PROBE, EgtMsg(31011))) ' Tastatore
|
|
End If
|
|
' Se il materiale lavorato è Marmo l'ordine di lettura e inserimento di Punta e Lama nelle famiglie di utensili attivi è invertito
|
|
If EgtWPFLib5.ToolDbWindowVM.m_MatType = MaterialType.STONE Then
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_SAWBLADE, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.SAWBLADE, EgtMsg(31002))) ' Lama
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_DRILLBIT, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.DRILLBIT, EgtMsg(31001))) ' Punta
|
|
End If
|
|
Else
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_DRILLBIT, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.DRILLBIT, EgtMsg(31001))) ' Punta
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_SAWBLADE, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.SAWBLADE, EgtMsg(31002))) ' Lama
|
|
End If
|
|
End If
|
|
|
|
If EgtWPFLib5.ToolDbWindowVM.m_MatType = MaterialType.STONE Then
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_MILL, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.MILL, EgtMsg(31003))) ' Fresa
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_CUPWHEEL, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.MILL, EgtMsg(90754))) ' Mola da scasso
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_POLISHINGWHEEL, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.MILL, EgtMsg(90756))) ' Mola lucidante
|
|
End If
|
|
Else
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_MILL, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.MILL, EgtMsg(31003))) ' Fresa
|
|
End If
|
|
End If
|
|
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_MORTISE, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.MORTISE, EgtMsg(31004))) ' Mortasatrice
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_CHISEL, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.CHISEL, EgtMsg(31009))) ' Scalpello
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_COMPO, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.COMPO, EgtMsg(31005))) ' Composito
|
|
End If
|
|
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_WATERJET, 0, sMachineIniPath) <> 0 Then
|
|
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.WATERJET, EgtMsg(31010))) ' Waterjet
|
|
End If
|
|
Return ActiveToolsFamiliesList.ToArray
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Structure that represent a tool's family, containing family type and family name
|
|
''' </summary>
|
|
Public Class ToolsFamily
|
|
|
|
Private m_Id As MCH_TF
|
|
Public ReadOnly Property Id As MCH_TF
|
|
Get
|
|
Return m_Id
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Name As String
|
|
Public ReadOnly Property Name As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
End Property
|
|
|
|
Sub New(nFamilyId As MCH_TF, sFamilyName As String)
|
|
m_Id = nFamilyId
|
|
m_Name = sFamilyName
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
#End Region ' Tool
|
|
|
|
End Module
|