44e97c3452
- introdotto calcolo volume dato contorno pareti - aggiunta in supervisore gestione tabella MDI - aggiunto salvataggio progetto dopo aggiornamento duplo - girate tutte le viste per macchine inverse, anche in supervisore - nacosti pezzi quando in ottimizzatore o supervisore senza Machgroup - scritte BTLPartList in verde se raggiunta quantita' INPROD - aggiunta gestione bottoni abilitati/disabilitati a seconda degli elementi selezionati - introdotta modifica dimensioni grezzi - corretto errore che non impostava corretamente progetto quando aperto da ottimizzatore - smontato assemblato prima di eseguire alcuni comandi per poi ripristinarlo
238 lines
7.9 KiB
VB.net
238 lines
7.9 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports EgtBEAMWALL.Core
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Module CurrentMachine
|
|
|
|
' Nome macchina corrente
|
|
Private m_sMachineName As String = String.Empty
|
|
' Direttorio macchina corrente
|
|
Private m_sMachDir As String = String.Empty
|
|
' File ini della macchina
|
|
Private m_sMachIniFile As String = String.Empty
|
|
' File ini dei parametri macchina
|
|
Private m_sMachParamIniFile As String = String.Empty
|
|
' Cartella degli script
|
|
Private m_sMachScriptDir As String = String.Empty
|
|
' Cartella dei setup
|
|
Private m_sMachSetupDir As String = String.Empty
|
|
' Tipo macchina
|
|
Private m_nType As MachineType
|
|
|
|
' Posizione vista
|
|
Private m_nViewDir As VT
|
|
Public ReadOnly Property ViewDir As VT
|
|
Get
|
|
Return m_nViewDir
|
|
End Get
|
|
End Property
|
|
' Posizione riferimento principale grezzo su tavola
|
|
Private m_OrigCorner As MCH_CR
|
|
Public ReadOnly Property OrigCorner As MCH_CR
|
|
Get
|
|
Return m_OrigCorner
|
|
End Get
|
|
End Property
|
|
' Posizione origine del grezzo per posizionamento pezzi
|
|
Private m_NestingCorner As MCH_CR
|
|
Public ReadOnly Property NestingCorner As MCH_CR
|
|
Get
|
|
Return m_NestingCorner
|
|
End Get
|
|
End Property
|
|
' Diametro fori lunghi
|
|
Private m_dHorDrillDiam As Double = 0
|
|
Public ReadOnly Property dHorDrillDiam As Double
|
|
Get
|
|
Return m_dHorDrillDiam
|
|
End Get
|
|
End Property
|
|
|
|
#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 sMachDir As String
|
|
Get
|
|
Return m_sMachDir
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property sMachIniFile As String
|
|
Get
|
|
Return m_sMachIniFile
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property sMachParamIniFile As String
|
|
Get
|
|
Return m_sMachParamIniFile
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property sMachScriptDir As String
|
|
Get
|
|
Return m_sMachScriptDir
|
|
End Get
|
|
End Property
|
|
|
|
Friend ReadOnly Property sMachSetupDir As String
|
|
Get
|
|
Return m_sMachSetupDir
|
|
End Get
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
Friend ReadOnly Property nType As MachineType
|
|
Get
|
|
Return m_nType
|
|
End Get
|
|
End Property
|
|
|
|
Private m_MachTableList As New ObservableCollection(Of MachTable)
|
|
Public Property MachTableList As ObservableCollection(Of MachTable)
|
|
Get
|
|
Return m_MachTableList
|
|
End Get
|
|
Set(value As ObservableCollection(Of MachTable))
|
|
m_MachTableList = value
|
|
End Set
|
|
End Property
|
|
|
|
#Region "Init"
|
|
|
|
Sub InitCurrentMachine(sMachinesRootDir As String, sMachineName As String, nMachineType As MachineType)
|
|
' Nome macchina corrente
|
|
m_sMachineName = sMachineName
|
|
' Impostazione direttorio macchina
|
|
m_sMachDir = sMachinesRootDir & "\" & sMachineName
|
|
' Impostazione path MachIni file
|
|
m_sMachIniFile = sMachinesRootDir & "\" & sMachineName & "\" & sMachineName & ".ini"
|
|
' Impostazione tipo macchina
|
|
m_nType = nMachineType
|
|
' Impostazione path MachParamIni file
|
|
If nType = MachineType.BEAM Then
|
|
m_sMachParamIniFile = sMachinesRootDir & "\" & sMachineName & "\" & K_BEAM & "\" & MACH_INI_FILE_NAME
|
|
ElseIf nType = MachineType.WALL Then
|
|
m_sMachParamIniFile = sMachinesRootDir & "\" & sMachineName & "\" & K_WALL & "\" & MACH_INI_FILE_NAME
|
|
Else
|
|
' Se macchina di tipo BOTH prendo quello presente in Beam, se esiste, altrimenti prendo quello in Wall
|
|
Dim sBeamMachParamIniFile = sMachinesRootDir & "\" & sMachineName & "\" & K_BEAM & "\" & MACH_INI_FILE_NAME
|
|
Dim sWallMachParamIniFile = sMachinesRootDir & "\" & sMachineName & "\" & K_WALL & "\" & MACH_INI_FILE_NAME
|
|
If nType = MachineType.BOTH Then
|
|
m_sMachParamIniFile = If(File.Exists(sBeamMachParamIniFile), sBeamMachParamIniFile, sWallMachParamIniFile)
|
|
End If
|
|
End If
|
|
' Impostazione path Script dir
|
|
m_sMachScriptDir = sMachinesRootDir & "\" & sMachineName & "\" & K_SCRIPT
|
|
' Impostazione path Setup dir
|
|
m_sMachSetupDir = sMachinesRootDir & "\" & sMachineName & "\" & K_SETUP
|
|
|
|
' crea l'elenco dei parametri della macchina corrente
|
|
CreateMachParams()
|
|
|
|
' leggo parametri macchina da WallData
|
|
If nType = MachineType.WALL Then
|
|
' Assegno i dati
|
|
EgtLuaCreateGlobTable("GWD")
|
|
EgtLuaSetGlobStringVar("GWD.MACHINE", m_sMachineName)
|
|
' Eseguo lo script
|
|
Dim sExecPath As String = Map.refMainWindowVM.MainWindowM.sWallRoot & "\" & GETWALLDATA_FILE_NAME
|
|
Dim bOk As Boolean = False
|
|
If EgtLuaExecFile(sExecPath) Then
|
|
' Recupero i risultati
|
|
Dim nErr As Integer = 999
|
|
EgtLuaGetGlobIntVar("GWD.ERR", nErr)
|
|
bOk = (nErr = 0)
|
|
If Not bOk Then EgtOutLog("GetWallData Err=" & nErr.ToString())
|
|
Else
|
|
bOk = False
|
|
EgtOutLog("Error executing GetWallData script " & sExecPath)
|
|
End If
|
|
If bOk Then
|
|
EgtLuaGetGlobIntVar("GWD.HOR_DRILL_DIAM", m_dHorDrillDiam)
|
|
Dim nTemp As Integer
|
|
EgtLuaGetGlobIntVar("GWD.SIMUL_VIEW_DIR", nTemp)
|
|
Select Case nTemp
|
|
Case 1
|
|
m_nViewDir = VT.ISO_NW
|
|
Case 2
|
|
m_nViewDir = VT.ISO_SW
|
|
Case 3
|
|
m_nViewDir = VT.ISO_NE
|
|
Case 4
|
|
m_nViewDir = VT.ISO_SE
|
|
End Select
|
|
Dim sTemp As String = ""
|
|
EgtLuaGetGlobStringVar("GWD.ORIG_CORNER", sTemp)
|
|
Select Case sTemp
|
|
Case "TL"
|
|
m_OrigCorner = MCH_CR.TL
|
|
Case "TR"
|
|
m_OrigCorner = MCH_CR.TR
|
|
Case "BL"
|
|
m_OrigCorner = MCH_CR.BL
|
|
Case "BR"
|
|
m_OrigCorner = MCH_CR.BR
|
|
End Select
|
|
EgtLuaGetGlobStringVar("GWD.NESTING_CORNER", sTemp)
|
|
Select Case sTemp
|
|
Case "TL"
|
|
m_NestingCorner = MCH_CR.TL
|
|
Case "TR"
|
|
m_NestingCorner = MCH_CR.TR
|
|
Case "BL"
|
|
m_NestingCorner = MCH_CR.BL
|
|
Case "BR"
|
|
m_NestingCorner = MCH_CR.BR
|
|
End Select
|
|
End If
|
|
' Cancello tavola globale
|
|
EgtLuaResetGlobVar("GWD")
|
|
' aggiorno parametro in gestore viste
|
|
Core.ViewPanelVM.UpdateMachParam(m_nViewDir)
|
|
' carico valori default opzioni nesting
|
|
Map.refOptimizePanelVM.bLDIntersOther = GetMainPrivateProfileInt(S_NEST, K_LDINTERSOTHER, 0)
|
|
Map.refOptimizePanelVM.dMinScore = GetMainPrivateProfileInt(S_NEST, K_MINSCORE, 0)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#End Region 'Init
|
|
|
|
#Region "Methods"
|
|
|
|
' funzione che crea l'elenco dei parametri Macchina
|
|
Friend Sub CreateMachParams()
|
|
MachTableList.Clear()
|
|
Dim NewMachParam As MachParam = Nothing
|
|
Dim MachParamList As New ObservableCollection(Of MachParam)
|
|
Dim TableIndex = 1
|
|
Dim ParamIndex As Integer = 1
|
|
Dim TableName As String = String.Empty
|
|
' verifico che ci sia una table con l'indice designato e ne leggo il nome
|
|
While GetMachPrivateProfileString(TableIndex, K_NAME, "", TableName)
|
|
' leggo tutti i parametri della table
|
|
While MachParamIniFile.GetMachPrivateProfileParam(TableIndex, ParamIndex, NewMachParam)
|
|
MachParamList.Add(NewMachParam)
|
|
ParamIndex += 1
|
|
End While
|
|
MachTableList.Add(New MachTable(TableName, MachParamList))
|
|
' aggiorno indici e resetto lista per lettura dell'eventuale table successiva
|
|
TableIndex += 1
|
|
ParamIndex = 1
|
|
MachParamList = New ObservableCollection(Of MachParam)
|
|
End While
|
|
End Sub
|
|
|
|
#End Region 'Methods
|
|
|
|
End Module
|