89504043b0
- migliorie varie - aggiunta gestione forature su curve e in angoli - in SplitPage si gestiscono anche le forature.
401 lines
12 KiB
VB.net
401 lines
12 KiB
VB.net
Imports EgtUILib
|
|
|
|
Public Class CurrentMachine
|
|
|
|
' Riferimento alla MainWindow
|
|
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
|
|
' Nome macchina corrente
|
|
Private m_sMachineName As String
|
|
|
|
' File ini della macchina
|
|
Private m_sMachIniFile As String
|
|
|
|
' Numero e tipo di utensili correntemente disponibili sulla macchina
|
|
Private m_MountedToolConfig As MountedToolConfigs
|
|
|
|
' Distanza di sicurezza
|
|
Private m_dSafeZ As Double
|
|
|
|
' Flag che indicano stato tipologia utensili (attivo/non attivo)
|
|
Private m_bSaw As Boolean
|
|
Private m_bDrill As Boolean
|
|
Private m_bMill As Boolean
|
|
|
|
'Flag che indicano presenza tipologia lavorazioni (attivo/non attivo)
|
|
Private m_bSawing As Boolean
|
|
Private m_bDrilling As Boolean
|
|
Private m_bMilling As Boolean
|
|
|
|
' Variabili che nel caso di porta utensili indicano quanti utensili possono essere ospitati per tipo
|
|
|
|
' Variabili che contengono il nome degli utensili disponibili per tipo
|
|
Private m_sCurrSaw(0) As String
|
|
Private m_sCurrDrill(0) As String
|
|
Private m_sCurrMill(0) As String
|
|
|
|
' Variabili che contengono le lavorazioni correntemente attive (utilizzate per definire lavorazioni nel programma)
|
|
Private m_sCurrSawing As String
|
|
Private m_sCurrDrilling As String
|
|
Private m_sCurrMilling As String
|
|
|
|
' Spessore sottopezzo
|
|
Private m_dAdditionalTable As Double
|
|
|
|
' Numero portautensili presenti
|
|
Private m_ToolChangerNum As Double
|
|
|
|
' Lista portautensili
|
|
Private m_ToolChanger As New List(Of ToolChangerPos)
|
|
|
|
' Numero portautensili manuali
|
|
Private m_ManualToolChangerNum As Double
|
|
|
|
' Lista portautensili
|
|
Private m_ManualToolChanger As New List(Of ToolChangerPos)
|
|
|
|
Friend Enum MountedToolConfigs As Integer
|
|
SAW = 0
|
|
SAWANDAUXTOOL = 1
|
|
MANUALTOOLCHANGER = 2
|
|
TOOLCHANGER = 3
|
|
End Enum
|
|
|
|
#Region "Proprietà che leggono e scrivono i valori anche da o su file ini"
|
|
|
|
Friend ReadOnly Property sMachineName As String
|
|
Get
|
|
Return m_sMachineName
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property sMachIniFile As String
|
|
Get
|
|
Return m_sMachIniFile
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property MountedToolConfig As MountedToolConfigs
|
|
Get
|
|
Return m_MountedToolConfig
|
|
End Get
|
|
End Property
|
|
|
|
Friend Property SafeZ As Double
|
|
Get
|
|
If EgtMdbGetGeneralParam(MCH_GP.SAFEZ, m_dSafeZ) Then
|
|
Return m_dSafeZ
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
Set(value As Double)
|
|
If EgtMdbSetGeneralParam(MCH_GP.SAFEZ, m_dSafeZ) And
|
|
EgtMdbSave() Then
|
|
m_dSafeZ = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend ReadOnly Property bSaw As Boolean
|
|
Get
|
|
Return m_bSaw
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property bDrill As Boolean
|
|
Get
|
|
Return m_bDrill
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property bMill As Boolean
|
|
Get
|
|
Return m_bMill
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property bSawing As Boolean
|
|
Get
|
|
Return m_bSawing
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property bDrilling As Boolean
|
|
Get
|
|
Return m_bDrilling
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property bMilling As Boolean
|
|
Get
|
|
Return m_bMilling
|
|
End Get
|
|
End Property
|
|
|
|
Friend Property sCurrSaw As String
|
|
Get
|
|
Return m_sCurrSaw(0)
|
|
End Get
|
|
Set(value As String)
|
|
If WritePrivateProfileString(S_MACH, K_CURRSAW, value, m_MainWindow.GetIniFile()) Then
|
|
m_sCurrSaw(0) = value
|
|
m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend Property sCurrDrill As String
|
|
Get
|
|
Return m_sCurrDrill(0)
|
|
End Get
|
|
Set(value As String)
|
|
If WritePrivateProfileString(S_MACH, K_CURRDRILL, value, m_MainWindow.GetIniFile()) Then
|
|
m_sCurrDrill(0) = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend Property sCurrMill As String
|
|
Get
|
|
Return m_sCurrMill(0)
|
|
End Get
|
|
Set(value As String)
|
|
If WritePrivateProfileString(S_MACH, K_CURRMILL, value, m_MainWindow.GetIniFile()) Then
|
|
m_sCurrMill(0) = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend Property sCurrSawing As String
|
|
Get
|
|
Return m_sCurrSawing
|
|
End Get
|
|
Set(value As String)
|
|
If WritePrivateProfileString(S_MACH, K_CURRSAWING, value, m_MainWindow.GetIniFile()) Then
|
|
m_sCurrSawing = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend Property sCurrDrilling As String
|
|
Get
|
|
Return m_sCurrDrilling
|
|
End Get
|
|
Set(value As String)
|
|
If WritePrivateProfileString(S_MACH, K_CURRDRILLING, value, m_MainWindow.GetIniFile()) Then
|
|
m_sCurrDrilling = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend Property sCurrMilling As String
|
|
Get
|
|
Return m_sCurrMilling
|
|
End Get
|
|
Set(value As String)
|
|
If WritePrivateProfileString(S_MACH, K_CURRMILLING, value, m_MainWindow.GetIniFile()) Then
|
|
m_sCurrMilling = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend Property dAdditionalTable As Double
|
|
Get
|
|
Return m_dAdditionalTable
|
|
End Get
|
|
Set(value As Double)
|
|
If WritePrivateProfileString(S_TABLE, K_ADDITIONALTABLE, value, sMachIniFile) Then
|
|
m_sCurrMilling = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend ReadOnly Property dToolChangerNum As Double
|
|
Get
|
|
Return m_ToolChangerNum
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property ToolChanger As List(Of ToolChangerPos)
|
|
Get
|
|
Return m_ToolChanger
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property ToolChangerName(Index As Integer) As String
|
|
Get
|
|
If Index >= 0 And Index < m_ToolChanger.Count Then
|
|
Return m_ToolChanger(Index).sName
|
|
Else
|
|
Return String.Empty
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Friend WriteOnly Property ToolPos(Index As Integer) As String
|
|
Set(value As String)
|
|
If value <> m_ToolChanger(Index).sTool Then
|
|
m_ToolChanger(Index).sTool = value
|
|
WritePrivateProfileString(S_TOOLCHANGER, K_POS & Index + 1, value, sMachIniFile)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend ReadOnly Property dManualToolChangerNum As Double
|
|
Get
|
|
Return m_ManualToolChangerNum
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property ManualToolChanger As List(Of ToolChangerPos)
|
|
Get
|
|
Return m_ManualToolChanger
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property ManualToolChangerName(Index As Integer) As String
|
|
Get
|
|
If Index >= 0 And Index < m_ManualToolChanger.Count Then
|
|
Return m_ManualToolChanger(Index).sName
|
|
Else
|
|
Return String.Empty
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Friend WriteOnly Property ManualToolPos(Index As Integer) As String
|
|
Set(value As String)
|
|
If value <> m_ManualToolChanger(Index).sTool Then
|
|
m_ManualToolChanger(Index).sTool = value
|
|
WritePrivateProfileString(S_TOOLCHANGER, K_MANUALPOS & Index + 1, value, sMachIniFile)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
Sub New()
|
|
|
|
' Leggo da file ini nome macchina corrente
|
|
GetPrivateProfileString(S_MACH, K_CURRMACH, "", m_sMachineName, m_MainWindow.GetIniFile())
|
|
' Impostazione path MachIni file
|
|
m_sMachIniFile = m_MainWindow.GetMachinesRootDir & "\" & sMachineName & "\" & sMachineName & ".ini"
|
|
' Leggo configurazione degli utensili in macchina
|
|
m_MountedToolConfig = GetPrivateProfileInt(S_TOOLS, K_MOUNTEDTOOLCONFIG, 0, sMachIniFile)
|
|
' Leggo flag presenza tipologie utensili
|
|
' lama
|
|
If GetPrivateProfileInt(S_TOOLS, K_SAWBLADE, Nothing, sMachIniFile) > 0 Then
|
|
m_bSaw = True
|
|
Else
|
|
m_bSaw = False
|
|
End If
|
|
' foretto
|
|
If GetPrivateProfileInt(S_TOOLS, K_DRILLBIT, Nothing, sMachIniFile) > 0 Then
|
|
m_bDrill = True
|
|
Else
|
|
m_bDrill = False
|
|
End If
|
|
' fresa
|
|
If GetPrivateProfileInt(S_TOOLS, K_MILL, Nothing, sMachIniFile) > 0 Then
|
|
m_bMill = True
|
|
Else
|
|
m_bMill = False
|
|
End If
|
|
' Leggo flag presenza tipologie lavorazioni
|
|
' lama
|
|
If GetPrivateProfileInt(S_MACHININGS, K_SAWING, Nothing, sMachIniFile) > 0 Then
|
|
m_bSawing = True
|
|
Else
|
|
m_bSawing = False
|
|
End If
|
|
' foretto
|
|
If GetPrivateProfileInt(S_MACHININGS, K_DRILLING, Nothing, sMachIniFile) > 0 Then
|
|
m_bDrilling = True
|
|
Else
|
|
m_bDrilling = False
|
|
End If
|
|
' fresa
|
|
If GetPrivateProfileInt(S_MACHININGS, K_MILLING, Nothing, sMachIniFile) > 0 Then
|
|
m_bMilling = True
|
|
Else
|
|
m_bMilling = False
|
|
End If
|
|
|
|
' Leggo utensili correnti
|
|
' lama
|
|
GetPrivateProfileString(S_MACH, K_CURRSAW, Nothing, m_sCurrSaw(0), m_MainWindow.GetIniFile())
|
|
' foretto
|
|
GetPrivateProfileString(S_MACH, K_CURRDRILL, Nothing, m_sCurrDrill(0), m_MainWindow.GetIniFile())
|
|
' fresa
|
|
GetPrivateProfileString(S_MACH, K_CURRMILL, Nothing, m_sCurrMill(0), m_MainWindow.GetIniFile())
|
|
|
|
' Leggo lavorazioni correnti
|
|
' lama
|
|
GetPrivateProfileString(S_MACH, K_CURRSAWING, Nothing, m_sCurrSawing, m_MainWindow.GetIniFile())
|
|
' foretto
|
|
GetPrivateProfileString(S_MACH, K_CURRDRILLING, Nothing, m_sCurrDrilling, m_MainWindow.GetIniFile())
|
|
' fresa
|
|
GetPrivateProfileString(S_MACH, K_CURRMILLING, Nothing, m_sCurrMilling, m_MainWindow.GetIniFile())
|
|
|
|
' Leggo numero di portautensili
|
|
m_ToolChangerNum = GetPrivateProfileInt(S_TOOLCHANGER, K_NUMBER, 0, sMachIniFile)
|
|
|
|
' Leggo da file ini nomi e utensili presenti in portautensili
|
|
For Index = 1 To m_ToolChangerNum
|
|
Dim sName As String = String.Empty
|
|
Dim sTool As String = String.Empty
|
|
GetPrivateProfileString(S_TOOLCHANGER, K_NAME & Index, Nothing, sName, sMachIniFile)
|
|
GetPrivateProfileString(S_TOOLCHANGER, K_POS & Index, Nothing, sTool, sMachIniFile)
|
|
m_ToolChanger.Add(New ToolChangerPos(Index, sName, sTool))
|
|
Next
|
|
' Leggo numero portautensili manuali
|
|
m_ManualToolChangerNum = GetPrivateProfileInt(S_TOOLCHANGER, K_MANUALNUMBER, 0, sMachIniFile)
|
|
|
|
' Leggo da file ini nomi e utensili manuali presenti
|
|
For Index = 1 To m_ManualToolChangerNum
|
|
Dim sName As String = String.Empty
|
|
Dim sTool As String = String.Empty
|
|
GetPrivateProfileString(S_TOOLCHANGER, K_MANUALNAME & Index, Nothing, sName, sMachIniFile)
|
|
GetPrivateProfileString(S_TOOLCHANGER, K_MANUALPOS & Index, Nothing, sTool, sMachIniFile)
|
|
m_ManualToolChanger.Add(New ToolChangerPos(Index, sName, sTool))
|
|
Next
|
|
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Class ToolChangerPos
|
|
|
|
Private m_sPosition As Integer
|
|
Private m_sName As String = String.Empty
|
|
Private m_sTool As String = String.Empty
|
|
|
|
Public ReadOnly Property sPosition As Integer
|
|
Get
|
|
Return m_sPosition
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sName As String
|
|
Get
|
|
Return m_sName
|
|
End Get
|
|
End Property
|
|
|
|
Public Property sTool As String
|
|
Get
|
|
Return m_sTool
|
|
End Get
|
|
Set(value As String)
|
|
m_sTool = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(sPosition As Integer, sName As String, sTool As String)
|
|
m_sPosition = sPosition
|
|
m_sName = sName
|
|
m_sTool = sTool
|
|
End Sub
|
|
|
|
End Class |