diff --git a/EgtBEAMWALL.Core/BTLFeature.vb b/EgtBEAMWALL.Core/BTLFeature.vb
new file mode 100644
index 00000000..30fd8238
--- /dev/null
+++ b/EgtBEAMWALL.Core/BTLFeature.vb
@@ -0,0 +1,409 @@
+Imports System.Collections.ObjectModel
+Imports System.Windows
+Imports System.Windows.Input
+Imports System.Windows.Media
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class BTLFeature
+ Inherits VMBase
+
+ ' Feature a cui appartiene il parametro
+ Protected m_ParentPart As BTLPart
+ Public ReadOnly Property ParentPart As BTLPart
+ Get
+ Return m_ParentPart
+ End Get
+ End Property
+
+ ' Id geometrico della feature
+ Protected m_nFeatureId As Integer
+ Public ReadOnly Property nFeatureId As Integer
+ Get
+ Return m_nFeatureId
+ End Get
+ End Property
+ Public Sub SetFeatureId(nFeatureId As Integer)
+ m_nFeatureId = nFeatureId
+ End Sub
+
+ ' lista dei gruppi
+ Protected m_GRPList As New ObservableCollection(Of Integer)
+ Public Property GRPList As ObservableCollection(Of Integer)
+ Get
+ Return m_GRPList
+ End Get
+ Set(value As ObservableCollection(Of Integer))
+ m_GRPList = value
+ End Set
+ End Property
+
+ Protected m_nSelGRP As Integer = -1
+ Public Overridable Property nSelGRP As Integer
+ Get
+ Return m_nSelGRP
+ End Get
+ Set(value As Integer)
+ m_nSelGRP = value
+ End Set
+ End Property
+
+ ' Processo
+ Protected m_nPRC As Integer
+ Public Property nPRC As Integer
+ Get
+ Return m_nPRC
+ End Get
+ Set(value As Integer)
+ m_nPRC = value
+ End Set
+ End Property
+
+ ' Lato
+ Protected m_SIDEList As New ObservableCollection(Of Integer)({1, 2, 3, 4})
+ Public Property SIDEList As ObservableCollection(Of Integer)
+ Get
+ Return m_SIDEList
+ End Get
+ Set(value As ObservableCollection(Of Integer))
+ m_SIDEList = value
+ End Set
+ End Property
+ Protected m_nSelSIDE As Integer = -1
+ Public Overridable Property nSelSIDE As Integer
+ Get
+ Return m_nSelSIDE
+ End Get
+ Set(value As Integer)
+ m_nSelSIDE = value
+ End Set
+ End Property
+
+ ' Nome
+ Protected m_sName As String
+ Public ReadOnly Property sName As String
+ Get
+ Return m_sName
+ End Get
+ End Property
+ Public Sub SetName(sName As String)
+ m_sName = sName
+ End Sub
+
+ Protected m_bDO As Boolean
+ Public Overridable Property bDO As Boolean
+ Get
+ Return m_bDO
+ End Get
+ Set(value As Boolean)
+ m_bDO = value
+ End Set
+ End Property
+
+ Protected m_nPRID As Integer
+ Public Property nPRID As Integer
+ Get
+ Return m_nPRID
+ End Get
+ Set(value As Integer)
+ m_nPRID = value
+ End Set
+ End Property
+
+ Protected m_sDES As String = String.Empty
+ Public Property sDES As String
+ Get
+ Return m_sDES
+ End Get
+ Set(value As String)
+ m_sDES = value
+ End Set
+ End Property
+
+ Protected m_frFRAME As New Frame3d
+ Public Property frFRAME As Frame3d
+ Get
+ Return m_frFRAME
+ End Get
+ Set(value As Frame3d)
+ m_frFRAME = value
+ End Set
+ End Property
+
+ Protected m_nState As CalcStates = -1
+ Public ReadOnly Property nState As CalcStates
+ Get
+ Return m_nState
+ End Get
+ End Property
+
+ Protected m_nCALC_ERR As Integer = -1
+ Public ReadOnly Property nCALC_ERR As Integer
+ Get
+ Return m_nCALC_ERR
+ End Get
+ End Property
+
+ Protected m_nCALC_ROT As Integer
+ Public ReadOnly Property nCALC_ROT As Integer
+ Get
+ Return m_nCALC_ROT
+ End Get
+ End Property
+
+ Protected m_nCALC_FALL As Integer
+ Public ReadOnly Property nCALC_FALL As Integer
+ Get
+ Return m_nCALC_FALL
+ End Get
+ End Property
+
+ Protected m_sCALC_MSG As String
+ Public ReadOnly Property nCALC_MSG As String
+ Get
+ Return m_sCALC_MSG
+ End Get
+ End Property
+
+ ' lista dei parametri della feature
+ Protected m_PParamList As ObservableCollection(Of BTLParam)
+ Public Property PParamList As ObservableCollection(Of BTLParam)
+ Get
+ Return m_PParamList
+ End Get
+ Set(value As ObservableCollection(Of BTLParam))
+ m_PParamList = value
+ End Set
+ End Property
+
+ Protected m_SelPParam As BTLParam
+ Public Overridable Property SelPParam As BTLParam
+ Get
+ Return m_SelPParam
+ End Get
+ Set(value As BTLParam)
+ m_SelPParam = value
+ End Set
+ End Property
+
+ ' lista dei parametri della feature
+ Protected m_QParamList As ObservableCollection(Of BTLParam)
+ Public Property QParamList As ObservableCollection(Of BTLParam)
+ Get
+ Return m_QParamList
+ End Get
+ Set(value As ObservableCollection(Of BTLParam))
+ m_QParamList = value
+ End Set
+ End Property
+
+ Protected m_SelQParam As BTLParam
+ Public Overridable Property SelQParam As BTLParam
+ Get
+ Return m_SelQParam
+ End Get
+ Set(value As BTLParam)
+ m_SelQParam = value
+ End Set
+ End Property
+
+#Region "MESSAGES"
+
+ Public ReadOnly Property Name_Msg As String
+ Get
+ Return EgtMsg(61614)
+ End Get
+ End Property
+
+ Public ReadOnly Property Value_Msg As String
+ Get
+ Return EgtMsg(61615)
+ End Get
+ End Property
+
+ Public ReadOnly Property Min_Msg As String
+ Get
+ Return EgtMsg(61616)
+ End Get
+ End Property
+
+ Public ReadOnly Property Max_Msg As String
+ Get
+ Return EgtMsg(61617)
+ End Get
+ End Property
+
+#End Region
+
+ Sub New(ParentPart As BTLPart, nFeatureId As Integer)
+ m_ParentPart = ParentPart
+ m_nFeatureId = nFeatureId
+ m_PParamList = New ObservableCollection(Of BTLParam)
+ m_QParamList = New ObservableCollection(Of BTLParam)
+ End Sub
+
+ Sub New(nPRC As Integer, nGRP As Integer, nSIDE As Integer)
+ m_PParamList = New ObservableCollection(Of BTLParam)
+ m_QParamList = New ObservableCollection(Of BTLParam)
+ m_nPRC = nPRC
+ m_nSelGRP = nGRP
+ m_nSelSIDE = nSIDE
+ m_bDO = True
+ End Sub
+
+ ' funzione che crea l'elenco dei parametri
+ Public Overridable Sub CreateFeatureParams()
+ Dim ParamIndex As Integer = 1
+ Dim NewBTLParam As BTLParam = Nothing
+ ' leggo tutti i P della feature
+ While BTLIniFile.GetBeamPrivateProfileParam(m_nSelGRP, m_nPRC, True, ParamIndex, Me, NewBTLParam)
+ m_PParamList.Add(NewBTLParam)
+ ParamIndex += 1
+ End While
+ ' leggo tutti i Q della feature
+ ParamIndex = 1
+ While BTLIniFile.GetBeamPrivateProfileParam(m_nSelGRP, m_nPRC, False, ParamIndex, Me, NewBTLParam)
+ m_QParamList.Add(NewBTLParam)
+ ParamIndex += 1
+ End While
+ End Sub
+
+ ' funzione che legge il valore corrente del parametro
+ Public Function ReadFeatureParams() As Boolean
+ Return ReadFeatureParams(PParamList) And ReadFeatureParams(QParamList)
+ End Function
+ Private Function ReadFeatureParams(ParamList As ObservableCollection(Of Core.BTLParam)) As Boolean
+ ' leggo valore parametro da struttura geometrica
+ For Each Param As BTLParam In ParamList
+ If Param.nType = BTLParamType.DOUBLE_ Or Param.nType = BTLParamType.LENGTH Then
+ Dim dParamValue As Double = 0
+ If Not EgtGetInfo(m_nFeatureId, Param.sName, dParamValue) Then
+ dParamValue = 0
+ End If
+ Param.dValue = dParamValue
+ ElseIf Param.nType = BTLParamType.STRING_ Then
+ Dim sParamValue As String = String.Empty
+ EgtGetInfo(m_nFeatureId, Param.sName, sParamValue)
+ Param.sValue = sParamValue
+ ElseIf Param.nType = BTLParamType.COMBO Then
+ Dim nParamValue As Integer
+ EgtGetInfo(m_nFeatureId, Param.sName, nParamValue)
+ Param.nSelValue = nParamValue
+ End If
+ Next
+ Return False
+ End Function
+
+ ' funzione che setta i valori di default a tutti i parametri
+ Public Function SetDefaultValues() As Boolean
+ Return SetDefaultValues(PParamList) And SetDefaultValues(QParamList)
+ End Function
+ Private Function SetDefaultValues(ParamList As ObservableCollection(Of Core.BTLParam)) As Boolean
+ ' leggo valore parametro da struttura geometrica
+ For Each Param As BTLParam In ParamList
+ If Param.nType = BTLParamType.DOUBLE_ Or Param.nType = BTLParamType.LENGTH Then
+ Param.dValue = Param.dDefault
+ ElseIf Param.nType = BTLParamType.STRING_ Then
+ Param.sValue = ""
+ ElseIf Param.nType = BTLParamType.COMBO Then
+ Param.nSelValue = Param.dDefault
+ End If
+ Next
+ Return False
+ End Function
+
+ ' funzione che calcola array dei valori dei parametri
+ Public Function CalcParamArray(ByRef vPar() As Double, ByRef sPar As String) As Boolean
+ ' verifico che lista parametri non sia vuota
+ If IsNothing(m_PParamList) OrElse m_PParamList.Count = 0 Then Return False
+ ' caclcolo lunghezza array
+ Dim nLastParId As Integer = m_PParamList(m_PParamList.Count - 1).nId - 1
+ Dim vTempPar(nLastParId) As Double
+ Dim sTempPar As String = String.Empty
+ ' carico tutti i parametri su array
+ For ParIndex = 0 To m_PParamList.Count - 1
+ Dim BTLPar As BTLParam = DirectCast(m_PParamList(ParIndex), BTLParam)
+ Select Case BTLPar.nType
+ Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
+ vTempPar(BTLPar.nId - 1) = BTLPar.dValue
+ Case BTLParamType.STRING_
+ sTempPar = BTLPar.sValue
+ 'Case BTLParamType.COMBO
+ ' Dim cBTLPar As BTLParamCombo = DirectCast(ParentFeature.PParamList(ParIndex), BTLParamCombo)
+ ' vPar(ParIndex) = cBTLPar.
+ End Select
+ Next
+ vPar = vTempPar
+ If String.IsNullOrEmpty(sTempPar) Then
+ sPar = " "
+ Else
+ sPar = sTempPar
+ End If
+ Return True
+ End Function
+
+ Public Overridable Function Copy() As BTLFeature
+ ' creo nuova feature
+ Dim vPar() As Double = Nothing
+ Dim sPar As String = String.Empty
+ Me.CalcParamArray(vPar, sPar)
+ ' aggiorno la feature con nuovo valore
+ EgtBeamSetPart(Me.ParentPart.nPartId)
+ Dim nNewFeatureId As Integer = EgtBeamAddProcess(Me.nSelGRP, Me.nPRC, Me.nSelSIDE, Me.sDES, Me.ParentPart.NewProcId(), Me.frFRAME, vPar, sPar)
+ ' se è stata creata
+ If nNewFeatureId <> GDB_ID.NULL Then
+ Dim NewFeat As New BTLFeature(Me.ParentPart, nNewFeatureId)
+ ' la aggiungo a struttura BTL corrente
+ Me.ParentPart.FeatureList.Add(NewFeat)
+ Return NewFeat
+ End If
+ Return Nothing
+ End Function
+
+ Public Overridable Function Copy(DestBTLPart As BTLPart) As Boolean
+ ' creo nuova feature
+ Dim vPar() As Double
+ Dim sPar As String = String.Empty
+ Me.CalcParamArray(vPar, sPar)
+ ' aggiorno la feature con nuovo valore
+ EgtBeamSetPart(DestBTLPart.nPartId)
+ Dim nNewFeatureId As Integer = EgtBeamAddProcess(Me.nSelGRP, Me.nPRC, Me.nSelSIDE, Me.sDES, DestBTLPart.NewProcId(), Me.frFRAME, vPar, sPar)
+ ' se è stata creata
+ If nNewFeatureId <> GDB_ID.NULL Then
+ Dim NewFeat As New BTLFeature(Me.ParentPart, nNewFeatureId)
+ ' la aggiungo a struttura BTL pezzo di destinazione
+ DestBTLPart.FeatureList.Add(NewFeat)
+ Return True
+ End If
+ Return False
+ End Function
+
+ ' funzione che aggiorna parametri della feature
+ Public Function UpdateParams(nNewGRP As Integer, nNewPRC As Integer, nNewSIDE As Integer, sNewDesc As String, nNewProcId As Integer,
+ frNewRef As Frame3d, vNewPar() As Double, sNewPar As String) As Boolean
+ ' aggiorno la feature con nuovo valore
+ Dim vPar() As Double = Nothing
+ Dim sPar As String = String.Empty
+ CalcParamArray(vPar, sPar)
+ Dim nFeatureId As Integer = EgtBeamModifyProcess(Me.nFeatureId, nNewGRP, nNewPRC, nNewSIDE, sNewDesc, nNewProcId,
+ frNewRef, vNewPar, sNewPar)
+ If nFeatureId <> GDB_ID.NULL Then
+ SetFeatureId(nFeatureId)
+ ' imposto modificato per copie
+ EgtDuploSetModified(ParentPart.nPartId)
+ Return True
+ Else
+ MessageBox.Show("Impossible create feature with this values", "Error")
+ nFeatureId = EgtBeamModifyProcess(Me.nFeatureId, Me.nSelGRP, Me.nPRC, Me.nSelSIDE, "", Me.nPRID, New Frame3d(), vPar, sPar)
+ SetFeatureId(nFeatureId)
+ Return False
+ End If
+ End Function
+
+ ' funzione che restituisce se la feature è un contorno libero
+ Public Function IsFreeContour() As Boolean
+ Return m_nPRC = 250 OrElse m_nPRC = 251 OrElse m_nPRC = 252
+ End Function
+
+End Class
+
diff --git a/EgtBEAMWALL.Core/BTLParam.vb b/EgtBEAMWALL.Core/BTLParam.vb
new file mode 100644
index 00000000..b8535d3e
--- /dev/null
+++ b/EgtBEAMWALL.Core/BTLParam.vb
@@ -0,0 +1,187 @@
+Imports System.Collections.ObjectModel
+Imports System.Windows
+Imports System.Windows.Input
+Imports System.Windows.Media
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class BTLParam
+ Inherits VMBase
+
+ ' parametro che dice se il parametro e' P o Q
+ Protected m_bIsP As Boolean = True
+ Public ReadOnly Property bIsP As Boolean
+ Get
+ Return m_bIsP
+ End Get
+ End Property
+
+ ' parametri da struttura
+ Protected m_sName As String
+ Public Property sName As String
+ Get
+ Return m_sName
+ End Get
+ Set(value As String)
+ m_sName = value
+ End Set
+ End Property
+
+ Protected m_nId As Integer
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Protected m_sDescription As String
+ Public Property sDescription As String
+ Get
+ Return m_sDescription
+ End Get
+ Set(value As String)
+ m_sDescription = value
+ End Set
+ End Property
+
+ ' parametri da struttura
+ Protected m_dMin As Double
+
+ Protected m_dMax As Double
+
+ Protected m_ValueList As List(Of String)
+ Public ReadOnly Property ValueList As List(Of String)
+ Get
+ Return m_ValueList
+ End Get
+ End Property
+
+ ' parametri da geometria
+ Protected m_dValue As Double
+ Protected m_sValue As String
+ Public Overridable Property sValue As String
+ Get
+ Return m_sValue
+ End Get
+ Set(value As String)
+ m_sValue = value
+ End Set
+ End Property
+ Public Overridable Property dValue As Double
+ Get
+ Return m_dValue
+ End Get
+ Set(value As Double)
+ m_dValue = value
+ End Set
+ End Property
+
+ Protected m_nSelValue As Integer
+ Public Property nSelValue As Integer
+ Get
+ Return m_nSelValue
+ End Get
+ Set(value As Integer)
+ m_nSelValue = value
+ End Set
+ End Property
+
+ Protected m_dDefault As Double
+ Public ReadOnly Property dDefault As Double
+ Get
+ Return m_dDefault
+ End Get
+ End Property
+
+ Protected m_sDrawPath As String
+
+ ' tipo della variabile
+ Protected m_nType As BTLParamType
+ Public ReadOnly Property nType As BTLParamType
+ Get
+ Return m_nType
+ End Get
+ End Property
+
+ ' Feature a cui appartiene il parametro
+ Protected m_ParentFeature As BTLFeature
+ Public ReadOnly Property ParentFeature As BTLFeature
+ Get
+ Return m_ParentFeature
+ End Get
+ End Property
+
+#Region "MESSAGES"
+
+ Public ReadOnly Property Name_Msg As String
+ Get
+ Return EgtMsg(61614)
+ End Get
+ End Property
+
+ Public ReadOnly Property Value_Msg As String
+ Get
+ Return EgtMsg(61615)
+ End Get
+ End Property
+
+ Public ReadOnly Property Min_Msg As String
+ Get
+ Return EgtMsg(61616)
+ End Get
+ End Property
+
+ Public ReadOnly Property Max_Msg As String
+ Get
+ Return EgtMsg(61617)
+ End Get
+ End Property
+
+#End Region
+
+ Public Sub StdInit(ParentFeature As BTLFeature, IsP As Boolean, Type As BTLParamType, sName As String, sDescription As String)
+ m_ParentFeature = ParentFeature
+ m_bIsP = IsP
+ m_nType = Type
+ m_sName = sName
+ Dim nDescription As Integer
+ If IsNumeric(sDescription) AndAlso Integer.TryParse(sDescription, nDescription) Then
+ m_sDescription = EgtMsg(sDescription)
+ Else
+ m_sDescription = sDescription
+ End If
+ If Not String.IsNullOrWhiteSpace(sName) Then
+ Dim sId As String = sName.Trim({"P"c, "Q"c, "p"c, "q"c})
+ Integer.TryParse(sId, m_nId)
+ End If
+ End Sub
+
+ ' new per double e length
+ Sub New(ParentFeature As BTLFeature, IsP As Boolean, nType As BTLParamType, sParamName As String, dMin As Double, dMax As Double, dDefault As Double, sDescription As String)
+ StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
+ m_dMin = dMin
+ m_dMax = dMax
+ m_dDefault = dDefault
+ End Sub
+
+ ' new per stringhe
+ Sub New(ParentFeature As BTLFeature, IsP As Boolean, nType As BTLParamType, sParamName As String, sDescription As String)
+ StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
+ End Sub
+
+ ' new per combobox
+ Sub New(ParentFeature As BTLFeature, IsP As Boolean, nType As BTLParamType, sParamName As String, nMin As Integer, nMax As Integer, nDefault As Integer, sDescription As String, ValueList As List(Of String))
+ StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
+ m_dMin = nMin
+ m_dMax = nMax
+ m_dDefault = nDefault
+ m_ValueList = ValueList
+ End Sub
+
+ ' new per parametro vuoto
+ Sub New(IsP As Boolean, nType As BTLParamType, sParamName As String)
+ StdInit(Nothing, IsP, nType, sParamName, "")
+ End Sub
+
+End Class
+
diff --git a/EgtBEAMWALL.Core/BTLPart.vb b/EgtBEAMWALL.Core/BTLPart.vb
new file mode 100644
index 00000000..a84fec75
--- /dev/null
+++ b/EgtBEAMWALL.Core/BTLPart.vb
@@ -0,0 +1,235 @@
+Imports System.Collections.ObjectModel
+
+Public Class BTLPart
+ Inherits VMBase
+
+ ' Feature a cui appartiene il parametro
+ Protected m_ParentStructure As BTLStructure
+ Public ReadOnly Property ParentStructure As BTLStructure
+ Get
+ Return m_ParentStructure
+ End Get
+ End Property
+
+ ' Id geometrico del pezzo
+ Protected m_nPartId As Integer
+ Public ReadOnly Property nPartId As Integer
+ Get
+ Return m_nPartId
+ End Get
+ End Property
+ Public WriteOnly Property SetPartId As Integer
+ Set(value As Integer)
+ m_nPartId = value
+ End Set
+ End Property
+
+ ' Info del pezzo
+ Protected m_nPDN As Integer
+ Public Property nPDN As Integer
+ Get
+ Return m_nPDN
+ End Get
+ Set(value As Integer)
+ m_nPDN = value
+ End Set
+ End Property
+
+ Protected m_bDO As Boolean
+ Public Overridable Property bDO As Boolean
+ Get
+ Return m_bDO
+ End Get
+ Set(value As Boolean)
+ m_bDO = value
+ End Set
+ End Property
+
+ Protected m_sNAM As String
+ Public Overridable Property sNAM As String
+ Get
+ Return m_sNAM
+ End Get
+ Set(value As String)
+ m_sNAM = value
+ End Set
+ End Property
+
+ Protected m_dL As Double
+ Public Property dL As Double
+ Get
+ Return m_dL
+ End Get
+ Set(value As Double)
+ m_dL = value
+ End Set
+ End Property
+
+ Protected m_dW As Double
+ Public Property dW As Double
+ Get
+ Return m_dW
+ End Get
+ Set(value As Double)
+ m_dW = value
+ End Set
+ End Property
+
+ Protected m_dH As Double
+ Public Property dH As Double
+ Get
+ Return m_dH
+ End Get
+ Set(value As Double)
+ m_dH = value
+ End Set
+ End Property
+
+ Protected m_sMATERIAL As String
+ Public Overridable Property sMATERIAL As String
+ Get
+ Return m_sMATERIAL
+ End Get
+ Set(value As String)
+ m_sMATERIAL = value
+ End Set
+ End Property
+
+ Protected m_nCNT As Integer
+ Public Property nCNT As Integer
+ Get
+ Return m_nCNT
+ End Get
+ Set(value As Integer)
+ m_nCNT = value
+ End Set
+ End Property
+
+ Protected m_nTBP As Integer
+ Public Property nTBP As Integer
+ Get
+ Return m_nTBP
+ End Get
+ Set(value As Integer)
+ m_nTBP = value
+ End Set
+ End Property
+
+ Protected m_nDON As Integer
+ Public Property nDON As Integer
+ Get
+ Return m_nDON
+ End Get
+ Set(value As Integer)
+ m_nDON = value
+ End Set
+ End Property
+
+ Protected m_nROT As Integer
+ Public Property nROT As Integer
+ Get
+ Return m_nROT
+ End Get
+ Set(value As Integer)
+ m_nROT = value
+ End Set
+ End Property
+
+ Protected m_sGRP As String
+ Public Property sGRP As String
+ Get
+ Return m_sGRP
+ End Get
+ Set(value As String)
+ m_sGRP = value
+ End Set
+ End Property
+
+ Protected m_nUNT As Integer
+ Public Property nUNT As Integer
+ Get
+ Return m_nUNT
+ End Get
+ Set(value As Integer)
+ m_nUNT = value
+ End Set
+ End Property
+
+ Protected m_nGlobalState As CalcStates = -1
+ Protected m_nState As CalcStates = -1
+ Public Property nState As CalcStates
+ Get
+ Return m_nState
+ End Get
+ Set(value As CalcStates)
+ m_nState = value
+ End Set
+ End Property
+
+ Protected m_nCALC_ROT As Integer
+ Public Property nCALC_ROT As Integer
+ Get
+ Return m_nCALC_ROT
+ End Get
+ Set(value As Integer)
+ m_nCALC_ROT = value
+ End Set
+ End Property
+
+ Protected m_nCALC_TIME As Integer
+ Public Property nCALC_TIME As Integer
+ Get
+ Return m_nCALC_TIME
+ End Get
+ Set(value As Integer)
+ m_nCALC_TIME = value
+ End Set
+ End Property
+
+ ' lista delle feature del pezzo
+ Protected m_FeatureList As ObservableCollection(Of BTLFeature)
+ Public Property FeatureList As ObservableCollection(Of BTLFeature)
+ Get
+ Return m_FeatureList
+ End Get
+ Set(value As ObservableCollection(Of BTLFeature))
+ m_FeatureList = value
+ End Set
+ End Property
+
+ Protected m_SelFeature As BTLFeature
+ Public Overridable Property SelFeature As BTLFeature
+ Get
+ Return m_SelFeature
+ End Get
+ Set(value As BTLFeature)
+ m_SelFeature = value
+ End Set
+ End Property
+
+ Public ReadOnly Property Section As SectionXMaterial
+ Get
+ Return New SectionXMaterial(m_dW, m_dH, m_dL, m_sMATERIAL)
+ End Get
+ End Property
+
+#Region "CONSTRUCTOR"
+
+ Sub New(ParentStructure As BTLStructure, nPartId As Integer)
+ m_ParentStructure = ParentStructure
+ Me.SetPartId = nPartId
+ m_FeatureList = New ObservableCollection(Of BTLFeature)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+ Public Function NewProcId() As Integer
+ Dim nMaxProcId As Integer = 0
+ If Not IsNothing(Me.FeatureList) AndAlso Me.FeatureList.Count > 0 Then
+ nMaxProcId = Me.FeatureList.Max(Function(x) x.nPRID)
+ End If
+ Return nMaxProcId + 1
+ End Function
+
+End Class
+
diff --git a/EgtBEAMWALL.Core/BTLStructure.vb b/EgtBEAMWALL.Core/BTLStructure.vb
new file mode 100644
index 00000000..e6399761
--- /dev/null
+++ b/EgtBEAMWALL.Core/BTLStructure.vb
@@ -0,0 +1,382 @@
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class BTLStructure
+ Inherits VMBase
+
+ Dim m_bOldEnMod As Boolean = False
+ Dim m_nBTLInfoId As Integer = 0
+
+ ' pezzi da BTL
+ Protected m_PartList As New ObservableCollection(Of BTLPart)
+ Public Property PartList As ObservableCollection(Of BTLPart)
+ Get
+ Return m_PartList
+ End Get
+ Set(value As ObservableCollection(Of BTLPart))
+ m_PartList = value
+ End Set
+ End Property
+
+ Protected m_SelPart As BTLPart
+ Public Overridable Property SelPart As BTLPart
+ Get
+ Return m_SelPart
+ End Get
+ Set(value As BTLPart)
+ m_SelPart = value
+ End Set
+ End Property
+
+ ' grezzi da BTL
+ Protected m_BTLRawPartList As List(Of BTLRawPart)
+
+#Region "Parametri generici"
+
+ Protected m_sPROJNUM As String
+ Public Overridable Property sPROJNUM As String
+ Get
+ Return m_sPROJNUM
+ End Get
+ Set(value As String)
+ m_sPROJNUM = value
+ End Set
+ End Property
+
+ Protected m_sPROJNAME As String
+ Public Overridable Property sPROJNAME As String
+ Get
+ Return m_sPROJNAME
+ End Get
+ Set(value As String)
+ m_sPROJNAME = value
+ End Set
+ End Property
+
+ Protected m_sPROJPART As String
+ Public Overridable Property sPROJPART As String
+ Get
+ Return m_sPROJPART
+ End Get
+ Set(value As String)
+ m_sPROJPART = value
+ End Set
+ End Property
+
+ Protected m_sPROJGUID As String
+ Public Overridable Property sPROJGUID As String
+ Get
+ Return m_sPROJGUID
+ End Get
+ Set(value As String)
+ m_sPROJGUID = value
+ End Set
+ End Property
+
+ Protected m_sLISTNAME As String
+ Public Overridable Property sLISTNAME As String
+ Get
+ Return m_sLISTNAME
+ End Get
+ Set(value As String)
+ m_sLISTNAME = value
+ End Set
+ End Property
+
+ Protected m_sCUSTOMER As String
+ Public Overridable Property sCUSTOMER As String
+ Get
+ Return m_sCUSTOMER
+ End Get
+ Set(value As String)
+ m_sCUSTOMER = value
+ End Set
+ End Property
+
+ Protected m_sARCHITECT As String
+ Public Overridable Property sARCHITECT As String
+ Get
+ Return m_sARCHITECT
+ End Get
+ Set(value As String)
+ m_sARCHITECT = value
+ End Set
+ End Property
+
+ Protected m_sEDITOR As String
+ Public Overridable Property sEDITOR As String
+ Get
+ Return m_sEDITOR
+ End Get
+ Set(value As String)
+ m_sEDITOR = value
+ End Set
+ End Property
+
+ Protected m_sDELIVDATE As String
+ Public Overridable Property sDELIVDATE As String
+ Get
+ Return m_sDELIVDATE
+ End Get
+ Set(value As String)
+ m_sDELIVDATE = value
+ End Set
+ End Property
+
+ Protected m_sEXPDATE As String
+ Public Overridable Property sEXPDATE As String
+ Get
+ Return m_sEXPDATE
+ End Get
+ Set(value As String)
+ m_sEXPDATE = value
+ End Set
+ End Property
+
+ Protected m_sEXPTIME As String
+ Public Overridable Property sEXPTIME As String
+ Get
+ Return m_sEXPTIME
+ End Get
+ Set(value As String)
+ m_sEXPTIME = value
+ End Set
+ End Property
+
+ Protected m_sEXPRELEASE As String
+ Public Overridable Property sEXPRELEASE As String
+ Get
+ Return m_sEXPRELEASE
+ End Get
+ Set(value As String)
+ m_sEXPRELEASE = value
+ End Set
+ End Property
+
+ Protected m_sLANGUAGE As String
+ Public Overridable Property sLANGUAGE As String
+ Get
+ Return m_sLANGUAGE
+ End Get
+ Set(value As String)
+ m_sLANGUAGE = value
+ End Set
+ End Property
+
+ Protected m_ocRANGE As New ObservableCollection(Of Object)({New IdNameStruct(Range.STANDARD, EgtMsg(61710)),
+ New IdNameStruct(Range.EXTENDED, EgtMsg(61711))})
+ Public ReadOnly Property ocRANGE As ObservableCollection(Of Object)
+ Get
+ Return m_ocRANGE
+ End Get
+ End Property
+
+ Protected m_SelRANGE As Integer
+ Public Overridable Property SelRANGE As Integer
+ Get
+ Return m_SelRANGE
+ End Get
+ Set(value As Integer)
+ m_SelRANGE = value
+ End Set
+ End Property
+
+ Protected m_ocPROCESSINGQUALITY As New ObservableCollection(Of Object)({New IdNameStruct(ProcessingQuality.AUTOMATIC, EgtMsg(61658)),
+ New IdNameStruct(ProcessingQuality.VISIBLE, EgtMsg(61659)),
+ New IdNameStruct(ProcessingQuality.FAST, EgtMsg(61660))})
+ Public ReadOnly Property ocPROCESSINGQUALITY As ObservableCollection(Of Object)
+ Get
+ Return m_ocPROCESSINGQUALITY
+ End Get
+ End Property
+
+ Protected m_SelPROCESSINGQUALITY As Integer
+ Public Overridable Property SelPROCESSINGQUALITY As Integer
+ Get
+ Return m_SelPROCESSINGQUALITY
+ End Get
+ Set(value As Integer)
+ m_SelPROCESSINGQUALITY = value
+ End Set
+ End Property
+
+ Protected m_sCOMPUTERNAME As String
+ Public Overridable Property sCOMPUTERNAME As String
+ Get
+ Return m_sCOMPUTERNAME
+ End Get
+ Set(value As String)
+ m_sCOMPUTERNAME = value
+ End Set
+ End Property
+
+ Protected m_sUSER As String
+ Public Overridable Property sUSER As String
+ Get
+ Return m_sUSER
+ End Get
+ Set(value As String)
+ m_sUSER = value
+ End Set
+ End Property
+
+ Protected m_sSRCFILE As String
+ Public Overridable Property sSRCFILE As String
+ Get
+ Return m_sSRCFILE
+ End Get
+ Set(value As String)
+ m_sSRCFILE = value
+ End Set
+ End Property
+
+ Protected m_sEXPFILE As String
+ Public Overridable Property sEXPFILE As String
+ Get
+ Return m_sEXPFILE
+ End Get
+ Set(value As String)
+ m_sEXPFILE = value
+ End Set
+ End Property
+
+ Protected m_ocRECESS As New ObservableCollection(Of Object)({New IdNameStruct(Recess.AUTOMATIC, EgtMsg(61658)),
+ New IdNameStruct(Recess.MANUAL, EgtMsg(61661))})
+ Public ReadOnly Property ocRECESS As ObservableCollection(Of Object)
+ Get
+ Return m_ocRECESS
+ End Get
+ End Property
+
+ Protected m_SelRECESS As Integer
+ Public Overridable Property SelRECESS As Integer
+ Get
+ Return m_SelRECESS
+ End Get
+ Set(value As Integer)
+ m_SelRECESS = value
+ End Set
+ End Property
+
+ Protected m_sUSERATTRIBUTE As String
+ Public Overridable Property sUSERATTRIBUTE As String
+ Get
+ Return m_sUSERATTRIBUTE
+ End Get
+ Set(value As String)
+ m_sUSERATTRIBUTE = value
+ End Set
+ End Property
+
+#End Region ' Parametri generici
+
+#Region "MESSAGES"
+
+ ' Info del pezzo
+ Public ReadOnly Property PDN_Msg As String
+ Get
+ Return EgtMsg(61601)
+ End Get
+ End Property
+
+ Public ReadOnly Property DO_Msg As String
+ Get
+ Return EgtMsg(61602)
+ End Get
+ End Property
+
+ Public ReadOnly Property NAM_Msg As String
+ Get
+ Return EgtMsg(61603)
+ End Get
+ End Property
+
+ Public ReadOnly Property L_Msg As String
+ Get
+ Return EgtMsg(61604)
+ End Get
+ End Property
+
+ Public ReadOnly Property W_Msg As String
+ Get
+ Return EgtMsg(61605)
+ End Get
+ End Property
+
+ Public ReadOnly Property H_Msg As String
+ Get
+ Return EgtMsg(61606)
+ End Get
+ End Property
+
+ Public ReadOnly Property MAT_Msg As String
+ Get
+ Return EgtMsg(61607)
+ End Get
+ End Property
+
+ Public ReadOnly Property CNT_Msg As String
+ Get
+ Return EgtMsg(61608)
+ End Get
+ End Property
+
+ Public ReadOnly Property TBP_Msg As String
+ Get
+ Return EgtMsg(61609)
+ End Get
+ End Property
+
+ Public ReadOnly Property DON_Msg As String
+ Get
+ Return EgtMsg(61610)
+ End Get
+ End Property
+
+ Public ReadOnly Property ROT_Msg As String
+ Get
+ Return EgtMsg(61611)
+ End Get
+ End Property
+
+ Public ReadOnly Property GRP_Msg As String
+ Get
+ Return EgtMsg(61612)
+ End Get
+ End Property
+
+ Public ReadOnly Property UNT_Msg As String
+ Get
+ Return EgtMsg(61613)
+ End Get
+ End Property
+
+#End Region ' MESSAGES
+
+#Region "CONSTRUCTOR"
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Public Function NewPDN() As Integer
+ Dim nMaxPDN As Integer = 0
+ If Not IsNothing(PartList) And PartList.Count > 0 Then
+ nMaxPDN = PartList.Max(Function(x) x.nPDN)
+ End If
+ Return nMaxPDN + 1
+ End Function
+
+ Public Shared Function Empty()
+ Return New BTLStructure
+ End Function
+
+#End Region ' METHODS
+
+End Class
+
+Public Class BTLRawPart
+
+End Class
+
diff --git a/EgtBEAMWALL.Core/Beam.vb b/EgtBEAMWALL.Core/Beam.vb
new file mode 100644
index 00000000..9adddad5
--- /dev/null
+++ b/EgtBEAMWALL.Core/Beam.vb
@@ -0,0 +1,39 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class Beam
+ Inherits Part
+
+ Protected m_dOffset As Double
+ Public ReadOnly Property dOffset As Double
+ Get
+ Return m_dOffset
+ End Get
+ End Property
+
+ ' Id del grezzo
+ Protected m_nRawPartId As Integer = GDB_ID.NULL
+
+#Region "CONSTRUCTOR"
+
+ Sub New(nParentMachGroup As Core.MyMachGroup, nPartId As Integer, nRawPartId As Integer)
+ MyBase.New(nParentMachGroup, nPartId)
+ m_nRawPartId = nRawPartId
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+ Friend Sub UpdateOffset()
+ ' calcolo offset
+ Dim nBeamIndex As Integer = ParentMachGroup.PartList.IndexOf(Me)
+ If nBeamIndex > 0 Then
+ m_dOffset = dPOSX - (ParentMachGroup.PartList(nBeamIndex - 1).dPOSX + ParentMachGroup.PartList(nBeamIndex - 1).dL)
+ Else
+ Dim BeamMachGroup As BeamMachGroup = DirectCast(ParentMachGroup, BeamMachGroup)
+ m_dOffset = BeamMachGroup.dStartCut
+ End If
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.Core/BeamMachGroup.vb b/EgtBEAMWALL.Core/BeamMachGroup.vb
new file mode 100644
index 00000000..b141464d
--- /dev/null
+++ b/EgtBEAMWALL.Core/BeamMachGroup.vb
@@ -0,0 +1,60 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class BeamMachGroup
+ Inherits MyMachGroup
+
+ Protected m_dStartCut As Double
+ Public ReadOnly Property dStartCut As Double
+ Get
+ Return m_dStartCut
+ End Get
+ End Property
+
+ Sub New(nId As Integer, sName As String, sMachine As String)
+ MyBase.New(nId, sName, sMachine)
+ SetMachineType(MachineType.BEAM)
+ EgtGetInfo(nId, MGR_RPT_BARLEN, dL)
+ EgtGetInfo(nId, MGR_RPT_BARHEIGHT, dH)
+ EgtGetInfo(nId, MGR_RPT_BARWIDTH, dW)
+ m_dTotMat = dL
+ For Each Part In PartList
+ m_dMatForPart += Part.dL
+ Next
+ End Sub
+
+ Public Overrides Sub RefreshPartList()
+ ' leggo StartCut da posizione primo pezzo
+ Dim sInfo As String = ""
+ Dim sSplitInfo() As String
+ Dim bFound As Boolean = False
+ EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
+ If Not String.IsNullOrWhiteSpace(sInfo) Then
+ sSplitInfo = sInfo.Split(","c)
+ StringToDouble(sSplitInfo(1), m_dStartCut)
+ Else
+ m_dStartCut = 0
+ End If
+ ' aggiorno lista pezzi
+ PartList.Clear()
+ Dim nRawPartId As Integer = EgtGetFirstRawPart()
+ While nRawPartId <> GDB_ID.NULL
+ Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
+ If nPartId <> GDB_ID.NULL Then
+ Dim NewBeam As Beam = New Beam(Me, nPartId, nRawPartId)
+ PartList.Add(NewBeam)
+ NewBeam.UpdateOffset()
+ End If
+ nRawPartId = EgtGetNextRawPart(nRawPartId)
+ End While
+ End Sub
+
+ Public Overrides Sub RefreshGroupData()
+ EgtGetInfo(Id, MGR_RPT_BARLEN, dL)
+ EgtGetInfo(Id, MGR_RPT_BARHEIGHT, dH)
+ EgtGetInfo(Id, MGR_RPT_BARWIDTH, dW)
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.Core/Constants/ConstBeam.vb b/EgtBEAMWALL.Core/Constants/ConstBeam.vb
new file mode 100644
index 00000000..b1642789
--- /dev/null
+++ b/EgtBEAMWALL.Core/Constants/ConstBeam.vb
@@ -0,0 +1,257 @@
+Public Module ConstBeam
+
+ Public Enum BTLParamType As Integer
+ DOUBLE_ = 1
+ STRING_ = 2
+ COMBO = 3
+ LENGTH = 4
+ CHECKBOX = 5
+ End Enum
+
+ Public Enum BTLPartParam As Integer
+ NULL = 0
+ PDN = 1
+ NAM = 2
+ GRP = 3
+ End Enum
+
+ Public Enum GRPType As Integer
+ L = 0
+ T = 1
+ End Enum
+
+ Enum MachineType As Integer
+ NULL = 0
+ BEAM = 1
+ WALL = 2
+ End Enum
+
+ Enum CalcStates As Integer
+ NOTCALCULATED = -1
+ OK = 0
+ WARNING = 1
+ ERROR_ = 2
+ End Enum
+
+ Public Enum Range As Integer
+ STANDARD = 1
+ EXTENDED = 2
+ End Enum
+
+ Public Enum PartOffset_RefSideFixClamp As Integer
+ INACTIVE = 0
+ REFSIDE1 = 1
+ REFSIDE2 = 2
+ REFSIDE3 = 3
+ REFSIDE4 = 4
+ End Enum
+
+ Public Enum ProcessingQuality As Integer
+ AUTOMATIC = 1
+ VISIBLE = 2
+ FAST = 3
+ End Enum
+
+ Public Enum Recess As Integer
+ AUTOMATIC = 1
+ MANUAL = 2
+ End Enum
+
+ Public Enum StoreyType As Integer
+ CEILING = 1
+ ROOF = 2
+ WALL = 3
+ End Enum
+
+ Public Enum AlignmentLocation As Integer
+ INACTIV = 0
+ BR = 1
+ TR = 2
+ BA = 3
+ TA = 4
+ HC = 5
+ VC = 6
+ AC = 7
+ End Enum
+
+ Public Enum AlignmentEndtype As Integer
+ R = 1
+ A = 2
+ D = 3
+ End Enum
+
+ Public Enum MaterialType As Integer
+ INACTIV = 0
+ BA = 1
+ CL = 2
+ MT = 3
+ ME_ = 4
+ GB = 5
+ GF = 6
+ IN_ = 7
+ SH = 8
+ FB = 9
+ PB = 10
+ PL = 11
+ End Enum
+
+ Public Enum MoveDirections As Integer
+ UP = -1
+ DOWN = 1
+ End Enum
+
+ Public Const BTLFEATURES_FILE_NAME As String = "BTLFeatures.ini"
+
+ 'Public Const S_GENERAL As String = "General"
+ 'Public Const K_DEBUG As String = "Debug"
+
+ ' Tipo di progetto
+ Public Enum ProjectType As Integer
+ PROJ = 1
+ PROD = 2
+ End Enum
+
+ Friend Const PROJ As String = "PROJ"
+ Friend Const FILENAMESEPARATOR As Char = "^"c
+ Friend Const BTLINFO As String = "BtlInfo"
+
+ ' info parametri BTL
+ Friend Const BTL_PRT_PDN As String = "PDN"
+ Friend Const BTL_PRT_DO As String = "DO"
+ Friend Const BTL_PRT_NAM As String = "NAM"
+ Friend Const BTL_PRT_L As String = "L"
+ Friend Const BTL_PRT_W As String = "W"
+ Friend Const BTL_PRT_H As String = "H"
+ Friend Const BTL_PRT_CNT As String = "CNT"
+ Friend Const BTL_PRT_ROTATED As String = "ROTATED"
+ Friend Const BTL_PRT_INVERTED As String = "INVERTED"
+ Friend Const BTL_PRT_MATERIAL As String = "MATERIAL"
+ ' parametri pezzo
+ Friend Const BTL_PRT_SINGLEMEMBERNUM = "SINGLEMEMBERNUMBER"
+ Friend Const BTL_PRT_ASSEMBLYNUM = "ASSEMBLYNUMBER"
+ Friend Const BTL_PRT_ORDERNUM = "ORDERNUMBER"
+ Friend Const BTL_PRT_DESIGNATION = "DESIGNATION"
+ Friend Const BTL_PRT_ANNOTATION = "ANNOTATION"
+ Friend Const BTL_PRT_STOREY = "STOREY"
+ Friend Const BTL_PRT_GROUP = "GROUP"
+ Friend Const BTL_PRT_PACKAGE = "PACKAGE"
+ Friend Const BTL_PRT_TIMBERGRADE = "TIMBERGRADE"
+ Friend Const BTL_PRT_QUALITYGRADE = "QUALITYGRADE"
+ Friend Const BTL_PRT_COLOUR = "COLOUR"
+ Friend Const BTL_PRT_PLANINGLENGTH = "PLANINGLENGTH"
+ Friend Const BTL_PRT_STARTOFFSET = "STARTOFFSET"
+ Friend Const BTL_PRT_ENDOFFSET = "ENDOFFSET"
+ Friend Const BTL_PRT_UID = "UID"
+ Friend Const BTL_PRT_TRANSFORMATION = "TRANSFORMATION"
+ Friend Const BTL_PRT_CAMBER = "CAMBER"
+ Friend Const BTL_PRT_PARTOFFSET = "PARTOFFSET"
+ Friend Const BTL_PRT_PROCESSINGQUALITY = "PROCESSINGQUALITY"
+ Friend Const BTL_PRT_RECESS = "RECESS"
+ Friend Const BTL_PRT_STOREYTYPE = "STOREYTYPE"
+ Friend Const BTL_PRT_ELEMENTNUM = "ELEMENTNUMBER"
+ Friend Const BTL_PRT_LAYER = "LAYER"
+ Friend Const BTL_PRT_MODULENUM = "MODULENUMBER"
+ 'Friend Const BTL_PRT_USERATTRIBUTE = "USERATTRIBUTE"
+ Friend Const BTL_PRT_COMMENT = "COMMENT"
+ Friend Const BTL_PRT_GRAINDIR = "GRAINDIRECTION"
+ Friend Const BTL_PRT_REFSIDE = "REFERENCESIDE"
+ Friend Const BTL_PRT_ALIGNMENT = "ALIGNMENT"
+ Friend Const BTL_PRT_MATERIALTYPE = "MATERIALTYPE"
+
+ ' parametri generici
+ Friend Const BTL_GEN_PROJNUM = "PROJECTNUMBER"
+ Friend Const BTL_GEN_PROJNAME = "PROJECTNAME"
+ Friend Const BTL_GEN_PROJPART = "PROJECTPART"
+ Friend Const BTL_GEN_PROJGUID = "PROJECTGUID"
+ Friend Const BTL_GEN_LISTNAME = "LISTNAME"
+ Friend Const BTL_GEN_CUSTOMER = "CUSTOMER"
+ Friend Const BTL_GEN_ARCHITECT = "ARCHITECT"
+ Friend Const BTL_GEN_EDITOR = "EDITOR"
+ Friend Const BTL_GEN_DELIVDATE = "DELIVERYDATE"
+ Friend Const BTL_GEN_EXPDATE = "EXPORTDATE"
+ Friend Const BTL_GEN_EXPTIME = "EXPORTTIME"
+ Friend Const BTL_GEN_EXPRELEASE = "EXPORTRELEASE"
+ Friend Const BTL_GEN_LANGUAGE = "LANGUAGE"
+ Friend Const BTL_GEN_RANGE = "RANGE"
+ Friend Const BTL_GEN_COMPUTERNAME = "COMPUTERNAME"
+ Friend Const BTL_GEN_USER = "USER"
+ Friend Const BTL_GEN_SRCFILE = "SOURCEFILE"
+ Friend Const BTL_GEN_EXPFILE = "EXPORTFILE"
+ Friend Const BTL_GEN_USERATTRIBUTE = "USERATTRIBUTE"
+
+ Friend Const PROCESSINGS As String = "Processings"
+ Friend Const OUTLINE As String = "Outline"
+ Friend Const BTL_FTR_GRP As String = "GRP"
+ Friend Const BTL_FTR_PRC As String = "PRC"
+ Friend Const BTL_FTR_DO As String = "DO"
+ Friend Const BTL_FTR_SIDE As String = "SIDE"
+ Friend Const BTL_FTR_NAME As String = "NAME"
+ Friend Const BTL_FTR_DES As String = "DES"
+ Friend Const BTL_FTR_PRID As String = "PRID"
+ Friend Const BTL_FTR_FRAME As String = "FRAME"
+
+ ' parametri machgroup grezzi
+ Friend Const MGR_RPT_ID As String = "ID"
+ Friend Const MGR_RPT_L As String = "L"
+ Friend Const MGR_RPT_W As String = "W"
+ Friend Const MGR_RPT_H As String = "H"
+ Friend Const MGR_RPT_WASTE As String = "WASTE"
+ Friend Const MGR_RPT_USAGE As String = "USAGE"
+ Friend Const MGR_RPT_STARTCUT As String = "STARTCUT"
+ Friend Const MGR_RPT_MATERIAL As String = "MATERIAL"
+
+ Friend Const MGR_PRT_PDN As String = "PDN"
+ Friend Const MGR_PRT_L As String = "L"
+ Friend Const MGR_PRT_W As String = "W"
+ Friend Const MGR_PRT_H As String = "H"
+ Friend Const MGR_PRT_DES As String = "DES"
+ Friend Const MGR_PRT_STARTCUT As String = "STARTCUT"
+ Friend Const MGR_PRT_MATERIAL As String = "MATERIAL"
+
+ Friend Const MGR_FTR_GRP As String = "GRP"
+ Friend Const MGR_FTR_PRC As String = "PRC"
+ Friend Const MGR_FTR_DO As String = "DO"
+ Friend Const MGR_FTR_SIDE As String = "SIDE"
+ Friend Const MGR_FTR_NAME As String = "NAME"
+ Friend Const MGR_FTR_DES As String = "DES"
+ Friend Const MGR_FTR_PRID As String = "PRID"
+ Friend Const MGR_FTR_FRAME As String = "FRAME"
+
+ ' parametri creazione barre
+ Friend Const MGR_RPT_BARLEN As String = "BARLEN"
+ Friend Const MGR_RPT_BARHEIGHT As String = "BARHEIGHT"
+ Friend Const MGR_RPT_BARWIDTH As String = "BARWIDTH"
+ Friend Const MGR_RPT_PANELLEN As String = "PANELLEN"
+ Friend Const MGR_RPT_PANELWIDTH As String = "PANELWIDTH"
+ Friend Const MGR_RPT_PANELHEIGHT As String = "PANELHEIGHT"
+ Friend Const MGR_RPT_PART As String = "PART"
+
+ ' parametri errori integration
+ Friend Const ITG_CUTID As String = "CUTID"
+ Friend Const ITG_TASKID As String = "TASKID"
+ Friend Const ITG_PROJ_ERR As String = "PROJ_ERR"
+ Friend Const ITG_PROJ_MSG As String = "PROJ_MSG"
+ Friend Const ITG_PROJ_ROT As String = "PROJ_ROT"
+ Friend Const ITG_PROJ_FALL As String = "PROJ_FALL"
+ Friend Const ITG_PROJ_TIME As String = "PROJ_TIME"
+
+ ' parametri errori integration
+ Friend Const ITG_PROD_ERR As String = "PROD_ERR"
+ Friend Const ITG_PROD_MSG As String = "PROD_MSG"
+ Friend Const ITG_PROD_ROT As String = "PROD_ROT"
+ Friend Const ITG_PROD_TIME As String = "PROD_TIME"
+
+ ' parametri errori integration
+ Friend Const DUPLO_TODELETE As String = "DUPLO_TODELETE"
+
+ ' parametri warehouse
+ Friend Const WRH_BEAM As String = "BEAM"
+ Friend Const WRH_WALL As String = "WALL"
+ Friend Const WRH_CURRENT As String = "Current"
+ Friend Const WRH_STARTOFFSET As String = "StartOffset"
+ Friend Const WRH_OFFSET As String = "Offset"
+ Friend Const WRH_L As String = "L"
+ Friend Const WRH_KERF As String = "Kerf"
+ Friend Const WRH_S As String = "S"
+
+End Module
diff --git a/EgtBEAMWALL.Core/EgtBEAMWALL.Core.vbproj b/EgtBEAMWALL.Core/EgtBEAMWALL.Core.vbproj
new file mode 100644
index 00000000..cc5b0e32
--- /dev/null
+++ b/EgtBEAMWALL.Core/EgtBEAMWALL.Core.vbproj
@@ -0,0 +1,129 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}
+ Library
+ EgtBEAMWALL.Core
+ EgtBEAMWALL.Core
+ 512
+ Windows
+ v4.0
+ true
+
+
+ true
+ full
+ true
+ true
+ bin\Debug\
+ EgtBEAMWALL.Core.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ EgtBEAMWALL.Core.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+
+ ..\..\..\EgtProg\DllD32\EgtUILib.dll
+
+
+ ..\..\..\EgtProg\DllD32\EgtWPFLib5.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+ copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\ViewerOptimizer\EgtBEAMWALL.Core.dll
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.Core/Enum.vb b/EgtBEAMWALL.Core/Enum.vb
new file mode 100644
index 00000000..635e4bec
--- /dev/null
+++ b/EgtBEAMWALL.Core/Enum.vb
@@ -0,0 +1,6 @@
+Public Enum CalcStates As Integer
+ NOTCALCULATED = -1
+ OK = 0
+ WARNING = 1
+ ERROR_ = 2
+End Enum
diff --git a/EgtBEAMWALL.Core/My Project/Application.Designer.vb b/EgtBEAMWALL.Core/My Project/Application.Designer.vb
new file mode 100644
index 00000000..88dd01c7
--- /dev/null
+++ b/EgtBEAMWALL.Core/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/EgtBEAMWALL.Core/My Project/Application.myapp b/EgtBEAMWALL.Core/My Project/Application.myapp
new file mode 100644
index 00000000..758895de
--- /dev/null
+++ b/EgtBEAMWALL.Core/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ false
+ 0
+ true
+ 0
+ 1
+ true
+
diff --git a/EgtBEAMWALL.Core/My Project/AssemblyInfo.vb b/EgtBEAMWALL.Core/My Project/AssemblyInfo.vb
new file mode 100644
index 00000000..920a6cf5
--- /dev/null
+++ b/EgtBEAMWALL.Core/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/EgtBEAMWALL.Core/My Project/Resources.Designer.vb b/EgtBEAMWALL.Core/My Project/Resources.Designer.vb
new file mode 100644
index 00000000..f8728e8c
--- /dev/null
+++ b/EgtBEAMWALL.Core/My Project/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("EgtBEAMWALL.Core.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/EgtBEAMWALL.Core/My Project/Resources.resx b/EgtBEAMWALL.Core/My Project/Resources.resx
new file mode 100644
index 00000000..af7dbebb
--- /dev/null
+++ b/EgtBEAMWALL.Core/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.Core/My Project/Settings.Designer.vb b/EgtBEAMWALL.Core/My Project/Settings.Designer.vb
new file mode 100644
index 00000000..06ae7162
--- /dev/null
+++ b/EgtBEAMWALL.Core/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.EgtBEAMWALL.Core.My.MySettings
+ Get
+ Return Global.EgtBEAMWALL.Core.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/EgtBEAMWALL.Core/My Project/Settings.settings b/EgtBEAMWALL.Core/My Project/Settings.settings
new file mode 100644
index 00000000..85b890b3
--- /dev/null
+++ b/EgtBEAMWALL.Core/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.Core/MyMachGroup.vb b/EgtBEAMWALL.Core/MyMachGroup.vb
new file mode 100644
index 00000000..f0b36a90
--- /dev/null
+++ b/EgtBEAMWALL.Core/MyMachGroup.vb
@@ -0,0 +1,166 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports System.Windows.Input
+Imports System.Windows.Media
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public MustInherit Class MyMachGroup
+ Inherits MachGroup
+
+ Protected m_nMachineType As MachineType
+ Public ReadOnly Property nMachineType As MachineType
+ Get
+ Return m_nMachineType
+ End Get
+ End Property
+ Public Sub SetMachineType(nMachineType As MachineType)
+ m_nMachineType = nMachineType
+ End Sub
+
+ Protected m_dL As Double
+ Public Property dL As Double
+ Get
+ Return m_dL
+ End Get
+ Set(value As Double)
+ m_dL = value
+ End Set
+ End Property
+
+ Protected m_dW As Double
+ Public Property dW As Double
+ Get
+ Return m_dW
+ End Get
+ Set(value As Double)
+ m_dW = value
+ End Set
+ End Property
+
+ Protected m_dH As Double
+ Public Property dH As Double
+ Get
+ Return m_dH
+ End Get
+ Set(value As Double)
+ m_dH = value
+ End Set
+ End Property
+
+ Protected m_dMatForPart As Double = 0
+ Protected m_dTotMat As Double = 0
+ Public ReadOnly Property dUsage As Double
+ Get
+ Return If(m_dMatForPart > 0 AndAlso m_dTotMat > 0, m_dMatForPart / m_dTotMat * 100, 0)
+ End Get
+ End Property
+
+ Public ReadOnly Property dWaste As Double
+ Get
+ Return If(m_dMatForPart > 0 AndAlso m_dTotMat > 0, (m_dTotMat - m_dMatForPart) / m_dTotMat * 100, 0)
+ End Get
+ End Property
+
+ Public ReadOnly Property sUsage As String
+ Get
+ Return dUsage & "%"
+ End Get
+ End Property
+
+ Public ReadOnly Property sWaste As String
+ Get
+ Return dWaste & "%"
+ End Get
+ End Property
+
+ Protected m_sMATERIAL As String
+ Public Property sMATERIAL As String
+ Get
+ Return m_sMATERIAL
+ End Get
+ Set(value As String)
+ m_sMATERIAL = value
+ End Set
+ End Property
+
+ ' lista dei pezzi che sono nel grezzo
+ Private m_PartList As New ObservableCollection(Of Part)
+ Public Property PartList As ObservableCollection(Of Part)
+ Get
+ Return m_PartList
+ End Get
+ Set(value As ObservableCollection(Of Part))
+ m_PartList = value
+ End Set
+ End Property
+
+ Protected m_SelPart As Part
+ Public Overridable Property SelPart As Part
+ Get
+ Return m_SelPart
+ End Get
+ Set(value As Part)
+ m_SelPart = value
+ ' seleziono pezzo
+ EgtDeselectAll()
+ If Not IsNothing(value) Then EgtSelectObj(SelPart.nPartId)
+ EgtDraw()
+ NotifyPropertyChanged("SelPart")
+ End Set
+ End Property
+
+ Protected m_nState As CalcStates = -1
+ Public ReadOnly Property nState As CalcStates
+ Get
+ Return m_nState
+ End Get
+ End Property
+
+ Public ReadOnly Property Calc_Background As SolidColorBrush
+ Get
+ If m_nState = 0 Then
+ Return Brushes.Green
+ ElseIf m_nState < 0 Then
+ Return Brushes.LightGray
+ ElseIf m_nState > 0 Then
+ Return Brushes.Red
+ End If
+ End Get
+ End Property
+
+ Sub New(nId As Integer, sName As String, sMachine As String)
+ MyBase.New(nId, sName, sMachine)
+ 'aggiorno lista pezzi
+ RefreshPartList()
+ End Sub
+
+ Public MustOverride Sub RefreshPartList()
+
+ Public MustOverride Sub RefreshGroupData()
+
+ Public Overridable Sub DeleteMachGroup()
+ ' elimino tutte le copie
+ Dim nRawPartId As Integer = EgtGetFirstRawPart()
+ Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
+ While nRawPartId <> GDB_ID.NULL
+ EgtRemovePartFromRawPart(nBeamId)
+ EgtErase(nBeamId)
+ nRawPartId = EgtGetNextRawPart(nRawPartId)
+ nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
+ End While
+ ' elimino MachGroup
+ EgtRemoveMachGroup(Me.Id)
+ End Sub
+
+ Public Sub CalcMachGroupUpdate()
+ m_nState = CalcStates.OK
+ For Each Part In PartList
+ If Part.nGlobalState > 0 AndAlso m_nState = CalcStates.OK Then
+ m_nState = CalcStates.ERROR_
+ End If
+ Next
+ NotifyPropertyChanged("Calc_Background")
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.Core/Part.vb b/EgtBEAMWALL.Core/Part.vb
new file mode 100644
index 00000000..683b1a6e
--- /dev/null
+++ b/EgtBEAMWALL.Core/Part.vb
@@ -0,0 +1,350 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports System.Windows.Input
+Imports System.Windows.Media
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public MustInherit Class Part
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Protected m_ParentMachGroup As MyMachGroup
+ Public ReadOnly Property ParentMachGroup As MyMachGroup
+ Get
+ Return m_ParentMachGroup
+ End Get
+ End Property
+
+ ' Id geometrico del pezzo
+ Protected m_nPartId As Integer
+ Public ReadOnly Property nPartId As Integer
+ Get
+ Return m_nPartId
+ End Get
+ End Property
+ Friend Sub SetPartId(nPartId As Integer)
+ m_nPartId = nPartId
+ End Sub
+ ' Info del pezzo
+ Protected m_nPDN As Integer
+ Public ReadOnly Property nPDN As Integer
+ Get
+ Return m_nPDN
+ End Get
+ End Property
+
+ Protected m_sNAM As String
+ Public ReadOnly Property sNAM As String
+ Get
+ Return m_sNAM
+ End Get
+ End Property
+
+ Protected m_dL As Double
+ Public Property dL As Double
+ Get
+ Return m_dL
+ End Get
+ Set(value As Double)
+ m_dL = value
+ End Set
+ End Property
+
+ Protected m_dW As Double
+ Public Property dW As Double
+ Get
+ Return m_dW
+ End Get
+ Set(value As Double)
+ m_dW = value
+ End Set
+ End Property
+
+ Protected m_dH As Double
+ Public Property dH As Double
+ Get
+ Return m_dH
+ End Get
+ Set(value As Double)
+ m_dH = value
+ End Set
+ End Property
+
+ Protected m_dPOSX As Double
+ Public Property sPOSX As String
+ Get
+ Return LenToString(m_dPOSX, 3)
+ End Get
+ Set(value As String)
+ StringToLen(value, m_dPOSX)
+ End Set
+ End Property
+ Public Property dPOSX As Double
+ Get
+ Return m_dPOSX
+ End Get
+ Set(value As Double)
+ m_dPOSX = value
+ NotifyPropertyChanged("sPOSX")
+ End Set
+ End Property
+
+ Protected m_nCNT As Integer
+ Public Property nCNT As Integer
+ Get
+ Return m_nCNT
+ End Get
+ Set(value As Integer)
+ m_nCNT = value
+ End Set
+ End Property
+
+ Protected m_nINVERTED As Integer
+ Public ReadOnly Property sINVERTED As String
+ Get
+ Return m_nINVERTED & "°"
+ End Get
+ End Property
+ Public Sub SetInverted(nInverted As Integer)
+ m_nINVERTED = nInverted
+ End Sub
+
+ Protected m_nROTATED As Integer
+ Public ReadOnly Property sROTATED As String
+ Get
+ Return m_nROTATED & "°"
+ End Get
+ End Property
+ Public Sub SetRotated(nRotated As Integer)
+ m_nROTATED = nRotated
+ End Sub
+
+ Protected m_sMATERIAL As String
+ Public Property sMATERIAL As String
+ Get
+ Return m_sMATERIAL
+ End Get
+ Set(value As String)
+ m_sMATERIAL = value
+ End Set
+ End Property
+
+ Protected m_nGlobalState As CalcStates = -1
+ Public ReadOnly Property nGlobalState As CalcStates
+ Get
+ Return m_nGlobalState
+ End Get
+ End Property
+
+ Protected m_nState As CalcStates = -1
+ Public Property nState As CalcStates
+ Get
+ Return m_nState
+ End Get
+ Set(value As CalcStates)
+ m_nState = value
+ End Set
+ End Property
+
+ Public ReadOnly Property Calc_Background As SolidColorBrush
+ Get
+ If m_nGlobalState = 0 Then
+ Return Brushes.Green
+ ElseIf m_nGlobalState < 0 Then
+ Return Brushes.LightGray
+ ElseIf m_nGlobalState > 0 Then
+ Return Brushes.Red
+ End If
+ End Get
+ End Property
+
+ Protected m_nCALC_ERR As Integer
+ Public ReadOnly Property nCALC_ERR As Integer
+ Get
+ Return m_nCALC_ERR
+ End Get
+ End Property
+
+ Protected m_sCALC_MSG As String = String.Empty
+ Public ReadOnly Property nCALC_MSG As String
+ Get
+ Return m_sCALC_MSG
+ End Get
+ End Property
+
+ Protected m_nCALC_ROT As Integer
+ Public Property nCALC_ROT As Integer
+ Get
+ Return m_nCALC_ROT
+ End Get
+ Set(value As Integer)
+ m_nCALC_ROT = value
+ End Set
+ End Property
+
+ Protected m_nCALC_FALL As Integer
+ Public Property nCALC_FALL As Integer
+ Get
+ Return m_nCALC_FALL
+ End Get
+ Set(value As Integer)
+ m_nCALC_FALL = value
+ End Set
+ End Property
+
+ Protected m_nCALC_TIME As Integer
+ Public Property nCALC_TIME As Integer
+ Get
+ Return m_nCALC_TIME
+ End Get
+ Set(value As Integer)
+ m_nCALC_TIME = value
+ End Set
+ End Property
+
+ ' lista delle feature del pezzo
+ Protected m_FeatureList As ObservableCollection(Of BTLFeature)
+ Public Property FeatureList As ObservableCollection(Of BTLFeature)
+ Get
+ Return m_FeatureList
+ End Get
+ Set(value As ObservableCollection(Of BTLFeature))
+ m_FeatureList = value
+ End Set
+ End Property
+
+ Protected m_SelFeature As BTLFeature
+ Public Property SelFeature As Core.BTLFeature
+ Get
+ Return m_SelFeature
+ End Get
+ Set(value As Core.BTLFeature)
+ m_SelFeature = value
+ EgtDeselectAll()
+ If Not IsNothing(value) Then EgtSelectObj(m_SelFeature.nFeatureId)
+ EgtDraw()
+ NotifyPropertyChanged("SelFeature")
+ End Set
+ End Property
+
+ ' definizione comandi
+ Private m_cmdDeletePart As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New(nParentMachGroup As MyMachGroup, nPartId As Integer)
+ m_ParentMachGroup = nParentMachGroup
+ SetPartId(nPartId)
+ m_FeatureList = New ObservableCollection(Of BTLFeature)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+ ' funzione che aggiorna lo stato e gli errori dopo calcolo
+ Public Sub CalcPartUpdate(bCalc As Boolean, ERR As Integer, ROT As Integer, FALL As Integer, MSG As String)
+ If Not bCalc Then
+ nState = CalcStates.NOTCALCULATED
+ m_nCALC_ERR = 0
+ m_nCALC_ROT = 0
+ m_nCALC_FALL = 0
+ m_sCALC_MSG = ""
+ Else
+ m_nCALC_ERR = ERR
+ m_nCALC_ROT = ROT
+ m_nCALC_FALL = 0
+ m_sCALC_MSG = MSG
+ If ERR = 0 Then
+ nState = CalcStates.OK
+ ElseIf ERR > 1 Then
+ nState = CalcStates.ERROR_
+ ElseIf ERR < 1 Then
+ nState = CalcStates.NOTCALCULATED
+ End If
+ End If
+ NotifyPropertyChanged("Calc_Background")
+ End Sub
+
+ ' funzione che aggiorna lo stato e gli errori dopo calcolo
+ Public Sub CalcFeatureUpdate()
+ m_nGlobalState = nState
+ For Each Feature In FeatureList
+ If Not Feature.bDO Then
+
+ ElseIf Feature.nState < 0 Then
+ m_nGlobalState = CalcStates.NOTCALCULATED
+ Exit For
+ ElseIf Feature.nState > 0 AndAlso m_nGlobalState = CalcStates.OK Then
+ m_nGlobalState = CalcStates.ERROR_
+ End If
+ Next
+ NotifyPropertyChanged("Calc_Background")
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "DeletePart"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property DeletePart_Command() As ICommand
+ Get
+ If m_cmdDeletePart Is Nothing Then
+ m_cmdDeletePart = New Command(AddressOf DeletePart)
+ End If
+ Return m_cmdDeletePart
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Overridable Sub DeletePart()
+ EgtRemovePartFromRawPart(Me.m_nPartId)
+ ' elimino pezzo copia
+ EgtErase(Me.m_nPartId)
+ ' elimino info pezzo su mach group
+ Dim sInfo As String = ""
+ Dim Index As Integer = 1
+ Dim sSplitInfo() As String
+ Dim bFound As Boolean = False
+ While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
+ If Not String.IsNullOrWhiteSpace(sInfo) Then
+ sSplitInfo = sInfo.Split(","c)
+ If bFound Then
+ EgtSetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index - 1, sInfo)
+ End If
+ If sSplitInfo(0) = nPartId Then
+ bFound = True
+ End If
+ End If
+ Index += 1
+ End While
+ If bFound Then
+ EgtSetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index - 1, "")
+ End If
+ ' rimuovo dalla lista pezzi
+ Index = ParentMachGroup.PartList.IndexOf(Me)
+ If Index = 0 Then
+ If ParentMachGroup.PartList.Count > 0 Then
+ ParentMachGroup.SelPart = ParentMachGroup.PartList(0)
+ Else
+ ParentMachGroup.SelPart = Nothing
+ End If
+ ElseIf Index = ParentMachGroup.PartList.Count - 1 Then
+ If ParentMachGroup.PartList.Count > 1 Then
+ ParentMachGroup.SelPart = ParentMachGroup.PartList(ParentMachGroup.PartList.Count - 2)
+ Else
+ ParentMachGroup.SelPart = Nothing
+ End If
+ Else
+ ParentMachGroup.SelPart = ParentMachGroup.PartList(Index - 1)
+ End If
+ ParentMachGroup.PartList.Remove(Me)
+ End Sub
+
+#End Region ' DeletePart
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/EgtBEAMWALL.Core/SectionXMaterial.vb b/EgtBEAMWALL.Core/SectionXMaterial.vb
new file mode 100644
index 00000000..4e8afadf
--- /dev/null
+++ b/EgtBEAMWALL.Core/SectionXMaterial.vb
@@ -0,0 +1,226 @@
+Imports System.Windows
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class SectionXMaterial
+ Inherits VMBase
+
+ Private Shared m_nType As MachineType
+ Public Shared Sub SetType(nType As MachineType)
+ m_nType = nType
+ End Sub
+
+ Protected m_Material As List(Of String)
+ Public ReadOnly Property sMaterial As List(Of String)
+ Get
+ Return m_Material
+ End Get
+ End Property
+
+ Protected m_MaterialForSameSection_List As New List(Of String)
+ Public Property MaterialForSameSection_List As List(Of String)
+ Get
+ Return m_MaterialForSameSection_List
+ End Get
+ Set(value As List(Of String))
+ m_MaterialForSameSection_List = value
+ End Set
+ End Property
+
+ Protected m_SelMaterialForSameSection As String
+ Public Property SelMaterialForSameSection As String
+ Get
+ Return m_SelMaterialForSameSection
+ End Get
+ Set(value As String)
+ m_SelMaterialForSameSection = value
+ End Set
+ End Property
+
+ Protected m_dW As Double = 0
+ Public ReadOnly Property dW As Double
+ Get
+ Return m_dW
+ End Get
+ End Property
+
+ Protected m_dH As Double = 0
+ Public ReadOnly Property dH As Double
+ Get
+ Return m_dH
+ End Get
+ End Property
+
+ Protected m_dL As Double = 0
+ Public ReadOnly Property dL As Double
+ Get
+ Return m_dL
+ End Get
+ End Property
+
+ Public ReadOnly Property sSectionXMaterial As String
+ Get
+ Dim sAlias As String = String.Empty
+ For Each sMatItem In sMaterial
+ sAlias &= sMatItem & ";"
+ Next
+ sAlias = sAlias.TrimEnd(";")
+ If Me = Empty Then
+ Return ""
+ ElseIf m_nType = MachineType.BEAM Then
+ Return LenToString(m_dW, 3) & " x " & LenToString(m_dH, 3) & " " & sAlias
+ ElseIf m_nType = MachineType.WALL Then
+ Return LenToString(m_dH, 3) & " " & sAlias
+ Else Return ""
+ End If
+ End Get
+ End Property
+
+ Shared Operator =(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
+ Return (S1.m_dH = S2.m_dH AndAlso S1.m_dW = S2.m_dW AndAlso S1.m_dL = S2.m_dL AndAlso S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)))
+ End Operator
+
+ Shared Operator <>(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
+ Return (S1.m_dH <> S2.m_dH OrElse S1.m_dW <> S2.m_dW OrElse S1.m_dL <> S2.m_dL) OrElse Not S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x))
+ End Operator
+
+ Public Overrides Function Equals(ByVal obj As Object) As Boolean
+ If TypeOf obj Is SectionXMaterial Then
+ Return (m_dH = obj.dH AndAlso m_dW = obj.dW AndAlso m_dL = obj.dL AndAlso m_Material.Any(Function(x) DirectCast(obj.sMaterial, List(Of String)).Any(Function(y) y = x)))
+ End If
+ Return False
+ End Function
+
+ Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String)
+ If m_nType = MachineType.BEAM Then
+ m_dW = dW
+ m_dH = dH
+ ElseIf m_nType = MachineType.WALL Then
+ m_dH = dH
+ End If
+ m_Material = New List(Of String)
+ Dim sMaterialArray() As String = Split(sMaterial, ";")
+ For Each sMatItem In sMaterialArray
+ m_Material.Add(sMatItem)
+ Next
+ End Sub
+
+ Public Shared Empty As New SectionXMaterial(-1, -1, -1, "")
+
+#Region "Import BTL <-> Warehouse"
+
+ Private m_dNewW As Double
+ Public Property dNewW As Double
+ Get
+ Return m_dNewW
+ End Get
+ Set(value As Double)
+ m_dNewW = value
+ End Set
+ End Property
+
+ Private m_dNewL As Double
+ Public Property dNewL As Double
+ Get
+ Return m_dNewL
+ End Get
+ Set(value As Double)
+ m_dNewL = value
+ End Set
+ End Property
+
+ Private m_Alias_IsEnabled As Boolean
+ Public Property Alias_IsEnabled As Boolean
+ Get
+ Return m_Alias_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_Alias_IsEnabled = value
+ End Set
+ End Property
+
+ Private m_Alias_IsChecked As Boolean
+ Public Property Alias_IsChecked As Boolean
+ Get
+ Return m_Alias_IsChecked
+ End Get
+ Set(value As Boolean)
+ m_Alias_IsChecked = value
+ If value Then
+ NewBeam_Visibility = Visibility.Collapsed
+ NewWall_Visibility = Visibility.Collapsed
+ Alias_Visibility = Visibility.Visible
+ Else
+ If m_nType = MachineType.BEAM Then
+ NewBeam_Visibility = Visibility.Visible
+ NewWall_Visibility = Visibility.Collapsed
+ Else
+ NewBeam_Visibility = Visibility.Collapsed
+ NewWall_Visibility = Visibility.Visible
+ End If
+ Alias_Visibility = Visibility.Collapsed
+ End If
+ End Set
+ End Property
+
+ Private m_NewBeam_Visibility As Visibility
+ Public Property NewBeam_Visibility As Visibility
+ Get
+ Return m_NewBeam_Visibility
+ End Get
+ Set(value As Visibility)
+ If value <> m_NewBeam_Visibility Then
+ m_NewBeam_Visibility = value
+ NotifyPropertyChanged("NewBeam_Visibility")
+ End If
+ End Set
+ End Property
+
+ Private m_NewWall_Visibility As Visibility
+ Public Property NewWall_Visibility As Visibility
+ Get
+ Return m_NewWall_Visibility
+ End Get
+ Set(value As Visibility)
+ If value <> m_NewWall_Visibility Then
+ m_NewWall_Visibility = value
+ NotifyPropertyChanged("NewWall_Visibility")
+ End If
+ End Set
+ End Property
+
+ Private m_Alias_Visibility As Visibility
+ Public Property Alias_Visibility As Visibility
+ Get
+ Return m_Alias_Visibility
+ End Get
+ Set(value As Visibility)
+ If value <> m_Alias_Visibility Then
+ m_Alias_Visibility = value
+ NotifyPropertyChanged("Alias_Visibility")
+ End If
+ End Set
+ End Property
+
+ Public ReadOnly Property L_Msg As String
+ Get
+ Return EgtMsg(61604)
+ End Get
+ End Property
+
+ Public ReadOnly Property W_Msg As String
+ Get
+ Return EgtMsg(61605)
+ End Get
+ End Property
+
+ Public ReadOnly Property H_Msg As String
+ Get
+ Return EgtMsg(61606)
+ End Get
+ End Property
+
+#End Region ' Import BTL <-> Warehouse
+
+End Class
+
diff --git a/EgtBEAMWALL.Core/Utility/BTLIniFile.vb b/EgtBEAMWALL.Core/Utility/BTLIniFile.vb
new file mode 100644
index 00000000..b6fdfe4c
--- /dev/null
+++ b/EgtBEAMWALL.Core/Utility/BTLIniFile.vb
@@ -0,0 +1,173 @@
+'----------------------------------------------------------------------------
+' EgalTech 2017-2017
+'----------------------------------------------------------------------------
+' File : IniFile.vb Data : 08.04.17 Versione : 1.8d1
+' Contenuto : Modulo IniFile per gestione lettura/scrittura da file INI.
+'
+'
+'
+' Modifiche : 08.04.17 ES Creazione modulo.
+'
+'
+'----------------------------------------------------------------------------
+
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Module BTLIniFile
+
+ Public m_sBTLIniFile As String
+
+ Public Function GetBeamPrivateProfileProcessList(IpGRPType As GRPType, ByRef IpProcessList As ObservableCollection(Of Integer)) As Boolean
+ Dim PRCList As New ObservableCollection(Of Integer)
+ Dim sProcess As String = String.Empty
+ If EgtUILib.GetPrivateProfileString(PROCESSINGS, IpGRPType, String.Empty, sProcess, m_sBTLIniFile) > 0 Then
+ Dim sProcesses() As String = sProcess.Split(","c)
+ ' verifico ce ne sia almeno uno
+ If sProcesses.Count >= 0 Then
+ ' cancello spazi
+ For Index = 0 To sProcesses.Count - 1
+ sProcesses(Index) = sProcesses(Index).Trim()
+ Dim nProcess As Integer
+ Integer.TryParse(sProcesses(Index), nProcess)
+ PRCList.Add(nProcess)
+ Next
+ IpProcessList = PRCList
+ Return True
+ End If
+ End If
+ Return False
+ End Function
+
+ Public Function GetBeamPrivateProfileGRPList(IpGRP As Integer, IpPRC As Integer, ByRef IpGRPList As ObservableCollection(Of Integer)) As Boolean
+ IpGRPList.Clear()
+ ' ciclo sui tipi di gruppo
+ Dim sBTLGroup As String = String.Empty
+ If EgtUILib.GetPrivateProfileString(IpGRP & "." & IpPRC, BTL_FTR_GRP, String.Empty, sBTLGroup, m_sBTLIniFile) > 0 Then
+ Dim sBTLGroups() As String = sBTLGroup.Split(","c)
+ ' verifico numero minimo di parametri
+ If sBTLGroups.Count >= 0 Then
+ ' cancello spazi
+ For Index = 0 To sBTLGroups.Count - 1
+ sBTLGroups(Index) = sBTLGroups(Index).Trim()
+ Next
+ ' creo parametro
+ For Each Group In sBTLGroups
+ Dim nGroup As Integer = -1
+ Integer.TryParse(Group, nGroup)
+ If IpGRP = GRPType.L And (nGroup = 0 OrElse nGroup = 3 OrElse nGroup = 4) Then
+ IpGRPList.Add(nGroup)
+ ElseIf IpGRP = GRPType.T And (nGroup = 1 OrElse nGroup = 2) Then
+ IpGRPList.Add(nGroup)
+ End If
+ Next
+ End If
+ End If
+ Return IpGRPList.Count > 0
+ End Function
+
+ 'Public Function GetBeamPrivateProfileVerifyGRP(IpAppName As String, IpGPRtoVerify As String) As Boolean
+ ' ' ciclo sui tipi di gruppo
+ ' Dim sBTLGroup As String = String.Empty
+ ' If EgtUILib.GetPrivateProfileString(IpAppName, BTL_FTR_GRP, String.Empty, sBTLGroup, m_sBTLIniFile) > 0 Then
+ ' Dim sBTLGroups() As String = sBTLGroup.Split(","c)
+ ' ' verifico numero minimo di parametri
+ ' If sBTLGroups.Count >= 0 Then
+ ' ' cancello spazi
+ ' For Index = 0 To sBTLGroups.Count - 1
+ ' sBTLGroups(Index) = sBTLGroups(Index).Trim()
+ ' Next
+ ' End If
+ ' Return sBTLGroups.Contains(IpGPRtoVerify)
+ ' End If
+ ' Return False
+ 'End Function
+
+ Public Function CalcBeamPrivateProfileGRP(nGRP As Integer) As Integer
+ If nGRP = 1 Or nGRP = 2 Then
+ Return 1
+ ElseIf nGRP = 0 Or nGRP = 3 Or nGRP = 4 Then
+ Return 0
+ Else
+ Return nGRP
+ End If
+ End Function
+
+ Public Function GetBeamPrivateProfileName(IpGRP As Integer, IpPRC As Integer, ByRef IpBTLFeature As BTLFeature) As Boolean
+ Dim sBTLName As String = String.Empty
+ ' creo lista GRP e leggo nome
+ If EgtUILib.GetPrivateProfileString(CalcBeamPrivateProfileGRP(IpGRP) & "." & IpPRC, BTL_FTR_NAME, String.Empty, sBTLName, m_sBTLIniFile) > 0 Then
+ ' verifico numero minimo di parametri
+ If Not String.IsNullOrEmpty(sBTLName) Then
+ Dim nNameMsg As Integer
+ Integer.TryParse(sBTLName, nNameMsg)
+ IpBTLFeature.SetName(EgtMsg(nNameMsg))
+ Return True
+ End If
+ End If
+ Return False
+ End Function
+
+ Public Function GetBeamPrivateProfileName(IpGRP As Integer, IpPRC As Integer) As String
+ Dim sBTLName As String = String.Empty
+ ' creo lista GRP e leggo nome
+ If EgtUILib.GetPrivateProfileString(CalcBeamPrivateProfileGRP(IpGRP) & "." & IpPRC, BTL_FTR_NAME, String.Empty, sBTLName, m_sBTLIniFile) > 0 Then
+ ' verifico numero minimo di parametri
+ If Not String.IsNullOrEmpty(sBTLName) Then
+ Dim nNameMsg As Integer
+ Integer.TryParse(sBTLName, nNameMsg)
+ Return EgtMsg(nNameMsg)
+ Return True
+ End If
+ End If
+ Return ""
+ End Function
+
+ Public Function GetBeamPrivateProfileParam(IpGRP As Integer, IpPRC As Integer, IsP As Boolean, IpFeatureParamIndex As String, IpParentFeature As BTLFeature, ByRef IpBTLParam As BTLParam) As Boolean
+ Dim sBTLParam As String = String.Empty
+ If EgtUILib.GetPrivateProfileString(CalcBeamPrivateProfileGRP(IpGRP) & "." & IpPRC, If(IsP, "P", "Q") & IpFeatureParamIndex, String.Empty, sBTLParam, m_sBTLIniFile) > 0 Then
+ Dim sBTLParamParams() As String = sBTLParam.Split(","c)
+ ' verifico numero minimo di parametri
+ If sBTLParamParams.Count >= 6 Then
+ ' cancello spazi
+ For Index = 0 To sBTLParamParams.Count - 1
+ sBTLParamParams(Index) = sBTLParamParams(Index).Trim()
+ Next
+ ' creo parametro
+ If sBTLParamParams(0) = "d" OrElse sBTLParamParams(0) = "l" Then
+ Dim dMin As Double
+ Dim dMax As Double
+ Dim dDefault As Double
+ StringToDouble(sBTLParamParams(2), dMin)
+ StringToDouble(sBTLParamParams(3), dMax)
+ StringToDouble(sBTLParamParams(4), dDefault)
+ Dim ParamType As BTLParamType
+ If sBTLParamParams(0) = "d" Then
+ ParamType = BTLParamType.DOUBLE_
+ Else
+ ParamType = BTLParamType.LENGTH
+ End If
+ IpBTLParam = New BTLParam(IpParentFeature, IsP, ParamType, sBTLParamParams(1), dMin, dMax, dDefault, sBTLParamParams(5))
+ Return Not IsNothing(IpBTLParam)
+ ElseIf sBTLParamParams(0) = "s" Then
+ IpBTLParam = New BTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(5))
+ Return Not IsNothing(IpBTLParam)
+ ElseIf sBTLParamParams(0) = "c" Then
+ Dim nMin As Integer
+ Dim nMax As Integer
+ Dim nDefault As Integer
+ Integer.TryParse(sBTLParamParams(2), nMin)
+ Integer.TryParse(sBTLParamParams(3), nMax)
+ Integer.TryParse(sBTLParamParams(4), nDefault)
+ ' recupero lista valori
+ Dim ValueList As New List(Of String)
+ IpBTLParam = New BTLParam(IpParentFeature, IsP, BTLParamType.COMBO, sBTLParamParams(1), nMin, nMax, nDefault, sBTLParamParams(5), ValueList)
+ Return Not IsNothing(IpBTLParam)
+ End If
+ End If
+ End If
+ Return False
+ End Function
+
+End Module
diff --git a/EgtBEAMWALL.Core/Utility/Command.vb b/EgtBEAMWALL.Core/Utility/Command.vb
new file mode 100644
index 00000000..f64d83b6
--- /dev/null
+++ b/EgtBEAMWALL.Core/Utility/Command.vb
@@ -0,0 +1,70 @@
+Imports System.Windows.Input
+
+'''
+''' A command whose sole purpose is to
+''' relay its functionality to other
+''' objects by invoking delegates. The
+''' default return value for the CanExecute
+''' method is 'true'.
+'''
+Public Class Command
+ Implements ICommand
+
+#Region "Fields"
+
+ Private ReadOnly _execute As Action(Of Object)
+ Private ReadOnly _canExecute As Predicate(Of Object)
+
+#End Region ' Fields
+
+#Region "Constructors"
+
+ '''
+ ''' Creates a new command that can always execute.
+ '''
+ ''' The execution logic.
+ Public Sub New(ByVal execute As Action(Of Object))
+ Me.New(execute, Nothing)
+ End Sub
+
+ '''
+ ''' Creates a new command.
+ '''
+ ''' The execution logic.
+ ''' The execution status logic.
+ Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
+ If execute Is Nothing Then
+ Throw New ArgumentNullException("execute")
+ End If
+
+ _execute = execute
+ _canExecute = canExecute
+ End Sub
+
+#End Region ' Constructors
+
+#Region "ICommand Members"
+
+ _
+ Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
+ Return If(_canExecute Is Nothing, True, _canExecute(parameter))
+ End Function
+
+ Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
+ AddHandler(ByVal value As EventHandler)
+ AddHandler CommandManager.RequerySuggested, value
+ End AddHandler
+ RemoveHandler(ByVal value As EventHandler)
+ RemoveHandler CommandManager.RequerySuggested, value
+ End RemoveHandler
+ RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
+ End RaiseEvent
+ End Event
+
+ Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
+ _execute(parameter)
+ End Sub
+
+#End Region ' ICommand Members
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.Core/Utility/VMBase.vb b/EgtBEAMWALL.Core/Utility/VMBase.vb
new file mode 100644
index 00000000..b2d5ce6c
--- /dev/null
+++ b/EgtBEAMWALL.Core/Utility/VMBase.vb
@@ -0,0 +1,12 @@
+Imports System.ComponentModel
+
+Public Class VMBase
+ Implements INotifyPropertyChanged
+
+ Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
+
+ Public Sub NotifyPropertyChanged(propName As String)
+ RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.Core/Wall.vb b/EgtBEAMWALL.Core/Wall.vb
new file mode 100644
index 00000000..fb4961cd
--- /dev/null
+++ b/EgtBEAMWALL.Core/Wall.vb
@@ -0,0 +1,47 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class Wall
+ Inherits Part
+
+ Protected m_dPOSY As Double
+ Public Property dPOSY As Double
+ Get
+ Return m_dPOSY
+ End Get
+ Set(value As Double)
+ m_dPOSY = value
+ End Set
+ End Property
+
+ Protected m_dROT As Double
+ Public Property dROT As Double
+ Get
+ Return m_dROT
+ End Get
+ Set(value As Double)
+ m_dROT = value
+ End Set
+ End Property
+
+ Protected m_dFLIP As Double
+ Public Property dFLIP As Double
+ Get
+ Return m_dFLIP
+ End Get
+ Set(value As Double)
+ m_dFLIP = value
+ End Set
+ End Property
+
+#Region "CONSTRUCTOR"
+
+ Sub New(nParentMachGroup As MyMachGroup, nPartId As Integer)
+ MyBase.New(nParentMachGroup, nPartId)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+End Class
diff --git a/EgtBEAMWALL.Core/WallMachGroup.vb b/EgtBEAMWALL.Core/WallMachGroup.vb
new file mode 100644
index 00000000..5711f5b5
--- /dev/null
+++ b/EgtBEAMWALL.Core/WallMachGroup.vb
@@ -0,0 +1,45 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class WallMachGroup
+ Inherits MyMachGroup
+
+ Protected m_nRawPartId As Integer = GDB_ID.NULL
+ Public ReadOnly Property nRawPartId As Integer
+ Get
+ Return m_nRawPartId
+ End Get
+ End Property
+
+ Sub New(nId As Integer, sName As String, sMachine As String)
+ MyBase.New(nId, sName, sMachine)
+ SetMachineType(MachineType.WALL)
+ m_nRawPartId = EgtGetFirstRawPart()
+ EgtGetInfo(nId, MGR_RPT_PANELLEN, dL)
+ EgtGetInfo(nId, MGR_RPT_PANELWIDTH, dW)
+ EgtGetInfo(nId, MGR_RPT_PANELHEIGHT, dH)
+ m_dTotMat = dL * dW
+ For Each Part In PartList
+ m_dMatForPart += (Part.dL * Part.dW)
+ Next
+ End Sub
+
+ Public Overrides Sub RefreshPartList()
+ m_nRawPartId = EgtGetFirstRawPart()
+ PartList.Clear()
+ Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_nRawPartId)
+ While nPartId <> GDB_ID.NULL
+ PartList.Add(New Wall(Me, nPartId))
+ nPartId = EgtGetNextPartInRawPart(nPartId)
+ End While
+ End Sub
+
+ Public Overrides Sub RefreshGroupData()
+ EgtGetInfo(Id, MGR_RPT_PANELLEN, dL)
+ EgtGetInfo(Id, MGR_RPT_PANELWIDTH, dW)
+ EgtGetInfo(Id, MGR_RPT_PANELHEIGHT, dH)
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.DataLayer/App.config b/EgtBEAMWALL.DataLayer/App.config
new file mode 100644
index 00000000..e780891a
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/App.config
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/Constants.cs b/EgtBEAMWALL.DataLayer/Constants.cs
new file mode 100644
index 00000000..a9bf2060
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Constants.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace EgtBEAMWALL.DataLayer
+{
+ public static class Constants
+ {
+
+ // Database config
+ public const string DATABASE_SERV = "127.0.0.1";
+ public const string DATABASE_NAME = "EgtBwDb";
+ public const string DATABASE_USER = "root";
+ public const string DATABASE_PWD = "viacremasca";
+ public static int DATABASE_PROCESS_TIMEOUT = 5;
+
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/Controllers/BTLPartController.cs b/EgtBEAMWALL.DataLayer/Controllers/BTLPartController.cs
new file mode 100644
index 00000000..7bb3cea9
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Controllers/BTLPartController.cs
@@ -0,0 +1,292 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using EgtBEAMWALL.DataLayer.DatabaseModels;
+
+namespace EgtBEAMWALL.DataLayer.Controllers
+{
+ public class BTLPartController : IDisposable
+ {
+ private DatabaseContext dbCtx;
+
+ public BTLPartController()
+ {
+ // Initialize database context
+ dbCtx = new DatabaseContext();
+ }
+
+ public void Dispose()
+ {
+ // Clear database context
+ dbCtx.Dispose();
+ }
+ ///
+ /// Get record by DBId
+ ///
+ ///
+ ///
+ public BTLPartModel FindByDbId(int PartDbId)
+ {
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId == PartDbId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get record by ExtId
+ ///
+ ///
+ ///
+ public BTLPartModel FindByPartId(int PartId)
+ {
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.PartId == PartId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get paginated data from DB (ASC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedAsc(int PartDbIdStart, int numRecord)
+ {
+ int numEnd = PartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId <= PartDbIdStart)
+ .OrderBy(x => x.PartDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get paginated data from DB (DESC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedDesc(int PartDbIdStart, int numRecord)
+ {
+ int numEnd = PartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId <= PartDbIdStart)
+ .OrderByDescending(x => x.PartDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProjectId (ASC ordered)
+ ///
+ ///
+ ///
+ public List GetByProjectAsc(int ProjDbId)
+ {
+ // retrieve
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.ProjDbId == ProjDbId)
+ .OrderBy(x => x.PartDbId)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProjectId (DESC ordered)
+ ///
+ ///
+ ///
+ public List GetByProjectDesc(int ProjDbId)
+ {
+ // retrieve
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.ProjDbId == ProjDbId)
+ .OrderByDescending(x => x.PartDbId)
+ .ToList();
+ }
+
+ ///
+ /// Create multiple (empty) BTLPart record associated to Project
+ ///
+ ///
+ ///
+ ///
+ public List CreateBaseObj(int ProjDbId, List rawListData)
+ {
+ List partData = new List();
+
+ foreach (var item in rawListData)
+ {
+ BTLPartModel newItem = new BTLPartModel() { ProjDbId = ProjDbId, PartId = item };
+ partData.Add(newItem);
+ }
+
+ try
+ {
+ // Add to database
+ dbCtx.BTLPartList.AddRange(partData);
+ // Commit changes
+ dbCtx.SaveChanges();
+ }
+ catch
+ { }
+
+ return partData;
+ }
+
+
+ ///
+ /// Create multiple BTLPart record associated to Project
+ ///
+ ///
+ ///
+ ///
+ public List Create(int ProjID, List partData)
+ {
+ // se è adv mode --> uso TUTTI i dati
+ if (DbManager.AdvDataModel)
+ {
+ try
+ {
+ // Add to database
+ dbCtx.BTLPartList.AddRange(partData);
+ // Commit changes
+ dbCtx.SaveChanges();
+ }
+ catch
+ { }
+ return partData;
+ }
+ // se non adv --> faccio solo copia degli id...
+ else
+ {
+ List partIdList = new List();
+ foreach (var item in partData)
+ {
+ partIdList.Add(item.PartId);
+ }
+ return CreateBaseObj(ProjID, partIdList);
+ }
+ }
+
+ ///
+ /// Update single BTLPart
+ ///
+ ///
+ ///
+ public bool Update(BTLPartModel updItem)
+ {
+ bool done = false;
+ var item2del = dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId == updItem.PartDbId)
+ .SingleOrDefault();
+ try
+ {
+ // update, vers 1...
+ dbCtx.Entry(item2del).CurrentValues.SetValues(updItem);
+
+ //// update, vers 2
+ //dbCtx.BTLPartList.Remove(item2del);
+ //dbCtx.BTLPartList.Add(updItem);
+
+ // Commit changes
+ dbCtx.SaveChanges();
+ done = true;
+ }
+ catch
+ { }
+ return done;
+ }
+
+ ///
+ /// Delete single BTLPart
+ ///
+ ///
+ ///
+ public bool Delete(int PartDbId)
+ {
+ bool done = false;
+ var item2del = dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId == PartDbId)
+ .SingleOrDefault();
+ try
+ {
+ // Add to database
+ dbCtx.BTLPartList.Remove(item2del);
+ // Commit changes
+ dbCtx.SaveChanges();
+ done = true;
+ }
+ catch
+ { }
+ return done;
+ }
+ ///
+ /// Delete BTLPart by project
+ ///
+ ///
+ ///
+ public bool DeleteByProject(int ProjDbId)
+ {
+ bool done = false;
+ var items2del = dbCtx
+ .BTLPartList
+ .Where(x => x.ProjDbId == ProjDbId);
+ try
+ {
+ // Add to database
+ dbCtx.BTLPartList.RemoveRange(items2del);
+ // Commit changes
+ dbCtx.SaveChanges();
+ done = true;
+ }
+ catch
+ { }
+ return done;
+ }
+
+ ///
+ /// Conversion of base class to DB model class
+ ///
+ ///
+ ///
+ public BTLPartModel Convert(Core.BTLPart corePart)
+ {
+ BTLPartModel answ = new BTLPartModel();
+ if (corePart != null)
+ {
+ answ = new BTLPartModel()
+ {
+ PartId = corePart.nPartId,
+ PDN = corePart.nPDN,
+ DO = corePart.bDO,
+ NAM = corePart.sNAM,
+ W = corePart.dW,
+ L = corePart.dL,
+ H = corePart.dH,
+ MAT = corePart.sMATERIAL,
+ CNT = corePart.nCNT,
+ TBP = corePart.nTBP,
+ DON = corePart.nDON,
+ ROT = corePart.nROT,
+ GRP = corePart.sGRP,
+ UNT = corePart.nUNT,
+ CALC_State = (int)corePart.nState
+ };
+ }
+ return answ;
+ }
+
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
new file mode 100644
index 00000000..778431d3
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
@@ -0,0 +1,170 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using EgtBEAMWALL.DataLayer.DatabaseModels;
+
+namespace EgtBEAMWALL.DataLayer.Controllers
+{
+ public class ProdController : IDisposable
+ {
+ private DatabaseContext dbCtx;
+
+ public ProdController()
+ {
+ // Initialize database context
+ dbCtx = new DatabaseContext();
+ }
+
+ public void Dispose()
+ {
+ // Clear database context
+ dbCtx.Dispose();
+ }
+ ///
+ /// Get record by RawPartDbId
+ ///
+ ///
+ ///
+ public ProdModel FindByRawPartDbId(int RawPartDbId)
+ {
+ var rawPart = dbCtx
+ .RawPartList
+ .Where(x => x.RawPartDbId == RawPartDbId)
+ .SingleOrDefault();
+
+ return FindByProdDbId(rawPart.ProdDbId);
+ }
+ ///
+ /// Get record by RawPartId
+ ///
+ ///
+ ///
+ public ProdModel FindByRawPartId(int RawPartId)
+ {
+ var rawPart = dbCtx
+ .RawPartList
+ .Where(x => x.RawPartId == RawPartId)
+ .SingleOrDefault();
+
+ return FindByProdDbId(rawPart.ProdDbId);
+ }
+ ///
+ /// Get record by ProdDbId
+ ///
+ ///
+ ///
+ public ProdModel FindByProdDbId(int ProdDbId)
+ {
+ return dbCtx
+ .ProdList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get record by ProdId
+ ///
+ ///
+ ///
+ public ProdModel FindByProdId(int ProdId)
+ {
+ return dbCtx
+ .ProdList
+ .Where(x => x.ProdId == ProdId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get paginated data from DB (ASC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedAsc(int ProdDbIdStart, int numRecord)
+ {
+ int numEnd = ProdDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .ProdList
+ .Where(x => x.ProdDbId <= ProdDbIdStart)
+ .OrderBy(x => x.ProdDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get paginated data from DB (DESC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedDesc(int PartDbIdStart, int numRecord)
+ {
+ int numEnd = PartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .ProdList
+ .Where(x => x.ProdDbId <= PartDbIdStart)
+ .OrderByDescending(x => x.ProdDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProdectId (ASC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdAsc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .ProdList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderBy(x => x.ProdDbId)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProdectId (DESC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdDesc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .ProdList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderByDescending(x => x.ProdDbId)
+ .ToList();
+ }
+
+ ///
+ /// Create record on DB
+ ///
+ ///
+ ///
+ ///
+ public ProdModel Create(int newProdId, string Description)
+ {
+ ProdModel newProd = new ProdModel() { ProdId = newProdId, Description = Description };
+
+ try
+ {
+ // Add to database
+ dbCtx.ProdList.Add(newProd);
+ // Commit changes
+ dbCtx.SaveChanges();
+ }
+ catch
+ { }
+
+ return newProd;
+ }
+
+
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs b/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs
new file mode 100644
index 00000000..3cb72efc
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using EgtBEAMWALL.DataLayer.DatabaseModels;
+
+namespace EgtBEAMWALL.DataLayer.Controllers
+{
+ public class ProjController : IDisposable
+ {
+ private DatabaseContext dbCtx;
+
+ public ProjController()
+ {
+ // Initialize database context
+ dbCtx = new DatabaseContext();
+ }
+
+ public void Dispose()
+ {
+ // Clear database context
+ dbCtx.Dispose();
+ }
+ ///
+ /// Get record by ProjDbId
+ ///
+ ///
+ ///
+ public ProjModel FindByProjDbId(int ProjDbId)
+ {
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProjDbId == ProjDbId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get record by ProjId
+ ///
+ ///
+ ///
+ public ProjModel FindByProjId(int ProjId)
+ {
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProjId == ProjId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get paginated data from DB (ASC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedAsc(int ProjDbIdStart, int numRecord)
+ {
+ int numEnd = ProjDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProjDbId <= ProjDbIdStart)
+ .OrderBy(x => x.ProjDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get paginated data from DB (DESC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedDesc(int PartDbIdStart, int numRecord)
+ {
+ int numEnd = PartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProjDbId <= PartDbIdStart)
+ .OrderByDescending(x => x.ProjDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProjectId (ASC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdAsc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderBy(x => x.ProdDbId)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProjectId (DESC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdDesc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderByDescending(x => x.ProdDbId)
+ .ToList();
+ }
+
+ ///
+ /// Create record on DB
+ ///
+ ///
+ ///
+ ///
+ public ProjModel Create(int newProjId, string newBTLFileName)
+ {
+ ProjModel newProj = new ProjModel() { ProjId=newProjId, BTLFileName=newBTLFileName };
+
+ try
+ {
+ // Add to database
+ dbCtx.ProjList.Add(newProj);
+ // Commit changes
+ dbCtx.SaveChanges();
+ }
+ catch
+ { }
+
+ return newProj;
+ }
+
+
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/Controllers/RawPartController.cs b/EgtBEAMWALL.DataLayer/Controllers/RawPartController.cs
new file mode 100644
index 00000000..8f9e8922
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Controllers/RawPartController.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using EgtBEAMWALL.DataLayer.DatabaseModels;
+
+namespace EgtBEAMWALL.DataLayer.Controllers
+{
+ public class RawPartController : IDisposable
+ {
+ private DatabaseContext dbCtx;
+
+ public RawPartController()
+ {
+ // Initialize database context
+ dbCtx = new DatabaseContext();
+ }
+
+ public void Dispose()
+ {
+ // Clear database context
+ dbCtx.Dispose();
+ }
+ ///
+ /// Get record by RawPartDbId
+ ///
+ ///
+ ///
+ public RawPartModel FindByRawPartDbId(int RawPartDbId)
+ {
+ return dbCtx
+ .RawPartList
+ .Where(x => x.RawPartDbId == RawPartDbId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get record by RawPartId
+ ///
+ ///
+ ///
+ public RawPartModel FindByRawPartId(int RawPartId)
+ {
+ return dbCtx
+ .RawPartList
+ .Where(x => x.RawPartId == RawPartId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get paginated data from DB (ASC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedAsc(int RawPartDbIdStart, int numRecord)
+ {
+ int numEnd = RawPartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .RawPartList
+ .Where(x => x.RawPartDbId <= RawPartDbIdStart)
+ .OrderBy(x => x.RawPartDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get paginated data from DB (DESC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedDesc(int PartDbIdStart, int numRecord)
+ {
+ int numEnd = PartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .RawPartList
+ .Where(x => x.RawPartDbId <= PartDbIdStart)
+ .OrderByDescending(x => x.RawPartDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by RawPartectId (ASC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdAsc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .RawPartList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderBy(x => x.ProdDbId)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by RawPartectId (DESC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdDesc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .RawPartList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderByDescending(x => x.ProdDbId)
+ .ToList();
+ }
+
+ ///
+ /// Create record on DB
+ ///
+ ///
+ ///
+ ///
+ public RawPartModel Create(int newRawPartId, string description)
+ {
+ RawPartModel newRawPart = new RawPartModel() { RawPartId=newRawPartId, Description=description, State= RawPartState.ND };
+
+ try
+ {
+ // Add to database
+ dbCtx.RawPartList.Add(newRawPart);
+ // Commit changes
+ dbCtx.SaveChanges();
+ }
+ catch
+ { }
+
+ return newRawPart;
+ }
+
+
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/DatabaseContext.cs b/EgtBEAMWALL.DataLayer/DatabaseContext.cs
new file mode 100644
index 00000000..f01dadcb
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/DatabaseContext.cs
@@ -0,0 +1,120 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Data.Entity.Migrations;
+using MySql.Data.Entity;
+using System.Linq;
+using System.Text;
+using EgtBEAMWALL.DataLayer.DatabaseModels;
+using EgtBEAMWALL.DataLayer.Migrations;
+using System.ServiceProcess;
+//using EgtBEAMWALL.DataLayer.Migrations;
+//using EgtBEAMWALL.DataLayer.Controllers;
+
+namespace EgtBEAMWALL.DataLayer
+{
+
+ [DbConfigurationType(typeof(MySqlEFConfiguration))]
+ public class DatabaseContext : DbContext
+ {
+ ///
+ /// BTLParts management
+ ///
+ public DbSet BTLPartList { get; set; }
+ ///
+ /// Parts management
+ ///
+ public DbSet ProdList { get; set; }
+ ///
+ /// Parts management
+ ///
+ public DbSet ProjList { get; set; }
+ ///
+ /// Parts management
+ ///
+ public DbSet RawPartList { get; set; }
+ ///
+ /// Parts management
+ ///
+ public DbSet PartList { get; set; }
+
+#if false
+ ///
+ /// Db data mode
+ ///
+ public static bool AdvDataModel { get; set; } = false;
+#endif
+
+ //providerName="System.Data.EntityClient"
+
+
+ public static string CONNECTION_STRING = $"server={Constants.DATABASE_SERV};port=3306;database={Constants.DATABASE_NAME};uid={Constants.DATABASE_USER};pwd={Constants.DATABASE_PWD};";
+
+ public DatabaseContext() : base(CONNECTION_STRING)
+ {
+ }
+
+ public static DatabaseContext Create()
+ {
+ return new DatabaseContext();
+ }
+
+ private static string getDbServiceName()
+ {
+ ServiceController[] services = ServiceController.GetServices();
+ var service = services.FirstOrDefault(s => s.ServiceName == "MariaDB");
+ if (service != null)
+ return service.DisplayName;
+
+ service = services.FirstOrDefault(s => s.ServiceName == "MySQL");
+ if (service != null)
+ return service.DisplayName;
+
+ return "";
+
+ }
+
+ public static bool SetUpDbConnectionAndDbConfig()
+ {
+ try
+ {
+ String serviceName = getDbServiceName();
+ if (serviceName.Equals(""))
+ {
+ return false;
+ }
+
+
+ ServiceController service = new ServiceController(serviceName);
+ try
+ {
+ TimeSpan timeout = TimeSpan.FromSeconds(Constants.DATABASE_PROCESS_TIMEOUT);
+ service.WaitForStatus(ServiceControllerStatus.Running, timeout);
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+
+
+
+ System.Data.Entity.Database.SetInitializer(null);
+ var migrator = new DbMigrator(new Configuration());
+
+ if (migrator.GetPendingMigrations().Any())
+ {
+ // Run migrations and seed.
+ migrator.Update();
+ }
+
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/DatabaseModels/BTLPartModel.cs b/EgtBEAMWALL.DataLayer/DatabaseModels/BTLPartModel.cs
new file mode 100644
index 00000000..cb470ae9
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/DatabaseModels/BTLPartModel.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DataLayer.DatabaseModels
+{
+ ///
+ /// Tabella di gestione dei PROTOTIPI dal file BTL (part + quantità)
+ ///
+ [Table("BTLPartList")]
+ public class BTLPartModel
+ {
+ ///
+ /// Chiave univoca
+ ///
+ [Key, Column("BTLPartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int PartDbId { get; set; }
+
+ ///
+ /// PartId dal programma
+ ///
+ [Column("BTLPartId")]
+ public int PartId { get; set; }
+
+ [Column("BTLPart_PDN")]
+ public int PDN { get; set; } = 0;
+
+ [Column("BTLPart_DO")]
+ public bool DO { get; set; } = false;
+
+ [Column("BTLPart_NAM")]
+ public string NAM { get; set; } = "";
+
+ [Column("BTLPart_W")]
+ public double W { get; set; } = 0;
+
+ [Column("BTLPart_L")]
+ public double L { get; set; } = 0;
+
+ [Column("BTLPart_H")]
+ public double H { get; set; } = 0;
+
+ [Column("BTLPart_MAT")]
+ public string MAT { get; set; } = "";
+
+ ///
+ /// Quantità richiesta
+ ///
+ [Column("BTLPart_CNT")]
+ public int CNT { get; set; } = 0;
+
+ [Column("BTLPart_TBP")]
+ public int TBP { get; set; } = 0;
+
+ [Column("BTLPart_DON")]
+ public int DON { get; set; } = 0;
+
+ [Column("BTLPart_ROT")]
+ public int ROT { get; set; } = 0;
+
+ [Column("BTLPart_GRP")]
+ public string GRP { get; set; } = "";
+
+ [Column("BTLPart_UNT")]
+ public int UNT { get; set; } = 0;
+
+ [Column("BTLPart_CalcState")]
+ public int CALC_State { get; set; } = -1;
+
+ [Column("ProjDbId")]
+ public int ProjDbId { get; set; }
+
+ [ForeignKey("ProjDbId")]
+ public ProjModel Project { get; set; }
+
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/DatabaseModels/PartModel.cs b/EgtBEAMWALL.DataLayer/DatabaseModels/PartModel.cs
new file mode 100644
index 00000000..8b3771a1
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/DatabaseModels/PartModel.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DataLayer.DatabaseModels
+{
+ ///
+ /// Tabelal delle singole istsanze prodotte\
+ ///
+ [Table("PartList")]
+ public class PartModel
+ {
+ [Key, Column("PartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int PartDbId { get; set; }
+
+ [Column("PartId")]
+ public int PartId { get; set; }
+
+ [Column("Part_PDN")]
+ public int PDN { get; set; } = 0;
+
+ [Column("Part_NAM")]
+ public string NAM { get; set; } = "";
+
+ [Column("Part_W")]
+ public double W { get; set; } = 0;
+
+ [Column("Part_L")]
+ public double L { get; set; } = 0;
+
+ [Column("Part_H")]
+ public double H { get; set; } = 0;
+
+ [Column("Part_MAT")]
+ public string MAT { get; set; } = "";
+
+ [Column("Part_ROT")]
+ public int ROT { get; set; } = 0;
+
+ [Column("Part_GRP")]
+ public string GRP { get; set; } = "";
+
+ [Column("Part_CalcState")]
+ public int CALC_State { get; set; } = -1;
+
+ ///
+ /// Stato della singola Part (da enum)
+ ///
+ [Column("Part_State")]
+ public PartState State { get; set; } = PartState.ND;
+
+ [Column("BTLPartDbId")]
+ public int BTLPartDbId { get; set; }
+
+ [ForeignKey("BTLPartDbId")]
+ public BTLPartModel BTLPart { get; set; }
+
+ [Column("RawPartDbId")]
+ public int? RawPartDbId { get; set; }
+
+ [ForeignKey("RawPartDbId")]
+ public virtual RawPartModel RawPart { get; set; }
+
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/DatabaseModels/ProdModel.cs b/EgtBEAMWALL.DataLayer/DatabaseModels/ProdModel.cs
new file mode 100644
index 00000000..9705aa61
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/DatabaseModels/ProdModel.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DataLayer.DatabaseModels
+{
+ ///
+ /// Tabella deiu raggruppamenti PROJ in forma di PROD
+ ///
+ [Table("ProdList")]
+ public class ProdModel
+ {
+ [Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int ProdDbId { get; set; }
+
+ [Column("ProdId")]
+ public int ProdId { get; set; }
+
+ [Column("Prod_Description")]
+ public string Description { get; set; } = "";
+
+ [Column("Prod_Lock")]
+ public bool Locked { get; set; } = false;
+
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/DatabaseModels/ProjModel.cs b/EgtBEAMWALL.DataLayer/DatabaseModels/ProjModel.cs
new file mode 100644
index 00000000..f5a1a33f
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/DatabaseModels/ProjModel.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DataLayer.DatabaseModels
+{
+ ///
+ /// Tabella dei PROJ caricati dal BTL
+ ///
+ [Table("ProjList")]
+ public class ProjModel
+ {
+ [Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int ProjDbId { get; set; }
+
+ [Column("ProjId")]
+ public int ProjId { get; set; }
+
+ [Column("Proj_BTLFileName")]
+ public string BTLFileName { get; set; } = "";
+
+ [Column("ProdDbId")]
+ public int? ProdDbId { get; set; }
+
+ [ForeignKey("ProdDbId")]
+ public virtual ProdModel Prod { get; set; }
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/DatabaseModels/RawPartModel.cs b/EgtBEAMWALL.DataLayer/DatabaseModels/RawPartModel.cs
new file mode 100644
index 00000000..37349d29
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/DatabaseModels/RawPartModel.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DataLayer.DatabaseModels
+{
+ ///
+ /// Tabella dei grezzi
+ ///
+ [Table("RawPartList")]
+ public class RawPartModel
+ {
+ [Key, Column("RawPartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int RawPartDbId { get; set; }
+
+ [Column("RawPartId")]
+ public int RawPartId { get; set; }
+
+ [Column("RawPart_Descript")]
+ public string Description { get; set; } = "";
+
+ [Column("RawPart_State")]
+ public RawPartState State { get; set; } = RawPartState.ND;
+
+ [Column("RawPart_Assign")]
+ public string Assign { get; set; } = "";
+
+ [Column("ProdDbId")]
+ public int ProdDbId { get; set; }
+
+ [ForeignKey("ProdDbId")]
+ public ProdModel Prod { get; set; }
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/DbManager.cs b/EgtBEAMWALL.DataLayer/DbManager.cs
new file mode 100644
index 00000000..105c2f82
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/DbManager.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace EgtBEAMWALL.DataLayer
+{
+ public class DbManager
+ {
+ public static bool AdvDataModel { get; set; } = false;
+
+ public DbManager()
+ {
+ }
+
+ public Controllers.ProjController ProjCtr = new Controllers.ProjController();
+ public Controllers.BTLPartController BtlPartCtr = new Controllers.BTLPartController();
+
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/EgtBEAMWALL.DataLayer.csproj b/EgtBEAMWALL.DataLayer/EgtBEAMWALL.DataLayer.csproj
new file mode 100644
index 00000000..aadab368
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/EgtBEAMWALL.DataLayer.csproj
@@ -0,0 +1,99 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}
+ Library
+ Properties
+ EgtBEAMWALL.DataLayer
+ EgtBEAMWALL.DataLayer
+ v4.0
+ 512
+ true
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.SqlServer.dll
+
+
+ ..\packages\MySql.Data.6.9.12\lib\net40\MySql.Data.dll
+
+
+ ..\packages\MySql.Data.Entity.6.9.12\lib\net40\MySql.Data.Entity.EF6.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 202103031811160_InitDb.cs
+
+
+
+
+
+
+
+
+
+
+ {f22835a1-83d8-4334-91bb-baaeb9cf59b1}
+ EgtBEAMWALL.Core
+
+
+
+
+ 202103031811160_InitDb.cs
+
+
+
+
+ copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\ViewerOptimizer\EgtBEAMWALL.DataLayer.dll
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/Enums.cs b/EgtBEAMWALL.DataLayer/Enums.cs
new file mode 100644
index 00000000..32741785
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Enums.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace EgtBEAMWALL.DataLayer
+{
+
+ ///
+ /// Stati ammessi per le PARTS da tagliare
+ ///
+ public enum PartState
+ {
+ ND = -1,
+ RawAssigned = 0,
+ WIP = 1,
+ Produced = 2,
+ Scrapped = 3
+ }
+
+ ///
+ /// Stati ammessi per le RawParts
+ ///
+ public enum RawPartState
+ {
+ ND = -1,
+ Assigned = 0,
+ Wip = 1,
+ Produced = 2,
+ Scrapped = 3
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/Migrations/202103031811160_InitDb.Designer.cs b/EgtBEAMWALL.DataLayer/Migrations/202103031811160_InitDb.Designer.cs
new file mode 100644
index 00000000..e486f803
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Migrations/202103031811160_InitDb.Designer.cs
@@ -0,0 +1,29 @@
+//
+namespace EgtBEAMWALL.DataLayer.Migrations
+{
+ using System.CodeDom.Compiler;
+ using System.Data.Entity.Migrations;
+ using System.Data.Entity.Migrations.Infrastructure;
+ using System.Resources;
+
+ [GeneratedCode("EntityFramework.Migrations", "6.0.0-20911")]
+ public sealed partial class InitDb : IMigrationMetadata
+ {
+ private readonly ResourceManager Resources = new ResourceManager(typeof(InitDb));
+
+ string IMigrationMetadata.Id
+ {
+ get { return "202103031811160_InitDb"; }
+ }
+
+ string IMigrationMetadata.Source
+ {
+ get { return null; }
+ }
+
+ string IMigrationMetadata.Target
+ {
+ get { return Resources.GetString("Target"); }
+ }
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/Migrations/202103031811160_InitDb.cs b/EgtBEAMWALL.DataLayer/Migrations/202103031811160_InitDb.cs
new file mode 100644
index 00000000..44a5967f
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Migrations/202103031811160_InitDb.cs
@@ -0,0 +1,119 @@
+namespace EgtBEAMWALL.DataLayer.Migrations
+{
+ using System;
+ using System.Data.Entity.Migrations;
+
+ public partial class InitDb : DbMigration
+ {
+ public override void Up()
+ {
+ CreateTable(
+ "dbo.BTLPartList",
+ c => new
+ {
+ BTLPartDbId = c.Int(nullable: false, identity: true),
+ BTLPartId = c.Int(nullable: false),
+ BTLPart_PDN = c.Int(nullable: false),
+ BTLPart_DO = c.Boolean(nullable: false),
+ BTLPart_NAM = c.String(unicode: false),
+ BTLPart_W = c.Double(nullable: false),
+ BTLPart_L = c.Double(nullable: false),
+ BTLPart_H = c.Double(nullable: false),
+ BTLPart_MAT = c.String(unicode: false),
+ BTLPart_CNT = c.Int(nullable: false),
+ BTLPart_TBP = c.Int(nullable: false),
+ BTLPart_DON = c.Int(nullable: false),
+ BTLPart_ROT = c.Int(nullable: false),
+ BTLPart_GRP = c.String(unicode: false),
+ BTLPart_UNT = c.Int(nullable: false),
+ BTLPart_State = c.Int(nullable: false),
+ ProjDbId = c.Int(nullable: false),
+ })
+ .PrimaryKey(t => t.BTLPartDbId)
+ .ForeignKey("dbo.ProjList", t => t.ProjDbId, cascadeDelete: true)
+ .Index(t => t.ProjDbId);
+
+ CreateTable(
+ "dbo.ProjList",
+ c => new
+ {
+ ProjDbId = c.Int(nullable: false, identity: true),
+ ProjId = c.Int(nullable: false),
+ Proj_BTLFileName = c.String(unicode: false),
+ ProdDbId = c.Int(),
+ })
+ .PrimaryKey(t => t.ProjDbId)
+ .ForeignKey("dbo.ProdList", t => t.ProdDbId)
+ .Index(t => t.ProdDbId);
+
+ CreateTable(
+ "dbo.ProdList",
+ c => new
+ {
+ ProdDbId = c.Int(nullable: false, identity: true),
+ ProdId = c.Int(nullable: false),
+ Prod_Description = c.String(unicode: false),
+ Prod_Lock = c.Boolean(nullable: false),
+ })
+ .PrimaryKey(t => t.ProdDbId);
+
+ CreateTable(
+ "dbo.PartList",
+ c => new
+ {
+ PartDbId = c.Int(nullable: false, identity: true),
+ PartId = c.Int(nullable: false),
+ Part_PDN = c.Int(nullable: false),
+ Part_NAM = c.String(unicode: false),
+ Part_W = c.Double(nullable: false),
+ Part_L = c.Double(nullable: false),
+ Part_H = c.Double(nullable: false),
+ Part_MAT = c.String(unicode: false),
+ Part_ROT = c.Int(nullable: false),
+ Part_GRP = c.String(unicode: false),
+ Part_State = c.Int(nullable: false),
+ BTLPartDbId = c.Int(nullable: false),
+ RawPartDbId = c.Int(),
+ })
+ .PrimaryKey(t => t.PartDbId)
+ .ForeignKey("dbo.BTLPartList", t => t.BTLPartDbId, cascadeDelete: true)
+ .ForeignKey("dbo.RawPartList", t => t.RawPartDbId)
+ .Index(t => t.BTLPartDbId)
+ .Index(t => t.RawPartDbId);
+
+ CreateTable(
+ "dbo.RawPartList",
+ c => new
+ {
+ RawPartDbId = c.Int(nullable: false, identity: true),
+ RawPartId = c.Int(nullable: false),
+ RawPart_Descript = c.String(unicode: false),
+ RawPart_Lock = c.Boolean(nullable: false),
+ ProdDbId = c.Int(nullable: false),
+ })
+ .PrimaryKey(t => t.RawPartDbId)
+ .ForeignKey("dbo.ProdList", t => t.ProdDbId, cascadeDelete: true)
+ .Index(t => t.ProdDbId);
+
+ }
+
+ public override void Down()
+ {
+ DropForeignKey("dbo.PartList", "RawPartDbId", "dbo.RawPartList");
+ DropForeignKey("dbo.RawPartList", "ProdDbId", "dbo.ProdList");
+ DropForeignKey("dbo.PartList", "BTLPartDbId", "dbo.BTLPartList");
+ DropForeignKey("dbo.BTLPartList", "ProjDbId", "dbo.ProjList");
+ DropForeignKey("dbo.ProjList", "ProdDbId", "dbo.ProdList");
+ DropIndex("dbo.PartList", new[] { "RawPartDbId" });
+ DropIndex("dbo.RawPartList", new[] { "ProdDbId" });
+ DropIndex("dbo.PartList", new[] { "BTLPartDbId" });
+ DropIndex("dbo.BTLPartList", new[] { "ProjDbId" });
+ DropIndex("dbo.ProjList", new[] { "ProdDbId" });
+ DropTable("dbo.RawPartList");
+ DropTable("dbo.PartList");
+ DropTable("dbo.ProdList");
+ DropTable("dbo.ProjList");
+ DropTable("dbo.BTLPartList");
+ }
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/Migrations/202103031811160_InitDb.resx b/EgtBEAMWALL.DataLayer/Migrations/202103031811160_InitDb.resx
new file mode 100644
index 00000000..a4259707
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Migrations/202103031811160_InitDb.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ H4sIAAAAAAAEAO1czW7jNhC+F+g7CDoWqJ3sYoF2Ye/CsZNNUDsJ4mRzDBiRdtTVjyvRafJsPfSR+gqlZEkWxR+RIp3Ei73FIvlxODPifBxx8t8//w4+P4WB84iS1I+joXvYO3AdFHkx9KPl0F3jxa+/uZ8//fzT4BiGT87Xst/7rB8ZGaVD9wHj1cd+P/UeUAjSXuh7SZzGC9zz4rAPYNx/d3Dwe//wsI8IhEuwHGdwtY6wH6L8B/k5jiMPrfAaBLMYoiAtnpOWeY7qnIMQpSvgoaF7vMRHx6PZ7Wg67U0ABlPwjBLXGQU+IMLMUbBwHRBFMQaYiPrxJkVznMTRcr4iD0Bw/bxCpN8CBCkqlvBx2111NQfvstX0twM7acOt1klWekw0gp8z8fLVDt2j6+klSHCukXpP0vcP9Ew9II8uk3iFEvx8hRbF+Gzw5P4Muk6fHt1vDq8GMyMzcYbuWYTfv3Od83UQgPsAVdqrqXmO4wR9QRFKAEbwEmCMEqLNM4jyZTEycGZsn68FY3JuBjC5KMcfxXGAQKSNcD6alRDE6cgr5Doz8DRF0RI/DF3yp+uc+E8Ilk8K0JvIJ28cGYSTdesct+UMk3hNJNOWcWo4/tRw/Gx0vXMdjc+vzVzh+ujS1JcMnfHqwnAJX64ud67nG1M9z8n2gQxf+yT+U2WzaqCcg0d/me9dHDzkYde5QkHenj74q01g6dW35Luq40kSh1dx0Niyy/a7ebxOvGyRsaTTNUiWCNNSDvrbmCCNFBlI9zBR6U87TChq3mKYIDOahgmi/hM/QNmPnb8f5CfkaEjDFSHXDyuD3226bD2QbmF8r9Fs6nXQxOtgZ6/j6XS3XgdNvW6CUi/xVxuquGOvm8beNwT1uIy61X9Q0hekpD8I5dsglHvBxiyQqYKbdOBTTYWBvwVAqsGvEIUf/yr+VPWqhcBmIxsFmR68QCgTrlhei3BVL55wRaNEuLKHUZQuQDpv2ZQhdXdtsRfscOMuJv3eI3Z3ZmRMP+s+xTBQppHxcLaHjoeP0jT2/Fyk5vFnIwu9uuMIOnJqvDEtRauJidcB9leB7xEJhu4vjNKEsOVSaFjIhT3o9Q4ZZPLqoSTzdBCMidZxAvwIs++pH3n+CgRSIRqjtIh4ZoBqlmbLBK1QlL2OUtWaTl/N0th12jQ06Nd8RO463AO9yNLy0/3W3lTiVsOTpIkBFTc9bKp8cBFNUIAwckbeJr09BqkHILsJkJcNWvBD2RIU3YGbjNDyRpmdTIV4AZ9kyY1w6xEznZq3dHFFMUNS9PPXd0XhEpRcQEB59HZFkXlUJKCY+Kv4IRvlRd4iCflbb6GIqIYritmCSoh9fT8Uyv9i0Vlonj0I0Oxhqn3LYk5W1jbD5olM0b0t8jyRKCqmlBzlOu5rDU1bEMK6S20OEWQMJiNQUh7uAAb3IEXZc/TEOlU2Zo4wvRdP/ZTYfHsq4YZBxotoqIxbCHBqtK4dBIpBoCKIeEXqyymsKcCh34kGVM1etHrqx8paJ/6nj6YDtR73qhXUbcH4YevxjoaBPBjKJUlPheXzvy+ySmg/tqgfXGorofxcohPpQUVBwR00w8n4cXxDzpwVuXN9ASraEHNlNdV20AYnAcNqo4W/KTK42hqol12iEDFj281bw0m4ynyDSyQUqUR332hSBzW9SrRR5seq0Fa1DfqbW3PFg0FfcL1uMAOrlR8ta9ftiifOfHPXbvzrXP9iW7jB6Hsp535bJW01E44TsESNVjI1kfTET1JchmrXGcOQ6aYYyMvZ2HjO2q4MYuWY7O/NOO7VQzr+sxSogDkhqwwzDpVnt9mdQTDcya5AggAkwu+h4zhYh5HCoVEOJoDSBMq+d3JQ7vIGdZzsJh4PJnuujpJ/POXB5A3qOLd8lFsdjCkfY6qDccrHONXByD+W8lDyBnWc/IYdDydvUMfJL9rxcPIGHY8ReF7eoI6Tf+jl4eQN6jj5914eTt6gjnMj0vONnp6Lb8M8pKJJ4y2v8qN1OHHWNAtBjV2QOfcx2y6Ti6F3cqV9vuKf5pv89nCmv8NLxtpTsQyJh6OHQl2aa0LdUa1aokHuIgUJp9f0I2jPj3iX5lT9SDTWnoplSDwcPRTqo3oT6o5q1YitxddzBi9reEtuZI9zmhBOa2zTFtW0wDO7kEyGHlrghsbE0JgVWqCEXfggw5uskKYujInDdLrRHOowZeGURWW+63jSlPir7Vb1rIT5hiW+hpYDtu1Z8uG2Nd6CJ0CzFAnLRFHZwTQSlniiYLgn7IxJdzW7VLNXaa9GemtQpJraS0yZ3NOmi+uQ1T/6MMs7zZ7nfwW5f/fyP8eBTxa87TEDkb9AKb6Ov6Fo6H7ofWiUqHYoF+2nKQw4OTWLNaOSra39tifn8rCf6aT1Pme3S8qNWbqB3NWu6JvAbGtH7+M46AxTu+8fxNEyT2nWsFTuktbSUxsg2O1afS1FZQXn1BJO7bq/qYpqZaImtq8Vi5q5kBVPrJUqmMDUChZM1XxjR81UeUMXoG36RBVj3yowd7LdltkiM8XTSSIzx9qSEK5MLMS+1TTuyo7Q2I6NJI25HQteqhw7961QcTemNKY/NriPLcZiha5Y4SpWiIotlmIjmtsK5XYCsOiAYF5baC8CvLV6uZ3sH0yJnIEZaokKMx+jExUGh6kWeqARVExqzcprmJ0LwTh3ELtWq3WtKRN+qlInP06nOrJ9uJquVTumaUKrZQv8i5sGJWtmJYqvUwj2fVV+dTLkjpyKL8iu3Unbti0FVfrVD99dGZdm0NqRO9FFA50LyPYl5LV8GHtzUa/lHrWpIduY0KvsNdo2sl5ptUelVezF7aYxucVVhf1aqqs2H+LI0fw+Jh6w4fOy0gpe+ZVoplobb5pLUTELrzpLMgeUz8EviuAVbwnnkKtLWVf0a9pS3MWbSVbX8ALVX7QRGjfolEq+mGImfiXbm6nz0hRcwihF9QlvsJCrk+CioMK9JvcG67VM3Jv3XrOXbN5gWVYnwXdkaY3qK/baCYm5tf9/TqJ+6i+3ENl/Q4+QR0Xbqs9ZtIjLyN+QqOzSyIbNEAaQhOJRgv0F8DBp9lCa5v/I6isI1qTLcXiP4Fl0scarNSZLRuF9QP2brYw8yObPS8xomQcX+Sei1MYSiJg+WQK6iI7WfgAruU84mTwBRMZKigRqZkucJVKXzxXSeRwpAhXqq8jUNQpXAQFLL6I5eERi2dp1SGtsMPHBMgFhWmBsx5OfxP1g+PTpf0/YPpzBXwAA
+
+
+ dbo
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/Migrations/Configuration.cs b/EgtBEAMWALL.DataLayer/Migrations/Configuration.cs
new file mode 100644
index 00000000..9c526a4a
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Migrations/Configuration.cs
@@ -0,0 +1,31 @@
+namespace EgtBEAMWALL.DataLayer.Migrations
+{
+ using System;
+ using System.Data.Entity;
+ using System.Data.Entity.Migrations;
+ using System.Linq;
+
+ internal sealed class Configuration : DbMigrationsConfiguration
+ {
+ public Configuration()
+ {
+ AutomaticMigrationsEnabled = false;
+ }
+
+ protected override void Seed(EgtBEAMWALL.DataLayer.DatabaseContext context)
+ {
+ // This method will be called after migrating to the latest version.
+
+ // You can use the DbSet.AddOrUpdate() helper extension method
+ // to avoid creating duplicate seed data. E.g.
+ //
+ // context.People.AddOrUpdate(
+ // p => p.FullName,
+ // new Person { FullName = "Andrew Peters" },
+ // new Person { FullName = "Brice Lambson" },
+ // new Person { FullName = "Rowan Miller" }
+ // );
+ //
+ }
+ }
+}
diff --git a/EgtBEAMWALL.DataLayer/Properties/AssemblyInfo.cs b/EgtBEAMWALL.DataLayer/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..bd9659fc
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("EgtBEAMWALL.DataLayer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EgtBEAMWALL.DataLayer")]
+[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("24d7760e-662a-47e4-b729-b70126c24a31")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("2.2.12.1")]
+[assembly: AssemblyFileVersion("2.2.12.1")]
diff --git a/EgtBEAMWALL.DataLayer/packages.config b/EgtBEAMWALL.DataLayer/packages.config
new file mode 100644
index 00000000..9b33c92a
--- /dev/null
+++ b/EgtBEAMWALL.DataLayer/packages.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.DbDataLayer/App.config b/EgtBEAMWALL.DbDataLayer/App.config
new file mode 100644
index 00000000..e6ff48ed
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/App.config
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.DbDataLayer/Constants.cs b/EgtBEAMWALL.DbDataLayer/Constants.cs
new file mode 100644
index 00000000..5b058676
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/Constants.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace EgtBEAMWALL.DbDataLayer
+{
+ public static class Constants
+ {
+
+ // Database config
+ public const string DATABASE_SERV = "127.0.0.1";
+ public const string DATABASE_NAME = "EgtBwDb";
+ public const string DATABASE_USER = "root";
+ public const string DATABASE_PWD = "viacremasca";
+ public static int DATABASE_PROCESS_TIMEOUT = 5;
+
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/Controllers/BTLPartController.cs b/EgtBEAMWALL.DbDataLayer/Controllers/BTLPartController.cs
new file mode 100644
index 00000000..08a36cb2
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/Controllers/BTLPartController.cs
@@ -0,0 +1,292 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using EgtBEAMWALL.DbDataLayer.DatabaseModels;
+
+namespace EgtBEAMWALL.DbDataLayer.Controllers
+{
+ public class BTLPartController : IDisposable
+ {
+ private DatabaseContext dbCtx;
+
+ public BTLPartController()
+ {
+ // Initialize database context
+ dbCtx = new DatabaseContext();
+ }
+
+ public void Dispose()
+ {
+ // Clear database context
+ dbCtx.Dispose();
+ }
+ ///
+ /// Get record by Id
+ ///
+ ///
+ ///
+ public BTLPartModel FindByDbId(int PartDbId)
+ {
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId == PartDbId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get record by ExtId
+ ///
+ ///
+ ///
+ public BTLPartModel FindByPartId(int PartId)
+ {
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.PartId == PartId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get paginated data from DB (ASC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedAsc(int PartDbIdStart, int numRecord)
+ {
+ int numEnd = PartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId <= PartDbIdStart)
+ .OrderBy(x => x.PartDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get paginated data from DB (DESC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedDesc(int PartDbIdStart, int numRecord)
+ {
+ int numEnd = PartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId <= PartDbIdStart)
+ .OrderByDescending(x => x.PartDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProjectId (ASC ordered)
+ ///
+ ///
+ ///
+ public List GetByProjectAsc(int ProjDbId)
+ {
+ // retrieve
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.ProjDbId == ProjDbId)
+ .OrderBy(x => x.PartDbId)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProjectId (DESC ordered)
+ ///
+ ///
+ ///
+ public List GetByProjectDesc(int ProjDbId)
+ {
+ // retrieve
+ return dbCtx
+ .BTLPartList
+ .Where(x => x.ProjDbId == ProjDbId)
+ .OrderByDescending(x => x.PartDbId)
+ .ToList();
+ }
+
+ ///
+ /// Create multiple (empty) Part record associated to Project
+ ///
+ ///
+ ///
+ ///
+ public List CreateBaseObj(int ProjDbId, List rawListData)
+ {
+ List partData = new List();
+
+ foreach (var item in rawListData)
+ {
+ BTLPartModel newItem = new BTLPartModel() { ProjDbId = ProjDbId, PartId = item };
+ partData.Add(newItem);
+ }
+
+ try
+ {
+ // Add to database
+ dbCtx.BTLPartList.AddRange(partData);
+ // Commit changes
+ dbCtx.SaveChanges();
+ }
+ catch
+ { }
+
+ return partData;
+ }
+
+
+ ///
+ /// Create multipole Part record associated to Project
+ ///
+ ///
+ ///
+ ///
+ public List Create(int ProjID, List partData)
+ {
+ // se è adv mode --> uso TUTTI i dati
+ if (DbManager.AdvDataModel)
+ {
+ try
+ {
+ // Add to database
+ dbCtx.BTLPartList.AddRange(partData);
+ // Commit changes
+ dbCtx.SaveChanges();
+ }
+ catch
+ { }
+ return partData;
+ }
+ // se non adv --> faccio solo copia degli id...
+ else
+ {
+ List partIdList = new List();
+ foreach (var item in partData)
+ {
+ partIdList.Add(item.PartId);
+ }
+ return CreateBaseObj(ProjID, partIdList);
+ }
+ }
+
+ ///
+ /// Delete single Part
+ ///
+ ///
+ ///
+ public bool Update(BTLPartModel updItem)
+ {
+ bool done = false;
+ var item2del = dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId == updItem.PartDbId)
+ .SingleOrDefault();
+ try
+ {
+ // update, vers 1...
+ dbCtx.Entry(item2del).CurrentValues.SetValues(updItem);
+
+ //// update, vers 2
+ //dbCtx.BTLPartList.Remove(item2del);
+ //dbCtx.BTLPartList.Add(updItem);
+
+ // Commit changes
+ dbCtx.SaveChanges();
+ done = true;
+ }
+ catch
+ { }
+ return done;
+ }
+
+ ///
+ /// Delete single Part
+ ///
+ ///
+ ///
+ public bool Delete(int PartDbId)
+ {
+ bool done = false;
+ var item2del = dbCtx
+ .BTLPartList
+ .Where(x => x.PartDbId == PartDbId)
+ .SingleOrDefault();
+ try
+ {
+ // Add to database
+ dbCtx.BTLPartList.Remove(item2del);
+ // Commit changes
+ dbCtx.SaveChanges();
+ done = true;
+ }
+ catch
+ { }
+ return done;
+ }
+ ///
+ /// Delete Part by project
+ ///
+ ///
+ ///
+ public bool DeleteByProject(int ProjDbId)
+ {
+ bool done = false;
+ var items2del = dbCtx
+ .BTLPartList
+ .Where(x => x.ProjDbId == ProjDbId);
+ try
+ {
+ // Add to database
+ dbCtx.BTLPartList.RemoveRange(items2del);
+ // Commit changes
+ dbCtx.SaveChanges();
+ done = true;
+ }
+ catch
+ { }
+ return done;
+ }
+
+ ///
+ /// COnversion of base class to DB model class
+ ///
+ ///
+ ///
+ public BTLPartModel Convert(Core.BTLPart corePart)
+ {
+ BTLPartModel answ = new BTLPartModel();
+ if (corePart != null)
+ {
+ answ = new BTLPartModel()
+ {
+ PartId = corePart.nPartId,
+ PDN = corePart.nPDN,
+ DO = corePart.bDO,
+ NAM = corePart.sNAM,
+ W = corePart.dW,
+ L = corePart.dL,
+ H = corePart.dH,
+ MAT = corePart.sMATERIAL,
+ CNT = corePart.nCNT,
+ TBP = corePart.nTBP,
+ DON = corePart.nDON,
+ ROT = corePart.nROT,
+ GRP = corePart.sGRP,
+ UNT = corePart.nUNT,
+ State = (int)corePart.nState
+ };
+ }
+ return answ;
+ }
+
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/Controllers/ProjController.cs b/EgtBEAMWALL.DbDataLayer/Controllers/ProjController.cs
new file mode 100644
index 00000000..5a50f6d1
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/Controllers/ProjController.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using EgtBEAMWALL.DbDataLayer.DatabaseModels;
+
+namespace EgtBEAMWALL.DbDataLayer.Controllers
+{
+ public class ProjController : IDisposable
+ {
+ private DatabaseContext dbCtx;
+
+ public ProjController()
+ {
+ // Initialize database context
+ dbCtx = new DatabaseContext();
+ }
+
+ public void Dispose()
+ {
+ // Clear database context
+ dbCtx.Dispose();
+ }
+ ///
+ /// Get record by ProjDbId
+ ///
+ ///
+ ///
+ public ProjModel FindByProjDbId(int ProjDbId)
+ {
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProjDbId == ProjDbId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get record by ProjId
+ ///
+ ///
+ ///
+ public ProjModel FindByProjId(int ProjId)
+ {
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProjId == ProjId)
+ .SingleOrDefault();
+ }
+ ///
+ /// Get paginated data from DB (ASC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedAsc(int ProjDbIdStart, int numRecord)
+ {
+ int numEnd = ProjDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProjDbId <= ProjDbIdStart)
+ .OrderBy(x => x.ProjDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get paginated data from DB (DESC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedDesc(int PartDbIdStart, int numRecord)
+ {
+ int numEnd = PartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProjDbId <= PartDbIdStart)
+ .OrderByDescending(x => x.ProjDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProjectId (ASC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdAsc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderBy(x => x.ProdDbId)
+ .ToList();
+ }
+ ///
+ /// Get filtered data by ProjectId (DESC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdDesc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .ProjList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderByDescending(x => x.ProdDbId)
+ .ToList();
+ }
+
+ ///
+ /// Create record on DB
+ ///
+ ///
+ ///
+ ///
+ public ProjModel Create(int newProjId, string newBTLFileName)
+ {
+ ProjModel newProj = new ProjModel() { ProjId=newProjId, BTLFileName=newBTLFileName };
+
+ try
+ {
+ // Add to database
+ dbCtx.ProjList.Add(newProj);
+ // Commit changes
+ dbCtx.SaveChanges();
+ }
+ catch
+ { }
+
+ return newProj;
+ }
+
+
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/DatabaseContext.cs b/EgtBEAMWALL.DbDataLayer/DatabaseContext.cs
new file mode 100644
index 00000000..73109274
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/DatabaseContext.cs
@@ -0,0 +1,120 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Data.Entity.Migrations;
+using MySql.Data.Entity;
+using System.Linq;
+using System.Text;
+using EgtBEAMWALL.DbDataLayer.DatabaseModels;
+using EgtBEAMWALL.DbDataLayer.Migrations;
+using System.ServiceProcess;
+//using EgtBEAMWALL.DataLayer.Migrations;
+//using EgtBEAMWALL.DataLayer.Controllers;
+
+namespace EgtBEAMWALL.DbDataLayer
+{
+
+ [DbConfigurationType(typeof(MySqlEFConfiguration))]
+ public class DatabaseContext : DbContext
+ {
+ ///
+ /// BTLParts management
+ ///
+ public DbSet BTLPartList { get; set; }
+ ///
+ /// Parts management
+ ///
+ public DbSet ProdList { get; set; }
+ ///
+ /// Parts management
+ ///
+ public DbSet ProjList { get; set; }
+ ///
+ /// Parts management
+ ///
+ public DbSet RawPartList { get; set; }
+ ///
+ /// Parts management
+ ///
+ public DbSet PartList { get; set; }
+
+#if false
+ ///
+ /// Db data mode
+ ///
+ public static bool AdvDataModel { get; set; } = false;
+#endif
+
+ //providerName="System.Data.EntityClient"
+
+
+ public static string CONNECTION_STRING = $"server={Constants.DATABASE_SERV};port=3306;database={Constants.DATABASE_NAME};uid={Constants.DATABASE_USER};pwd={Constants.DATABASE_PWD};";
+
+ public DatabaseContext() : base(CONNECTION_STRING)
+ {
+ }
+
+ public static DatabaseContext Create()
+ {
+ return new DatabaseContext();
+ }
+
+ private static string getDbServiceName()
+ {
+ ServiceController[] services = ServiceController.GetServices();
+ var service = services.FirstOrDefault(s => s.ServiceName == "MariaDB");
+ if (service != null)
+ return service.DisplayName;
+
+ service = services.FirstOrDefault(s => s.ServiceName == "MySQL");
+ if (service != null)
+ return service.DisplayName;
+
+ return "";
+
+ }
+
+ public static bool SetUpDbConnectionAndDbConfig()
+ {
+ try
+ {
+ String serviceName = getDbServiceName();
+ if (serviceName.Equals(""))
+ {
+ return false;
+ }
+
+
+ ServiceController service = new ServiceController(serviceName);
+ try
+ {
+ TimeSpan timeout = TimeSpan.FromSeconds(Constants.DATABASE_PROCESS_TIMEOUT);
+ service.WaitForStatus(ServiceControllerStatus.Running, timeout);
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+
+
+
+ System.Data.Entity.Database.SetInitializer(null);
+ var migrator = new DbMigrator(new Configuration());
+
+ if (migrator.GetPendingMigrations().Any())
+ {
+ // Run migrations and seed.
+ migrator.Update();
+ }
+
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/EgtBEAMWALL.DbDataLayer/DatabaseModels/BTLPartModel.cs b/EgtBEAMWALL.DbDataLayer/DatabaseModels/BTLPartModel.cs
new file mode 100644
index 00000000..2e9b2281
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/DatabaseModels/BTLPartModel.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
+{
+ [Table("BTLPartList")]
+ public class BTLPartModel
+ {
+ [Key, Column("BTLPartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int PartDbId { get; set; }
+
+ [Column("BTLPartId")]
+ public int PartId { get; set; }
+
+ [Column("BTLPart_PDN")]
+ public int PDN { get; set; } = 0;
+
+ [Column("BTLPart_DO")]
+ public bool DO { get; set; } = false;
+
+ [Column("BTLPart_NAM")]
+ public string NAM { get; set; } = "";
+
+ [Column("BTLPart_W")]
+ public double W { get; set; } = 0;
+
+ [Column("BTLPart_L")]
+ public double L { get; set; } = 0;
+
+ [Column("BTLPart_H")]
+ public double H { get; set; } = 0;
+
+ [Column("BTLPart_MAT")]
+ public string MAT { get; set; } = "";
+
+ [Column("BTLPart_CNT")]
+ public int CNT { get; set; } = 0;
+
+ [Column("BTLPart_TBP")]
+ public int TBP { get; set; } = 0;
+
+ [Column("BTLPart_DON")]
+ public int DON { get; set; } = 0;
+
+ [Column("BTLPart_ROT")]
+ public int ROT { get; set; } = 0;
+
+ [Column("BTLPart_GRP")]
+ public string GRP { get; set; } = "";
+
+ [Column("BTLPart_UNT")]
+ public int UNT { get; set; } = 0;
+
+ [Column("BTLPart_State")]
+ public int State { get; set; } = -1;
+
+ [Column("ProjDbId")]
+ public int ProjDbId { get; set; }
+
+ [ForeignKey("ProjDbId")]
+ public ProjModel Project { get; set; }
+
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/DatabaseModels/PartModel.cs b/EgtBEAMWALL.DbDataLayer/DatabaseModels/PartModel.cs
new file mode 100644
index 00000000..e1dcb230
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/DatabaseModels/PartModel.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
+{
+ [Table("PartList")]
+ public class PartModel
+ {
+ [Key, Column("PartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int PartDbId { get; set; }
+
+ [Column("PartId")]
+ public int PartId { get; set; }
+
+ [Column("Part_PDN")]
+ public int PDN { get; set; } = 0;
+
+ [Column("Part_NAM")]
+ public string NAM { get; set; } = "";
+
+ [Column("Part_W")]
+ public double W { get; set; } = 0;
+
+ [Column("Part_L")]
+ public double L { get; set; } = 0;
+
+ [Column("Part_H")]
+ public double H { get; set; } = 0;
+
+ [Column("Part_MAT")]
+ public string MAT { get; set; } = "";
+
+ [Column("Part_ROT")]
+ public int ROT { get; set; } = 0;
+
+ [Column("Part_GRP")]
+ public string GRP { get; set; } = "";
+
+ [Column("Part_State")]
+ public int State { get; set; } = -1;
+
+ [Column("BTLPartDbId")]
+ public int BTLPartDbId { get; set; }
+
+ [ForeignKey("BTLPartDbId")]
+ public BTLPartModel BTLPart { get; set; }
+
+ [Column("RawPartDbId")]
+ public int? RawPartDbId { get; set; }
+
+ [ForeignKey("RawPartDbId")]
+ public virtual RawPartModel RawPart { get; set; }
+
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/DatabaseModels/ProdModel.cs b/EgtBEAMWALL.DbDataLayer/DatabaseModels/ProdModel.cs
new file mode 100644
index 00000000..4f32564b
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/DatabaseModels/ProdModel.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
+{
+ [Table("ProdList")]
+ public class ProdModel
+ {
+ [Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int ProdDbId { get; set; }
+
+ [Column("ProdId")]
+ public int ProdId { get; set; }
+
+ [Column("Prod_Description")]
+ public string Description { get; set; } = "";
+
+ [Column("Prod_Lock")]
+ public bool Locked { get; set; } = false;
+
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/DatabaseModels/ProjModel.cs b/EgtBEAMWALL.DbDataLayer/DatabaseModels/ProjModel.cs
new file mode 100644
index 00000000..f6cf5573
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/DatabaseModels/ProjModel.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
+{
+ [Table("ProjList")]
+ public class ProjModel
+ {
+ [Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int ProjDbId { get; set; }
+
+ [Column("ProjId")]
+ public int ProjId { get; set; }
+
+ [Column("Proj_BTLFileName")]
+ public string BTLFileName { get; set; } = "";
+
+ [Column("ProdDbId")]
+ public int? ProdDbId { get; set; }
+
+ [ForeignKey("ProdDbId")]
+ public virtual ProdModel Prod { get; set; }
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/DatabaseModels/RawPartModel.cs b/EgtBEAMWALL.DbDataLayer/DatabaseModels/RawPartModel.cs
new file mode 100644
index 00000000..1795e833
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/DatabaseModels/RawPartModel.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EgtBEAMWALL.DbDataLayer.DatabaseModels
+{
+ [Table("RawPartList")]
+ public class RawPartModel
+ {
+ [Key, Column("RawPartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int RawPartDbId { get; set; }
+
+ [Column("RawPartId")]
+ public int RawPartId { get; set; }
+
+ [Column("RawPart_Descript")]
+ public string Description { get; set; } = "";
+
+ [Column("RawPart_Lock")]
+ public bool Locked { get; set; } = false;
+
+ [Column("ProdDbId")]
+ public int ProdDbId { get; set; }
+
+ [ForeignKey("ProdDbId")]
+ public ProdModel Prod { get; set; }
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/DbManager.cs b/EgtBEAMWALL.DbDataLayer/DbManager.cs
new file mode 100644
index 00000000..59f802f8
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/DbManager.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace EgtBEAMWALL.DbDataLayer
+{
+ public class DbManager
+ {
+ public static bool AdvDataModel { get; set; } = false;
+
+ public DbManager()
+ {
+ }
+
+ public Controllers.ProjController ProjCtr = new Controllers.ProjController();
+ public Controllers.BTLPartController BtlPartCtr = new Controllers.BTLPartController();
+
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/EgtBEAMWALL.DbDataLayer.csproj b/EgtBEAMWALL.DbDataLayer/EgtBEAMWALL.DbDataLayer.csproj
new file mode 100644
index 00000000..e055a694
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/EgtBEAMWALL.DbDataLayer.csproj
@@ -0,0 +1,113 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {5F1CDE84-FD6A-4107-968C-ECC4D64F8043}
+ Library
+ Properties
+ EgtBEAMWALL.DbDataLayer
+ EgtBEAMWALL.DbDataLayer
+ v4.5.2
+ 512
+ true
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ false
+
+
+
+ ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll
+
+
+ ..\packages\MySql.Data.6.10.9\lib\net452\MySql.Data.dll
+
+
+ ..\packages\MySql.Data.Entity.6.10.9\lib\net452\MySql.Data.Entity.EF6.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 202103031756343_InitDb.cs
+
+
+
+
+
+
+
+
+
+
+ {f22835a1-83d8-4334-91bb-baaeb9cf59b1}
+ EgtBEAMWALL.Core
+
+
+
+
+ 202103031756343_InitDb.cs
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.DbDataLayer/Migrations/202103031756343_InitDb.Designer.cs b/EgtBEAMWALL.DbDataLayer/Migrations/202103031756343_InitDb.Designer.cs
new file mode 100644
index 00000000..3353fa06
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/Migrations/202103031756343_InitDb.Designer.cs
@@ -0,0 +1,29 @@
+//
+namespace EgtBEAMWALL.DbDataLayer.Migrations
+{
+ using System.CodeDom.Compiler;
+ using System.Data.Entity.Migrations;
+ using System.Data.Entity.Migrations.Infrastructure;
+ using System.Resources;
+
+ [GeneratedCode("EntityFramework.Migrations", "6.4.4")]
+ public sealed partial class InitDb : IMigrationMetadata
+ {
+ private readonly ResourceManager Resources = new ResourceManager(typeof(InitDb));
+
+ string IMigrationMetadata.Id
+ {
+ get { return "202103031756343_InitDb"; }
+ }
+
+ string IMigrationMetadata.Source
+ {
+ get { return null; }
+ }
+
+ string IMigrationMetadata.Target
+ {
+ get { return Resources.GetString("Target"); }
+ }
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/Migrations/202103031756343_InitDb.cs b/EgtBEAMWALL.DbDataLayer/Migrations/202103031756343_InitDb.cs
new file mode 100644
index 00000000..65807de8
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/Migrations/202103031756343_InitDb.cs
@@ -0,0 +1,119 @@
+namespace EgtBEAMWALL.DbDataLayer.Migrations
+{
+ using System;
+ using System.Data.Entity.Migrations;
+
+ public partial class InitDb : DbMigration
+ {
+ public override void Up()
+ {
+ CreateTable(
+ "dbo.BTLPartList",
+ c => new
+ {
+ BTLPartDbId = c.Int(nullable: false, identity: true),
+ BTLPartId = c.Int(nullable: false),
+ BTLPart_PDN = c.Int(nullable: false),
+ BTLPart_DO = c.Boolean(nullable: false),
+ BTLPart_NAM = c.String(unicode: false),
+ BTLPart_W = c.Double(nullable: false),
+ BTLPart_L = c.Double(nullable: false),
+ BTLPart_H = c.Double(nullable: false),
+ BTLPart_MAT = c.String(unicode: false),
+ BTLPart_CNT = c.Int(nullable: false),
+ BTLPart_TBP = c.Int(nullable: false),
+ BTLPart_DON = c.Int(nullable: false),
+ BTLPart_ROT = c.Int(nullable: false),
+ BTLPart_GRP = c.String(unicode: false),
+ BTLPart_UNT = c.Int(nullable: false),
+ BTLPart_State = c.Int(nullable: false),
+ ProjDbId = c.Int(nullable: false),
+ })
+ .PrimaryKey(t => t.BTLPartDbId)
+ .ForeignKey("dbo.ProjList", t => t.ProjDbId, cascadeDelete: true)
+ .Index(t => t.ProjDbId);
+
+ CreateTable(
+ "dbo.ProjList",
+ c => new
+ {
+ ProjDbId = c.Int(nullable: false, identity: true),
+ ProjId = c.Int(nullable: false),
+ Proj_BTLFileName = c.String(unicode: false),
+ ProdDbId = c.Int(),
+ })
+ .PrimaryKey(t => t.ProjDbId)
+ .ForeignKey("dbo.ProdList", t => t.ProdDbId)
+ .Index(t => t.ProdDbId);
+
+ CreateTable(
+ "dbo.ProdList",
+ c => new
+ {
+ ProdDbId = c.Int(nullable: false, identity: true),
+ ProdId = c.Int(nullable: false),
+ Prod_Description = c.String(unicode: false),
+ Prod_Lock = c.Boolean(nullable: false),
+ })
+ .PrimaryKey(t => t.ProdDbId);
+
+ CreateTable(
+ "dbo.PartList",
+ c => new
+ {
+ PartDbId = c.Int(nullable: false, identity: true),
+ PartId = c.Int(nullable: false),
+ Part_PDN = c.Int(nullable: false),
+ Part_NAM = c.String(unicode: false),
+ Part_W = c.Double(nullable: false),
+ Part_L = c.Double(nullable: false),
+ Part_H = c.Double(nullable: false),
+ Part_MAT = c.String(unicode: false),
+ Part_ROT = c.Int(nullable: false),
+ Part_GRP = c.String(unicode: false),
+ Part_State = c.Int(nullable: false),
+ BTLPartDbId = c.Int(nullable: false),
+ RawPartDbId = c.Int(),
+ })
+ .PrimaryKey(t => t.PartDbId)
+ .ForeignKey("dbo.BTLPartList", t => t.BTLPartDbId, cascadeDelete: true)
+ .ForeignKey("dbo.RawPartList", t => t.RawPartDbId)
+ .Index(t => t.BTLPartDbId)
+ .Index(t => t.RawPartDbId);
+
+ CreateTable(
+ "dbo.RawPartList",
+ c => new
+ {
+ RawPartDbId = c.Int(nullable: false, identity: true),
+ RawPartId = c.Int(nullable: false),
+ RawPart_Descript = c.String(unicode: false),
+ RawPart_Lock = c.Boolean(nullable: false),
+ ProdDbId = c.Int(nullable: false),
+ })
+ .PrimaryKey(t => t.RawPartDbId)
+ .ForeignKey("dbo.ProdList", t => t.ProdDbId, cascadeDelete: true)
+ .Index(t => t.ProdDbId);
+
+ }
+
+ public override void Down()
+ {
+ DropForeignKey("dbo.PartList", "RawPartDbId", "dbo.RawPartList");
+ DropForeignKey("dbo.RawPartList", "ProdDbId", "dbo.ProdList");
+ DropForeignKey("dbo.PartList", "BTLPartDbId", "dbo.BTLPartList");
+ DropForeignKey("dbo.BTLPartList", "ProjDbId", "dbo.ProjList");
+ DropForeignKey("dbo.ProjList", "ProdDbId", "dbo.ProdList");
+ DropIndex("dbo.RawPartList", new[] { "ProdDbId" });
+ DropIndex("dbo.PartList", new[] { "RawPartDbId" });
+ DropIndex("dbo.PartList", new[] { "BTLPartDbId" });
+ DropIndex("dbo.ProjList", new[] { "ProdDbId" });
+ DropIndex("dbo.BTLPartList", new[] { "ProjDbId" });
+ DropTable("dbo.RawPartList");
+ DropTable("dbo.PartList");
+ DropTable("dbo.ProdList");
+ DropTable("dbo.ProjList");
+ DropTable("dbo.BTLPartList");
+ }
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/Migrations/202103031756343_InitDb.resx b/EgtBEAMWALL.DbDataLayer/Migrations/202103031756343_InitDb.resx
new file mode 100644
index 00000000..ba5a2127
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/Migrations/202103031756343_InitDb.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ H4sIAAAAAAAEAO1d224juRF9D5B/aPRjMCvZM1ggMaRd2JK9Y0SyDcveyZtBN2lNZ/uidFMTG0G+LA/5pPxC2FeRzUuTTcqWB4t5kUTykCwWWaeKLM///vPfyc/PceR9Q1kepsnUPx4d+R5KghSGyXrqb/HTD3/2f/7pj3+YnMP42fu1qfepqEdaJvnU/4rx5mQ8zoOvKAb5KA6DLM3TJzwK0ngMYDr+eHT0l/Hx8RgRCJ9ged7kdpvgMEblF/J1liYB2uAtiJYpRFFe/05KViWqdwVilG9AgKb++RqfnZ8uv5wuFqP54xxgsAAvKPO90ygEZDgrFD35HkiSFANMBntyn6MVztJkvdqQH0B097JBpN4TiHJUT+JkV113Pkcfi/mMdw0bqGCb4zQ2BDz+VAto3G0+SMx+K0AiwnMiavxSzLoU49Q/u1vcgAyXova9bocnsygrKkslPSo+PYIcVWs1ouE+eJJGH1rdISpW/PvgzbYR3mZomqAtzgBperN9jMLgr+jlLv0NJdNkG0X0RMhUSBnzA/npJks3KMMvt+ipnl4xmPnjJfS9Mdt63G3eNuZaVgK4TPCnj753RQYCHiPU6gwlrBVOM/QLSlAGMII3AGOUkSW/hKiUOjcGQY/9/fVgzK/sAObXTfuzNI0QSIwRrk6XDQTZauTo8L0leF6gZI2/Tn3y0fcuwmcEm19q0PskJCcNaYSzbW8fX5oe5inRE2Q8xoVl+8+W7Zend3uX0ezqzk4V7s5ubHXJUhlvry2n8Mvtzd7lfG8r5xU5PpDlts/Sv+scVh2UK/AtXJdnlwAPBdj3blFUludfw01lTpkj/qGteJGl8W0adSxKU/6wSrdZUEwyVVS6A9kaYXaUk/HOZCkNWQHiyoq1WAdhwtq1NTZhmlrh0ISRHm1NGFGNizBCxZe9713yFQokZLBNoHCPtAr0UFXZ7Q62hNsXnWLbHQEd7gh4SDsCDt4RovXe746AtjtijvIgCzeVB7DnHbFIg98QNOOA+hrp0NP43c14z27G707CYTgJ74JhOyDINd8cwJG7AgP/lADpkoZ6KGLe0HLithZFHbqFPHvgaogIhGpw9fR6BtfWEg2uLlQMrqlhxW5qEFfmhIY7BIvC6JmpUZEr6R7tSt3p9052hpNKa6+C1lHOseAKuQ3I1zDZgKd5ngZhOaSux12NhZ3deQI9tcdTLS3jLZElJtsp3JANREYw9f/ECU0K20yFhYVC2KPR6JhDJlsPZYWmg2hGpE42c5hgfp+GSRBuQKQcRKeVkQ9TLEDbS7dkjjYoKbajUrS23be9dE6dPglNxpSOqFVHGEOSrbQ6oLRbb/YqQ1+TlLEoHTU97op8cp3MUYQw8k6D6tpnBvIAQP4QIJsNOtBD1RQ01UEYYzLSRtU62Q7iFXSS517So0dOxChtGaKKcgKnqedvr4rSKWipgITymJ2KsuXRGQHjKLyJHvJWXqYtCpO/0xaWJ+uropwt6JjYt9dD6fhfzTpLl+cdGGje1+s/sjjHz9lh2HUYNdXbIc+TDUVnKRWu3MBzrSNpB4NwrlKVE0HaYNICZY1zVzvdxe/oGQv89ntSWLnuee3DddWjwF0hzJ7XizAnaDvPRWgqOU1joQr+IcGhqF8/CJSDQE0Q+Yz0p1OvuASH3TcdKGpNWfHQridVSXzr1VWyXpewnQG9Fpyu9rqALAwUwTBqS2pqTF987c0Lod+10XduqJkweq6QidKZ0RDwAMkIgpYC3VCza01+TU9ARxpyPq0n2gHSEARpeGn0cDxNlkfNgdnsCoHIWd1+do0gZqzSDSHZ0KQbw3WjSy/05KqQRhNDa81fWzYZV49Y6x8mY8lr18kSbDZhsqZev9a/eKvq6evsh5X5c9C4whgHueBVaDvatiecZmCNOqWkazLSizDLcWPOfW8GY65a19hLzFXTG2/P+bVrjFjTpvhctZOF+RkGwBOlGuiCzDMumFYZA+fPBklzr3iTDCKQSS91Z2m0jRMN11INJoEyBCoubQUoD2WBPk7xRFQEU/yuj1LeAItgygJ9nC9ilC8mGAsxxsIE47MY47MJRnnjK0IpC/RxyqefIpyyQB+nfAEqwikLTDRGonllgT5OeVstwikL9HHKS2sRTlmgj3Mvk/O9mZzrC24RUl1ksMvbKCoNJ4+tFkaocwpy3iF38HIRG/Ys1zrpWwbq4pjfOWjmZ7yirTshq5BEOGYozJvJLtQDU2o0NCicpCQw9ZaaBF1qErTQJFlbd0JWIYlwzFCY6/cu1ANTamBf63t2Dq8oOCRFcsk8bWinM87pinA6YJtDqCZHEh0wRGt6aM0NHRDDIayQY09OqNMQ3iTgO8PIDuNSOfC1mCg5jacMn7/ZeUVHJ1wcWUxQ2PzUUjd3LfMePAmaI2vYhIyaCrbWsMGTGcR3wtG4wFe3Stt7GwDrBLomddCpP/ebi0JVVXyPzP5bCIsI1PJl9Y+ofOk5Kj/OopBMeFdjCZLwCeW4eqrp/zj6sZM5fjhZ3OM8h5EgaCdL5WbXTOvJqeLM7H9yKnhgHRai7n1UOuwhd6eXYSAPVBqDDcwuZ/oxTaPBMFRORJQm6+qCdIel86CVin5VQHBY6gEVAXOC89kRDpUSYSsiKj3aZu2pJGk7FXKiiVQ6hw0MldRhK+Z7N2JmUkCGAO1iMxQG9/rgMoHoeer/q2x04l3+7aFp98G7zojFOPGOvH87S4cTB55eOy14L+d0E8OyWzE2dGWnkTtSZKwBUKUBfN8DMnSHKYCjLNh9KQC0VoBOxMleAWqCrW2tB6S2DlnKwbTrVTiXPeFywbZccSQnBMkJO3JCjVzxIhf8wRV5cGPyZS6JxplPNTUw/PwQBIl4ukOgmu7B8shDNW+TnriXc4vLSByiRXykx0632UiPhdu4Lz5jYAVtcgKbp7CDE/YE70CHZhUOzf2TXhTqszVvUL7fe0ghMMrxM1xCp+kl4sezFqmFdqmkb5Ow931l6A1ayD0plXgg+1Yn47XtSXwzz1L57tLtDI3WntSJTdwYnOj3Xkxez5XkwVm9nrfstgvZx4Te5KwxXiPnGXHvKAWOfzzfXUxhglu9fj0ZbtUV6NSHjynRgIrPq9JbRClwsp6oMlE3N7KEIlGGnKIPqO5DnJgiSqCT9qEWl7as2G3ak2An6kmVW/IKGXjsInTeL2ql3XEJZeJswoPJtTMcuIJRyjJEDjCZbtDAZUZF+ETxAHPmbNRbtK/5500HmBo3aOB7WmmDDDj+wQ+xudR/CUGsfh6udxDFfxCRoICxtm2dy+QpbSx/Z0RNlU4YbYkwgMQUn2Y4fAIBJsUByvPyD479CqItqXIePyJ4mVxv8WaLyZRR/Bgxfw6tIA+q/ss0P3bMk+vyTit3MQUyzJBMAV0nZ9swgu24LwSRPAlEwUrqyGuxlriIwK5fWqSrNNEEqsXXkqk7FG8iApZfJyvwDQ0Z232OFmgNgpeb+tmWHKR/IVixT+YhWGcgzmuMXXvylegwjJ9/+j/V9lSRGWUAAA==
+
+
+ dbo
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.DbDataLayer/Migrations/Configuration.cs b/EgtBEAMWALL.DbDataLayer/Migrations/Configuration.cs
new file mode 100644
index 00000000..6995f10a
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/Migrations/Configuration.cs
@@ -0,0 +1,23 @@
+namespace EgtBEAMWALL.DbDataLayer.Migrations
+{
+ using System;
+ using System.Data.Entity;
+ using System.Data.Entity.Migrations;
+ using System.Linq;
+
+ internal sealed class Configuration : DbMigrationsConfiguration
+ {
+ public Configuration()
+ {
+ AutomaticMigrationsEnabled = false;
+ }
+
+ protected override void Seed(EgtBEAMWALL.DbDataLayer.DatabaseContext context)
+ {
+ // This method will be called after migrating to the latest version.
+
+ // You can use the DbSet.AddOrUpdate() helper extension method
+ // to avoid creating duplicate seed data.
+ }
+ }
+}
diff --git a/EgtBEAMWALL.DbDataLayer/Properties/AssemblyInfo.cs b/EgtBEAMWALL.DbDataLayer/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..3a3d3149
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("EgtBEAMWALL.DbDataLayer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EgtBEAMWALL.DbDataLayer")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("5f1cde84-fd6a-4107-968c-ecc4d64f8043")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/EgtBEAMWALL.DbDataLayer/packages.config b/EgtBEAMWALL.DbDataLayer/packages.config
new file mode 100644
index 00000000..ffa9838d
--- /dev/null
+++ b/EgtBEAMWALL.DbDataLayer/packages.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.Supervisor/Application.xaml b/EgtBEAMWALL.Supervisor/Application.xaml
new file mode 100644
index 00000000..0f83d48e
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/Application.xaml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.Supervisor/Application.xaml.vb b/EgtBEAMWALL.Supervisor/Application.xaml.vb
new file mode 100644
index 00000000..5b871242
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/Application.xaml.vb
@@ -0,0 +1,14 @@
+Class Application
+
+ ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
+ ' can be handled in this file.
+ Protected Overrides Sub OnStartup(e As StartupEventArgs)
+ MyBase.OnStartup(e)
+ ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
+ ' Creo la View principale
+ Me.MainWindow = New MainWindowV
+ ' Mostro la View principale
+ Me.MainWindow.Show()
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.Supervisor/EgtBEAMWALL.Supervisor.vbproj b/EgtBEAMWALL.Supervisor/EgtBEAMWALL.Supervisor.vbproj
new file mode 100644
index 00000000..6e88f917
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/EgtBEAMWALL.Supervisor.vbproj
@@ -0,0 +1,201 @@
+
+
+
+ Debug
+ AnyCPU
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ WinExe
+ EgtBEAMWALL.Supervisor
+ EgtBEAMWALL.Supervisor
+ v4.0
+ Custom
+ true
+
+
+ AnyCPU
+ true
+ full
+ true
+ true
+ true
+ bin\Debug\
+ EgtBEAMWALL.Supervisor.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+
+
+ AnyCPU
+ pdbonly
+ false
+ false
+ true
+ false
+ true
+ bin\Release\
+ EgtBEAMWALL.Supervisor.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+ true
+ true
+ true
+ bin\x64\Debug\
+ EgtBEAMWALL.Supervisor.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+ full
+ x64
+ MinimumRecommendedRules.ruleset
+
+
+ true
+ bin\x64\Release\
+ EgtBEAMWALL.Supervisor.xml
+ true
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+ pdbonly
+ x64
+ MinimumRecommendedRules.ruleset
+
+
+ true
+ true
+ true
+ bin\x86\Debug\
+ EgtBEAMWALL.Supervisor.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+ full
+ x86
+ MinimumRecommendedRules.ruleset
+
+
+ true
+ bin\x86\Release\
+ EgtBEAMWALL.Supervisor.xml
+ true
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+ pdbonly
+ x86
+ MinimumRecommendedRules.ruleset
+
+
+
+ ..\..\..\EgtProg\DllD32\EgtUILib.dll
+
+
+ ..\..\..\EgtProg\DllD32\EgtWPFLib5.dll
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+ Dictionary.xaml
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Application.xaml
+ Code
+
+
+ MainWindowV.xaml
+ Code
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+ Microsoft.VisualBasic.WPF.MyExtension
+ 1.0.0.0
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.vb
+
+
+
+
+ {f22835a1-83d8-4334-91bb-baaeb9cf59b1}
+ EgtBEAMWALL.Core
+
+
+ {24d7760e-662a-47e4-b729-b70126c24a31}
+ EgtBEAMWALL.DataLayer
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.Supervisor/MainWindow/MainWindowV.xaml b/EgtBEAMWALL.Supervisor/MainWindow/MainWindowV.xaml
new file mode 100644
index 00000000..51775bf8
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/MainWindow/MainWindowV.xaml
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.Supervisor/MainWindow/MainWindowV.xaml.vb b/EgtBEAMWALL.Supervisor/MainWindow/MainWindowV.xaml.vb
new file mode 100644
index 00000000..e63255af
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/MainWindow/MainWindowV.xaml.vb
@@ -0,0 +1,3 @@
+Class MainWindowV
+
+End Class
diff --git a/EgtBEAMWALL.Supervisor/MainWindow/MainWindowVM.vb b/EgtBEAMWALL.Supervisor/MainWindow/MainWindowVM.vb
new file mode 100644
index 00000000..8a0d5d46
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/MainWindow/MainWindowVM.vb
@@ -0,0 +1,37 @@
+Imports EgtBEAMWALL.Core
+
+Public Class MainWindowVM
+
+ Private m_MachGroupList As New List(Of MyMachGroup)
+ Public Property MachGroupList As List(Of MyMachGroup)
+ Get
+ Return m_MachGroupList
+ End Get
+ Set(value As List(Of MyMachGroup))
+ m_MachGroupList = value
+ End Set
+ End Property
+
+ Private m_SelMachGroup As MyMachGroup
+ Public Property SelMachGroup As MyMachGroup
+ Get
+ Return m_SelMachGroup
+ End Get
+ Set(value As MyMachGroup)
+ m_SelMachGroup = value
+ End Set
+ End Property
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ '' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
+ 'Map.BeginInit(Me)
+ '' Creo Model della MainWindow
+ 'm_MainWindowM = New MainWindowM
+ m_MachGroupList.Add(New beammachgroup(43, "Mach7", "Essetre-FAST"))
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+End Class
diff --git a/EgtBEAMWALL.Supervisor/My Project/AssemblyInfo.vb b/EgtBEAMWALL.Supervisor/My Project/AssemblyInfo.vb
new file mode 100644
index 00000000..1941705e
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/My Project/AssemblyInfo.vb
@@ -0,0 +1,59 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+Imports System.Globalization
+Imports System.Resources
+Imports System.Windows
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+'In order to begin building localizable applications, set
+'CultureYouAreCodingWith in your .vbproj file
+'inside a . For example, if you are using US english
+'in your source files, set the to "en-US". Then uncomment the
+'NeutralResourceLanguage attribute below. Update the "en-US" in the line
+'below to match the UICulture setting in the project file.
+
+'
+
+
+'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
+'1st parameter: where theme specific resource dictionaries are located
+'(used if a resource is not found in the page,
+' or application resource dictionaries)
+
+'2nd parameter: where the generic resource dictionary is located
+'(used if a resource is not found in the page,
+'app, and any theme specific resource dictionaries)
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/EgtBEAMWALL.Supervisor/My Project/MyExtensions/MyWpfExtension.vb b/EgtBEAMWALL.Supervisor/My Project/MyExtensions/MyWpfExtension.vb
new file mode 100644
index 00000000..22f84b7d
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/My Project/MyExtensions/MyWpfExtension.vb
@@ -0,0 +1,121 @@
+#If _MyType <> "Empty" Then
+
+Namespace My
+ '''
+ ''' Module used to define the properties that are available in the My Namespace for WPF
+ '''
+ '''
+ _
+ Module MyWpfExtension
+ Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer)
+ Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User)
+ Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows)
+ Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log)
+ '''
+ ''' Returns the application object for the running application
+ '''
+ _
+ Friend ReadOnly Property Application() As Application
+ Get
+ Return CType(Global.System.Windows.Application.Current, Application)
+ End Get
+ End Property
+ '''
+ ''' Returns information about the host computer.
+ '''
+ _
+ Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer
+ Get
+ Return s_Computer.GetInstance()
+ End Get
+ End Property
+ '''
+ ''' Returns information for the current user. If you wish to run the application with the current
+ ''' Windows user credentials, call My.User.InitializeWithWindowsUser().
+ '''
+ _
+ Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User
+ Get
+ Return s_User.GetInstance()
+ End Get
+ End Property
+ '''
+ ''' Returns the application log. The listeners can be configured by the application's configuration file.
+ '''
+ _
+ Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log
+ Get
+ Return s_Log.GetInstance()
+ End Get
+ End Property
+
+ '''
+ ''' Returns the collection of Windows defined in the project.
+ '''
+ _
+ Friend ReadOnly Property Windows() As MyWindows
+ _
+ Get
+ Return s_Windows.GetInstance()
+ End Get
+ End Property
+ _
+ _
+ Friend NotInheritable Class MyWindows
+ _
+ Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T
+ If Instance Is Nothing Then
+ If s_WindowBeingCreated IsNot Nothing Then
+ If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then
+ Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.")
+ End If
+ Else
+ s_WindowBeingCreated = New Global.System.Collections.Hashtable()
+ End If
+ s_WindowBeingCreated.Add(GetType(T), Nothing)
+ Return New T()
+ s_WindowBeingCreated.Remove(GetType(T))
+ Else
+ Return Instance
+ End If
+ End Function
+ _
+ _
+ Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T)
+ instance = Nothing
+ End Sub
+ _
+ _
+ Public Sub New()
+ MyBase.New()
+ End Sub
+ Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable
+ Public Overrides Function Equals(ByVal o As Object) As Boolean
+ Return MyBase.Equals(o)
+ End Function
+ Public Overrides Function GetHashCode() As Integer
+ Return MyBase.GetHashCode
+ End Function
+ _
+ _
+ Friend Overloads Function [GetType]() As Global.System.Type
+ Return GetType(MyWindows)
+ End Function
+ Public Overrides Function ToString() As String
+ Return MyBase.ToString
+ End Function
+ End Class
+ End Module
+End Namespace
+Partial Class Application
+ Inherits Global.System.Windows.Application
+ _
+ _
+ Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo
+ _
+ Get
+ Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly())
+ End Get
+ End Property
+End Class
+#End If
\ No newline at end of file
diff --git a/EgtBEAMWALL.Supervisor/My Project/Resources.Designer.vb b/EgtBEAMWALL.Supervisor/My Project/Resources.Designer.vb
new file mode 100644
index 00000000..b22e10f7
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/My Project/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:$clrversion$
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("$safeprojectname$.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/EgtBEAMWALL.Supervisor/My Project/Resources.resx b/EgtBEAMWALL.Supervisor/My Project/Resources.resx
new file mode 100644
index 00000000..af7dbebb
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.Supervisor/My Project/Settings.Designer.vb b/EgtBEAMWALL.Supervisor/My Project/Settings.Designer.vb
new file mode 100644
index 00000000..4fc18d52
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.EgtBEAMWALL.Supervisor.My.MySettings
+ Get
+ Return Global.EgtBEAMWALL.Supervisor.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/EgtBEAMWALL.Supervisor/My Project/Settings.settings b/EgtBEAMWALL.Supervisor/My Project/Settings.settings
new file mode 100644
index 00000000..40ed9fdb
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.Supervisor/Resources/EgtBEAMWALL.ico b/EgtBEAMWALL.Supervisor/Resources/EgtBEAMWALL.ico
new file mode 100644
index 00000000..90d62965
Binary files /dev/null and b/EgtBEAMWALL.Supervisor/Resources/EgtBEAMWALL.ico differ
diff --git a/EgtBEAMWALL.Supervisor/Resources/TreeView/Folder.png b/EgtBEAMWALL.Supervisor/Resources/TreeView/Folder.png
new file mode 100644
index 00000000..2c1339d0
Binary files /dev/null and b/EgtBEAMWALL.Supervisor/Resources/TreeView/Folder.png differ
diff --git a/EgtBEAMWALL.Supervisor/Utility/Command.vb b/EgtBEAMWALL.Supervisor/Utility/Command.vb
new file mode 100644
index 00000000..476e71f6
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/Utility/Command.vb
@@ -0,0 +1,68 @@
+
+'''
+''' A command whose sole purpose is to
+''' relay its functionality to other
+''' objects by invoking delegates. The
+''' default return value for the CanExecute
+''' method is 'true'.
+'''
+Public Class Command
+ Implements ICommand
+
+#Region "Fields"
+
+ Private ReadOnly _execute As Action(Of Object)
+ Private ReadOnly _canExecute As Predicate(Of Object)
+
+#End Region ' Fields
+
+#Region "Constructors"
+
+ '''
+ ''' Creates a new command that can always execute.
+ '''
+ ''' The execution logic.
+ Public Sub New(ByVal execute As Action(Of Object))
+ Me.New(execute, Nothing)
+ End Sub
+
+ '''
+ ''' Creates a new command.
+ '''
+ ''' The execution logic.
+ ''' The execution status logic.
+ Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
+ If execute Is Nothing Then
+ Throw New ArgumentNullException("execute")
+ End If
+
+ _execute = execute
+ _canExecute = canExecute
+ End Sub
+
+#End Region ' Constructors
+
+#Region "ICommand Members"
+
+ _
+ Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
+ Return If(_canExecute Is Nothing, True, _canExecute(parameter))
+ End Function
+
+ Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
+ AddHandler(ByVal value As EventHandler)
+ AddHandler CommandManager.RequerySuggested, value
+ End AddHandler
+ RemoveHandler(ByVal value As EventHandler)
+ RemoveHandler CommandManager.RequerySuggested, value
+ End RemoveHandler
+ RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
+ End RaiseEvent
+ End Event
+
+ Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
+ _execute(parameter)
+ End Sub
+
+#End Region ' ICommand Members
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.Supervisor/Utility/Dictionary.xaml b/EgtBEAMWALL.Supervisor/Utility/Dictionary.xaml
new file mode 100644
index 00000000..d4e5a379
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/Utility/Dictionary.xaml
@@ -0,0 +1,646 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.Supervisor/Utility/Dictionary.xaml.vb b/EgtBEAMWALL.Supervisor/Utility/Dictionary.xaml.vb
new file mode 100644
index 00000000..fef4e3b7
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/Utility/Dictionary.xaml.vb
@@ -0,0 +1,30 @@
+Public Class OmagOFFICEDictionary
+
+ Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM"
+
+#Region "Colors"
+
+ Private m_Omag_Red As SolidColorBrush = Brushes.Red
+ Public ReadOnly Property Omag_Red As SolidColorBrush
+ Get
+ Return m_Omag_Red
+ End Get
+ End Property
+
+ Private Shared m_Button_Static_Background As SolidColorBrush = New BrushConverter().ConvertFrom("#FFDDDDDD")
+ Public Shared ReadOnly Property Button_Static_Background As SolidColorBrush
+ Get
+ Return m_Button_Static_Background
+ End Get
+ End Property
+
+ Private Shared m_TabControl_Header_Background As LinearGradientBrush = Application.Current.FindResource("TabItem.Static.Background")
+ Public Shared ReadOnly Property TabControl_Header_Background As LinearGradientBrush
+ Get
+ Return m_TabControl_Header_Background
+ End Get
+ End Property
+
+#End Region ' Colors
+
+End Class
diff --git a/EgtBEAMWALL.Supervisor/Utility/VMBase.vb b/EgtBEAMWALL.Supervisor/Utility/VMBase.vb
new file mode 100644
index 00000000..b2d5ce6c
--- /dev/null
+++ b/EgtBEAMWALL.Supervisor/Utility/VMBase.vb
@@ -0,0 +1,12 @@
+Imports System.ComponentModel
+
+Public Class VMBase
+ Implements INotifyPropertyChanged
+
+ Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
+
+ Public Sub NotifyPropertyChanged(propName As String)
+ RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddFeatureWnd/AddFeatureWndV.vb b/EgtBEAMWALL.ViewerOptimizer/AddFeatureWnd/AddFeatureWndV.vb
new file mode 100644
index 00000000..35d7d688
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddFeatureWnd/AddFeatureWndV.vb
@@ -0,0 +1,18 @@
+Public Class AddFeatureWndV
+
+ Private WithEvents m_AddFeatureWndVM As AddFeatureWndVM
+
+ Sub New(Owner As Window, AddFeatureWndVM As AddFeatureWndVM)
+ MyBase.New(Owner)
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = AddFeatureWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_AddFeatureWndVM = AddFeatureWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_AddFeatureWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddFeatureWnd/AddFeatureWndV.xaml b/EgtBEAMWALL.ViewerOptimizer/AddFeatureWnd/AddFeatureWndV.xaml
new file mode 100644
index 00000000..1be62179
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddFeatureWnd/AddFeatureWndV.xaml
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddFeatureWnd/AddFeatureWndVM.vb b/EgtBEAMWALL.ViewerOptimizer/AddFeatureWnd/AddFeatureWndVM.vb
new file mode 100644
index 00000000..8a6a4762
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddFeatureWnd/AddFeatureWndVM.vb
@@ -0,0 +1,230 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+Imports EgtBEAMWALL.Core
+
+Public Class AddFeatureWndVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+ Friend m_MacroFilePathList As List(Of String)
+
+ Private m_SelGRPType As GRPType
+ Public Property SelGRPType As Integer
+ Get
+ Return m_SelGRPType
+ End Get
+ Set(value As Integer)
+ m_SelGRPType = value
+ ' carico lista process
+ Dim TempPRCList As New ObservableCollection(Of Integer)
+ GetBeamPrivateProfileProcessList(m_SelGRPType, TempPRCList)
+ m_PRCList.Clear()
+ For Each PRC In TempPRCList
+ ' leggo gruppi
+ Dim GRPList As New ObservableCollection(Of Integer)
+ GetBeamPrivateProfileGRPList(m_SelGRPType, PRC, GRPList)
+ m_PRCList.Add(New PRC(If(GRPList.Count > 0, GRPList(0), m_SelGRPType), PRC, GetBeamPrivateProfileName(m_SelGRPType, PRC)))
+ Next
+ m_nSelPRC = Nothing
+ MacroList_IsEnabled = False
+ NotifyPropertyChanged("PRCList")
+ NotifyPropertyChanged("nSelPRC")
+ End Set
+ End Property
+
+ Private m_PRCList As New ObservableCollection(Of PRC)
+ Public ReadOnly Property PRCList As ObservableCollection(Of PRC)
+ Get
+ Return m_PRCList
+ End Get
+ End Property
+
+ Private m_nSelPRC As PRC = Nothing
+ Public Property nSelPRC As PRC
+ Get
+ Return m_nSelPRC
+ End Get
+ Set(value As PRC)
+ If value IsNot m_nSelPRC Then
+ m_nSelPRC = value
+ NotifyPropertyChanged("sDrawPath")
+ ' carico eventuali file Macro
+ MacroList.Clear()
+ m_MacroFilePathList = New List(Of String)
+ If Not IsNothing(nSelPRC) Then
+ Dim nGRPFromFileName As Integer = 0
+ Dim nPRCFromFileName As Integer = 0
+ Dim sMacroNameFromFileName As String = String.Empty
+ Dim nIdMacroName As Integer = 0
+ ' ricavo lista file Macro
+ Dim AllFilesInDir As IEnumerable(Of String) = IO.Directory.EnumerateFiles(Map.refMainWindowVM.MainWindowM.sMacroDir)
+ For Each File In AllFilesInDir
+ If Path.GetExtension(File).ToLower() = ".lua" Then
+ If File.Contains(FILENAMESEPARATOR) Then
+ Dim FileName As String = Path.GetFileNameWithoutExtension(File)
+ Dim DataFromFileName As String() = FileName.Split(FILENAMESEPARATOR)
+ If DataFromFileName.Count = 2 Then
+ If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
+ Dim NumbersFromFileName As String() = DataFromFileName(0).Split(".")
+ Integer.TryParse(NumbersFromFileName(0), nGRPFromFileName)
+ Integer.TryParse(NumbersFromFileName(1), nPRCFromFileName)
+ End If
+ If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
+ sMacroNameFromFileName = DataFromFileName(1)
+ End If
+ If nGRPFromFileName = CalcBeamPrivateProfileGRP(nSelPRC.nGRP) AndAlso nPRCFromFileName = nSelPRC.nPRC Then
+ MacroList.Add(New IdNameStruct(nIdMacroName, sMacroNameFromFileName))
+ m_MacroFilePathList.Add(File)
+ nIdMacroName = nIdMacroName + 1
+ End If
+ End If
+ End If
+ End If
+ Next
+ If MacroList.Count > 0 Then
+ MacroList_IsEnabled = True
+ Else
+ MacroList_IsEnabled = False
+ End If
+ End If
+ End If
+ End Set
+ End Property
+
+ Private m_MacroList_IsEnabled As Boolean
+ Public Property MacroList_IsEnabled As Boolean
+ Get
+ Return m_MacroList_IsEnabled
+ End Get
+ Set(value As Boolean)
+ If value <> m_MacroList_IsEnabled Then
+ m_MacroList_IsEnabled = value
+ NotifyPropertyChanged("MacroList_IsEnabled")
+ End If
+ End Set
+ End Property
+
+ Private m_MacroList As New ObservableCollection(Of Object)
+ Public ReadOnly Property MacroList As ObservableCollection(Of Object)
+ Get
+ Return m_MacroList
+ End Get
+ End Property
+
+ Private m_nSelMacro As Integer = -1
+ Public Property nSelMacro As Integer
+ Get
+ Return m_nSelMacro
+ End Get
+ Set(value As Integer)
+ If value <> m_nSelMacro Then
+ m_nSelMacro = value
+ End If
+ End Set
+ End Property
+
+ Public ReadOnly Property sDrawPath As String
+ Get
+ If IsNothing(m_nSelPRC) Then Return ""
+ Dim sDescConstruction As String = String.Empty
+ If m_SelGRPType = GRPType.L Then
+ sDescConstruction = "L"
+ Else
+ sDescConstruction = "T"
+ End If
+ sDescConstruction &= m_nSelPRC.nPRC.ToString("000")
+ Return Map.refMainWindowVM.MainWindowM.sResourcesRoot & "\Features\" & sDescConstruction & ".png"
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ SelGRPType = 0
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "Ok"
+
+ Public ReadOnly Property Ok_Command As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ Public Sub Ok()
+ 'verifico che tutti i campi contengano un valore valido
+ If Not IsNothing(m_nSelPRC) AndAlso m_nSelPRC.nPRC > 0 Then
+ RaiseEvent m_CloseWindow(True)
+ Else
+ MessageBox.Show("Errore! Impossibile creare una feature con questi parametri", "Errore")
+ End If
+ End Sub
+
+#End Region ' Ok
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class PRC
+
+ ' Processo
+ Private m_nPRC As Integer
+ Friend ReadOnly Property nPRC As Integer
+ Get
+ Return m_nPRC
+ End Get
+ End Property
+
+ ' Gruppo
+ Private m_nGRP As Integer
+ Friend ReadOnly Property nGRP As Integer
+ Get
+ Return m_nGRP
+ End Get
+ End Property
+
+ Private m_nSIDE As Integer = 2
+ Public ReadOnly Property nSIDE As Integer
+ Get
+ Return m_nSIDE
+ End Get
+ End Property
+
+ ' Nome
+ Private m_sName As String
+ Public ReadOnly Property sName As String
+ Get
+ Return m_sName
+ End Get
+ End Property
+
+ Public ReadOnly Property ghDesc As String
+ Get
+ Return If(m_nGRP = 1 OrElse m_nGRP = 2, "T", "L") & m_nPRC.ToString("000") & " " & m_sName
+ End Get
+ End Property
+
+ Sub New(GRP As Integer, PRC As Integer, Name As String)
+ m_nPRC = PRC
+ m_sName = Name
+ m_nGRP = GRP
+ End Sub
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddPartWnd/AddPartWndV.xaml b/EgtBEAMWALL.ViewerOptimizer/AddPartWnd/AddPartWndV.xaml
new file mode 100644
index 00000000..e85ce166
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddPartWnd/AddPartWndV.xaml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddPartWnd/AddPartWndV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/AddPartWnd/AddPartWndV.xaml.vb
new file mode 100644
index 00000000..a03fc3bc
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddPartWnd/AddPartWndV.xaml.vb
@@ -0,0 +1,18 @@
+Public Class AddPartWndV
+
+ Private WithEvents m_AddPartWndVM As AddPartWndVM
+
+ Sub New(Owner As Window, AddPartWndVM As AddPartWndVM)
+ MyBase.New(Owner)
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = AddPartWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_AddPartWndVM = AddPartWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_AddPartWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddPartWnd/AddPartWndVM.vb b/EgtBEAMWALL.ViewerOptimizer/AddPartWnd/AddPartWndVM.vb
new file mode 100644
index 00000000..69a59a22
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddPartWnd/AddPartWndVM.vb
@@ -0,0 +1,176 @@
+Imports EgtWPFLib5
+Imports EgtUILib
+
+Public Class AddPartWndVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ Private m_nPDN As Integer
+ Public Property nPDN As Integer
+ Get
+ Return m_nPDN
+ End Get
+ Set(value As Integer)
+ m_nPDN = value
+ End Set
+ End Property
+
+ Private m_sNAM As String
+ Public Property sNAM As String
+ Get
+ Return m_sNAM
+ End Get
+ Set(value As String)
+ m_sNAM = value
+ End Set
+ End Property
+
+ Private m_dL As Double
+ Public ReadOnly Property dL As Double
+ Get
+ Return m_dL
+ End Get
+ End Property
+ Public Property sL As String
+ Get
+ Return LenToString(m_dL, 3)
+ End Get
+ Set(value As String)
+ Dim dTempL As Double
+ If StringToLen(value, dTempL) AndAlso dTempL > 0 Then
+ m_dL = dTempL
+ Else
+ NotifyPropertyChanged("sL")
+ End If
+ End Set
+ End Property
+
+ Private m_dW As Double
+ Public ReadOnly Property dW As Double
+ Get
+ Return m_dW
+ End Get
+ End Property
+ Public Property sW As String
+ Get
+ Return LenToString(m_dW, 3)
+ End Get
+ Set(value As String)
+ Dim dTempW As Double
+ If StringToLen(value, dTempW) AndAlso dTempW > 0 Then
+ EgtDraw()
+ m_dW = dTempW
+ Else
+ NotifyPropertyChanged("sW")
+ End If
+ End Set
+ End Property
+
+ Private m_dH As Double
+ Public ReadOnly Property dH As Double
+ Get
+ Return m_dH
+ End Get
+ End Property
+ Public Property sH As String
+ Get
+ Return LenToString(m_dH, 3)
+ End Get
+ Set(value As String)
+ Dim dTempH As Double
+ If StringToLen(value, dTempH) AndAlso dTempH > 0 Then
+ EgtDraw()
+ m_dH = dTempH
+ Else
+ NotifyPropertyChanged("sH")
+ End If
+ End Set
+ End Property
+
+ Private m_sMAT As String
+ Public Property sMAT As String
+ Get
+ Return m_sMAT
+ End Get
+ Set(value As String)
+ m_sMAT = value
+ End Set
+ End Property
+
+ Private m_nCNT As Integer
+ Public ReadOnly Property nCNT As Integer
+ Get
+ Return m_nCNT
+ End Get
+ End Property
+ Public Property sCNT As String
+ Get
+ Return m_nCNT
+ End Get
+ Set(value As String)
+ Dim nTempCNT As Integer
+ If Integer.TryParse(value, nTempCNT) AndAlso nTempCNT > 0 Then
+ m_nCNT = nTempCNT
+ Else
+ NotifyPropertyChanged("sCNT")
+ End If
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ If Not IsNothing(Map.refProjectVM.BTLStructure.PartList) Then
+ If Not IsNothing(Map.refProjectVM.BTLStructure.SelPart) Then
+ m_dW = Map.refProjectVM.BTLStructure.SelPart.dW
+ m_dH = Map.refProjectVM.BTLStructure.SelPart.dH
+ m_dL = Map.refProjectVM.BTLStructure.SelPart.dL
+ ElseIf Map.refProjectVM.BTLStructure.PartList.Count > 0 Then
+ m_dW = Map.refProjectVM.BTLStructure.PartList(0).dW
+ m_dH = Map.refProjectVM.BTLStructure.PartList(0).dH
+ m_dL = Map.refProjectVM.BTLStructure.PartList(0).dL
+ End If
+ m_nPDN = Map.refProjectVM.BTLStructure.NewPDN()
+ End If
+ m_nCNT = 1
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "Ok"
+
+ Public ReadOnly Property Ok_Command As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ Public Sub Ok()
+ 'verifico che tutti i campi contengano un valore valido
+ If Not IsNothing(m_dL) AndAlso m_dL > 0 AndAlso
+ Not IsNothing(m_dW) AndAlso m_dW >= 0 AndAlso
+ Not IsNothing(m_dH) AndAlso m_dH >= 0 Then
+ RaiseEvent m_CloseWindow(True)
+ Else
+ MessageBox.Show("Errore! Impossibile creare un nuovo pezzo con questi parametri", "Errore")
+ End If
+ End Sub
+
+#End Region ' Ok
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddRawPartWnd/AddRawPartWndV.xaml b/EgtBEAMWALL.ViewerOptimizer/AddRawPartWnd/AddRawPartWndV.xaml
new file mode 100644
index 00000000..85e1c2c7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddRawPartWnd/AddRawPartWndV.xaml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddRawPartWnd/AddRawPartWndV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/AddRawPartWnd/AddRawPartWndV.xaml.vb
new file mode 100644
index 00000000..55b49ee6
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddRawPartWnd/AddRawPartWndV.xaml.vb
@@ -0,0 +1,18 @@
+Public Class AddRawPartWndV
+
+ Private WithEvents m_AddRawPartWndVM As AddRawPartWndVM
+
+ Sub New(Owner As Window, AddRawPartWndVM As AddRawPartWndVM)
+ MyBase.New(Owner)
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = AddRawPartWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_AddRawPartWndVM = AddRawPartWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_AddRawPartWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddRawPartWnd/AddRawPartWndVM.vb b/EgtBEAMWALL.ViewerOptimizer/AddRawPartWnd/AddRawPartWndVM.vb
new file mode 100644
index 00000000..28173e31
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddRawPartWnd/AddRawPartWndVM.vb
@@ -0,0 +1,198 @@
+Imports System.Collections.ObjectModel
+Imports EgtWPFLib5
+Imports EgtUILib
+
+Public Class AddRawPartWndVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ ' flag che indica se trave o parete
+ Private m_nMachineType As MachineType = 1
+
+ ' lista delle varibili da mostrare
+ Private m_VariableList As ObservableCollection(Of Variable)
+ Public ReadOnly Property VariableList As ObservableCollection(Of Variable)
+ Get
+ Return m_VariableList
+ End Get
+ End Property
+
+ 'Private m_dL As Double
+ 'Public ReadOnly Property dL As Double
+ ' Get
+ ' Return m_dL
+ ' End Get
+ 'End Property
+ 'Public Property sL As String
+ ' Get
+ ' Return LenToString(m_dL, 3)
+ ' End Get
+ ' Set(value As String)
+ ' Dim dTempL As Double
+ ' If StringToLen(value, dTempL) AndAlso dTempL > 0 Then
+ ' m_dL = dTempL
+ ' Else
+ ' NotifyPropertyChanged("sL")
+ ' End If
+ ' End Set
+ 'End Property
+
+ 'Private m_dPOSX As Double
+ 'Public Property dPOSX As Double
+ ' Get
+ ' Return m_dPOSX
+ ' End Get
+ ' Set(value As Double)
+ ' m_dPOSX = value
+ ' End Set
+ 'End Property
+ 'Public Property sPOSX As String
+ ' Get
+ ' Return LenToString(m_dPOSX, 3)
+ ' End Get
+ ' Set(value As String)
+ ' Dim dTempPOSX As Double
+ ' If StringToLen(value, dTempPOSX) AndAlso dTempPOSX > 0 Then
+ ' m_dPOSX = dTempPOSX
+ ' Else
+ ' NotifyPropertyChanged("sPOSX")
+ ' End If
+ ' End Set
+ 'End Property
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New(MachineType As Integer, dL As Double, dW As Double, dPosx As Double)
+ m_nMachineType = MachineType
+ Select Case m_nMachineType
+ Case ConstBeam.MachineType.BEAM
+ m_VariableList = New ObservableCollection(Of Variable)({New Variable(Variable.VariableType.LENGTH, "Lunghezza", dL),
+ New Variable(Variable.VariableType.LENGTH, "Ritaglio iniziale", dPosx)})
+ Case ConstBeam.MachineType.WALL
+ m_VariableList = New ObservableCollection(Of Variable)({New Variable(Variable.VariableType.LENGTH, "Lunghezza", dL),
+ New Variable(Variable.VariableType.LENGTH, "Larghezza", dW)})
+ End Select
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "Ok"
+
+ Public ReadOnly Property Ok_Command As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ Public Sub Ok()
+ 'verifico che tutti i campi contengano un valore valido
+ For Each Variable In m_VariableList
+ If (Variable.nType = Variable.VariableType.STRING_ AndAlso IsNothing(Variable.sValue)) OrElse
+ ((Variable.nType = Variable.VariableType.DOUBLE_ OrElse Variable.nType = Variable.VariableType.LENGTH) AndAlso IsNothing(Variable.dValue)) Then
+ MessageBox.Show(If(m_nMachineType = MachineType.BEAM, "Errore! Impossibile creare una barra con questi parametri", "Errore! Impossibile creare una parete con questi parametri"), "Errore")
+ Return
+ End If
+ Next
+ ' se non ci sono problemi esco restituendo vero
+ RaiseEvent m_CloseWindow(True)
+ 'If Not IsNothing(m_dL) AndAlso m_dL > 0 AndAlso
+ ' Not IsNothing(m_dPOSX) AndAlso m_dPOSX >= 0 Then
+ ' RaiseEvent m_CloseWindow(True)
+ 'Else
+ ' MessageBox.Show("Errore! Impossibile creare una barra con questi parametri", "Errore")
+ 'End If
+ End Sub
+
+#End Region ' Ok
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class Variable
+ Inherits VMBase
+
+ Public Enum VariableType As Integer
+ DOUBLE_ = 1
+ STRING_ = 2
+ COMBO = 3
+ LENGTH = 4
+ End Enum
+
+ Private m_nType As VariableType
+ Public ReadOnly Property nType As VariableType
+ Get
+ Return m_nType
+ End Get
+ End Property
+
+ Private m_sMsg As String
+ Public Property sMsg As String
+ Get
+ Return m_sMsg
+ End Get
+ Set(value As String)
+ m_sMsg = value
+ End Set
+ End Property
+
+ Private m_dValue As Double = 0
+ Friend ReadOnly Property dValue As Double
+ Get
+ Return m_dValue
+ End Get
+ End Property
+ Private m_sValue As String = ""
+ Public Property sValue As String
+ Get
+ Select Case m_nType
+ Case VariableType.STRING_
+ Return m_sValue
+ Case VariableType.LENGTH
+ Return LenToString(m_dValue, 3)
+ Case Else ' VariableType.DOUBLE_
+ Return DoubleToString(m_dValue, 3)
+ End Select
+ End Get
+ Set(value As String)
+ Select Case m_nType
+ Case VariableType.STRING_
+ m_sValue = value
+ Case VariableType.LENGTH
+ Dim dTempValue As Double
+ If StringToLen(value, dTempValue) Then
+ m_dValue = dTempValue
+ Else
+ NotifyPropertyChanged("sValue")
+ End If
+ Case Else ' VariableType.DOUBLE_
+ Dim dTempValue As Double
+ If StringToDouble(value, dTempValue) Then
+ m_dValue = dTempValue
+ Else
+ NotifyPropertyChanged("sValue")
+ End If
+ End Select
+ End Set
+ End Property
+
+ Sub New(Type As VariableType, Msg As String, Value As String)
+ m_nType = Type
+ m_sMsg = Msg
+ sValue = Value
+ End Sub
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddSectionXMaterialWnd/AddSectionXMaterialWndV.xaml b/EgtBEAMWALL.ViewerOptimizer/AddSectionXMaterialWnd/AddSectionXMaterialWndV.xaml
new file mode 100644
index 00000000..e125f4ab
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddSectionXMaterialWnd/AddSectionXMaterialWndV.xaml
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddSectionXMaterialWnd/AddSectionXMaterialWndV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/AddSectionXMaterialWnd/AddSectionXMaterialWndV.xaml.vb
new file mode 100644
index 00000000..d3e05ad1
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddSectionXMaterialWnd/AddSectionXMaterialWndV.xaml.vb
@@ -0,0 +1,18 @@
+Public Class AddSectionXMaterialWndV
+
+ Private WithEvents m_AddSectionXMaterialWndVM As AddSectionXMaterialWndVM
+
+ Sub New(Owner As Window, AddSectionXMaterialWndVM As AddSectionXMaterialWndVM)
+ MyBase.New(Owner)
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = AddSectionXMaterialWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_AddSectionXMaterialWndVM = AddSectionXMaterialWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_AddSectionXMaterialWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/AddSectionXMaterialWnd/AddSectionXMaterialWndVM.vb b/EgtBEAMWALL.ViewerOptimizer/AddSectionXMaterialWnd/AddSectionXMaterialWndVM.vb
new file mode 100644
index 00000000..6619a7d7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/AddSectionXMaterialWnd/AddSectionXMaterialWndVM.vb
@@ -0,0 +1,228 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+Imports EgtBEAMWALL.Core
+
+Public Class AddSectionXMaterialWndVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ Private m_NewSectionXMaterialList As New ObservableCollection(Of SectionXMaterial)
+ Public Property NewSectionXMaterialList As ObservableCollection(Of SectionXMaterial)
+ Get
+ Return m_NewSectionXMaterialList
+ End Get
+ Set(value As ObservableCollection(Of SectionXMaterial))
+ m_NewSectionXMaterialList = value
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "MESSAGES"
+
+ Public ReadOnly Property SectionXMaterial_Msg As String
+ Get
+ Return EgtMsg(61771)
+ End Get
+ End Property
+
+ Public ReadOnly Property Alias_Msg As String
+ Get
+ Return EgtMsg(61772)
+ End Get
+ End Property
+
+ Public ReadOnly Property Values_Msg As String
+ Get
+ Return EgtMsg(61773)
+ End Get
+ End Property
+
+ Public ReadOnly Property Ok_Msg As String
+ Get
+ Return EgtMsg(61761)
+ End Get
+ End Property
+
+ Public ReadOnly Property Cancel_Msg As String
+ Get
+ Return EgtMsg(61763)
+ End Get
+ End Property
+
+ Public ReadOnly Property Error_Msg As String
+ Get
+ Return EgtMsg(61764)
+ End Get
+ End Property
+
+ Public ReadOnly Property IncorrectValues_Msg As String
+ Get
+ Return EgtMsg(61768)
+ End Get
+ End Property
+
+#End Region ' MESSAGES
+
+#Region "CONSTRUCTOR"
+
+ Sub New(SectXMatList As List(Of SectionXMaterial))
+ NewSectionXMaterialList = New ObservableCollection(Of SectionXMaterial)(SectXMatList)
+ ' Rimuovo il primo elemento perché sempre vuoto
+ NewSectionXMaterialList.RemoveAt(0)
+ ' Prendo i SectionXMaterial appena messi nella Lista di questa finestra e li confronto con ciascuno di quelli presenti in BTLStructure.SectionList.
+ ' Se le sezioni sono uguali carico i materiali relativi alla medesima sezione.
+ ' Se i materiali di quella medesima sezione non ci sono disabilito la CheckBox Alias.
+ For Each NewSectXMatItem In NewSectionXMaterialList
+ NewSectXMatItem.Alias_IsChecked = False
+
+ For Each SectionListItem In Map.refProjectVM.BTLStructure.SectionList
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ If NewSectXMatItem.dW = SectionListItem.dW AndAlso NewSectXMatItem.dH = SectionListItem.dH Then
+ ' Se le sezioni sono uguali allora indago sui materiali
+ For Index As Integer = 0 To SectionListItem.sMaterial.Count - 1
+ If Not NewSectXMatItem.MaterialForSameSection_List.Contains(SectionListItem.sMaterial(Index)) And Not NewSectXMatItem.sMaterial.Contains(SectionListItem.sMaterial(Index)) Then
+ NewSectXMatItem.MaterialForSameSection_List.Add(SectionListItem.sMaterial(Index))
+ End If
+ If NewSectXMatItem.MaterialForSameSection_List.Count > 0 Then
+ NewSectXMatItem.Alias_IsEnabled = True
+ End If
+ Next
+ End If
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ If NewSectXMatItem.dH = SectionListItem.dH Then
+ ' Se le sezioni sono uguali allora indago sui materiali
+ For Index As Integer = 0 To SectionListItem.sMaterial.Count - 1
+ If Not NewSectXMatItem.MaterialForSameSection_List.Contains(SectionListItem.sMaterial(Index)) And Not NewSectXMatItem.sMaterial.Contains(SectionListItem.sMaterial(Index)) Then
+ NewSectXMatItem.MaterialForSameSection_List.Add(SectionListItem.sMaterial(Index))
+ End If
+ If NewSectXMatItem.MaterialForSameSection_List.Count > 0 Then
+ NewSectXMatItem.Alias_IsEnabled = True
+ End If
+ Next
+ End If
+ End If
+ Next
+
+ Next
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "Ok"
+
+ Public ReadOnly Property Ok_Command As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ Public Sub Ok()
+ ' Se i valori non sono corretti segnalo l'errore e impedisco il salvataggio
+ For Index As Integer = 0 To NewSectionXMaterialList.Count - 1
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM AndAlso NewSectionXMaterialList(Index).dNewL < 0 Then
+ MessageBox.Show(IncorrectValues_Msg, Error_Msg)
+ Return
+ End If
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL AndAlso (NewSectionXMaterialList(Index).dNewW < 0 Or NewSectionXMaterialList(Index).dNewL < 0) Then
+ MessageBox.Show(IncorrectValues_Msg, Error_Msg)
+ Return
+ End If
+ Index += 1
+ Next
+ ' Se i valori sono corretti salvo
+ Save()
+ End Sub
+
+#End Region ' Ok
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+#Region "Save"
+
+ Public Sub Save()
+
+ ' Indice per scansionare NewSectionXMaterialList
+ Dim Index = 0
+ ' Indice da incrementare in modo da scrivere i nuovi parametri L/S a partire dal giusto numero
+ Dim ParamIndex = 1
+
+ Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
+
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+
+ ' Ciclo sui parametri L esistenti nell'INI in modo da avere l'indice di partenza per gli ulteriori parametri da scrivere
+ Dim sValue As String = String.Empty
+ While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
+ ParamIndex += 1
+ End While
+
+ ' Se i valori sono tutti >= 0 li scrivo nel file INI
+ Index = 0
+ For Each NewSxMItem In NewSectionXMaterialList
+ Dim sAlias As String = String.Empty
+ For Each Mat In NewSectionXMaterialList(Index).sMaterial
+ sAlias &= Mat & ";"
+ Next
+ sAlias = sAlias.TrimEnd(";")
+ ' Se Alias è checkato aggiungo l'Alias scelto dalla ComboBox alla stringa
+ If NewSxMItem.Alias_IsChecked Then sAlias &= ";" & NewSxMItem.SelMaterialForSameSection
+ ' Scrivo il parametro
+ WritePrivateProfileString(S_BEAM, K_L & ParamIndex, LenToString(NewSectionXMaterialList(Index).dW, 3) & "," &
+ LenToString(NewSectionXMaterialList(Index).dH, 3) & "," &
+ sAlias & "," &
+ LenToString(NewSectionXMaterialList(Index).dNewL, 3), sWarehousePath)
+ Index += 1
+ ParamIndex += 1
+ Next
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+
+ ' Ciclo sui parametri S esistenti nell'INI in modo da avere l'indice di partenza per gli ulteriori parametri da scrivere
+ Dim sValue As String = String.Empty
+ While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
+ ParamIndex += 1
+ End While
+
+ ' Se i valori sono tutti > 0 li scrivo nel file INI
+ Index = 0
+ For Each NewSxMItem In NewSectionXMaterialList
+ Dim sAlias As String = String.Empty
+ For Each Mat In NewSectionXMaterialList(Index).sMaterial
+ sAlias &= Mat & ";"
+ Next
+ sAlias = sAlias.TrimEnd(";")
+ ' Se Alias è checkato aggiungo l'Alias scelto dalla ComboBox alla stringa
+ If NewSxMItem.Alias_IsChecked Then sAlias &= ";" & NewSxMItem.SelMaterialForSameSection
+ ' Scrivo il parametro
+ WritePrivateProfileString(S_WALL, K_S & ParamIndex, LenToString(NewSectionXMaterialList(Index).dH, 3) & "," &
+ sAlias & "," &
+ LenToString(NewSectionXMaterialList(Index).dNewW, 3) & "," &
+ LenToString(NewSectionXMaterialList(Index).dNewL, 3), sWarehousePath)
+ Index += 1
+ ParamIndex += 1
+ Next
+ End If
+
+ RaiseEvent m_CloseWindow(True)
+ End Sub
+
+#End Region ' Save
+
+#End Region ' METHODS
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/App.config b/EgtBEAMWALL.ViewerOptimizer/App.config
new file mode 100644
index 00000000..266e19d9
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/App.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/Application.xaml b/EgtBEAMWALL.ViewerOptimizer/Application.xaml
new file mode 100644
index 00000000..f421ce59
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Application.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/Application.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/Application.xaml.vb
new file mode 100644
index 00000000..5b871242
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Application.xaml.vb
@@ -0,0 +1,14 @@
+Class Application
+
+ ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
+ ' can be handled in this file.
+ Protected Overrides Sub OnStartup(e As StartupEventArgs)
+ MyBase.OnStartup(e)
+ ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
+ ' Creo la View principale
+ Me.MainWindow = New MainWindowV
+ ' Mostro la View principale
+ Me.MainWindow.Show()
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLDataWnd/BTLDataWndV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLDataWnd/BTLDataWndV.xaml
new file mode 100644
index 00000000..ae65a4d8
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLDataWnd/BTLDataWndV.xaml
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLDataWnd/BTLDataWndV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLDataWnd/BTLDataWndV.xaml.vb
new file mode 100644
index 00000000..7a620c10
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLDataWnd/BTLDataWndV.xaml.vb
@@ -0,0 +1,19 @@
+Public Class BTLDataWndV
+
+ Private WithEvents m_BTLDataWndVM As BTLDataWndVM
+
+ Sub New(Owner As Window, BTLDataWndVM As BTLDataWndVM)
+ MyBase.New(Owner)
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = BTLDataWndVM
+ Me.Tag = Map.refProjectVM.BTLStructure
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_BTLDataWndVM = BTLDataWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_BTLDataWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLDataWnd/BTLDataWndVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLDataWnd/BTLDataWndVM.vb
new file mode 100644
index 00000000..b3f51946
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLDataWnd/BTLDataWndVM.vb
@@ -0,0 +1,182 @@
+Imports EgtWPFLib5
+Imports EgtUILib
+
+Public Class BTLDataWndVM
+ Inherits VMBase
+
+#Region "Messages"
+
+ Public ReadOnly Property PROJNUM_MSG As String
+ Get
+ Return EgtMsg(61692)
+ End Get
+ End Property
+
+ Public ReadOnly Property PROJNAME_MSG As String
+ Get
+ Return EgtMsg(61693)
+ End Get
+ End Property
+
+ Public ReadOnly Property PROJPART_MSG As String
+ Get
+ Return EgtMsg(61694)
+ End Get
+ End Property
+
+ Public ReadOnly Property PROJGUID_MSG As String
+ Get
+ Return EgtMsg(61695)
+ End Get
+ End Property
+
+ Public ReadOnly Property LISTNAME_MSG As String
+ Get
+ Return EgtMsg(61696)
+ End Get
+ End Property
+
+ Public ReadOnly Property CUSTOMER_MSG As String
+ Get
+ Return EgtMsg(61697)
+ End Get
+ End Property
+
+ Public ReadOnly Property ARCHITECT_MSG As String
+ Get
+ Return EgtMsg(61698)
+ End Get
+ End Property
+
+ Public ReadOnly Property EDITOR_MSG As String
+ Get
+ Return EgtMsg(61699)
+ End Get
+ End Property
+
+ Public ReadOnly Property DELIVDATE_MSG As String
+ Get
+ Return EgtMsg(61700)
+ End Get
+ End Property
+
+ Public ReadOnly Property EXPDATE_MSG As String
+ Get
+ Return EgtMsg(61701)
+ End Get
+ End Property
+
+ Public ReadOnly Property EXPTIME_MSG As String
+ Get
+ Return EgtMsg(61702)
+ End Get
+ End Property
+
+ Public ReadOnly Property EXPRELEASE_MSG As String
+ Get
+ Return EgtMsg(61703)
+ End Get
+ End Property
+
+ Public ReadOnly Property LANGUAGE_MSG As String
+ Get
+ Return EgtMsg(61704)
+ End Get
+ End Property
+
+ Public ReadOnly Property RANGE_MSG As String
+ Get
+ Return EgtMsg(61705)
+ End Get
+ End Property
+
+ Public ReadOnly Property PROCESSINGQUALITY_MSG As String
+ Get
+ Return EgtMsg(61642)
+ End Get
+ End Property
+
+ Public ReadOnly Property COMPUTERNAME_MSG As String
+ Get
+ Return EgtMsg(61706)
+ End Get
+ End Property
+
+ Public ReadOnly Property USER_MSG As String
+ Get
+ Return EgtMsg(61707)
+ End Get
+ End Property
+
+ Public ReadOnly Property SRCFILE_MSG As String
+ Get
+ Return EgtMsg(61708)
+ End Get
+ End Property
+
+ Public ReadOnly Property EXPFILE_MSG As String
+ Get
+ Return EgtMsg(61709)
+ End Get
+ End Property
+
+ Public ReadOnly Property RECESS_MSG As String
+ Get
+ Return EgtMsg(61643)
+ End Get
+ End Property
+
+ Public ReadOnly Property USERATTRIBUTE_MSG As String
+ Get
+ Return EgtMsg(61648)
+ End Get
+ End Property
+
+#End Region ' Messages
+
+#Region "FIELDS & PROPERTIES"
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "Ok"
+
+ Public ReadOnly Property Ok_Command As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ Public Sub Ok()
+ ''verifico che tutti i campi contengano un valore valido
+ 'If Not IsNothing(m_dL) AndAlso m_dL > 0 AndAlso
+ ' Not IsNothing(m_dW) AndAlso m_dW >= 0 AndAlso
+ ' Not IsNothing(m_dH) AndAlso m_dH >= 0 Then
+ RaiseEvent m_CloseWindow(True)
+ 'Else
+ ' MessageBox.Show("Errore! Impossibile creare una feature con questi parametri", "Errore")
+ 'End If
+ End Sub
+
+#End Region ' Ok
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructure.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructure.vb
new file mode 100644
index 00000000..24ac4224
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructure.vb
@@ -0,0 +1,2817 @@
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+Imports EgtWPFLib5
+Imports EgtBEAMWALL.Core
+
+Public Class BTLStructure
+ Inherits Core.BTLStructure
+
+ Dim m_bOldEnMod As Boolean = False
+ Dim m_nBTLInfoId As Integer = 0
+
+ ' pezzi da BTL
+ Private m_PartList_View As CollectionView
+
+ Public Overrides Property SelPart As Core.BTLPart
+ Get
+ Return m_SelPart
+ End Get
+ Set(value As Core.BTLPart)
+ m_SelPart = value
+ ' se seleziono un pezzo
+ If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(m_SelPart) Then
+ ' se modalità building, la tolgo
+ If Map.refShowBeamPanelVM.ShowBuilding_IsChecked Then
+ ShowBuilding(False)
+ Map.refShowBeamPanelVM.SetShowBuilding(False)
+ End If
+ ' deseleziono tutto
+ EgtDeselectAll()
+ ' disabilito impostazione modificato
+ DisableModified()
+ ' ciclo sui pezzi
+ For Each Part As BTLPart In m_PartList
+ ' se non è quello selezionato, lo nasondo
+ If Not Part Is SelPart Then
+ EgtSetMode(Part.nPartId, GDB_MD.HIDDEN)
+ Else
+ EgtSetMode(Part.nPartId, GDB_MD.STD)
+ End If
+ Next
+ ' ripristino precedente impostazione modificato
+ EnableModified()
+ ' seleziono pezzo in Db geometrico
+ EgtBeamSetPart(m_SelPart.nPartId)
+ ' seleziono pagina BottomPanel
+ Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.PART)
+ ' deseleziono le feature
+ If Not IsNothing(m_SelPart.SelFeature) Then SelPart.SelFeature = Nothing
+ ' aggiorno stato selezionato tutto
+ Map.refShowBeamPanelVM.bShowAll = False
+ ' aggiorno vista
+ EgtSetView(VT.ISO_SW, False)
+ EgtZoom(ZM.ALL)
+ End If
+ NotifyPropertyChanged("SelPart")
+ End Set
+ End Property
+
+ ' lista parametri per ricerca testuale
+ Private m_SearchParamList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(BTLPartParam.NULL, ""),
+ New IdNameStruct(BTLPartParam.PDN, "PDN"),
+ New IdNameStruct(BTLPartParam.NAM, "Descrizione"),
+ New IdNameStruct(BTLPartParam.GRP, "Gruppo")})
+ Public ReadOnly Property SearchParamList As ObservableCollection(Of IdNameStruct)
+ Get
+ Return m_SearchParamList
+ End Get
+ End Property
+
+ Private m_SelSearchParam As IdNameStruct = m_SearchParamList(0)
+ Public Property SelSearchParam As IdNameStruct
+ Get
+ Return m_SelSearchParam
+ End Get
+ Set(value As IdNameStruct)
+ m_SelSearchParam = value
+ End Set
+ End Property
+
+ ' lista dei materiali utilizzati
+ Private m_MaterialList_View As CollectionView
+ Private m_MaterialList As New ObservableCollection(Of String)({""})
+ Public Property MaterialList As ObservableCollection(Of String)
+ Get
+ Return m_MaterialList
+ End Get
+ Set(value As ObservableCollection(Of String))
+ m_MaterialList = value
+ End Set
+ End Property
+
+ Private m_SelMaterial As String = ""
+ Public Property SelMaterial As String
+ Get
+ Return m_SelMaterial
+ End Get
+ Set(value As String)
+ m_SelMaterial = value
+ m_PartList_View.Refresh()
+ m_SectionList_View.Refresh()
+ End Set
+ End Property
+
+ ' lista delle sezioni utilizzate
+ Private m_SectionList_View As CollectionView
+ Private m_SectionList As New ObservableCollection(Of SectionXMaterial)({SectionXMaterial.Empty})
+ Public Property SectionList As ObservableCollection(Of SectionXMaterial)
+ Get
+ Return m_SectionList
+ End Get
+ Set(value As ObservableCollection(Of SectionXMaterial))
+ m_SectionList = value
+ End Set
+ End Property
+
+ Private m_SelSection As SectionXMaterial = SectionXMaterial.Empty
+ Public Property SelSection As SectionXMaterial
+ Get
+ Return m_SelSection
+ End Get
+ Set(value As SectionXMaterial)
+ m_SelSection = value
+ m_PartList_View.Refresh()
+ m_MaterialList_View.Refresh()
+ End Set
+ End Property
+
+ Private m_SearchText As String = ""
+ Public Property SearchText As String
+ Get
+ Return m_SearchText
+ End Get
+ Set(value As String)
+ m_SearchText = value
+ m_PartList_View.Refresh()
+ m_MaterialList_View.Refresh()
+ m_SectionList_View.Refresh()
+ End Set
+ End Property
+
+#Region "Parametri generici"
+
+ Public Overrides Property sPROJNUM As String
+ Get
+ Return m_sPROJNUM
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_PROJNUM, value) Then
+ m_sPROJNUM = value
+ Else
+ NotifyPropertyChanged("sPROJNUM")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sPROJNAME As String
+ Get
+ Return m_sPROJNAME
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_PROJNAME, value) Then
+ m_sPROJNAME = value
+ Else
+ NotifyPropertyChanged("sPROJNAME")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sPROJPART As String
+ Get
+ Return m_sPROJPART
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_PROJPART, value) Then
+ m_sPROJPART = value
+ Else
+ NotifyPropertyChanged("sPROJPART")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sPROJGUID As String
+ Get
+ Return m_sPROJGUID
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_PROJGUID, value) Then
+ m_sPROJGUID = value
+ Else
+ NotifyPropertyChanged("sPROJGUID")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sLISTNAME As String
+ Get
+ Return m_sLISTNAME
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_LISTNAME, value) Then
+ m_sLISTNAME = value
+ Else
+ NotifyPropertyChanged("sLISTNAME")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sCUSTOMER As String
+ Get
+ Return m_sCUSTOMER
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_CUSTOMER, value) Then
+ m_sCUSTOMER = value
+ Else
+ NotifyPropertyChanged("sCUSTOMER")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sARCHITECT As String
+ Get
+ Return m_sARCHITECT
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_ARCHITECT, value) Then
+ m_sARCHITECT = value
+ Else
+ NotifyPropertyChanged("sARCHITECT")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sEDITOR As String
+ Get
+ Return m_sEDITOR
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_EDITOR, value) Then
+ m_sEDITOR = value
+ Else
+ NotifyPropertyChanged("sEDITOR")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sDELIVDATE As String
+ Get
+ Return m_sDELIVDATE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_DELIVDATE, value) Then
+ m_sDELIVDATE = value
+ Else
+ NotifyPropertyChanged("sDELIVDATE")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sEXPDATE As String
+ Get
+ Return m_sEXPDATE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_EXPDATE, value) Then
+ m_sEXPDATE = value
+ Else
+ NotifyPropertyChanged("sEXPDATE")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sEXPTIME As String
+ Get
+ Return m_sEXPTIME
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_EXPTIME, value) Then
+ m_sEXPTIME = value
+ Else
+ NotifyPropertyChanged("sEXPTIME")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sEXPRELEASE As String
+ Get
+ Return m_sEXPRELEASE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_EXPRELEASE, value) Then
+ m_sEXPRELEASE = value
+ Else
+ NotifyPropertyChanged("sEXPRELEASE")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sLANGUAGE As String
+ Get
+ Return m_sLANGUAGE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_LANGUAGE, value) Then
+ m_sLANGUAGE = value
+ Else
+ NotifyPropertyChanged("sLANGUAGE")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property SelRANGE As Integer
+ Get
+ Return m_SelRANGE
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocRANGE)
+ Dim sValue As String = [Enum].GetName(GetType(Range), nValue)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_RANGE, sValue) Then
+ m_SelRANGE = value
+ Else
+ NotifyPropertyChanged("SelRANGE")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property SelPROCESSINGQUALITY As Integer
+ Get
+ Return m_SelPROCESSINGQUALITY
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocPROCESSINGQUALITY)
+ Dim sValue As String = [Enum].GetName(GetType(ProcessingQuality), nValue)
+ If EgtSetInfo(m_nBTLInfoId, BTL_PRT_PROCESSINGQUALITY, sValue) Then
+ m_SelPROCESSINGQUALITY = value
+ Else
+ NotifyPropertyChanged("SelPROCESSINGQUALITY")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sCOMPUTERNAME As String
+ Get
+ Return m_sCOMPUTERNAME
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_COMPUTERNAME, value) Then
+ m_sCOMPUTERNAME = value
+ Else
+ NotifyPropertyChanged("sCOMPUTERNAME")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sUSER As String
+ Get
+ Return m_sUSER
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_USER, value) Then
+ m_sUSER = value
+ Else
+ NotifyPropertyChanged("sUSER")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sSRCFILE As String
+ Get
+ Return m_sSRCFILE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_SRCFILE, value) Then
+ m_sSRCFILE = value
+ Else
+ NotifyPropertyChanged("sSRCFILE")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sEXPFILE As String
+ Get
+ Return m_sEXPFILE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_EXPFILE, value) Then
+ m_sEXPFILE = value
+ Else
+ NotifyPropertyChanged("sEXPFILE")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property SelRECESS As Integer
+ Get
+ Return m_SelRECESS
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocRECESS)
+ Dim sValue As String = [Enum].GetName(GetType(Recess), nValue)
+ If EgtSetInfo(m_nBTLInfoId, BTL_PRT_RECESS, sValue) Then
+ m_SelRECESS = value
+ Else
+ NotifyPropertyChanged("SelRECESS")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sUSERATTRIBUTE As String
+ Get
+ Return m_sUSERATTRIBUTE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nBTLInfoId, BTL_GEN_USERATTRIBUTE, value) Then
+ m_sUSERATTRIBUTE = value
+ Else
+ NotifyPropertyChanged("sUSERATTRIBUTE")
+ End If
+ End Set
+ End Property
+
+#End Region ' Parametri generici
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ m_PartList_View = CollectionViewSource.GetDefaultView(m_PartList)
+ m_MaterialList_View = CollectionViewSource.GetDefaultView(m_MaterialList)
+ m_SectionList_View = CollectionViewSource.GetDefaultView(m_SectionList)
+ m_PartList_View.Filter = AddressOf PartFilter
+ m_MaterialList_View.Filter = AddressOf MaterialFilter
+ m_SectionList_View.Filter = AddressOf SectionFilter
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Public Shared Function Init() As BTLStructure
+ Dim NewBTLStructure As New BTLStructure
+ Dim sValue As String = String.Empty
+ NewBTLStructure.m_nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNUM, NewBTLStructure.m_sPROJNUM)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNAME, NewBTLStructure.m_sPROJNAME)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJPART, NewBTLStructure.m_sPROJPART)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJGUID, NewBTLStructure.m_sPROJGUID)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_LISTNAME, NewBTLStructure.m_sLISTNAME)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_CUSTOMER, NewBTLStructure.m_sCUSTOMER)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_ARCHITECT, NewBTLStructure.m_sARCHITECT)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_EDITOR, NewBTLStructure.m_sEDITOR)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_DELIVDATE, NewBTLStructure.m_sDELIVDATE)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_EXPDATE, NewBTLStructure.m_sEXPDATE)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_EXPTIME, NewBTLStructure.m_sEXPTIME)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_EXPRELEASE, NewBTLStructure.m_sEXPRELEASE)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_LANGUAGE, NewBTLStructure.m_sLANGUAGE)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_RANGE, sValue)
+ NewBTLStructure.m_SelRANGE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, NewBTLStructure.ocRANGE), NewBTLStructure.ocRANGE)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_PRT_PROCESSINGQUALITY, sValue)
+ NewBTLStructure.m_SelPROCESSINGQUALITY = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, NewBTLStructure.ocPROCESSINGQUALITY), NewBTLStructure.ocPROCESSINGQUALITY)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_COMPUTERNAME, NewBTLStructure.m_sCOMPUTERNAME)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_USER, NewBTLStructure.m_sUSER)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_SRCFILE, NewBTLStructure.m_sSRCFILE)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_EXPFILE, NewBTLStructure.m_sEXPFILE)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_PRT_RECESS, sValue)
+ NewBTLStructure.m_SelRECESS = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, NewBTLStructure.ocRECESS), NewBTLStructure.ocRECESS)
+ EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_USERATTRIBUTE, NewBTLStructure.m_sUSERATTRIBUTE)
+ ' recupero i part
+ Dim nPartId As Integer = EgtGetFirstPart()
+ While nPartId <> GDB_ID.NULL
+ NewBTLStructure.m_PartList.Add(New BTLPart(NewBTLStructure, nPartId))
+ nPartId = EgtGetNextPart(nPartId)
+ End While
+ Return NewBTLStructure
+ End Function
+
+ Private Sub DisableModified()
+ m_bOldEnMod = EgtGetEnableModified()
+ If m_bOldEnMod Then EgtDisableModified()
+ End Sub
+
+ Private Sub EnableModified()
+ If m_bOldEnMod Then EgtEnableModified()
+ End Sub
+
+ Friend Sub ShowAll(Optional bRedraw As Boolean = True)
+ ' disabilito impostazione modificato
+ DisableModified()
+ If Not IsNothing(SelPart) Then
+ ' se pezzo solido, lo riporto normale
+ If Map.refShowBeamPanelVM.ShowSolid_IsChecked Then
+ ShowSolid(False)
+ Map.refShowBeamPanelVM.SetShowSolid(False)
+ End If
+ ' tolgo pezzo selezionato
+ SelPart.SelFeature = Nothing
+ End If
+ SelPart = Nothing
+ ' mostro tutti i pezzi
+ For Each Part As BTLPart In m_PartList
+ Dim nMode As Integer
+ EgtGetMode(Part.nPartId, nMode)
+ If nMode <> GDB_MD.STD Then
+ EgtSetMode(Part.nPartId, GDB_MD.STD)
+ End If
+ Next
+ ' ripristino precedente impostazione modificato
+ EnableModified()
+ EgtSetView(VT.ISO_SW, False)
+ EgtZoom(ZM.ALL, bRedraw)
+ ' imposto stato per ShowBeamPanel
+ Map.refShowBeamPanelVM.bShowAll = True
+ End Sub
+
+ Friend Sub ShowBuilding(Optional bRedraw As Boolean = True)
+ ' disabilito impostazione modificato
+ DisableModified()
+ ' tolgo pezzo selezionato
+ If Not IsNothing(SelPart) Then SelPart.SelFeature = Nothing
+ SelPart = Nothing
+ ' recupero il gruppo di assemblaggio
+ Dim AsseBaseId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, "AsseBase")
+ If IsNothing(AsseBaseId) Then Return
+
+ ' recupero il primo oggetto nel gruppo e verifico se devo assemblare o disassemblare
+ Dim AsseId As Integer = EgtGetFirstInGroup(AsseBaseId)
+ If IsNothing(AsseId) Then Return
+ Dim bMake As Boolean = (EgtGetGroupObjs(AsseId) = 0)
+
+ ' ciclo sul gruppo di assemblaggio
+ While AsseId <> GDB_ID.NULL
+ ' salvo il successivo nel gruppo dell'assemblato
+ Dim NextId As Integer = EgtGetNext(AsseId)
+ ' costruisco l'assemblato
+ If bMake Then
+ ' recupero il pezzo sorgente
+ Dim SouId As Integer
+ If EgtGetInfo(AsseId, GDB_SI_SOURCE, SouId) Then
+ EgtSetMode(SouId, GDB_MD.STD)
+ EgtSetStatus(SouId, GDB_ST.ON_)
+ ' se già utilizzato, ne faccio una copia
+ If Not EgtIsPart(SouId) Then
+ Dim CopyId As Integer = EgtCopy(SouId, GDB_ID.ROOT)
+ If CopyId <> GDB_ID.NULL Then
+ EgtRemoveInfo(CopyId, GDB_SI_BASE)
+ EgtRemoveInfo(CopyId, GDB_SI_LIST)
+ EgtSetInfo(CopyId, GDB_SI_COPY, SouId)
+ SouId = CopyId
+ EgtSetInfo(AsseId, GDB_SI_SOURCE, SouId)
+ End If
+ End If
+ EgtSetStatus(EgtGetFirstNameInGroup(SouId, "Box"), GDB_ST.OFF)
+ EgtGroupSwap(SouId, AsseId, True, True)
+ End If
+ ' ritorno ai pezzi
+ Else
+ Dim BasId As Integer
+ If EgtGetInfo(AsseId, GDB_SI_BASE, BasId) Then
+ EgtGroupSwap(AsseId, BasId, True, True)
+ Dim CopId As Integer
+ If EgtGetInfo(AsseId, GDB_SI_COPY, CopId) Then
+ EgtErase(AsseId)
+ EgtSetInfo(BasId, GDB_SI_SOURCE, CopId)
+ Else
+ EgtSetStatus(EgtGetFirstNameInGroup(AsseId, "Box"), GDB_ST.ON_)
+ End If
+ End If
+ End If
+ ' passo al successivo
+ AsseId = NextId
+ End While
+ ' ripristino precedente impostazione modificato
+ EnableModified()
+ EgtSetView(VT.ISO_SW, False)
+ EgtZoom(ZM.ALL, bRedraw)
+ End Sub
+
+ Friend Sub ShowSolid(Optional bRedraw As Boolean = True)
+ ' disabilito impostazione modificato
+ DisableModified()
+ ' Recupero il pezzo del primo oggetto selezionato
+ Dim nPartId As Integer = If(Not IsNothing(SelPart), SelPart.nPartId, GDB_ID.NULL)
+ If nPartId = GDB_ID.NULL Or Not EgtIsPart(nPartId) Then
+ Map.refMyStatusBarVM.SetOutputMessage("ERROR: Nessuna trave selezionata ", 5, MSG_TYPE.ERROR_)
+ Return
+ End If
+ EgtDeselectAll()
+
+ Dim nSolId As Integer = EgtBeamGetSolid(nPartId)
+ If nSolId = GDB_ID.NULL OrElse Not EgtExistsInfo(nSolId, "VALID") Then
+ EgtBeamCalcSolid(nPartId)
+ EgtBeamShowSolid(nPartId, True)
+ Else
+ Dim nStat As Integer
+ EgtGetStatus(EgtGetParent(nSolId), nStat)
+ EgtBeamShowSolid(nPartId, (nStat = GDB_ST.OFF))
+ End If
+
+ If bRedraw Then EgtDraw()
+ ' ripristino precedente impostazione modificato
+ EnableModified()
+ End Sub
+
+ ' Funzione per regolarizzare, se necessario, la superficie della feature
+ Private Function RegularizeTriMesh(SurfId As Integer, DestGrpId As Integer, dStep As Double) As Integer
+ ' solo per superfici trimesh con poche facce (max4)
+ Dim nFacetCnt As Integer = EgtSurfTmFacetCount(SurfId)
+ If nFacetCnt > 4 Then
+ Return SurfId
+ End If
+ ' box della superficie
+ Dim b3Surf As New BBox3d
+ EgtGetBBox(SurfId, GDB_BB.STANDARD, b3Surf)
+ If b3Surf.IsEmpty() Or b3Surf.DimX() < 2 * dStep Then
+ Return SurfId
+ End If
+ ' recupero le facce e le divido in X
+ Dim dXmin As Double = b3Surf.Min().x - 1
+ Dim dXmax As Double = b3Surf.Max().x + 1
+ Dim nStep As Integer = CInt(Math.Floor((dXmax - dXmin) / dStep + 0.9))
+ dStep = (dXmax - dXmin) / nStep
+ Dim NewSurfId As Integer = GDB_ID.NULL
+ For nF = 0 To nFacetCnt - 1
+ Dim FacId As Integer = EgtCopySurfTmFacet(SurfId, nF, DestGrpId)
+ Dim b3Fac As New BBox3d
+ EgtGetBBox(FacId, GDB_BB.STANDARD, b3Fac)
+ Dim dX2 As Double = dXmin
+ For nI = 1 To nStep
+ Dim dX1 As Double = dX2
+ dX2 = dX2 + dStep
+ If b3Fac.Min().x < dX2 And b3Fac.Max().x > dX1 Then
+ EgtCutSurfTmPlane(FacId, New Point3d(dX1, 0, 0), -Vector3d.X_AX, True)
+ EgtCutSurfTmPlane(FacId, New Point3d(dX2, 0, 0), Vector3d.X_AX, False)
+ Dim nCount As Integer = 0
+ Dim LoopId As Integer = EgtExtractSurfTmFacetLoops(FacId, 0, DestGrpId, nCount)
+ EgtMergeCurvesInCurveCompo(LoopId, 0.001)
+ Dim TmpSurfId As Integer = EgtCreateSurfTmByFlatContour(DestGrpId, LoopId, 0.01)
+ EgtErase(LoopId)
+ If NewSurfId <> GDB_ID.NULL Then
+ NewSurfId = EgtCreateSurfTmBySewing(DestGrpId, 2, {NewSurfId, TmpSurfId}, True)
+ Else
+ NewSurfId = TmpSurfId
+ End If
+ EgtErase(FacId)
+ FacId = EgtCopySurfTmFacet(SurfId, nF, DestGrpId)
+ End If
+ Next
+ EgtErase(FacId)
+ Next
+ Return NewSurfId
+ End Function
+
+ Private Function PartFilter(Part As Object) As Boolean
+ Dim CurrBTLPart As BTLPart = DirectCast(Part, BTLPart)
+ Dim bMaterialOk As Boolean = True
+ Dim bSectionOk As Boolean = True
+ Dim bSearchTextOk As Boolean = True
+ If SelMaterial <> "" AndAlso CurrBTLPart.sMATERIAL <> SelMaterial Then bMaterialOk = False
+ If SelSection <> SectionXMaterial.Empty AndAlso CurrBTLPart.Section <> SelSection Then bSectionOk = False
+ 'If SearchText <> "" AndAlso CurrBTLPart.sNAM.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0 Then bSectionOk = False
+ If m_SelSearchParam.Id <> BTLPartParam.NULL AndAlso m_SearchText <> String.Empty AndAlso (
+ (m_SelSearchParam.Id = BTLPartParam.PDN AndAlso CurrBTLPart.nPDN.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
+ (m_SelSearchParam.Id = BTLPartParam.NAM AndAlso CurrBTLPart.sNAM.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
+ (m_SelSearchParam.Id = BTLPartParam.GRP AndAlso (IsNothing(CurrBTLPart.sGRP) OrElse CurrBTLPart.sGRP.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase)) < 0)) Then bSectionOk = False
+ Return (bMaterialOk AndAlso bSectionOk)
+ End Function
+
+ Private Function MaterialFilter(Material As Object) As Boolean
+ Dim CurrMaterial As String = DirectCast(Material, String)
+ Dim bOk As Boolean = True
+ If SelSection <> SectionXMaterial.Empty AndAlso SearchText <> "" AndAlso CurrMaterial <> "" Then
+ bOk = m_PartList.Any(Function(x) x.sMATERIAL = CurrMaterial AndAlso x.Section = SelSection AndAlso Not x.sNAM.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0)
+ End If
+ Return bOk
+ End Function
+
+ Private Function SectionFilter(Section As Object) As Boolean
+ Dim CurrSection As SectionXMaterial = DirectCast(Section, SectionXMaterial)
+ Dim bOk As Boolean = True
+ If SelMaterial <> "" AndAlso SearchText <> "" AndAlso CurrSection <> Section.Empty Then
+ bOk = m_PartList.Any(Function(x) x.sMATERIAL = SelMaterial AndAlso x.Section = CurrSection AndAlso Not x.sNAM.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0)
+ End If
+ Return bOk
+ End Function
+
+ Friend Sub UpdateSectionFromRotation(Part As BTLPart)
+ If IsNothing(PartList) Then Return
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ ' verifico se era unico con vecchia sezione
+ If Not PartList.Any(Function(x) x.dH = Part.dW AndAlso x.dW = Part.dH AndAlso x.sMATERIAL = Part.sMATERIAL) Then
+ ' nel caso lo cerco ed elimino
+ For nIndex = 0 To m_SectionList.Count - 1
+ Dim CurrSection As SectionXMaterial = m_SectionList(nIndex)
+ If CurrSection.dH = Part.dW AndAlso CurrSection.dW = Part.dH AndAlso If(CurrSection.sMaterial.Count > 0, CurrSection.sMaterial(0), String.Empty) = Part.sMATERIAL Then
+ m_SectionList.RemoveAt(nIndex)
+ Exit For
+ End If
+ Next
+ End If
+ ' verifico se esiste già nuova sezione
+ If Not m_SectionList.Any(Function(x) x.dH = Part.dH AndAlso x.dW = Part.dW AndAlso If(x.sMaterial.Count > 0, x.sMaterial(0), String.Empty) = Part.sMATERIAL) Then
+ m_SectionList.Add(Part.Section)
+ End If
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ ' se ruoto o inverto parete, la sezione non cambia
+ End If
+ End Sub
+
+#End Region ' METHODS
+
+End Class
+
+Public Class BTLPart
+ ' Inherits VMBase
+ Inherits Core.BTLPart
+
+#Region "FIELDS & PROPERTIES"
+
+ Public Property sL As String
+ Get
+ Return LenToString(m_dL, 3)
+ End Get
+ Set(value As String)
+ Dim dTempL As Double
+ If StringToLen(value, dTempL) Then
+ ' verifico se ci sono già copie in grezzi
+ Dim nDuploCount As Integer = 0
+ If EgtDuploCount(m_nPartId, nDuploCount) AndAlso nDuploCount > 0 Then
+ ' se modalità travi e trave
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM OrElse
+ Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ If dTempL > m_dL Then
+ ' avviso che tutti i pezzi verranno tolti dai grezzi e chiedo di confermare
+ If MessageBox.Show("La modifica di questo parametro comporta la rimozione del pezzo da " & nDuploCount & " grezzi. Procedere comunque?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
+ MyMachGroupPanelVM.DuploSetToDelete(m_nPartId)
+ Else
+ ' reimposto vecchio valore
+ NotifyPropertyChanged("sL")
+ Return
+ End If
+ End If
+ End If
+ End If
+ If EgtBeamSetPartBox(dTempL, dH, dW) Then
+ ' imposto modificato per copie
+ EgtDuploSetModified(nPartId)
+ EgtDraw()
+ m_dL = dTempL
+ End If
+ Else
+ NotifyPropertyChanged("sL")
+ End If
+ End Set
+ End Property
+
+ Public Property sW As String
+ Get
+ Return LenToString(m_dW, 3)
+ End Get
+ Set(value As String)
+ Dim dTempW As Double
+ If StringToLen(value, dTempW) AndAlso EgtBeamSetPartBox(dL, dH, dTempW) Then
+ EgtDraw()
+ m_dW = dTempW
+ Else
+ NotifyPropertyChanged("sW")
+ End If
+ End Set
+ End Property
+
+ Public Property sH As String
+ Get
+ Return LenToString(m_dH, 3)
+ End Get
+ Set(value As String)
+ Dim dTempH As Double
+ If StringToLen(value, dTempH) AndAlso EgtBeamSetPartBox(dL, dTempH, dW) Then
+ EgtDraw()
+ m_dH = dTempH
+ Else
+ NotifyPropertyChanged("sH")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property bDO As Boolean
+ Get
+ Return m_bDO
+ End Get
+ Set(value As Boolean)
+ m_bDO = value
+ EgtSetInfo(nPartId, BTL_PRT_DO, If(value, 1, 0))
+ NotifyPropertyChanged("Calc_BorderBrush")
+ End Set
+ End Property
+
+ Public Overrides Property sNAM As String
+ Get
+ Return m_sNAM
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_NAM, value) Then
+ m_sNAM = value
+ Else
+ NotifyPropertyChanged("sNAM")
+ End If
+ End Set
+ End Property
+
+#Region "Parametri pezzo"
+
+ Protected m_nSINGLEMEMBERNUM As Integer
+ Public Property nSINGLEMEMBERNUM As Integer
+ Get
+ Return m_nSINGLEMEMBERNUM
+ End Get
+ Set(value As Integer)
+ If EgtSetInfo(m_nPartId, BTL_PRT_SINGLEMEMBERNUM, value) Then
+ m_nSINGLEMEMBERNUM = value
+ Else
+ NotifyPropertyChanged("nSINGLEMEMBERNUM")
+ End If
+ End Set
+ End Property
+
+ Protected m_sASSEMBLYNUM As String
+ Public Property sASSEMBLYNUM As String
+ Get
+ Return m_sASSEMBLYNUM
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_ASSEMBLYNUM, value) Then
+ m_sASSEMBLYNUM = value
+ Else
+ NotifyPropertyChanged("sASSEMBLYNUM")
+ End If
+ End Set
+ End Property
+
+ Protected m_nORDERNUM As Integer
+ Public Property nORDERNUM As Integer
+ Get
+ Return m_nORDERNUM
+ End Get
+ Set(value As Integer)
+ If EgtSetInfo(m_nPartId, BTL_PRT_ORDERNUM, value) Then
+ m_nORDERNUM = value
+ Else
+ NotifyPropertyChanged("nORDERNUM")
+ End If
+ End Set
+ End Property
+
+ Protected m_sDESIGN As String
+ Public Property sDESIGN As String
+ Get
+ Return m_sDESIGN
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_DESIGNATION, value) Then
+ m_sDESIGN = value
+ Else
+ NotifyPropertyChanged("sDESIGN")
+ End If
+ End Set
+ End Property
+
+ Protected m_sANNOT As String
+ Public Property sANNOT As String
+ Get
+ Return m_sANNOT
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_ANNOTATION, value) Then
+ m_sANNOT = value
+ Else
+ NotifyPropertyChanged("sANNOT")
+ End If
+ End Set
+ End Property
+
+ Protected m_sSTOREY As String
+ Public Property sSTOREY As String
+ Get
+ Return m_sSTOREY
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_STOREY, value) Then
+ m_sSTOREY = value
+ Else
+ NotifyPropertyChanged("sSTOREY")
+ End If
+ End Set
+ End Property
+
+ Protected m_sGROUP As String
+ Public Property sGROUP As String
+ Get
+ Return m_sGROUP
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_GROUP, value) Then
+ m_sGROUP = value
+ Else
+ NotifyPropertyChanged("sGROUP")
+ End If
+ End Set
+ End Property
+
+ Protected m_sPACKAGE As String
+ Public Property sPACKAGE As String
+ Get
+ Return m_sPACKAGE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_PACKAGE, value) Then
+ m_sPACKAGE = value
+ Else
+ NotifyPropertyChanged("sPACKAGE")
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property sMATERIAL As String
+ Get
+ Return m_sMATERIAL
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_MATERIAL, value) Then
+ m_sMATERIAL = value
+ Else
+ NotifyPropertyChanged("sMATERIAL")
+ End If
+ End Set
+ End Property
+
+ Protected m_sTIMBERGRADE As String
+ Public Property sTIMBERGRADE As String
+ Get
+ Return m_sTIMBERGRADE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_TIMBERGRADE, value) Then
+ m_sTIMBERGRADE = value
+ Else
+ NotifyPropertyChanged("sTIMBERGRADE")
+ End If
+ End Set
+ End Property
+
+ Protected m_sQUALITYGRADE As String
+ Public Property sQUALITYGRADE As String
+ Get
+ Return m_sQUALITYGRADE
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_QUALITYGRADE, value) Then
+ m_sQUALITYGRADE = value
+ Else
+ NotifyPropertyChanged("sQUALITYGRADE")
+ End If
+ End Set
+ End Property
+
+ Public ReadOnly Property PartColour As Brush
+ Get
+ Return New SolidColorBrush(Color.FromArgb(m_colCOLOR.ToColor().A,
+ CByte(m_colCOLOR.R),
+ CByte(m_colCOLOR.G),
+ CByte(m_colCOLOR.B)))
+ End Get
+ End Property
+
+ Protected m_colCOLOR As Color3d
+ Public Property sCOLRGB As String
+ Get
+ Return m_colCOLOR.R & "," &
+ m_colCOLOR.G & "," &
+ m_colCOLOR.B & "," &
+ nCOLA
+ End Get
+ Set(value As String)
+ Dim sValArray() As String = value.Split(",")
+ If sValArray.Count() >= 4 Then
+ m_colCOLOR.R = Color3d.Clamp(sValArray(0), 0, 255)
+ m_colCOLOR.G = Color3d.Clamp(sValArray(1), 0, 255)
+ m_colCOLOR.B = Color3d.Clamp(sValArray(2), 0, 255)
+ m_colCOLOR.A = Color3d.Clamp(nCOLA, 0, 100)
+ EgtSetInfo(m_nPartId, BTL_PRT_COLOUR, m_colCOLOR.ToString())
+ Else
+ NotifyPropertyChanged("sCOLRGB")
+ End If
+ End Set
+ End Property
+
+ Public Property nCOLA As Integer
+ Get
+ Return m_colCOLOR.A
+ End Get
+ Set(value As Integer)
+ If m_colCOLOR.A <> value Then
+ m_colCOLOR.A = Color3d.Clamp(value, 0, 100)
+ EgtSetInfo(m_nPartId, BTL_PRT_COLOUR, m_colCOLOR.ToString())
+ NotifyPropertyChanged("nCOLA")
+ NotifyPropertyChanged("PartColour")
+ End If
+ End Set
+ End Property
+
+ Protected m_dPLANINGLEN As Double
+ Public Property dPLANINGLEN As String
+ Get
+ Return LenToString(m_dPLANINGLEN, 3)
+ End Get
+ Set(value As String)
+ Dim dTempPlaningLen As Double
+ If StringToLen(value, dTempPlaningLen) AndAlso EgtSetInfo(m_nPartId, BTL_PRT_PLANINGLENGTH, dTempPlaningLen) Then
+ m_dPLANINGLEN = dTempPlaningLen
+ Else
+ NotifyPropertyChanged("dPLANINGLEN")
+ End If
+ End Set
+ End Property
+
+ Protected m_dSTARTOFFSET As Double
+ Public Property dSTARTOFFSET As String
+ Get
+ Return LenToString(m_dSTARTOFFSET, 3)
+ End Get
+ Set(value As String)
+ Dim dTempStartOffset As Double
+ If StringToLen(value, dTempStartOffset) AndAlso EgtSetInfo(m_nPartId, BTL_PRT_STARTOFFSET, dTempStartOffset) Then
+ m_dSTARTOFFSET = dTempStartOffset
+ Else
+ NotifyPropertyChanged("dSTARTOFFSET")
+ End If
+ End Set
+ End Property
+
+ Protected m_dENDOFFSET As Double
+ Public Property dENDOFFSET As String
+ Get
+ Return LenToString(m_dENDOFFSET, 3)
+ End Get
+ Set(value As String)
+ Dim dTempEndOffset As Double
+ If StringToLen(value, dTempEndOffset) AndAlso EgtSetInfo(m_nPartId, BTL_PRT_ENDOFFSET, dTempEndOffset) Then
+ m_dENDOFFSET = dTempEndOffset
+ Else
+ NotifyPropertyChanged("dENDOFFSET")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocUID As New ObservableCollection(Of Integer)
+ Public ReadOnly Property ocUID As ObservableCollection(Of Integer)
+ Get
+ Return m_ocUID
+ End Get
+ End Property
+
+ Protected m_SelUID As Integer
+ Public Property SelUID As Integer
+ Get
+ Return m_SelUID
+ End Get
+ Set(value As Integer)
+ If m_SelUID <> value Then
+ m_refTransf = refTransfList(value)
+ m_SelUID = value
+ NotifyPropertyChanged("TransfOrig")
+ NotifyPropertyChanged("TransfVersX")
+ NotifyPropertyChanged("TransfVersY")
+ Else
+ NotifyPropertyChanged("SelUID")
+ End If
+ End Set
+ End Property
+
+ Protected refTransfList As New List(Of Frame3d)
+ Protected m_refTransf As Frame3d
+ Public Property TransfOrig As String
+ Get
+ If SelUID >= 0 AndAlso
+ SelUID < refTransfList.Count AndAlso
+ Not IsNothing(refTransfList(SelUID)) Then
+ Return LenToString(refTransfList(SelUID).Orig().x, 3) & "," &
+ LenToString(refTransfList(SelUID).Orig().y, 3) & "," &
+ LenToString(refTransfList(SelUID).Orig().z, 3)
+ Else
+ Return Nothing
+ End If
+ End Get
+ Set(value As String)
+ Dim sValArray() As String = value.Split(",")
+ Dim ptOri As New Point3d
+ If sValArray.Count() >= 3 AndAlso
+ StringToLen(sValArray(0), ptOri.x) AndAlso
+ StringToLen(sValArray(1), ptOri.y) AndAlso
+ StringToLen(sValArray(2), ptOri.z) AndAlso
+ m_refTransf.ChangeOrigin(ptOri) Then
+ EgtSetInfo(m_nPartId, BTL_PRT_TRANSFORMATION & (SelUID + 1), LenToString(m_refTransf.Orig.x, 3) & "," &
+ LenToString(m_refTransf.Orig.y, 3) & "," &
+ LenToString(m_refTransf.Orig.z, 3) & "," &
+ DoubleToString(m_refTransf.VersX.x, 6) & "," &
+ DoubleToString(m_refTransf.VersX.y, 6) & "," &
+ DoubleToString(m_refTransf.VersX.z, 6) & "," &
+ DoubleToString(m_refTransf.VersY.x, 6) & "," &
+ DoubleToString(m_refTransf.VersY.y, 6) & "," &
+ DoubleToString(m_refTransf.VersY.z, 6))
+ Else
+ NotifyPropertyChanged("TransfOrig")
+ End If
+ End Set
+ End Property
+ Public Property TransfVersX As String
+ Get
+ If SelUID >= 0 AndAlso
+ SelUID < refTransfList.Count AndAlso
+ Not IsNothing(refTransfList(SelUID)) Then
+ Return DoubleToString(refTransfList(SelUID).VersX().x, 6) & "," &
+ DoubleToString(refTransfList(SelUID).VersX().y, 6) & "," &
+ DoubleToString(refTransfList(SelUID).VersX().z, 6)
+ Else
+ Return Nothing
+ End If
+ End Get
+ Set(value As String)
+ Dim ptOri As New Point3d(m_refTransf.Orig())
+ Dim vtVersY As New Vector3d(m_refTransf.VersY())
+ Dim sValArray() As String = value.Split(",")
+ Dim vtVersX As New Vector3d
+ If sValArray.Count() >= 3 AndAlso
+ StringToDouble(sValArray(0), vtVersX.x) AndAlso
+ StringToDouble(sValArray(1), vtVersX.y) AndAlso
+ StringToDouble(sValArray(2), vtVersX.z) AndAlso
+ m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY) Then
+ EgtSetInfo(m_nPartId, BTL_PRT_TRANSFORMATION & (SelUID + 1), LenToString(m_refTransf.Orig.x, 3) & "," &
+ LenToString(m_refTransf.Orig.y, 3) & "," &
+ LenToString(m_refTransf.Orig.z, 3) & "," &
+ DoubleToString(m_refTransf.VersX.x, 6) & "," &
+ DoubleToString(m_refTransf.VersX.y, 6) & "," &
+ DoubleToString(m_refTransf.VersX.z, 6) & "," &
+ DoubleToString(m_refTransf.VersY.x, 6) & "," &
+ DoubleToString(m_refTransf.VersY.y, 6) & "," &
+ DoubleToString(m_refTransf.VersY.z, 6))
+ NotifyPropertyChanged("TransfVersX")
+ NotifyPropertyChanged("TransfVersY")
+ Else
+ NotifyPropertyChanged("TransfVersX")
+ End If
+ End Set
+ End Property
+ Public Property TransfVersY As String
+ Get
+ If SelUID >= 0 AndAlso
+ SelUID < refTransfList.Count AndAlso
+ Not IsNothing(refTransfList(SelUID)) Then
+ Return DoubleToString(refTransfList(SelUID).VersY().x, 6) & "," &
+ DoubleToString(refTransfList(SelUID).VersY().y, 6) & "," &
+ DoubleToString(refTransfList(SelUID).VersY().z, 6)
+ Else
+ Return Nothing
+ End If
+ End Get
+ Set(value As String)
+ Dim ptOri As New Point3d(m_refTransf.Orig())
+ Dim vtVersX As New Vector3d(m_refTransf.VersX())
+ Dim sValArray() As String = value.Split(",")
+ Dim vtVersY As New Vector3d
+ If sValArray.Count() >= 3 AndAlso
+ StringToDouble(sValArray(0), vtVersY.x) AndAlso
+ StringToDouble(sValArray(1), vtVersY.y) AndAlso
+ StringToDouble(sValArray(2), vtVersY.z) AndAlso
+ m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY) Then
+ EgtSetInfo(m_nPartId, BTL_PRT_TRANSFORMATION & (SelUID + 1), LenToString(m_refTransf.Orig.x, 3) & "," &
+ LenToString(m_refTransf.Orig.y, 3) & "," &
+ LenToString(m_refTransf.Orig.z, 3) & "," &
+ DoubleToString(m_refTransf.VersX.x, 6) & "," &
+ DoubleToString(m_refTransf.VersX.y, 6) & "," &
+ DoubleToString(m_refTransf.VersX.z, 6) & "," &
+ DoubleToString(m_refTransf.VersY.x, 6) & "," &
+ DoubleToString(m_refTransf.VersY.y, 6) & "," &
+ DoubleToString(m_refTransf.VersY.z, 6))
+ NotifyPropertyChanged("TransfVersX")
+ NotifyPropertyChanged("TransfVersY")
+ Else
+ NotifyPropertyChanged("TransfVersY")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocCAMBERSIDE As New ObservableCollection(Of Integer)({1, 2, 3, 4})
+ Public ReadOnly Property ocCAMBERSIDE As ObservableCollection(Of Integer)
+ Get
+ Return m_ocCAMBERSIDE
+ End Get
+ End Property
+
+ Protected m_SelCAMBERSIDE As Integer
+ Public Property SelCAMBERSIDE As Integer
+ Get
+ Return m_SelCAMBERSIDE
+ End Get
+ Set(value As Integer)
+ Dim sValArray() As String = CamberParams.Split(",")
+ If sValArray.Count() >= 4 AndAlso
+ StringToLen(sValArray(0), m_dCamberLen1) AndAlso
+ StringToLen(sValArray(1), m_dCamberLen2) AndAlso
+ StringToLen(sValArray(2), m_dCamberLen3) AndAlso
+ StringToLen(sValArray(3), m_dCamberCross3) AndAlso
+ EgtSetInfo(m_nPartId, BTL_PRT_CAMBER, "SIDE: " & (value + 1) &
+ " P01: " & sValArray(0) &
+ " P02: " & sValArray(1) &
+ " P03: " & sValArray(2) &
+ " P04: " & sValArray(3)) Then
+ m_SelCAMBERSIDE = value
+ Else
+ NotifyPropertyChanged("SelCAMBERSIDE")
+ End If
+ End Set
+ End Property
+
+ Protected m_dCamberLen1 As Double
+ Protected m_dCamberLen2 As Double
+ Protected m_dCamberLen3 As Double
+ Protected m_dCamberCross3 As Double
+ Public Property CamberParams As String
+ Get
+ Return LenToString(m_dCamberLen1, 3) & "," &
+ LenToString(m_dCamberLen2, 3) & "," &
+ LenToString(m_dCamberLen3, 3) & "," &
+ LenToString(m_dCamberCross3, 3)
+ End Get
+ Set(value As String)
+ Dim sValArray() As String = value.Split(",")
+ If sValArray.Count() >= 4 AndAlso
+ StringToLen(sValArray(0), m_dCamberLen1) AndAlso
+ StringToLen(sValArray(1), m_dCamberLen2) AndAlso
+ StringToLen(sValArray(2), m_dCamberLen3) AndAlso
+ StringToLen(sValArray(3), m_dCamberCross3) Then
+ EgtSetInfo(m_nPartId, BTL_PRT_CAMBER, " SIDE: " & (SelCAMBERSIDE + 1) &
+ " P01: " & sValArray(0) &
+ " P02: " & sValArray(1) &
+ " P03: " & sValArray(2) &
+ " P04: " & sValArray(3))
+ Else
+ NotifyPropertyChanged("CamberParams")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocREFSIDEFIXCLAMP As New ObservableCollection(Of Object)({New IdNameStruct(PartOffset_RefSideFixClamp.INACTIVE, EgtMsg(61665)),
+ New IdNameStruct(PartOffset_RefSideFixClamp.REFSIDE1, EgtMsg(61687)),
+ New IdNameStruct(PartOffset_RefSideFixClamp.REFSIDE2, EgtMsg(61688)),
+ New IdNameStruct(PartOffset_RefSideFixClamp.REFSIDE3, EgtMsg(61689)),
+ New IdNameStruct(PartOffset_RefSideFixClamp.REFSIDE4, EgtMsg(61690))})
+ Public ReadOnly Property ocREFSIDEFIXCLAMP As ObservableCollection(Of Object)
+ Get
+ Return m_ocREFSIDEFIXCLAMP
+ End Get
+ End Property
+
+ Protected m_SelREFSIDEFIXCLAMP As Integer
+ Public Property SelREFSIDEFIXCLAMP As Integer
+ Get
+ Return m_SelREFSIDEFIXCLAMP
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocREFSIDEFIXCLAMP)
+ Dim sValue As String = ocREFSIDEFIXCLAMP(nValue).Name '[Enum].GetName(GetType(PartOffset_RefSideFixClamp), nValue)
+
+ Dim sValArray() As String = PartOffsetParams.Split(",")
+ If sValArray.Count() >= 4 AndAlso
+ StringToLen(sValArray(0), m_dPartOffsetSide1) AndAlso
+ StringToLen(sValArray(1), m_dPartOffsetSide2) AndAlso
+ StringToLen(sValArray(2), m_dPartOffsetSide3) AndAlso
+ StringToLen(sValArray(3), m_dPartOffsetSide4) AndAlso
+ EgtSetInfo(m_nPartId, BTL_PRT_PARTOFFSET, " P04: " & sValue &
+ " P11: " & sValArray(0) &
+ " P12: " & sValArray(1) &
+ " P13: " & sValArray(2) &
+ " P14: " & sValArray(3)) Then
+ m_SelREFSIDEFIXCLAMP = value
+ Else
+ NotifyPropertyChanged("SelREFSIDEFIXCLAMP")
+ End If
+ End Set
+ End Property
+
+ Protected m_dPartOffsetSide1 As Double
+ Protected m_dPartOffsetSide2 As Double
+ Protected m_dPartOffsetSide3 As Double
+ Protected m_dPartOffsetSide4 As Double
+ Public Property PartOffsetParams As String
+ Get
+ Return LenToString(m_dPartOffsetSide1, 3) & "," &
+ LenToString(m_dPartOffsetSide2, 3) & "," &
+ LenToString(m_dPartOffsetSide3, 3) & "," &
+ LenToString(m_dPartOffsetSide4, 3)
+ End Get
+ Set(value As String)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(SelREFSIDEFIXCLAMP, ocREFSIDEFIXCLAMP)
+ Dim sValue As String = ocREFSIDEFIXCLAMP(nValue).Name '[Enum].GetName(GetType(PartOffset_RefSideFixClamp), nValue)
+
+ Dim sValArray() As String = value.Split(",")
+ If sValArray.Count() >= 4 AndAlso
+ StringToLen(sValArray(0), m_dPartOffsetSide1) AndAlso
+ StringToLen(sValArray(1), m_dPartOffsetSide2) AndAlso
+ StringToLen(sValArray(2), m_dPartOffsetSide3) AndAlso
+ StringToLen(sValArray(3), m_dPartOffsetSide4) Then
+ EgtSetInfo(m_nPartId, BTL_PRT_PARTOFFSET, " P04: " & sValue &
+ " P11: " & sValArray(0) &
+ " P12: " & sValArray(1) &
+ " P13: " & sValArray(2) &
+ " P14: " & sValArray(3))
+ Else
+ NotifyPropertyChanged("PartOffsetParams")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocPROCESSINGQUALITY As New ObservableCollection(Of Object)({New IdNameStruct(ProcessingQuality.AUTOMATIC, EgtMsg(61658)),
+ New IdNameStruct(ProcessingQuality.VISIBLE, EgtMsg(61659)),
+ New IdNameStruct(ProcessingQuality.FAST, EgtMsg(61660))})
+ Public ReadOnly Property ocPROCESSINGQUALITY As ObservableCollection(Of Object)
+ Get
+ Return m_ocPROCESSINGQUALITY
+ End Get
+ End Property
+
+ Protected m_SelPROCESSINGQUALITY As Integer
+ Public Property SelPROCESSINGQUALITY As Integer
+ Get
+ Return m_SelPROCESSINGQUALITY
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocPROCESSINGQUALITY)
+ Dim sValue As String = [Enum].GetName(GetType(ProcessingQuality), nValue)
+ If EgtSetInfo(m_nPartId, BTL_PRT_PROCESSINGQUALITY, sValue) Then
+ m_SelPROCESSINGQUALITY = value
+ Else
+ NotifyPropertyChanged("SelPROCESSINGQUALITY")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocRECESS As New ObservableCollection(Of Object)({New IdNameStruct(Recess.AUTOMATIC, EgtMsg(61658)),
+ New IdNameStruct(Recess.MANUAL, EgtMsg(61661))})
+ Public ReadOnly Property ocRECESS As ObservableCollection(Of Object)
+ Get
+ Return m_ocRECESS
+ End Get
+ End Property
+
+ Protected m_SelRECESS As Integer
+ Public Property SelRECESS As Integer
+ Get
+ Return m_SelRECESS
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocRECESS)
+ Dim sValue As String = [Enum].GetName(GetType(Recess), nValue)
+ If EgtSetInfo(m_nPartId, BTL_PRT_RECESS, sValue) Then
+ m_SelRECESS = value
+ Else
+ NotifyPropertyChanged("SelRECESS")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocSTOREYTYPE As New ObservableCollection(Of Object)({New IdNameStruct(StoreyType.CEILING, EgtMsg(61662)),
+ New IdNameStruct(StoreyType.ROOF, EgtMsg(61663)),
+ New IdNameStruct(StoreyType.WALL, EgtMsg(61664))})
+ Public ReadOnly Property ocSTOREYTYPE As ObservableCollection(Of Object)
+ Get
+ Return m_ocSTOREYTYPE
+ End Get
+ End Property
+
+ Protected m_SelSTOREYTYPE As Integer
+ Public Property SelSTOREYTYPE As Integer
+ Get
+ Return m_SelSTOREYTYPE
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocSTOREYTYPE)
+ Dim sValue As String = [Enum].GetName(GetType(StoreyType), nValue)
+ If EgtSetInfo(m_nPartId, BTL_PRT_STOREYTYPE, sValue) Then
+ m_SelSTOREYTYPE = value
+ Else
+ NotifyPropertyChanged("SelSTOREYTYPE")
+ End If
+ End Set
+ End Property
+
+ Protected m_sELEMENTNUM As String
+ Public Property sELEMENTNUM As String
+ Get
+ Return m_sELEMENTNUM
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_ELEMENTNUM, value) Then
+ m_sELEMENTNUM = value
+ Else
+ NotifyPropertyChanged("sELEMENTNUM")
+ End If
+ End Set
+ End Property
+
+ Protected m_nLAYER As Integer
+ Public Property nLAYER As Integer
+ Get
+ Return m_nLAYER
+ End Get
+ Set(value As Integer)
+ If EgtSetInfo(m_nPartId, BTL_PRT_LAYER, value) Then
+ m_nLAYER = value
+ Else
+ NotifyPropertyChanged("nLAYER")
+ End If
+ End Set
+ End Property
+
+ Protected m_sMODULENUM As String
+ Public Property sMODULENUM As String
+ Get
+ Return m_sMODULENUM
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_MODULENUM, value) Then
+ m_sMODULENUM = value
+ Else
+ NotifyPropertyChanged("sMODULENUM")
+ End If
+ End Set
+ End Property
+
+ 'Protected m_sUSERATTRIBUTE As String
+ 'Public Property sUSERATTRIBUTE As String
+ ' Get
+ ' Return m_sUSERATTRIBUTE
+ ' End Get
+ ' Set(value As String)
+ ' If EgtSetInfo(m_nPartId, BTL_PRT_USERATTRIBUTE, value) Then
+ ' m_sUSERATTRIBUTE = value
+ ' Else
+ ' NotifyPropertyChanged("sUSERATTRIBUTE")
+ ' End If
+ ' End Set
+ 'End Property
+
+ Protected m_sCOMMENT As String
+ Public Property sCOMMENT As String
+ Get
+ Return m_sCOMMENT
+ End Get
+ Set(value As String)
+ If EgtSetInfo(m_nPartId, BTL_PRT_COMMENT, value) Then
+ m_sCOMMENT = value
+ Else
+ NotifyPropertyChanged("sCOMMENT")
+ End If
+ End Set
+ End Property
+
+ Protected m_refGrainDir As Vector3d
+ Public Property GrainDirection As String
+ Get
+ Return DoubleToString(m_refGrainDir.x, 6) & "," &
+ DoubleToString(m_refGrainDir.y, 6) & "," &
+ DoubleToString(m_refGrainDir.z, 6)
+ End Get
+ Set(value As String)
+ Dim sValArray() As String = value.Split(",")
+ If sValArray.Count() >= 3 AndAlso
+ StringToDouble(sValArray(0), m_refGrainDir.x) AndAlso
+ StringToDouble(sValArray(1), m_refGrainDir.y) AndAlso
+ StringToDouble(sValArray(2), m_refGrainDir.z) Then
+ EgtSetInfo(m_nPartId, BTL_PRT_GRAINDIR, sValArray(0) & "," &
+ sValArray(1) & "," &
+ sValArray(2) & ";" &
+ If(bGRAINDIRALIGN, 1, 0))
+ Else
+ NotifyPropertyChanged("GrainDirection")
+ End If
+ End Set
+ End Property
+
+ Protected m_bGRAINDIRALIGN As Boolean
+ Public Property bGRAINDIRALIGN As Boolean
+ Get
+ Return m_bGRAINDIRALIGN
+ End Get
+ Set(value As Boolean)
+ Dim sValArray() As String = GrainDirection.Split(",")
+ If sValArray.Count() >= 3 AndAlso
+ StringToDouble(sValArray(0), m_refGrainDir.x) AndAlso
+ StringToDouble(sValArray(1), m_refGrainDir.y) AndAlso
+ StringToDouble(sValArray(2), m_refGrainDir.z) AndAlso
+ EgtSetInfo(m_nPartId, BTL_PRT_GRAINDIR, sValArray(0) & "," &
+ sValArray(1) & "," &
+ sValArray(2) & ";" &
+ If(value, 1, 0)) Then
+ m_bGRAINDIRALIGN = value
+ NotifyPropertyChanged("bGRAINDIRALIGN")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocREFSIDE As New ObservableCollection(Of Integer)({1, 2, 3, 4})
+ Public ReadOnly Property ocREFSIDE As ObservableCollection(Of Integer)
+ Get
+ Return m_ocREFSIDE
+ End Get
+ End Property
+
+ Protected m_ReferenceSide As String
+ Protected m_SelREFSIDE As Integer
+ Public Property SelREFSIDE As Integer
+ Get
+ Return m_SelREFSIDE
+ End Get
+ Set(value As Integer)
+ If EgtSetInfo(m_nPartId, BTL_PRT_REFSIDE, (value + 1) & ";" & If(bREFSIDEALIGN, 1, 0)) Then
+ m_SelREFSIDE = value
+ Else
+ NotifyPropertyChanged("SelREFSIDE")
+ End If
+ End Set
+ End Property
+
+ Protected m_bREFSIDEALIGN As Boolean
+ Public Property bREFSIDEALIGN As Boolean
+ Get
+ Return m_bREFSIDEALIGN
+ End Get
+ Set(value As Boolean)
+ If EgtSetInfo(m_nPartId, BTL_PRT_REFSIDE, (SelREFSIDE + 1) & ";" & If(value, 1, 0)) Then
+ m_bREFSIDEALIGN = value
+ NotifyPropertyChanged("bREFSIDEALIGN")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocALIGNLOCATION As New ObservableCollection(Of Object)({New IdNameStruct(AlignmentLocation.INACTIV, EgtMsg(61665)),
+ New IdNameStruct(AlignmentLocation.BR, EgtMsg(61666)),
+ New IdNameStruct(AlignmentLocation.TR, EgtMsg(61667)),
+ New IdNameStruct(AlignmentLocation.BA, EgtMsg(61668)),
+ New IdNameStruct(AlignmentLocation.TA, EgtMsg(61669)),
+ New IdNameStruct(AlignmentLocation.HC, EgtMsg(61670)),
+ New IdNameStruct(AlignmentLocation.VC, EgtMsg(61671)),
+ New IdNameStruct(AlignmentLocation.AC, EgtMsg(61672))})
+ Public ReadOnly Property ocALIGNLOCATION As ObservableCollection(Of Object)
+ Get
+ Return m_ocALIGNLOCATION
+ End Get
+ End Property
+
+ Protected m_SelALIGNLOCATION As Integer
+ Public Property SelALIGNLOCATION As Integer
+ Get
+ Return m_SelALIGNLOCATION
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocALIGNLOCATION)
+ Dim sValueLoc As String = [Enum].GetName(GetType(AlignmentLocation), nValue)
+ nValue = IdNameStruct.IdFromInd(SelALIGNENDTYPE, ocALIGNENDTYPE)
+ Dim sValueEnd As String = [Enum].GetName(GetType(AlignmentEndtype), nValue)
+ If EgtSetInfo(m_nPartId, BTL_PRT_ALIGNMENT, sValueLoc & ": " & sValueEnd) Then
+ m_SelALIGNLOCATION = value
+ Else
+ NotifyPropertyChanged("SelALIGNLOCATION")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocALIGNENDTYPE As New ObservableCollection(Of Object)({New IdNameStruct(AlignmentEndtype.R, EgtMsg(61673)),
+ New IdNameStruct(AlignmentEndtype.A, EgtMsg(61674)),
+ New IdNameStruct(AlignmentEndtype.D, EgtMsg(61675))})
+ Public ReadOnly Property ocALIGNENDTYPE As ObservableCollection(Of Object)
+ Get
+ Return m_ocALIGNENDTYPE
+ End Get
+ End Property
+
+ Protected m_SelALIGNENDTYPE As Integer
+ Public Property SelALIGNENDTYPE As Integer
+ Get
+ Return m_SelALIGNENDTYPE
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(SelALIGNLOCATION, ocALIGNLOCATION)
+ Dim sValueLoc As String = [Enum].GetName(GetType(AlignmentLocation), nValue)
+ nValue = IdNameStruct.IdFromInd(value, ocALIGNENDTYPE)
+ Dim sValueEnd As String = [Enum].GetName(GetType(AlignmentEndtype), nValue)
+ If EgtSetInfo(m_nPartId, BTL_PRT_ALIGNMENT, sValueLoc & ": " & sValueEnd) Then
+ m_SelALIGNENDTYPE = value
+ Else
+ NotifyPropertyChanged("SelALIGNENDTYPE")
+ End If
+ End Set
+ End Property
+
+ Protected m_ocMATERIALTYPEGRP As New ObservableCollection(Of Object)({New IdNameStruct(MaterialType.INACTIV, EgtMsg(61665)),
+ New IdNameStruct(MaterialType.BA, EgtMsg(61676)),
+ New IdNameStruct(MaterialType.CL, EgtMsg(61677)),
+ New IdNameStruct(MaterialType.MT, EgtMsg(61678)),
+ New IdNameStruct(MaterialType.ME_, EgtMsg(61679)),
+ New IdNameStruct(MaterialType.GB, EgtMsg(61680)),
+ New IdNameStruct(MaterialType.GF, EgtMsg(61681)),
+ New IdNameStruct(MaterialType.IN_, EgtMsg(61682)),
+ New IdNameStruct(MaterialType.SH, EgtMsg(61683)),
+ New IdNameStruct(MaterialType.FB, EgtMsg(61684)),
+ New IdNameStruct(MaterialType.PB, EgtMsg(61685)),
+ New IdNameStruct(MaterialType.PL, EgtMsg(61686))})
+ Public ReadOnly Property ocMATERIALTYPEGRP As ObservableCollection(Of Object)
+ Get
+ Return m_ocMATERIALTYPEGRP
+ End Get
+ End Property
+
+ Protected m_SelMATERIALTYPEGRP As Integer
+ Public Property SelMATERIALTYPEGRP As Integer
+ Get
+ Return m_SelMATERIALTYPEGRP
+ End Get
+ Set(value As Integer)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocMATERIALTYPEGRP)
+ Dim sValue As String = ocMATERIALTYPEGRP(nValue).Name '[Enum].GetName(GetType(MaterialType), nValue)
+ If EgtSetInfo(m_nPartId, BTL_PRT_MATERIALTYPE, sValue & ": " & sMATERIALTYPESPEC) Then
+ m_SelMATERIALTYPEGRP = value
+ Else
+ NotifyPropertyChanged("SelMATERIALTYPEGRP")
+ End If
+ End Set
+ End Property
+
+ Protected m_sMATERIALTYPESPEC As String
+ Public Property sMATERIALTYPESPEC As String
+ Get
+ Return m_sMATERIALTYPESPEC
+ End Get
+ Set(value As String)
+ Dim nValue As Integer = IdNameStruct.IdFromInd(SelMATERIALTYPEGRP, ocMATERIALTYPEGRP)
+ Dim sValue As String = ocMATERIALTYPEGRP(nValue).Name '[Enum].GetName(GetType(MaterialType), nValue)
+ If EgtSetInfo(m_nPartId, BTL_PRT_MATERIALTYPE, sValue & ": " & value) Then
+ m_sMATERIALTYPESPEC = value
+ Else
+ NotifyPropertyChanged("sMATERIALTYPESPEC")
+ End If
+ End Set
+ End Property
+
+#End Region ' Parametri pezzo
+
+ Public Property sCNT As String
+ Get
+ Return m_nCNT
+ End Get
+ Set(value As String)
+ Dim nTempCNT As Integer
+ If Integer.TryParse(value, nTempCNT) AndAlso nTempCNT > 0 AndAlso EgtSetInfo(m_nPartId, BTL_PRT_CNT, value) Then
+ m_nCNT = nTempCNT
+ Else
+ NotifyPropertyChanged("sCNT")
+ End If
+ End Set
+ End Property
+
+ Private m_nINVERTED As Integer
+ Public ReadOnly Property sINVERTED As String
+ Get
+ Return m_nINVERTED & "°"
+ End Get
+ End Property
+
+ Private m_nROTATED As Integer
+ Public ReadOnly Property sROTATED As String
+ Get
+ Return m_nROTATED & "°"
+ End Get
+ End Property
+
+ Private m_nCALC_ERR As Integer
+ Public ReadOnly Property nCALC_ERR As Integer
+ Get
+ Return m_nCALC_ERR
+ End Get
+ End Property
+
+ Private m_nCALC_FALL As Integer
+ Public ReadOnly Property nCALC_FALL As Integer
+ Get
+ Return m_nCALC_FALL
+ End Get
+ End Property
+
+ Private m_sCALC_MSG As String
+ Public ReadOnly Property nCALC_MSG As String
+ Get
+ Return m_sCALC_MSG
+ End Get
+ End Property
+
+ Public ReadOnly Property Calc_BorderBrush As SolidColorBrush
+ Get
+ If Not bDO Then
+ Return Brushes.Aqua
+ ElseIf m_nGlobalState = 0 Then
+ Return Brushes.Green
+ ElseIf m_nGlobalState < 0 Then
+ Return Brushes.LightGray
+ ElseIf m_nGlobalState > 0 Then
+ Return Brushes.Red
+ End If
+ End Get
+ End Property
+
+ Public Property bDOALL As Boolean?
+ Get
+ If FeatureList.Count = 0 Then Return False
+ Dim bTemp As Boolean = FeatureList(0).bDO
+ For FeatureIndex = 1 To FeatureList.Count - 1
+ If FeatureList(FeatureIndex).bDO <> bTemp Then Return Nothing
+ Next
+ Return bTemp
+ End Get
+ Set(value As Boolean?)
+ If FeatureList.Count = 0 Then
+ NotifyPropertyChanged("bDOALL")
+ Return
+ End If
+ For Each Feature In FeatureList
+ Feature.bDO = value
+ Next
+ End Set
+ End Property
+
+ ' lista delle feature del pezzo
+
+ Public Overrides Property SelFeature As Core.BTLFeature
+ Get
+ Return m_SelFeature
+ End Get
+ Set(value As Core.BTLFeature)
+ m_SelFeature = value
+ If Map.refMainMenuVM.SelPage = Pages.VIEW Then
+ If Not IsNothing(m_SelFeature) Then
+ DirectCast(m_SelFeature, BTLFeature).SelGeomFeature()
+ EgtDraw()
+ ' imposto path disegno da mostrare in BottomPanel
+ Map.refBottomPanelVM.SetCurrDraw(DirectCast(m_SelFeature, BTLFeature).sDrawPath)
+ ' seleziono pagina BottomPanel
+ Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.FEATURE)
+ ' deseleziono i parametri
+ If Not IsNothing(SelFeature.SelPParam) Then SelFeature.SelPParam = Nothing
+ ' se contorno libero
+ If m_SelFeature.IsFreeContour() Then
+ ' attivo stato contorno libero
+
+ End If
+ Else
+ EgtDeselectAll()
+ End If
+ End If
+ NotifyPropertyChanged("SelFeature")
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdInvert As ICommand
+ Private m_cmdBackRotation As ICommand
+ Private m_cmdForwardRotation As ICommand
+ Private m_cmdPartColour As ICommand
+ Private m_cmdDeletePart As ICommand
+
+#Region "MESSAGES"
+
+ Public ReadOnly Property DO_Msg As String
+ Get
+ Return EgtMsg(61602)
+ End Get
+ End Property
+
+ Public ReadOnly Property NAM_Msg As String
+ Get
+ Return EgtMsg(61603)
+ End Get
+ End Property
+
+#End Region
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New(ParentStructure As BTLStructure, nPartId As Integer)
+ MyBase.New(ParentStructure, nPartId)
+ ' leggo info pezzo
+ Dim sValArray() As String
+ Dim sValue As String = String.Empty
+ Dim nValue As Integer = 0
+ EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
+ Dim nDO As Integer = 1
+ If EgtGetInfo(nPartId, BTL_PRT_DO, nDO) Then
+ m_bDO = (nDO <> 0)
+ Else
+ m_bDO = True
+ End If
+ EgtGetInfo(nPartId, BTL_PRT_NAM, m_sNAM)
+ EgtGetInfo(nPartId, BTL_PRT_L, m_dL)
+ EgtGetInfo(nPartId, BTL_PRT_W, m_dW)
+ EgtGetInfo(nPartId, BTL_PRT_H, m_dH)
+ EgtGetInfo(nPartId, BTL_PRT_CNT, m_nCNT)
+ EgtGetInfo(nPartId, BTL_PRT_ASSEMBLYNUM, m_sASSEMBLYNUM)
+ EgtGetInfo(nPartId, BTL_PRT_ORDERNUM, m_nORDERNUM)
+ EgtGetInfo(nPartId, BTL_PRT_DESIGNATION, m_sDESIGN)
+ EgtGetInfo(nPartId, BTL_PRT_ANNOTATION, m_sANNOT)
+ EgtGetInfo(nPartId, BTL_PRT_STOREY, m_sSTOREY)
+ EgtGetInfo(nPartId, BTL_PRT_GROUP, m_sGROUP)
+ EgtGetInfo(nPartId, BTL_PRT_PACKAGE, m_sPACKAGE)
+ EgtGetInfo(nPartId, BTL_PRT_TIMBERGRADE, m_sTIMBERGRADE)
+ EgtGetInfo(nPartId, BTL_PRT_QUALITYGRADE, m_sQUALITYGRADE)
+ EgtGetInfo(nPartId, BTL_PRT_COLOUR, sValue)
+ m_colCOLOR.FromString(sValue)
+ EgtGetInfo(nPartId, BTL_PRT_PLANINGLENGTH, m_dPLANINGLEN)
+ EgtGetInfo(nPartId, BTL_PRT_STARTOFFSET, m_dSTARTOFFSET)
+ EgtGetInfo(nPartId, BTL_PRT_ENDOFFSET, m_dENDOFFSET)
+
+ Dim ind As Integer = 1
+ While EgtGetInfo(nPartId, BTL_PRT_UID & ind, nValue)
+ ocUID.Add(nValue)
+ EgtGetInfo(nPartId, BTL_PRT_TRANSFORMATION & ind, sValue)
+ m_refTransf = New Frame3d
+ Dim ptOri As New Point3d
+ Dim vtVersX As New Vector3d
+ Dim vtVersY As New Vector3d
+ sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
+ If sValArray.Count() >= 9 Then
+ StringToLen(sValArray(0), ptOri.x)
+ StringToLen(sValArray(1), ptOri.y)
+ StringToLen(sValArray(2), ptOri.z)
+ StringToDouble(sValArray(3), vtVersX.x)
+ StringToDouble(sValArray(4), vtVersX.y)
+ StringToDouble(sValArray(5), vtVersX.z)
+ StringToDouble(sValArray(6), vtVersY.x)
+ StringToDouble(sValArray(7), vtVersY.y)
+ StringToDouble(sValArray(8), vtVersY.z)
+ m_refTransf.ChangeOrigin(ptOri)
+ m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
+ End If
+ refTransfList.Add(m_refTransf)
+ ind = ind + 1
+ End While
+
+ EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
+ sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
+ If sValArray.Count() >= 5 Then
+ StringToLen(sValArray(3), m_dCamberLen1)
+ StringToLen(sValArray(5), m_dCamberLen2)
+ StringToLen(sValArray(7), m_dCamberLen3)
+ StringToLen(sValArray(9), m_dCamberCross3)
+ End If
+ Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
+ Dim pTo As Integer = sValue.LastIndexOf(" P01")
+ If pTo >= 0 Then
+ nValue = CInt(sValue.Substring(pFrom, pTo - pFrom))
+ m_SelCAMBERSIDE = ocCAMBERSIDE.IndexOf(CInt(sValue.Substring(pFrom, pTo - pFrom)))
+ End If
+
+ EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
+ sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
+ If sValArray.Count() >= 5 Then
+ StringToLen(sValArray(3), m_dPartOffsetSide1)
+ StringToLen(sValArray(5), m_dPartOffsetSide2)
+ StringToLen(sValArray(7), m_dPartOffsetSide3)
+ StringToLen(sValArray(9), m_dPartOffsetSide4)
+ End If
+ pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
+ pTo = sValue.LastIndexOf(" P11")
+ If pTo >= 0 Then
+ m_SelREFSIDEFIXCLAMP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue.Substring(pFrom, pTo - pFrom), ocREFSIDEFIXCLAMP), ocREFSIDEFIXCLAMP)
+ End If
+
+ EgtGetInfo(nPartId, BTL_PRT_PROCESSINGQUALITY, sValue)
+ m_SelPROCESSINGQUALITY = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocPROCESSINGQUALITY), ocPROCESSINGQUALITY)
+ EgtGetInfo(nPartId, BTL_PRT_RECESS, sValue)
+ m_SelRECESS = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocRECESS), ocRECESS)
+ EgtGetInfo(nPartId, BTL_PRT_STOREYTYPE, sValue)
+ m_SelSTOREYTYPE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocSTOREYTYPE), ocSTOREYTYPE)
+ EgtGetInfo(nPartId, BTL_PRT_ELEMENTNUM, m_sELEMENTNUM)
+ EgtGetInfo(nPartId, BTL_PRT_LAYER, m_nLAYER)
+ EgtGetInfo(nPartId, BTL_PRT_MODULENUM, m_sMODULENUM)
+ 'EgtGetInfo(nPartId, BTL_PRT_USERATTRIBUTE, m_sUSERATTRIBUTE)
+ EgtGetInfo(nPartId, BTL_PRT_COMMENT, m_sCOMMENT)
+
+ EgtGetInfo(nPartId, BTL_PRT_GRAINDIR, sValue)
+ m_refGrainDir = New Vector3d
+ sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
+ If sValArray.Count() >= 4 Then
+ StringToDouble(sValArray(0), m_refGrainDir.x)
+ StringToDouble(sValArray(1), m_refGrainDir.y)
+ StringToDouble(sValArray(2), m_refGrainDir.z)
+ m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
+ End If
+
+ EgtGetInfo(nPartId, BTL_PRT_REFSIDE, sValue)
+ sValArray = sValue.Split({";"}, StringSplitOptions.RemoveEmptyEntries)
+ If sValArray.Count() >= 2 Then
+ m_SelREFSIDE = ocREFSIDE.IndexOf(CInt(sValArray(0)))
+ m_bREFSIDEALIGN = (CInt(sValArray(1)) = 1)
+ End If
+
+ EgtGetInfo(nPartId, BTL_PRT_ALIGNMENT, sValue)
+ sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
+ If sValArray.Count() >= 2 Then
+ m_SelALIGNLOCATION = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0), ocALIGNLOCATION), ocALIGNLOCATION)
+ m_SelALIGNENDTYPE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(1).Trim(), ocALIGNENDTYPE), ocALIGNENDTYPE)
+ End If
+
+ EgtGetInfo(nPartId, BTL_PRT_MATERIALTYPE, sValue)
+ sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
+ If sValArray.Count() >= 1 Then
+ m_SelMATERIALTYPEGRP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0), ocMATERIALTYPEGRP), ocMATERIALTYPEGRP)
+ If sValArray.Count() >= 2 Then m_sMATERIALTYPESPEC = sValArray(1).Trim()
+ End If
+
+ If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, m_nROTATED) Then
+ m_nROTATED = 0
+ End If
+ If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, m_nINVERTED) Then
+ m_nINVERTED = 0
+ End If
+ If EgtGetInfo(nPartId, BTL_PRT_MATERIAL, m_sMATERIAL) Then
+ If Not ParentStructure.MaterialList.Contains(m_sMATERIAL) Then
+ ParentStructure.MaterialList.Add(m_sMATERIAL)
+ End If
+ End If
+ If Not ParentStructure.SectionList.Contains(Section) Then
+ ParentStructure.SectionList.Add(Section)
+ End If
+ ' Leggo outline
+ Dim nOutlineLayerId As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
+ Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayerId)
+ While nOutlineId <> GDB_ID.NULL
+ ' verifico che sia una feature
+ Dim nGRP As Integer
+ If EgtGetInfo(nOutlineId, BTL_FTR_GRP, nGRP) Then
+ ' creo la feature
+ m_FeatureList.Add(New BTLFeature(Me, nOutlineId))
+ End If
+ nOutlineId = EgtGetNext(nOutlineId)
+ End While
+ ' Leggo feature
+ Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
+ Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
+ While nFeatureId <> GDB_ID.NULL
+ ' verifico che sia una feature
+ Dim nGRP As Integer
+ If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
+ ' creo la feature
+ m_FeatureList.Add(New BTLFeature(Me, nFeatureId))
+ End If
+ nFeatureId = EgtGetNext(nFeatureId)
+ End While
+ ' Aggiorno check DOALL
+ NotifyPropertyChanged("bDOALL")
+ ' leggo calc error
+ Dim nErr As Integer = 0
+ Dim nRot As Integer = 0
+ Dim nFall As Integer = 0
+ Dim sMsg As String = ""
+ Dim bCalc As Boolean = False
+ bCalc = EgtGetInfo(nPartId, ITG_PROJ_ERR, nErr)
+ EgtGetInfo(nPartId, ITG_PROJ_ROT, nRot)
+ EgtGetInfo(nPartId, ITG_PROJ_FALL, sMsg)
+ EgtGetInfo(nPartId, ITG_PROJ_MSG, sMsg)
+ CalcPartUpdate(bCalc, nErr, nRot, nFall, sMsg)
+ CalcFeatureUpdate()
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Public Sub Rotation(IsPositive As Boolean)
+ ' recupero il box del pezzo
+ Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
+ Dim b3Solid As New BBox3d
+ EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
+ If b3Solid.IsEmpty() Then
+ Map.refMyStatusBarVM.SetOutputMessage("ERROR: Box non definito per la trave " & sNAM, 5, MSG_TYPE.ERROR_)
+ Return
+ End If
+ ' eseguo rotazione di 90 gradi attorno asse X
+ Dim dRot = If(IsPositive, 90, -90)
+ Dim vtAxes As Vector3d
+ ' se travi ruoto attorno all'asse X
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ vtAxes = Vector3d.X_AX
+ ' se pareti ruoto attorno all'asse Z
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ vtAxes = Vector3d.Z_AX
+ End If
+ If EgtRotate(nPartId, b3Solid.Center, vtAxes, dRot, GDB_RT.GLOB) Then
+ Select Case m_nROTATED
+ Case 0
+ m_nROTATED = If(IsPositive, 90, 270)
+ Case 90
+ m_nROTATED = If(IsPositive, 180, 0)
+ Case 180
+ m_nROTATED = If(IsPositive, 270, 90)
+ Case 270
+ m_nROTATED = If(IsPositive, 0, 180)
+ End Select
+ EgtSetInfo(nPartId, BTL_PRT_ROTATED, m_nROTATED)
+ ' scambio dimensioni
+ SwapDimForRotation()
+ ' aggiorno sezioni
+ DirectCast(ParentStructure, BTLStructure).UpdateSectionFromRotation(Me)
+ ' imposto modificato per copie
+ EgtDuploSetModified(nPartId)
+ End If
+ EgtDraw()
+ NotifyPropertyChanged("sROTATED")
+ End Sub
+
+ Private Function SwapDimForRotation()
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ ' scambio W ed H
+ Dim Temp As Double = m_dW
+ m_dW = m_dH
+ m_dH = Temp
+ EgtSetInfo(nPartId, BTL_PRT_W, m_dW)
+ EgtSetInfo(nPartId, BTL_PRT_H, m_dH)
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ ' scambio W ed L
+ Dim Temp As Double = m_dW
+ m_dW = m_dL
+ m_dL = Temp
+ EgtSetInfo(nPartId, BTL_PRT_W, m_dW)
+ EgtSetInfo(nPartId, BTL_PRT_L, m_dL)
+ End If
+ ' notifica per valori in PartGrid
+ NotifyPropertyChanged("dW")
+ NotifyPropertyChanged("dH")
+ NotifyPropertyChanged("dL")
+ ' notifica per valori in PartManager(textbox)
+ NotifyPropertyChanged("sW")
+ NotifyPropertyChanged("sH")
+ NotifyPropertyChanged("sL")
+ End Function
+
+ ' funzione che aggiorna lo stato e gli errori dopo calcolo
+ Friend Sub CalcPartUpdate(bCalc As Boolean, ERR As Integer, ROT As Integer, FALL As Integer, MSG As String)
+ If Not bCalc Then
+ nState = CalcStates.NOTCALCULATED
+ m_nCALC_ERR = 0
+ m_nCALC_ROT = 0
+ m_nCALC_FALL = 0
+ m_sCALC_MSG = ""
+ Else
+ m_nCALC_ERR = ERR
+ m_nCALC_ROT = ROT
+ m_nCALC_FALL = FALL
+ m_sCALC_MSG = MSG
+ If ERR = 0 Then
+ nState = CalcStates.OK
+ ElseIf ERR > 1 Then
+ nState = CalcStates.ERROR_
+ ElseIf ERR < 1 Then
+ nState = CalcStates.NOTCALCULATED
+ End If
+ End If
+ NotifyPropertyChanged("Calc_BorderBrush")
+ End Sub
+
+ ' funzione che aggiorna lo stato e gli errori dopo calcolo
+ Friend Sub CalcFeatureUpdate()
+ m_nGlobalState = nState
+ For Each Feature In FeatureList
+ If Not Feature.bDO Then
+
+ ElseIf Feature.nState < 0 Then
+ m_nGlobalState = CalcStates.NOTCALCULATED
+ Exit For
+ ElseIf Feature.nState > 0 AndAlso m_nGlobalState = CalcStates.OK Then
+ m_nGlobalState = CalcStates.ERROR_
+ End If
+ Next
+ NotifyPropertyChanged("Calc_BorderBrush")
+ End Sub
+
+ Public Function Copy() As BTLPart
+ ' creo nuovo part
+ Dim nNewPartId As Integer = EgtBeamCreatePart()
+ If nNewPartId = GDB_ID.NULL Then Return Nothing
+ EgtBeamSetPartProdNbr(Me.ParentStructure.NewPDN())
+ EgtBeamSetPartName(Me.sNAM)
+ EgtBeamSetPartCount(Me.nCNT)
+ EgtBeamSetPartBox(Me.dL, Me.dH, Me.dW)
+ ' aggiungo dati pezzo
+ Dim NewPart As New BTLPart(Me.ParentStructure, nNewPartId)
+ 'aggiungo tutte le sue feature
+ For Each Feature In Me.FeatureList
+ Feature.Copy(NewPart)
+ Next
+ ' aggiungo pezzo alla lista
+ Me.ParentStructure.PartList.Add(NewPart)
+ Return NewPart
+ End Function
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "Invert"
+
+ Public ReadOnly Property Invert_Command As ICommand
+ Get
+ If m_cmdInvert Is Nothing Then
+ m_cmdInvert = New Command(AddressOf Invert)
+ End If
+ Return m_cmdInvert
+ End Get
+ End Property
+
+ Public Sub Invert()
+ ' recupero il box del pezzo
+ Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
+ Dim b3Solid As New BBox3d
+ EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
+ If b3Solid.IsEmpty() Then
+ Map.refMyStatusBarVM.SetOutputMessage("ERROR: Box non definito per la trave " & sNAM, 5, MSG_TYPE.ERROR_)
+ Return
+ End If
+ Dim vtAxes As Vector3d
+ ' se travi ruoto attorno all'asse Z
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ vtAxes = Vector3d.Z_AX
+ ' se pareti ruoto attorno all'asse X
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ vtAxes = Vector3d.X_AX
+ End If
+ ' eseguo rotazione di 180 gradi
+ If EgtRotate(nPartId, b3Solid.Center, vtAxes, 180, GDB_RT.GLOB) Then
+ m_nINVERTED = If(m_nINVERTED = 0, 180, 0)
+ EgtSetInfo(nPartId, BTL_PRT_INVERTED, m_nINVERTED)
+ ' imposto modificato per copie
+ EgtDuploSetModified(nPartId)
+ End If
+ EgtDraw()
+ NotifyPropertyChanged("sINVERTED")
+ End Sub
+
+#End Region ' Invert
+
+#Region "BackRotation"
+
+ Public ReadOnly Property BackRotation_Command As ICommand
+ Get
+ If m_cmdBackRotation Is Nothing Then
+ m_cmdBackRotation = New Command(AddressOf BackRotation)
+ End If
+ Return m_cmdBackRotation
+ End Get
+ End Property
+
+ Public Sub BackRotation()
+ Rotation(False)
+ End Sub
+
+#End Region ' BackRotation
+
+#Region "ForwardRotation"
+
+ Public ReadOnly Property ForwardRotation_Command As ICommand
+ Get
+ If m_cmdForwardRotation Is Nothing Then
+ m_cmdForwardRotation = New Command(AddressOf ForwardRotation)
+ End If
+ Return m_cmdForwardRotation
+ End Get
+ End Property
+
+ Public Sub ForwardRotation()
+ Rotation(True)
+ End Sub
+
+#End Region ' ForwardRotation
+
+#Region "PartColour"
+
+ Public ReadOnly Property PartColour_Command As ICommand
+ Get
+ If m_cmdPartColour Is Nothing Then
+ m_cmdPartColour = New Command(AddressOf PartColourCmd)
+ End If
+ Return m_cmdPartColour
+ End Get
+ End Property
+
+ Public Sub PartColourCmd()
+ Dim PartColor As New Color3d(192, 192, 192)
+ ' Eseguo modifica con dialogo
+ If SelectColor(m_colCOLOR, PartColor) Then
+ 'm_colCOLOR = PartColor
+ sCOLRGB = PartColor.ToString
+ NotifyPropertyChanged("PartColour")
+ End If
+ End Sub
+
+#End Region ' PartColour
+
+#Region "DeletePart"
+
+ Public ReadOnly Property DeletePart_Command As ICommand
+ Get
+ If m_cmdDeletePart Is Nothing Then
+ m_cmdDeletePart = New Command(AddressOf DeletePart)
+ End If
+ Return m_cmdDeletePart
+ End Get
+ End Property
+
+ Public Sub DeletePart()
+ If Map.refMainMenuVM.SelPage = Pages.VIEW Then Map.refLeftPanelVM.RemovePart()
+ End Sub
+
+#End Region ' DeletePart
+
+ Private Function SelectColor(Col As Color3d, ByRef NewCol As Color3d) As Boolean
+ ' Creo dialogo colori
+ Dim ColorDlg As New System.Windows.Forms.ColorDialog
+ ColorDlg.FullOpen = True
+ ColorDlg.Color = Col.ToColor()
+ ' Visualizzo dialogo
+ If ColorDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return False
+ ' Recupero colore scelto
+ NewCol.FromString(ColorDlg.Color.R & "," & ColorDlg.Color.G & "," & ColorDlg.Color.B & "," & ColorDlg.Color.A) 'NewCol.FromColor(ColorDlg.Color)
+ Return True
+ End Function
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class BTLFeature
+ Inherits Core.BTLFeature
+
+ Public Overrides Property nSelGRP As Integer
+ Get
+ Return m_nSelGRP
+ End Get
+ Set(value As Integer)
+ If value <> -1 Then
+ ' aggiorno la feature con nuovo valore
+ Dim vPar() As Double = Nothing
+ Dim sPar As String = String.Empty
+ CalcParamArray(vPar, sPar)
+ Dim bOK As Boolean = UpdateParams(value, nPRC, nSelSIDE, sDES, nPRID, frFRAME, vPar, sPar)
+ If bOK Then
+ m_nSelGRP = value
+ ' seleziono feature in disegno
+ SelGeomFeature()
+ ' rendo non calcolata questa feature
+ CalcFeatureUpdate(False, 0, 0, 0, "")
+ ' ed aggiorno stato pezzo
+ DirectCast(ParentPart, BTLPart).CalcFeatureUpdate()
+ Else
+ NotifyPropertyChanged("nSelGRP")
+ End If
+ EgtDraw()
+ End If
+ End Set
+ End Property
+ Friend ReadOnly Property sDescGRP As String
+ Get
+ Dim sDescConstruction As String = String.Empty
+ If CalcBeamPrivateProfileGRP(m_nSelGRP) = 0 Then
+ sDescConstruction = "L"
+ Else
+ sDescConstruction = "T"
+ End If
+ sDescConstruction &= m_nPRC.ToString("000")
+ Return sDescConstruction
+ End Get
+ End Property
+
+ ' Lato
+ Public Overrides Property nSelSIDE As Integer
+ Get
+ Return m_nSelSIDE
+ End Get
+ Set(value As Integer)
+ If value <> -1 Then
+ ' aggiorno la feature con nuovo valore
+ Dim vPar() As Double = Nothing
+ Dim sPar As String = String.Empty
+ CalcParamArray(vPar, sPar)
+ Dim bOK As Boolean = UpdateParams(nSelGRP, nPRC, value, sDES, nPRID, frFRAME, vPar, sPar)
+ If bOK Then
+ m_nSelSIDE = value
+ SelGeomFeature()
+ ' rendo non calcolata questa feature
+ CalcFeatureUpdate(False, 0, 0, 0, "")
+ ' ed aggiorno stato pezzo
+ DirectCast(ParentPart, BTLPart).CalcFeatureUpdate()
+ Else
+ NotifyPropertyChanged("nSelGRP")
+ End If
+ EgtDraw()
+ End If
+ End Set
+ End Property
+
+ Public Overrides Property bDO As Boolean
+ Get
+ Return m_bDO
+ End Get
+ Set(value As Boolean)
+ If EgtBeamEnableProcess(nFeatureId, value) Then
+ m_bDO = value
+ ' aggiorno check DOALL
+ ParentPart.NotifyPropertyChanged("bDOALL")
+ EgtDraw()
+ NotifyPropertyChanged("Calc_Background")
+ NotifyPropertyChanged("bDO")
+ End If
+ End Set
+ End Property
+
+ ' proprieta' che mostra la descrizione in interfaccia
+ Public ReadOnly Property sDesc As String
+ Get
+ Return sDescGRP & " " & sName
+ End Get
+ End Property
+
+ Public ReadOnly Property sDrawPath As String
+ Get
+ Return Map.refMainWindowVM.MainWindowM.sResourcesRoot & "\Features\" & sDescGRP & ".png"
+ End Get
+ End Property
+
+ Public ReadOnly Property Calc_Background As SolidColorBrush
+ Get
+ If Not m_bDO Then
+ Return Brushes.Aqua
+ ElseIf nState = 0 Then
+ Return Brushes.Green
+ ElseIf nState < 0 Then
+ Return Brushes.LightGray
+ ElseIf nState > 0 Then
+ Return Brushes.Red
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property CALC_ROT_Visibility As Visibility
+ Get
+ Return If(m_nCALC_ROT <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ Public ReadOnly Property CALC_FALL_Visibility As Visibility
+ Get
+ Return If(m_nCALC_FALL <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ Public ReadOnly Property CALC_ERR_Letter As String
+ Get
+ Select Case m_nCALC_ERR
+ Case 22
+ Return "c"
+ Case 19, 23, 24, 25
+ Return "e"
+ Case 17
+ Return "w"
+ Case < 0
+ Return "i"
+ End Select
+ End Get
+ End Property
+
+ Public ReadOnly Property CALC_ERR_Foreground As SolidColorBrush
+ Get
+ Select Case m_nCALC_ERR
+ Case 19, 22, 23, 24, 25
+ Return Brushes.Red
+ Case 17
+ Return Brushes.Orange
+ Case < 0
+ Return Brushes.Green
+ End Select
+ End Get
+ End Property
+
+ Public Overrides Property SelPParam As Core.BTLParam
+ Get
+ Return m_SelPParam
+ End Get
+ Set(value As Core.BTLParam)
+ m_SelPParam = value
+ If Not IsNothing(m_SelPParam) Then
+ ' imposto path disegno da mostrare in BottomPanel
+ Map.refBottomPanelVM.SetCurrDraw(DirectCast(m_SelPParam, BTLParam).sDrawPath)
+ End If
+ NotifyPropertyChanged("SelPParam")
+ End Set
+ End Property
+
+ Public Overrides Property SelQParam As Core.BTLParam
+ Get
+ Return m_SelQParam
+ End Get
+ Set(value As Core.BTLParam)
+ m_SelQParam = value
+ If Not IsNothing(m_SelQParam) Then
+ ' imposto path disegno da mostrare in BottomPanel
+ Map.refBottomPanelVM.SetCurrDraw(DirectCast(m_SelQParam, BTLParam).sDrawPath)
+ End If
+ NotifyPropertyChanged("SelQParam")
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdDeleteFeature As ICommand
+
+ Sub New(ParentPart As BTLPart, nFeatureId As Integer)
+ MyBase.New(ParentPart, nFeatureId)
+ ' leggo gruppo, numero feature e lato
+ EgtGetInfo(nFeatureId, BTL_FTR_GRP, m_nSelGRP)
+ EgtGetInfo(nFeatureId, BTL_FTR_PRC, m_nPRC)
+ EgtGetInfo(nFeatureId, BTL_FTR_SIDE, m_nSelSIDE)
+ Dim nDO As Integer = 1
+ If EgtGetInfo(nFeatureId, BTL_FTR_DO, nDO) Then
+ m_bDO = (nDO <> 0)
+ Else
+ m_bDO = True
+ End If
+ ' leggo des,prid e frame
+ EgtGetInfo(nFeatureId, BTL_FTR_DES, m_sDES)
+ EgtGetInfo(nFeatureId, BTL_FTR_PRID, m_nPRID)
+ EgtGetInfo(nFeatureId, BTL_FTR_FRAME, m_frFRAME)
+ ' leggo calc error
+ Dim nErr As Integer = 0
+ Dim nRot As Integer = 0
+ Dim nFall As Integer = 0
+ Dim sMsg As String = ""
+ Dim bCalc As Boolean = False
+ bCalc = EgtGetInfo(m_nFeatureId, ITG_PROJ_ERR, nErr)
+ EgtGetInfo(m_nFeatureId, ITG_PROJ_ROT, nRot)
+ EgtGetInfo(m_nFeatureId, ITG_PROJ_FALL, nFall)
+ EgtGetInfo(m_nFeatureId, ITG_PROJ_MSG, sMsg)
+ CalcFeatureUpdate(bCalc, nErr, nRot, nFall, sMsg)
+ ' leggo parametri della feature
+ GetBeamPrivateProfileGRPList(CalcBeamPrivateProfileGRP(nSelGRP), m_nPRC, m_GRPList)
+ GetBeamPrivateProfileName(m_nSelGRP, m_nPRC, Me)
+ ' crea parametri per questa feature da file ini
+ CreateFeatureParams()
+ ReadFeatureParams()
+ End Sub
+
+ Sub New(nPRC As Integer, nGRP As Integer, nSIDE As Integer)
+ MyBase.New(nPRC, nGRP, nSIDE)
+ End Sub
+
+ ' funzione che crea l'elenco dei parametri
+ Public Overrides Sub CreateFeatureParams()
+ Dim ParamIndex As Integer = 1
+ Dim NewBTLParam As BTLParam = Nothing
+ ' leggo tutti i P della feature
+ While BTLIniFile.GetBeamPrivateProfileParam(m_nSelGRP, m_nPRC, True, ParamIndex, Me, NewBTLParam)
+ m_PParamList.Add(NewBTLParam)
+ ParamIndex += 1
+ End While
+ ' leggo tutti i Q della feature
+ ParamIndex = 1
+ While BTLIniFile.GetBeamPrivateProfileParam(m_nSelGRP, m_nPRC, False, ParamIndex, Me, NewBTLParam)
+ m_QParamList.Add(NewBTLParam)
+ ParamIndex += 1
+ End While
+ End Sub
+
+ ' funzione che aggiorna lo stato e gli errori dopo calcolo
+ Friend Sub CalcFeatureUpdate(bCalc As Boolean, ERR As Integer, ROT As Integer, FALL As Integer, MSG As String)
+ If Not bCalc Then
+ m_nState = CalcStates.NOTCALCULATED
+ m_nCALC_ERR = 0
+ m_nCALC_ROT = 0
+ m_nCALC_FALL = 0
+ m_sCALC_MSG = ""
+ Else
+ m_nCALC_ERR = ERR
+ m_nCALC_ROT = ROT
+ m_nCALC_FALL = FALL
+ m_sCALC_MSG = MSG
+ If ERR = 0 Then
+ m_nState = 0
+ ElseIf ERR > 1 Then
+ m_nState = 1
+ ElseIf ERR < 1 Then
+ m_nState = -1
+ End If
+ End If
+ NotifyPropertyChanged("Calc_Background")
+ End Sub
+
+ ' funzione che seleziona la feature nella geometria
+ Friend Shared Sub SelGeomFeature(Feature As BTLFeature)
+ EgtDeselectAll()
+ If Not IsNothing(Feature) Then EgtSelectObj(Feature.nFeatureId)
+ End Sub
+ Friend Sub SelGeomFeature()
+ EgtDeselectAll()
+ EgtSelectObj(nFeatureId)
+ End Sub
+
+ Public Overrides Function Copy() As Core.BTLFeature
+ ' creo nuova feature
+ Dim vPar() As Double = Nothing
+ Dim sPar As String = String.Empty
+ Me.CalcParamArray(vPar, sPar)
+ ' aggiorno la feature con nuovo valore
+ EgtBeamSetPart(Me.ParentPart.nPartId)
+ Dim nNewFeatureId As Integer = EgtBeamAddProcess(Me.nSelGRP, Me.nPRC, Me.nSelSIDE, Me.sDES, Me.ParentPart.NewProcId(), Me.frFRAME, vPar, sPar)
+ ' se è stata creata
+ If nNewFeatureId <> GDB_ID.NULL Then
+ Dim NewFeat As New BTLFeature(Me.ParentPart, nNewFeatureId)
+ ' la aggiungo a struttura BTL corrente
+ Me.ParentPart.FeatureList.Add(NewFeat)
+ Return NewFeat
+ End If
+ Return Nothing
+ End Function
+
+ Public Overrides Function Copy(DestBTLPart As Core.BTLPart) As Boolean
+ ' creo nuova feature
+ Dim vPar() As Double
+ Dim sPar As String = String.Empty
+ Me.CalcParamArray(vPar, sPar)
+ ' aggiorno la feature con nuovo valore
+ EgtBeamSetPart(DestBTLPart.nPartId)
+ Dim nNewFeatureId As Integer = EgtBeamAddProcess(Me.nSelGRP, Me.nPRC, Me.nSelSIDE, Me.sDES, DestBTLPart.NewProcId(), Me.frFRAME, vPar, sPar)
+ ' se è stata creata
+ If nNewFeatureId <> GDB_ID.NULL Then
+ Dim NewFeat As New BTLFeature(Me.ParentPart, nNewFeatureId)
+ ' la aggiungo a struttura BTL pezzo di destinazione
+ DestBTLPart.FeatureList.Add(NewFeat)
+ Return True
+ End If
+ Return False
+ End Function
+
+#Region "COMMANDS"
+
+#Region "DeleteFeature"
+
+ Public ReadOnly Property DeleteFeature_Command As ICommand
+ Get
+ If m_cmdDeleteFeature Is Nothing Then
+ m_cmdDeleteFeature = New Command(AddressOf DeleteFeature)
+ End If
+ Return m_cmdDeleteFeature
+ End Get
+ End Property
+
+ Public Sub DeleteFeature()
+ If Map.refMainMenuVM.SelPage = Pages.VIEW Then Map.refLeftPanelVM.RemoveFeature()
+ End Sub
+
+#End Region ' DeleteFeature
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class BTLParam
+ Inherits Core.BTLParam
+
+ ' parametri da struttura
+ Public ReadOnly Property sMin As String
+ Get
+ Select Case nType
+ Case BTLParamType.DOUBLE_
+ Return DoubleToString(m_dMin, 3)
+ Case BTLParamType.LENGTH
+ Return LenToString(m_dMin, 3)
+ Case Else
+ Return ""
+ End Select
+ End Get
+ End Property
+
+ Public ReadOnly Property sMax As String
+ Get
+ Select Case nType
+ Case BTLParamType.DOUBLE_
+ Return DoubleToString(m_dMax, 3)
+ Case BTLParamType.LENGTH
+ Return LenToString(m_dMax, 3)
+ Case Else
+ Return ""
+ End Select
+ End Get
+ End Property
+
+ ' parametri da geometria
+ Public Overrides Property sValue As String
+ Get
+ Select Case nType
+ Case BTLParamType.DOUBLE_
+ Return DoubleToString(m_dValue, 3)
+ Case BTLParamType.LENGTH
+ Return LenToString(m_dValue, 3)
+ Case Else ' stringhe
+ Return m_sValue
+ End Select
+ Return If(nType = BTLParamType.LENGTH, LenToString(m_dValue, 3), DoubleToString(m_dValue, 3))
+ End Get
+ Set(value As String)
+ Dim dNewValue As Double
+ ' trasformo valori
+ Select Case nType
+ Case BTLParamType.DOUBLE_
+ StringToDouble(value, dNewValue)
+ Case BTLParamType.LENGTH
+ StringToLen(value, dNewValue)
+ Case Else
+ ' per string non faccio nulla
+ End Select
+ ' verifico che sia compreso tra minimo e massimo
+ If dNewValue < m_dMin OrElse dNewValue > m_dMax Then
+ MessageBox.Show("Valore non compreso tra minimo e massimo", "Error")
+ NotifyPropertyChanged("sValue")
+ Return
+ End If
+ Select Case nType
+ Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
+ UpdateParamValue(dNewValue, "")
+ Case Else
+ UpdateParamValue(0, value)
+ End Select
+ End Set
+ End Property
+ Public Overrides Property dValue As Double
+ Get
+ Return m_dValue
+ End Get
+ Set(value As Double)
+ m_dValue = value
+ NotifyPropertyChanged("sValue")
+ End Set
+ End Property
+
+ Public ReadOnly Property sDefault As String
+ Get
+ Select Case nType
+ Case BTLParamType.DOUBLE_
+ Return DoubleToString(m_dDefault, 3)
+ Case BTLParamType.LENGTH
+ Return LenToString(m_dDefault, 3)
+ Case Else
+ Return ""
+ End Select
+ End Get
+ End Property
+
+ Public ReadOnly Property sDrawPath As String
+ Get
+ Return Map.refMainWindowVM.MainWindowM.sResourcesRoot & "\Parameters\" & DirectCast(m_ParentFeature, BTLFeature).sDescGRP & "_" & m_sName & "_" & m_ParentFeature.nSelGRP & ".gif"
+ End Get
+ End Property
+
+ ' new per double e length
+ Sub New(ParentFeature As BTLFeature, IsP As Boolean, nType As BTLParamType, sParamName As String, dMin As Double, dMax As Double, dDefault As Double, sDescription As String)
+ MyBase.New(ParentFeature, IsP, nType, sParamName, dMin, dMax, dDefault, sDescription)
+ End Sub
+
+ ' new per stringhe
+ Sub New(ParentFeature As BTLFeature, IsP As Boolean, nType As BTLParamType, sParamName As String, sDescription As String)
+ MyBase.New(ParentFeature, IsP, nType, sParamName, sDescription)
+ End Sub
+
+ ' new per combobox
+ Sub New(ParentFeature As BTLFeature, IsP As Boolean, nType As BTLParamType, sParamName As String, nMin As Integer, nMax As Integer, nDefault As Integer, sDescription As String, ValueList As List(Of String))
+ MyBase.New(ParentFeature, IsP, nType, sParamName, nMin, nMax, nDefault, sDescription, ValueList)
+ End Sub
+
+ ' new per parametro vuoto
+ Sub New(IsP As Boolean, nType As BTLParamType, sParamName As String)
+ MyBase.New(IsP, nType, sParamName)
+ End Sub
+
+ Friend Sub UpdateParamValue(dNewValue As Double, sNewValue As String, Optional bDraw As Boolean = True)
+ ' se P
+ If bIsP Then
+ ' aggiorno la feature con nuovo valore
+ Dim vPar() As Double = Nothing
+ Dim sPar As String = String.Empty
+ ParentFeature.CalcParamArray(vPar, sPar)
+ ' modifico parametro cambiato con value
+ Select Case nType
+ Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
+ vPar(Me.nId - 1) = dNewValue
+ Case BTLParamType.STRING_
+ sPar = sNewValue
+ End Select
+ Dim bOK As Boolean = ParentFeature.UpdateParams(ParentFeature.nSelGRP, ParentFeature.nPRC, ParentFeature.nSelSIDE, ParentFeature.sDES,
+ ParentFeature.nPRID, ParentFeature.frFRAME, vPar, sPar)
+ If bOK Then
+ Select Case nType
+ Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
+ m_dValue = dNewValue
+ Case BTLParamType.STRING_
+ m_sValue = sNewValue
+ End Select
+ ' riseleziono questa feature
+ DirectCast(ParentFeature, BTLFeature).SelGeomFeature()
+ ' rendo non calcolata questa feature
+ DirectCast(ParentFeature, BTLFeature).CalcFeatureUpdate(False, 0, 0, 0, "")
+ ' ed aggiorno stato pezzo
+ DirectCast(ParentFeature.ParentPart, BTLPart).CalcFeatureUpdate()
+ Else
+ NotifyPropertyChanged("sValue")
+ End If
+ If bDraw Then EgtDraw()
+ Else
+ ' se Q
+ If EgtSetInfo(ParentFeature.nFeatureId, "Q" & Me.nId.ToString("D2"), dNewValue) Then
+ m_dValue = dNewValue
+ ' imposto modificato per copie
+ EgtDuploSetModified(ParentFeature.ParentPart.nPartId)
+ End If
+ End If
+ End Sub
+
+End Class
+
+'Friend Class BTLParamDouble
+' Inherits BTLParam
+
+
+
+' Private m_dDefault As Double
+' Friend ReadOnly Property dDefault As Double
+' Get
+' Return m_dDefault
+' End Get
+' End Property
+
+
+'End Class
+
+'Friend Class BTLParamString
+' Inherits BTLParam
+
+' ' parametri da geometria
+' Private m_sValue As String
+' Public Property sValue As String
+' Get
+' Return m_sValue
+' End Get
+' Set(value As String)
+' m_sValue = value
+' 'EgtSetPParam(m_nFeatureId, m_sName, value)
+' EgtDraw()
+' End Set
+' End Property
+
+' Sub New(ParentFeature As BTLFeature, IsP As Boolean, nType As BTLParamType, sParamName As String, sDescription As String)
+' MyBase.New(ParentFeature, IsP, nType, sParamName, sDescription)
+' End Sub
+
+'End Class
+
+'Friend Class BTLParamCombo
+' Inherits BTLParam
+
+' ' parametri da struttura
+' Dim m_nMin As Integer
+' Dim m_nMax As Integer
+
+' Dim m_ValueList As List(Of String)
+
+' ' parametri da geometria
+' Private m_nSelValue As Integer
+' Public Property nSelValue As Integer
+' Get
+' Return m_nSelValue
+' End Get
+' Set(value As Integer)
+' m_nSelValue = value
+' End Set
+' End Property
+
+' Private m_nDefault As Integer
+' Friend ReadOnly Property nDefault As Integer
+' Get
+' Return m_nDefault
+' End Get
+' End Property
+' Sub New(ParentFeature As BTLFeature, IsP As Boolean, nType As BTLParamType, sParamName As String, nMin As Integer, nMax As Integer, nDefault As Integer, sDescription As String, ValueList As List(Of String))
+' MyBase.New(ParentFeature, IsP, nType, sParamName, sDescription)
+' m_nMin = nMin
+' m_nMax = nMax
+' m_nDefault = nDefault
+' m_ValueList = ValueList
+' End Sub
+
+'End Class
+
+Friend Class BTLRawPart
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureInPartInRawPartListV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureInPartInRawPartListV.xaml
new file mode 100644
index 00000000..a5a3b809
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureInPartInRawPartListV.xaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureInPartInRawPartListV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureInPartInRawPartListV.xaml.vb
new file mode 100644
index 00000000..3374296b
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureInPartInRawPartListV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class FeatureInPartInRawPartListV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureListV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureListV.xaml
new file mode 100644
index 00000000..9f186db2
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureListV.xaml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureListV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureListV.xaml.vb
new file mode 100644
index 00000000..9d0670c0
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/FeatureListV.xaml.vb
@@ -0,0 +1,12 @@
+Public Class FeatureListV
+
+ Private Sub FeatureList_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
+ If TypeOf sender Is DataGridRow Then
+ Dim Row As DataGridRow = DirectCast(sender, DataGridRow)
+ If Not IsNothing(Row) AndAlso Row.IsSelected AndAlso Not IsNothing(Map.refProjectVM.BTLStructure.SelPart) Then
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature = Map.refProjectVM.BTLStructure.SelPart.SelFeature
+ End If
+ End If
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/ParameterListV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLParam/ParameterListV.xaml
new file mode 100644
index 00000000..413d4af6
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/ParameterListV.xaml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/ParameterListV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/ParameterListV.xaml.vb
new file mode 100644
index 00000000..7a273b90
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/ParameterListV.xaml.vb
@@ -0,0 +1,12 @@
+Public Class ParameterListV
+
+ Private Sub ParameterList_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
+ If TypeOf sender Is DataGridRow Then
+ Dim Row As DataGridRow = DirectCast(sender, DataGridRow)
+ If Not IsNothing(Row) AndAlso Row.IsSelected AndAlso Not IsNothing(Map.refProjectVM.BTLStructure.SelPart) AndAlso Not IsNothing(Map.refProjectVM.BTLStructure.SelPart.SelFeature) Then
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature.SelPParam = Map.refProjectVM.BTLStructure.SelPart.SelFeature.SelPParam
+ End If
+ End If
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml
new file mode 100644
index 00000000..430edb95
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml.vb
new file mode 100644
index 00000000..eb9d4c75
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml.vb
@@ -0,0 +1,13 @@
+Public Class PartInRawPartListV
+
+ Private Sub PartInRawPartList_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
+ If TypeOf sender Is DataGridRow Then
+ Dim Row As DataGridRow = DirectCast(sender, DataGridRow)
+ If Not IsNothing(Row) AndAlso Row.IsSelected Then
+ Dim MyMachGroup As Core.MyMachGroup = DirectCast(Map.refMachGroupPanelVM.SelectedMachGroup, Core.MyMachGroup)
+ MyMachGroup.SelPart = MyMachGroup.SelPart
+ End If
+ End If
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartListV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartListV.xaml
new file mode 100644
index 00000000..4f3acd11
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartListV.xaml
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartListV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartListV.xaml.vb
new file mode 100644
index 00000000..d38952f1
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartListV.xaml.vb
@@ -0,0 +1,12 @@
+Public Class PartListV
+
+ Private Sub PartList_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
+ If TypeOf sender Is DataGridRow Then
+ Dim Row As DataGridRow = DirectCast(sender, DataGridRow)
+ If Not IsNothing(Row) AndAlso Row.IsSelected Then
+ Map.refProjectVM.BTLStructure.SelPart = Map.refProjectVM.BTLStructure.SelPart
+ End If
+ End If
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartParametersV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartParametersV.xaml
new file mode 100644
index 00000000..1a7a9214
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartParametersV.xaml
@@ -0,0 +1,469 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartParametersV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartParametersV.xaml.vb
new file mode 100644
index 00000000..efae30e7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartParametersV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class PartParametersV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartParametersVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartParametersVM.vb
new file mode 100644
index 00000000..43647e1c
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartParametersVM.vb
@@ -0,0 +1,262 @@
+Imports EgtUILib
+
+Public Class PartParametersVM
+ Inherits VMBase
+
+#Region "Messages"
+
+ Public ReadOnly Property NAM_MSG As String
+ Get
+ Return EgtMsg(61603)
+ End Get
+ End Property
+
+ Public ReadOnly Property SINGLEMEMBERNUM_MSG As String
+ Get
+ Return EgtMsg(61618)
+ End Get
+ End Property
+
+ Public ReadOnly Property ASSEMBLYNUM_MSG As String
+ Get
+ Return EgtMsg(61619)
+ End Get
+ End Property
+
+ Public ReadOnly Property ORDERNUM_MSG As String
+ Get
+ Return EgtMsg(61620)
+ End Get
+ End Property
+
+ Public ReadOnly Property DESIGN_MSG As String
+ Get
+ Return EgtMsg(61621)
+ End Get
+ End Property
+
+ Public ReadOnly Property ANNOT_MSG As String
+ Get
+ Return EgtMsg(61622)
+ End Get
+ End Property
+
+ Public ReadOnly Property STOREY_MSG As String
+ Get
+ Return EgtMsg(61623)
+ End Get
+ End Property
+
+ Public ReadOnly Property GROUP_MSG As String
+ Get
+ Return EgtMsg(61624)
+ End Get
+ End Property
+
+ Public ReadOnly Property PACKAGE_MSG As String
+ Get
+ Return EgtMsg(61625)
+ End Get
+ End Property
+
+ Public ReadOnly Property MATERIAL_MSG As String
+ Get
+ Return EgtMsg(61626)
+ End Get
+ End Property
+
+ Public ReadOnly Property TIMBERGRADE_MSG As String
+ Get
+ Return EgtMsg(61627)
+ End Get
+ End Property
+
+ Public ReadOnly Property QUALITYGRADE_MSG As String
+ Get
+ Return EgtMsg(61628)
+ End Get
+ End Property
+
+ Public ReadOnly Property COUNT_MSG As String
+ Get
+ Return EgtMsg(61629)
+ End Get
+ End Property
+
+ Public ReadOnly Property COLOUR_MSG As String
+ Get
+ Return EgtMsg(61630)
+ End Get
+ End Property
+
+ Public ReadOnly Property TRANSPARENCY_MSG As String
+ Get
+ Return EgtMsg(61631)
+ End Get
+ End Property
+
+ Public ReadOnly Property PLANINGLEN_MSG As String
+ Get
+ Return EgtMsg(61632)
+ End Get
+ End Property
+
+ Public ReadOnly Property STARTOFFSET_MSG As String
+ Get
+ Return EgtMsg(61633)
+ End Get
+ End Property
+
+ Public ReadOnly Property ENDOFFSET_MSG As String
+ Get
+ Return EgtMsg(61634)
+ End Get
+ End Property
+
+ Public ReadOnly Property UID_MSG As String
+ Get
+ Return EgtMsg(61691)
+ End Get
+ End Property
+
+ Public ReadOnly Property TRANSFORIG_MSG As String
+ Get
+ Return EgtMsg(61635)
+ End Get
+ End Property
+
+ Public ReadOnly Property TRANSFVERSX_MSG As String
+ Get
+ Return EgtMsg(61636)
+ End Get
+ End Property
+
+ Public ReadOnly Property TRANSFVERSY_MSG As String
+ Get
+ Return EgtMsg(61637)
+ End Get
+ End Property
+
+ Public ReadOnly Property CAMBERSIDE_MSG As String
+ Get
+ Return EgtMsg(61638)
+ End Get
+ End Property
+
+ Public ReadOnly Property CAMBERPARAMS_MSG As String
+ Get
+ Return EgtMsg(61639)
+ End Get
+ End Property
+
+ Public ReadOnly Property REFSIDEFIXCLAMP_MSG As String
+ Get
+ Return EgtMsg(61640)
+ End Get
+ End Property
+
+ Public ReadOnly Property PARTOFFSETPARAMS_MSG As String
+ Get
+ Return EgtMsg(61641)
+ End Get
+ End Property
+
+ Public ReadOnly Property PROCESSINGQUALITY_MSG As String
+ Get
+ Return EgtMsg(61642)
+ End Get
+ End Property
+
+ Public ReadOnly Property RECESS_MSG As String
+ Get
+ Return EgtMsg(61643)
+ End Get
+ End Property
+
+ Public ReadOnly Property STOREYTYPE_MSG As String
+ Get
+ Return EgtMsg(61644)
+ End Get
+ End Property
+
+ Public ReadOnly Property ELEMENTNUM_MSG As String
+ Get
+ Return EgtMsg(61645)
+ End Get
+ End Property
+
+ Public ReadOnly Property LAYER_MSG As String
+ Get
+ Return EgtMsg(61646)
+ End Get
+ End Property
+
+ Public ReadOnly Property MODULENUM_MSG As String
+ Get
+ Return EgtMsg(61647)
+ End Get
+ End Property
+
+ Public ReadOnly Property USERATTRIBUTE_MSG As String
+ Get
+ Return EgtMsg(61648)
+ End Get
+ End Property
+
+ Public ReadOnly Property COMMENT_MSG As String
+ Get
+ Return EgtMsg(61649)
+ End Get
+ End Property
+
+ Public ReadOnly Property GRAINDIRECTION_MSG As String
+ Get
+ Return EgtMsg(61650)
+ End Get
+ End Property
+
+ Public ReadOnly Property GRAINDIRALIGN_MSG As String
+ Get
+ Return EgtMsg(61651)
+ End Get
+ End Property
+
+ Public ReadOnly Property REFSIDE_MSG As String
+ Get
+ Return EgtMsg(61652)
+ End Get
+ End Property
+
+ Public ReadOnly Property REFSIDEALIGN_MSG As String
+ Get
+ Return EgtMsg(61653)
+ End Get
+ End Property
+
+ Public ReadOnly Property ALIGNLOCATION_MSG As String
+ Get
+ Return EgtMsg(61654)
+ End Get
+ End Property
+
+ Public ReadOnly Property ALIGNENDTYPE_MSG As String
+ Get
+ Return EgtMsg(61655)
+ End Get
+ End Property
+
+ Public ReadOnly Property MATERIALTYPEGRP_MSG As String
+ Get
+ Return EgtMsg(61656)
+ End Get
+ End Property
+
+ Public ReadOnly Property MATERIALTYPESPEC_MSG As String
+ Get
+ Return EgtMsg(61657)
+ End Get
+ End Property
+
+#End Region ' Messages
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml
new file mode 100644
index 00000000..88c2d16c
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml.vb
new file mode 100644
index 00000000..372afa72
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class RawPartListV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListVM.vb
new file mode 100644
index 00000000..3c7a494e
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/RawPartListVM.vb
@@ -0,0 +1,30 @@
+Public Class RawPartListVM
+
+#Region "FIELDS & PROPERTIES"
+
+ Private m_bL_IsReadOnly As Boolean = True
+ Public Property bL_IsReadOnly As Boolean
+ Get
+ Return m_bL_IsReadOnly
+ End Get
+ Set(value As Boolean)
+ m_bL_IsReadOnly = value
+ End Set
+ End Property
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Aggiungo riferimento a Map
+ Map.SetRefRawPartListVM(Me)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+ Friend Sub SelMachine_Changed()
+
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BottomPanel/BottomPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/BottomPanel/BottomPanelV.xaml
new file mode 100644
index 00000000..7dcfc9a9
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BottomPanel/BottomPanelV.xaml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/BottomPanel/BottomPanelV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/BottomPanel/BottomPanelV.xaml.vb
new file mode 100644
index 00000000..7960e949
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BottomPanel/BottomPanelV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class BottomPanelV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/BottomPanel/BottomPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/BottomPanel/BottomPanelVM.vb
new file mode 100644
index 00000000..c9fc9391
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/BottomPanel/BottomPanelVM.vb
@@ -0,0 +1,42 @@
+Public Class BottomPanelVM
+ Inherits VMBase
+
+ Friend Enum PartFeatureTab As Integer
+ PART = 0
+ FEATURE = 1
+ End Enum
+ Private m_SelPartFeatureTab As PartFeatureTab
+ Public Property SelPartFeatureTab As Integer
+ Get
+ Return m_SelPartFeatureTab
+ End Get
+ Set(value As Integer)
+ m_SelPartFeatureTab = value
+ End Set
+ End Property
+ Friend Sub SetSelPartFeatureTab(SelPartFeatureTab As PartFeatureTab)
+ m_SelPartFeatureTab = SelPartFeatureTab
+ NotifyPropertyChanged("SelPartFeatureTab")
+ End Sub
+
+ Private m_sCurrDraw As String
+ Public ReadOnly Property sCurrDraw As String
+ Get
+ Return m_sCurrDraw
+ End Get
+ End Property
+ Friend Sub SetCurrDraw(sCurrDraw As String)
+ m_sCurrDraw = sCurrDraw
+ NotifyPropertyChanged("sCurrDraw")
+ End Sub
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in EgtCAM5Map
+ Map.SetRefBottomPanelVM(Me)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ChangeParameterWnd/ChangeParameterWndV.xaml b/EgtBEAMWALL.ViewerOptimizer/ChangeParameterWnd/ChangeParameterWndV.xaml
new file mode 100644
index 00000000..d39c92b4
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ChangeParameterWnd/ChangeParameterWndV.xaml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ChangeParameterWnd/ChangeParameterWndV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/ChangeParameterWnd/ChangeParameterWndV.xaml.vb
new file mode 100644
index 00000000..17039d44
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ChangeParameterWnd/ChangeParameterWndV.xaml.vb
@@ -0,0 +1,18 @@
+Public Class ChangeParameterWndV
+
+ Private WithEvents m_ChangeParameterWndVM As ChangeParameterWndVM
+
+ Sub New(Owner As Window, ChangeParameterWndVM As ChangeParameterWndVM)
+ MyBase.New(Owner)
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = ChangeParameterWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_ChangeParameterWndVM = ChangeParameterWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_ChangeParameterWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ChangeParameterWnd/ChangeParameterWndVM.vb b/EgtBEAMWALL.ViewerOptimizer/ChangeParameterWnd/ChangeParameterWndVM.vb
new file mode 100644
index 00000000..d9bf0ad7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ChangeParameterWnd/ChangeParameterWndVM.vb
@@ -0,0 +1,229 @@
+Imports System.Collections.ObjectModel
+Imports EgtWPFLib5
+Imports EgtBEAMWALL.Core
+
+Public Class ChangeParameterWndVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ Private m_PRCList As New ObservableCollection(Of PRC)
+ Public ReadOnly Property PRCList As ObservableCollection(Of PRC)
+ Get
+ Return m_PRCList
+ End Get
+ End Property
+
+ Private m_SelPRC As PRC = Nothing
+ Public Property SelPRC As PRC
+ Get
+ Return m_SelPRC
+ End Get
+ Set(value As PRC)
+ If value IsNot m_SelPRC Then
+ m_SelPRC = value
+ ' aggiorno lista parametri
+ m_ParamList.Clear()
+ Dim ParamIndex As Integer = 1
+ Dim NewBTLParam As BTLParam = Nothing
+ ' leggo tutti i P della feature
+ While BTLIniFile.GetBeamPrivateProfileParam(m_SelPRC.nGRP, m_SelPRC.nPRC, True, ParamIndex, Nothing, NewBTLParam)
+ m_ParamList.Add(New Parameters(True, NewBTLParam.nType, NewBTLParam.sName))
+ ParamIndex += 1
+ End While
+ ' leggo tutti i Q della feature
+ ParamIndex = 1
+ While BTLIniFile.GetBeamPrivateProfileParam(m_SelPRC.nGRP, m_SelPRC.nPRC, False, ParamIndex, Nothing, NewBTLParam)
+ m_ParamList.Add(New Parameters(False, NewBTLParam.nType, NewBTLParam.sName))
+ ParamIndex += 1
+ End While
+ ' aggiungo bDO come parametro
+ m_ParamList.Add(New Parameters(False, BTLParamType.CHECKBOX, "Abilitazione", True))
+ End If
+ End Set
+ End Property
+
+ Private m_ParamList As New ObservableCollection(Of Parameters)
+ Public Property ParamList As ObservableCollection(Of Parameters)
+ Get
+ Return m_ParamList
+ End Get
+ Set(value As ObservableCollection(Of Parameters))
+ m_ParamList = value
+ End Set
+ End Property
+ Private m_SelParam As Parameters = New Parameters(False, BTLParamType.STRING_, "") ' per dargli un valore iniziale ed evitare che visualizzi sia text che check
+ Public Property SelParam As Parameters
+ Get
+ Return m_SelParam
+ End Get
+ Set(value As Parameters)
+ m_SelParam = value
+ NotifyPropertyChanged("SelParam")
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ Dim TempPRCList As New ObservableCollection(Of Integer)
+ GetBeamPrivateProfileProcessList(GRPType.L, TempPRCList)
+ m_PRCList.Clear()
+ For Each PRC In TempPRCList
+ m_PRCList.Add(New PRC(GRPType.L, PRC, GetBeamPrivateProfileName(GRPType.L, PRC)))
+ Next
+ GetBeamPrivateProfileProcessList(GRPType.T, TempPRCList)
+ For Each PRC In TempPRCList
+ m_PRCList.Add(New PRC(GRPType.T, PRC, GetBeamPrivateProfileName(GRPType.T, PRC)))
+ Next
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "Ok"
+
+ Public ReadOnly Property Ok_Command As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ Public Sub Ok()
+ 'verifico che tutti i campi contengano un valore valido
+ If Not IsNothing(m_SelPRC) AndAlso
+ Not IsNothing(m_SelParam) AndAlso m_SelParam.sName <> "" Then
+ RaiseEvent m_CloseWindow(True)
+ Else
+ MessageBox.Show("Errore! Impossibile modificare questi valori", "Errore")
+ End If
+ End Sub
+
+#End Region ' Ok
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class Parameters
+ Inherits BTLParam
+
+ Private m_dActualValue As Double
+ Private m_sActualValue As String
+ Public ReadOnly Property dActualValue As Double
+ Get
+ Return m_dActualValue
+ End Get
+ End Property
+ Public Property sActualValue As String
+ Get
+ Select Case nType
+ Case BTLParamType.DOUBLE_
+ Return DoubleToString(m_dActualValue, 3)
+ Case BTLParamType.LENGTH
+ Return LenToString(m_dActualValue, 3)
+ Case Else ' BTLParamType.STRING_
+ Return m_sActualValue
+ End Select
+ End Get
+ Set(value As String)
+ Select Case nType
+ Case BTLParamType.DOUBLE_
+ StringToDouble(value, m_dActualValue)
+ Case BTLParamType.LENGTH
+ StringToLen(value, m_dActualValue)
+ Case Else ' BTLParamType.STRING_
+ m_sActualValue = value
+ End Select
+ End Set
+ End Property
+
+ Private m_dNewValue As Double
+ Private m_sNewValue As String
+ Public ReadOnly Property dNewValue As Double
+ Get
+ Return m_dNewValue
+ End Get
+ End Property
+ Public Property sNewValue As String
+ Get
+ Select Case nType
+ Case BTLParamType.DOUBLE_
+ Return DoubleToString(m_dNewValue, 3)
+ Case BTLParamType.LENGTH
+ Return LenToString(m_dNewValue, 3)
+ Case Else ' BTLParamType.STRING_
+ Return m_sNewValue
+ End Select
+ End Get
+ Set(value As String)
+ Select Case nType
+ Case BTLParamType.DOUBLE_
+ StringToDouble(value, m_dNewValue)
+ Case BTLParamType.LENGTH
+ StringToLen(value, m_dNewValue)
+ Case Else ' BTLParamType.STRING_
+ m_sNewValue = value
+ End Select
+ End Set
+ End Property
+
+ Private m_bActualValue As Boolean
+ Public Property bActualValue As String
+ Get
+ Return m_bActualValue
+ End Get
+ Set(value As String)
+ m_bActualValue = value
+ End Set
+ End Property
+
+ Private m_bNewValue As String
+ Public Property bNewValue As String
+ Get
+ Return m_bNewValue
+ End Get
+ Set(value As String)
+ m_bNewValue = value
+ End Set
+ End Property
+
+ Private m_bIsCheckBox As Boolean = False
+ Public Property IsTextBox_Visibility As Visibility
+ Get
+ Return If(m_bIsCheckBox, Visibility.Collapsed, Visibility.Visible)
+ End Get
+ Set(value As Visibility)
+ m_bIsCheckBox = Not value
+ End Set
+ End Property
+ Public Property IsCheckBox_Visibility As Visibility
+ Get
+ Return If(m_bIsCheckBox, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_bIsCheckBox = value
+ End Set
+ End Property
+
+ Sub New(IsP As Boolean, nType As BTLParamType, sParamName As String, Optional IsCheckBox As Boolean = False)
+ MyBase.New(IsP, nType, sParamName)
+ m_bIsCheckBox = IsCheckBox
+ End Sub
+
+ 'Shared Operator =(ByVal S1 As Parameters, ByVal S2 As BTLParam) As Boolean
+ ' Return (S1.m_dH <> S2.m_dH OrElse S1.m_dW <> S2.m_dW)
+ 'End Operator
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml b/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml
new file mode 100644
index 00000000..6b87601a
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml.vb
new file mode 100644
index 00000000..b380aec2
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml.vb
@@ -0,0 +1,5 @@
+Public Class ConfigurationPageV
+ Private Sub ScrollViewer_Scroll(sender As Object, e As Primitives.ScrollEventArgs)
+
+ End Sub
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageVM.vb b/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageVM.vb
new file mode 100644
index 00000000..c2d6b9d3
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageVM.vb
@@ -0,0 +1,321 @@
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class ConfigurationPageVM
+
+ ' flag modifica parametri Macchina
+ Friend bModifyMachParam As Boolean
+
+ ' Definizione comandi
+ Private m_cmdSave As ICommand
+
+ Private m_ConfigMachTableList As New ObservableCollection(Of MachTable)
+ Public Property ConfigMachTableList As ObservableCollection(Of MachTable)
+ Get
+ Return m_ConfigMachTableList
+ End Get
+ Set(value As ObservableCollection(Of MachTable))
+ m_ConfigMachTableList = value
+ End Set
+ End Property
+
+#Region "Constuctor"
+
+ Sub New()
+ ' imposto riferimento in Map
+ Map.SetRefConfigurationPageVM(Me)
+ ' assegno le liste dei parametri della macchina corrente alla ConfigMachTableList alla pagina di Configurazione
+ ConfigMachTableList = CurrentMachine.MachTableList
+ End Sub
+
+#End Region ' Constuctor
+
+#Region "SaveCommand"
+
+ '''
+ ''' Returns a command that do Save.
+ '''
+ Public ReadOnly Property SaveCommand As ICommand
+ Get
+ If m_cmdSave Is Nothing Then
+ m_cmdSave = New Command(AddressOf Save)
+ End If
+ Return m_cmdSave
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Save. This method is invoked by the SaveCommand.
+ '''
+ Public Sub Save()
+ WriteMachParams()
+ End Sub
+
+#End Region ' SaveCommand
+
+#Region "Methods"
+
+ ' funzione che scrive i parametri modificati sul file INI
+ Public Sub WriteMachParams()
+ For Each MachTableItem In ConfigMachTableList
+ For Each MachParamItem In MachTableItem.MachParamList
+ If MachParamItem.IsModified Then
+ Dim sMachParamType As String = String.Empty
+ Select Case MachParamItem.nType
+ Case MachParamType.DOUBLE_
+ sMachParamType = "d"
+ Case MachParamType.STRING_
+ sMachParamType = "s"
+ Case MachParamType.LENGTH
+ sMachParamType = "l"
+ End Select
+ Dim MachParamString As String = sMachParamType & "," & MachParamItem.sName & "," & MachParamItem.sValue & "," & MachParamItem.sDescription
+ Dim bOk = WriteMachPrivateProfileString(MachParamItem.nParentTable, MachParamItem.nParamIndex, MachParamString)
+ If Not bOk Then
+ MessageBox.Show("Errore nella scrittura di un parametro Macchina", "Error")
+ Return
+ End If
+ MachParamItem.IsModifiedReset()
+ End If
+ Next
+ Next
+ End Sub
+
+ ' funzione che verifica la modifica dei parametri e ne chiede il salvataggio
+ Friend Function VerifyConfigPageModification() As Boolean
+ For Each MachTableItem In ConfigMachTableList
+ For Each MachParamItem In MachTableItem.MachParamList
+ If MachParamItem.IsModified Then
+ If MessageBox.Show("Salvare le modifiche apportate ai parametri Macchina?", "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
+ ' salvo parametri Macchina
+ Save()
+ Else
+ ' se da non salvare
+ CreateMachParams()
+ Return False
+ End If
+ End If
+ Next
+ Next
+ Return True
+ End Function
+
+ ' funzione che verifica l'inserimento della password quando si edita un parametro Macchina
+ Friend Function VerifyConfigPagePassword() As Boolean
+ ' Display message, title, and default value.
+ Dim sPwdInput = InputBox("Inserire Password: ", "Richiesta Pwd")
+ ' Lettura PWD dall'INI e confronto
+ Dim sPwdIni As String = String.Empty
+ If GetMainPrivateProfileString(S_MACH, K_PASSWORD, "", sPwdIni) <> 0 Then
+ If sPwdIni = sPwdInput Then Return True
+ End If
+ Return False
+ End Function
+
+#End Region ' Methods
+
+End Class
+
+Public Class MachParam
+ Inherits VMBase
+
+ ' table a cui appartiene il parametro
+ Private m_nParentTable As Integer
+ Friend ReadOnly Property nParentTable As Integer
+ Get
+ Return m_nParentTable
+ End Get
+ End Property
+
+ ' indice del parametro
+ Private m_nParamIndex As Integer
+ Friend ReadOnly Property nParamIndex As Integer
+ Get
+ Return m_nParamIndex
+ End Get
+ End Property
+
+ ' tipo della variabile
+ Private m_nType As MachParamType
+ Friend ReadOnly Property nType As MachParamType
+ Get
+ Return m_nType
+ End Get
+ End Property
+
+ ' parametri da struttura
+ Private m_sName As String
+ Public Property sName As String
+ Get
+ Return m_sName
+ End Get
+ Set(value As String)
+ m_sName = value
+ End Set
+ End Property
+
+ ' parametri da geometria
+ Private m_IsModifiedValue As Boolean = False
+ Private m_dValue As Double
+ Private m_sValue As String
+ Public Property sValue As String
+ Get
+ Select Case nType
+ Case MachParamType.DOUBLE_
+ Return DoubleToString(m_dValue, 3)
+ Case MachParamType.LENGTH
+ Return LenToString(m_dValue, 3)
+ Case Else ' stringhe
+ Return m_sValue
+ End Select
+ Return If(nType = MachParamType.LENGTH, LenToString(m_dValue, 3), DoubleToString(m_dValue, 3))
+ End Get
+ Set(value As String)
+ Dim dNewValue As Double
+ ' verifico se valore immesso è diverso dall'originale
+ If nParentTable > 0 Then
+ Dim sOrigValue As String = String.Empty
+ Dim dOrigValue As Double
+ MachParamIniFile.GetMachPrivateProfileParamValue(nParentTable, nParamIndex, sOrigValue)
+ ' trasformo valori
+ Select Case nType
+ Case MachParamType.DOUBLE_
+ StringToDouble(value, dNewValue)
+ StringToDouble(sOrigValue, dOrigValue)
+ Case MachParamType.LENGTH
+ StringToLen(value, dNewValue)
+ StringToLen(sOrigValue, dOrigValue)
+ Case Else
+ ' per string non faccio nulla
+ End Select
+ m_IsModifiedValue = dNewValue <> dOrigValue
+ End If
+ ' se valore immesso è diverso e password non inserita
+ If m_IsModifiedValue AndAlso Not Map.refConfigurationPageVM.bModifyMachParam Then
+ Map.refConfigurationPageVM.bModifyMachParam = Map.refConfigurationPageVM.VerifyConfigPagePassword()
+ If Not Map.refConfigurationPageVM.bModifyMachParam Then
+ NotifyPropertyChanged("sValue")
+ m_IsModifiedValue = False
+ Return
+ End If
+ End If
+
+ Select Case nType
+ Case MachParamType.DOUBLE_, MachParamType.LENGTH
+ UpdateParamValue(dNewValue, "")
+ Case Else
+ UpdateParamValue(0, value)
+ End Select
+ End Set
+ End Property
+ Public Property dValue As Double
+ Get
+ Return m_dValue
+ End Get
+ Set(value As Double)
+ m_dValue = value
+ NotifyPropertyChanged("sValue")
+ End Set
+ End Property
+
+ ' descrizione del parametro
+ Private m_sDescription As String
+ Public Property sDescription As String
+ Get
+ Return m_sDescription
+ End Get
+ Set(value As String)
+ m_sDescription = value
+ End Set
+ End Property
+
+ Private Sub StdInit(nParentTable As Integer, nParamIndex As Integer, Type As MachParamType, sName As String, sDescription As String)
+ m_nParentTable = nParentTable
+ m_nParamIndex = nParamIndex
+ m_nType = Type
+ m_sName = sName
+ Dim nDescription As Integer
+ If IsNumeric(sDescription) AndAlso Integer.TryParse(sDescription, nDescription) Then
+ m_sDescription = EgtMsg(sDescription)
+ Else
+ m_sDescription = sDescription
+ End If
+ End Sub
+
+ ' new per double e length
+ Sub New(nParentTable As Integer, nParamIndex As Integer, nType As MachParamType, sParamName As String, dValue As Double, sDescription As String)
+ StdInit(nParentTable, nParamIndex, nType, sParamName, sDescription)
+ m_dValue = dValue 'sValue = DoubleToString(dValue, 3)
+ End Sub
+
+ ' new per stringhe
+ Sub New(nParentTable As Integer, nParamIndex As Integer, nType As MachParamType, sParamName As String, sDescription As String)
+ StdInit(nParentTable, nParamIndex, nType, sParamName, sDescription)
+ End Sub
+
+ ' new per parametro vuoto
+ Sub New(nType As MachParamType, nParamIndex As Integer, sParamName As String)
+ StdInit(Nothing, nParamIndex, nType, sParamName, "")
+ End Sub
+
+ Friend Sub UpdateParamValue(dNewValue As Double, sNewValue As String, Optional bDraw As Boolean = True)
+ Select Case nType
+ Case MachParamType.DOUBLE_, MachParamType.LENGTH
+ m_dValue = dNewValue
+ Case MachParamType.STRING_
+ m_sValue = sNewValue
+ End Select
+ End Sub
+
+ Public ReadOnly Property IsModified() As Boolean
+ Get
+ Return m_IsModifiedValue
+ End Get
+ End Property
+
+ Public Sub IsModifiedReset()
+ m_IsModifiedValue = False
+ End Sub
+
+End Class
+
+Public Class MachTable
+ Inherits VMBase
+
+ ' nome della table
+ Private m_sName As String
+ Public Property sName As String
+ Get
+ Return m_sName
+ End Get
+ Set(value As String)
+ m_sName = value
+ End Set
+ End Property
+
+ Private m_MachParamList As New ObservableCollection(Of MachParam)
+ Public Property MachParamList As ObservableCollection(Of MachParam)
+ Get
+ Return m_MachParamList
+ End Get
+ Set(value As ObservableCollection(Of MachParam))
+ m_MachParamList = value
+ End Set
+ End Property
+
+ Sub New(Name As String, ParamList As ObservableCollection(Of MachParam))
+ sName = Name
+ MachParamList = ParamList
+ End Sub
+
+End Class
+
+' Tipo parametro nel file di configurazione Macchina
+Public Enum MachParamType As Integer
+ DOUBLE_ = 1
+ STRING_ = 2
+ COMBO = 3
+ LENGTH = 4
+ CHECKBOX = 5
+End Enum
diff --git a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstBeam.vb b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstBeam.vb
new file mode 100644
index 00000000..b1642789
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstBeam.vb
@@ -0,0 +1,257 @@
+Public Module ConstBeam
+
+ Public Enum BTLParamType As Integer
+ DOUBLE_ = 1
+ STRING_ = 2
+ COMBO = 3
+ LENGTH = 4
+ CHECKBOX = 5
+ End Enum
+
+ Public Enum BTLPartParam As Integer
+ NULL = 0
+ PDN = 1
+ NAM = 2
+ GRP = 3
+ End Enum
+
+ Public Enum GRPType As Integer
+ L = 0
+ T = 1
+ End Enum
+
+ Enum MachineType As Integer
+ NULL = 0
+ BEAM = 1
+ WALL = 2
+ End Enum
+
+ Enum CalcStates As Integer
+ NOTCALCULATED = -1
+ OK = 0
+ WARNING = 1
+ ERROR_ = 2
+ End Enum
+
+ Public Enum Range As Integer
+ STANDARD = 1
+ EXTENDED = 2
+ End Enum
+
+ Public Enum PartOffset_RefSideFixClamp As Integer
+ INACTIVE = 0
+ REFSIDE1 = 1
+ REFSIDE2 = 2
+ REFSIDE3 = 3
+ REFSIDE4 = 4
+ End Enum
+
+ Public Enum ProcessingQuality As Integer
+ AUTOMATIC = 1
+ VISIBLE = 2
+ FAST = 3
+ End Enum
+
+ Public Enum Recess As Integer
+ AUTOMATIC = 1
+ MANUAL = 2
+ End Enum
+
+ Public Enum StoreyType As Integer
+ CEILING = 1
+ ROOF = 2
+ WALL = 3
+ End Enum
+
+ Public Enum AlignmentLocation As Integer
+ INACTIV = 0
+ BR = 1
+ TR = 2
+ BA = 3
+ TA = 4
+ HC = 5
+ VC = 6
+ AC = 7
+ End Enum
+
+ Public Enum AlignmentEndtype As Integer
+ R = 1
+ A = 2
+ D = 3
+ End Enum
+
+ Public Enum MaterialType As Integer
+ INACTIV = 0
+ BA = 1
+ CL = 2
+ MT = 3
+ ME_ = 4
+ GB = 5
+ GF = 6
+ IN_ = 7
+ SH = 8
+ FB = 9
+ PB = 10
+ PL = 11
+ End Enum
+
+ Public Enum MoveDirections As Integer
+ UP = -1
+ DOWN = 1
+ End Enum
+
+ Public Const BTLFEATURES_FILE_NAME As String = "BTLFeatures.ini"
+
+ 'Public Const S_GENERAL As String = "General"
+ 'Public Const K_DEBUG As String = "Debug"
+
+ ' Tipo di progetto
+ Public Enum ProjectType As Integer
+ PROJ = 1
+ PROD = 2
+ End Enum
+
+ Friend Const PROJ As String = "PROJ"
+ Friend Const FILENAMESEPARATOR As Char = "^"c
+ Friend Const BTLINFO As String = "BtlInfo"
+
+ ' info parametri BTL
+ Friend Const BTL_PRT_PDN As String = "PDN"
+ Friend Const BTL_PRT_DO As String = "DO"
+ Friend Const BTL_PRT_NAM As String = "NAM"
+ Friend Const BTL_PRT_L As String = "L"
+ Friend Const BTL_PRT_W As String = "W"
+ Friend Const BTL_PRT_H As String = "H"
+ Friend Const BTL_PRT_CNT As String = "CNT"
+ Friend Const BTL_PRT_ROTATED As String = "ROTATED"
+ Friend Const BTL_PRT_INVERTED As String = "INVERTED"
+ Friend Const BTL_PRT_MATERIAL As String = "MATERIAL"
+ ' parametri pezzo
+ Friend Const BTL_PRT_SINGLEMEMBERNUM = "SINGLEMEMBERNUMBER"
+ Friend Const BTL_PRT_ASSEMBLYNUM = "ASSEMBLYNUMBER"
+ Friend Const BTL_PRT_ORDERNUM = "ORDERNUMBER"
+ Friend Const BTL_PRT_DESIGNATION = "DESIGNATION"
+ Friend Const BTL_PRT_ANNOTATION = "ANNOTATION"
+ Friend Const BTL_PRT_STOREY = "STOREY"
+ Friend Const BTL_PRT_GROUP = "GROUP"
+ Friend Const BTL_PRT_PACKAGE = "PACKAGE"
+ Friend Const BTL_PRT_TIMBERGRADE = "TIMBERGRADE"
+ Friend Const BTL_PRT_QUALITYGRADE = "QUALITYGRADE"
+ Friend Const BTL_PRT_COLOUR = "COLOUR"
+ Friend Const BTL_PRT_PLANINGLENGTH = "PLANINGLENGTH"
+ Friend Const BTL_PRT_STARTOFFSET = "STARTOFFSET"
+ Friend Const BTL_PRT_ENDOFFSET = "ENDOFFSET"
+ Friend Const BTL_PRT_UID = "UID"
+ Friend Const BTL_PRT_TRANSFORMATION = "TRANSFORMATION"
+ Friend Const BTL_PRT_CAMBER = "CAMBER"
+ Friend Const BTL_PRT_PARTOFFSET = "PARTOFFSET"
+ Friend Const BTL_PRT_PROCESSINGQUALITY = "PROCESSINGQUALITY"
+ Friend Const BTL_PRT_RECESS = "RECESS"
+ Friend Const BTL_PRT_STOREYTYPE = "STOREYTYPE"
+ Friend Const BTL_PRT_ELEMENTNUM = "ELEMENTNUMBER"
+ Friend Const BTL_PRT_LAYER = "LAYER"
+ Friend Const BTL_PRT_MODULENUM = "MODULENUMBER"
+ 'Friend Const BTL_PRT_USERATTRIBUTE = "USERATTRIBUTE"
+ Friend Const BTL_PRT_COMMENT = "COMMENT"
+ Friend Const BTL_PRT_GRAINDIR = "GRAINDIRECTION"
+ Friend Const BTL_PRT_REFSIDE = "REFERENCESIDE"
+ Friend Const BTL_PRT_ALIGNMENT = "ALIGNMENT"
+ Friend Const BTL_PRT_MATERIALTYPE = "MATERIALTYPE"
+
+ ' parametri generici
+ Friend Const BTL_GEN_PROJNUM = "PROJECTNUMBER"
+ Friend Const BTL_GEN_PROJNAME = "PROJECTNAME"
+ Friend Const BTL_GEN_PROJPART = "PROJECTPART"
+ Friend Const BTL_GEN_PROJGUID = "PROJECTGUID"
+ Friend Const BTL_GEN_LISTNAME = "LISTNAME"
+ Friend Const BTL_GEN_CUSTOMER = "CUSTOMER"
+ Friend Const BTL_GEN_ARCHITECT = "ARCHITECT"
+ Friend Const BTL_GEN_EDITOR = "EDITOR"
+ Friend Const BTL_GEN_DELIVDATE = "DELIVERYDATE"
+ Friend Const BTL_GEN_EXPDATE = "EXPORTDATE"
+ Friend Const BTL_GEN_EXPTIME = "EXPORTTIME"
+ Friend Const BTL_GEN_EXPRELEASE = "EXPORTRELEASE"
+ Friend Const BTL_GEN_LANGUAGE = "LANGUAGE"
+ Friend Const BTL_GEN_RANGE = "RANGE"
+ Friend Const BTL_GEN_COMPUTERNAME = "COMPUTERNAME"
+ Friend Const BTL_GEN_USER = "USER"
+ Friend Const BTL_GEN_SRCFILE = "SOURCEFILE"
+ Friend Const BTL_GEN_EXPFILE = "EXPORTFILE"
+ Friend Const BTL_GEN_USERATTRIBUTE = "USERATTRIBUTE"
+
+ Friend Const PROCESSINGS As String = "Processings"
+ Friend Const OUTLINE As String = "Outline"
+ Friend Const BTL_FTR_GRP As String = "GRP"
+ Friend Const BTL_FTR_PRC As String = "PRC"
+ Friend Const BTL_FTR_DO As String = "DO"
+ Friend Const BTL_FTR_SIDE As String = "SIDE"
+ Friend Const BTL_FTR_NAME As String = "NAME"
+ Friend Const BTL_FTR_DES As String = "DES"
+ Friend Const BTL_FTR_PRID As String = "PRID"
+ Friend Const BTL_FTR_FRAME As String = "FRAME"
+
+ ' parametri machgroup grezzi
+ Friend Const MGR_RPT_ID As String = "ID"
+ Friend Const MGR_RPT_L As String = "L"
+ Friend Const MGR_RPT_W As String = "W"
+ Friend Const MGR_RPT_H As String = "H"
+ Friend Const MGR_RPT_WASTE As String = "WASTE"
+ Friend Const MGR_RPT_USAGE As String = "USAGE"
+ Friend Const MGR_RPT_STARTCUT As String = "STARTCUT"
+ Friend Const MGR_RPT_MATERIAL As String = "MATERIAL"
+
+ Friend Const MGR_PRT_PDN As String = "PDN"
+ Friend Const MGR_PRT_L As String = "L"
+ Friend Const MGR_PRT_W As String = "W"
+ Friend Const MGR_PRT_H As String = "H"
+ Friend Const MGR_PRT_DES As String = "DES"
+ Friend Const MGR_PRT_STARTCUT As String = "STARTCUT"
+ Friend Const MGR_PRT_MATERIAL As String = "MATERIAL"
+
+ Friend Const MGR_FTR_GRP As String = "GRP"
+ Friend Const MGR_FTR_PRC As String = "PRC"
+ Friend Const MGR_FTR_DO As String = "DO"
+ Friend Const MGR_FTR_SIDE As String = "SIDE"
+ Friend Const MGR_FTR_NAME As String = "NAME"
+ Friend Const MGR_FTR_DES As String = "DES"
+ Friend Const MGR_FTR_PRID As String = "PRID"
+ Friend Const MGR_FTR_FRAME As String = "FRAME"
+
+ ' parametri creazione barre
+ Friend Const MGR_RPT_BARLEN As String = "BARLEN"
+ Friend Const MGR_RPT_BARHEIGHT As String = "BARHEIGHT"
+ Friend Const MGR_RPT_BARWIDTH As String = "BARWIDTH"
+ Friend Const MGR_RPT_PANELLEN As String = "PANELLEN"
+ Friend Const MGR_RPT_PANELWIDTH As String = "PANELWIDTH"
+ Friend Const MGR_RPT_PANELHEIGHT As String = "PANELHEIGHT"
+ Friend Const MGR_RPT_PART As String = "PART"
+
+ ' parametri errori integration
+ Friend Const ITG_CUTID As String = "CUTID"
+ Friend Const ITG_TASKID As String = "TASKID"
+ Friend Const ITG_PROJ_ERR As String = "PROJ_ERR"
+ Friend Const ITG_PROJ_MSG As String = "PROJ_MSG"
+ Friend Const ITG_PROJ_ROT As String = "PROJ_ROT"
+ Friend Const ITG_PROJ_FALL As String = "PROJ_FALL"
+ Friend Const ITG_PROJ_TIME As String = "PROJ_TIME"
+
+ ' parametri errori integration
+ Friend Const ITG_PROD_ERR As String = "PROD_ERR"
+ Friend Const ITG_PROD_MSG As String = "PROD_MSG"
+ Friend Const ITG_PROD_ROT As String = "PROD_ROT"
+ Friend Const ITG_PROD_TIME As String = "PROD_TIME"
+
+ ' parametri errori integration
+ Friend Const DUPLO_TODELETE As String = "DUPLO_TODELETE"
+
+ ' parametri warehouse
+ Friend Const WRH_BEAM As String = "BEAM"
+ Friend Const WRH_WALL As String = "WALL"
+ Friend Const WRH_CURRENT As String = "Current"
+ Friend Const WRH_STARTOFFSET As String = "StartOffset"
+ Friend Const WRH_OFFSET As String = "Offset"
+ Friend Const WRH_L As String = "L"
+ Friend Const WRH_KERF As String = "Kerf"
+ Friend Const WRH_S As String = "S"
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstGen.vb b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstGen.vb
new file mode 100644
index 00000000..d80608c0
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstGen.vb
@@ -0,0 +1,87 @@
+'----------------------------------------------------------------------------
+' EgalTech 2015-2017
+'----------------------------------------------------------------------------
+' File : ConstGen.vb Data : 10.04.17 Versione : 1.8d1
+' Contenuto : Modulo costanti generali.
+'
+'
+'
+' Modifiche : 10.04.17 DS Creazione modulo.
+'
+'
+'----------------------------------------------------------------------------
+
+Module ConstGen
+
+ ' File con direttorio radice dei dati
+ Public Const DAT_FILE_NAME As String = "DataRoot.Ini"
+ Public Const S_DATA As String = "Data"
+ Public Const K_DATAROOT As String = "DataRoot"
+
+ ' File con dati di licenza
+ Public Const LIC_FILE_NAME As String = "EgtBEAMWALL.lic"
+ Public Const S_LICENCE As String = "Licence"
+ Public Const K_KEY As String = "Key"
+ Public Const K_NESTKEY As String = "NestKey"
+
+ ' Pagine del programma
+ Public Enum Pages As Integer
+ VIEW = 0
+ MACHINING = 1
+ SUPERVISOR = 2
+ CONFIG = 3
+ End Enum
+
+ ' Abilitazioni licenza
+ Friend Enum KEY_OPT As UInteger
+ CUT_BASE = 1 ' Prodotto OmagCUT
+ MAN_MANIP = 2
+ AUTO_MANIP = 4
+ MAN_PHOTO = 8
+ AUTO_PHOTO = 16
+ AUTO_NESTING = 32
+ ENABLE_MILL = 64
+ PROCUCTION_LINE = 128
+ OFFICE_BASE = 256 ' Prodotto OmagOFFICE
+ VM_MULTI = 512
+ UNDER_CUT = 1024
+ CSV_SIMPLE = 2048
+ PHOTO_BASE = 4096 ' Prodotto OmagPHOTO
+ TRF_IMPORT = 8192
+ MOVE_PARTS = 16384
+ IMPORT_SLABDXF = 32768
+ CURVED_FRAME = 65536
+ ENABLE_WJ = 131072
+ End Enum
+
+ ' File di log generale
+ Public Const GENLOG_FILE_NAME As String = "EgtBEAMWALLLog#.txt"
+
+ ' Sottodirettorio di configurazione
+ Public Const CONF_DIR As String = "Config"
+ ' Sottodirettorio delle risorse
+ Public Const RES_DIR As String = "Resources"
+ ' Sottodirettorio temporaneo
+ Public Const TEMP_DIR As String = "Temp"
+ ' Sottodirettorio per Cam automatico
+ Public Const PROJS_DIR As String = "Projs"
+ ' Sottodirettorio per Csv automatico
+ Public Const PRODS_DIR As String = "Prods"
+ ' Sottodirettorio per Macro
+ Public Const MACRO_DIR As String = "Macro"
+ ' Sottodirettorio per Magazzino
+ Public Const WAREHOUSE_DIR As String = "Warehouse"
+ ' Sottodirettorio per lavorazioni travi
+ Public Const BEAM_DIR As String = "Beam"
+ ' Sottodirettorio per lavorazioni pareti
+ Public Const WALL_DIR As String = "Wall"
+ ' Sottodirettorio di default per il salvataggio con nome
+ Public Const SAVE_DFL_NAMEDIR As String = "MyProjects"
+ ' Sottodirettorio di default per le macchine
+ Public Const MACHINES_DFL_DIR As String = "Machines"
+ ' Sottodirettorio di default per toolmakers
+ Public Const TOOLMAKERS_DFL_DIR As String = "ToolMakers"
+ ' Nome file Lua con le funzioni di attrezzaggio
+ Public Const SETUP_LUA As String = "SetUp.lua"
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstIni.vb b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstIni.vb
new file mode 100644
index 00000000..957af8cf
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstIni.vb
@@ -0,0 +1,112 @@
+'----------------------------------------------------------------------------
+' EgalTech 2015-2015
+'----------------------------------------------------------------------------
+' File : ConstIni.vb Data : 12.02.15 Versione : 1.6b3
+' Contenuto : Modulo costanti sezione e chiavi per file Ini.
+'
+'
+'
+' Modifiche : 12.02.15 DS Creazione modulo.
+'
+'
+'----------------------------------------------------------------------------
+
+Module ConstIni
+
+ Public Const INI_FILE_NAME As String = "EgtBEAMWALL.ini"
+
+ Public Const S_GENERAL As String = "General"
+ Public Const K_DEBUG As String = "Debug"
+ Public Const K_LICENCE As String = "Licence"
+ Public Const K_USERLEVEL As String = "UserLevel"
+ Public Const K_MAXINST As String = "MaxInstances"
+ Public Const K_INSTANCES As String = "Instances"
+ Public Const K_COMMANDLOG As String = "CommandLog"
+ Public Const K_MESSAGESDIR As String = "MessagesDir"
+ Public Const K_MESSAGES As String = "Messages"
+ Public Const K_WINPLACE As String = "WinPlace"
+ Public Const K_MMUNITS As String = "MmUnits"
+ Public Const K_LASTPROJ As String = "LastProj"
+ Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
+ Public Const K_LASTIMPDIR As String = "LastImpDir"
+ Public Const K_PROJSINDEX As String = "ProjsIndex"
+ Public Const K_PRODSINDEX As String = "ProdsIndex"
+ Public Const K_SUPPORT As String = "Support"
+ Public Const K_WAREHOUSE As String = "Warehouse"
+
+ Public Const S_LANGUAGES As String = "Languages"
+ Public Const K_LANGUAGE As String = "Language"
+
+ Public Const S_LUA As String = "Lua"
+ Public Const K_LIBSDIR As String = "LibsDir"
+ Public Const K_BASELIB As String = "BaseLib"
+
+ Public Const S_GEOMDB As String = "GeomDB"
+ Public Const K_DEFAULTFONT As String = "DefaultFont"
+ Public Const K_NFEFONTDIR As String = "NfeFontDir"
+ Public Const K_DEFAULTCOLOR As String = "DefaultColor"
+ Public Const K_SAVETYPE As String = "SaveType"
+
+ Public Const S_OPENGL As String = "OpenGL"
+ Public Const K_DOUBLEBUFFER As String = "DoubleBuffer"
+ Public Const K_COLORBITS As String = "ColorBits"
+ Public Const K_DEPTHBITS As String = "DepthBits"
+ Public Const K_DRIVER As String = "Driver"
+
+ Public Const S_SCENE As String = "Scene"
+ Public Const K_BACKTOP As String = "BackTop"
+ Public Const K_BACKBOTTOM As String = "BackBottom"
+ Public Const K_SHOWGFRAME As String = "ShowGFrame"
+ Public Const K_MARK As String = "Mark"
+ Public Const K_SELSURF As String = "SelSurf"
+ Public Const K_SHOWMODE As String = "ShowMode"
+ Public Const K_CURVEDIR As String = "CurveDir"
+ Public Const K_SHOWTRIAADV As String = "ShowTriaAdv"
+ Public Const K_SHOWZMAP As String = "ShowZmap"
+ Public Const K_TEXMAXLINPIX As String = "TextureMaxLinPixels"
+ Public Const K_ZOOMWIN As String = "ZoomWin"
+ Public Const K_DISTLINE As String = "DistLine"
+
+ Public Const S_GRID As String = "Grid"
+ Public Const K_SHOWGRID As String = "ShowGrid"
+ Public Const K_SHOWFRAME As String = "ShowFrame"
+ Public Const K_SNAPSTEP As String = "SnapStep"
+ Public Const K_SNAPSTEPINCH As String = "SnapStepInch"
+ Public Const K_MINLINESSTEP As String = "MinLineSStep"
+ Public Const K_MAJLINESSTEP As String = "MajLineSStep"
+ Public Const K_EXTSSTEP As String = "ExtSStep"
+ Public Const K_MINLNCOLOR As String = "MinLnColor"
+ Public Const K_MAJLNCOLOR As String = "MajLnColor"
+
+ Public Const S_IMPORT As String = "Import"
+ Public Const K_BTLFLAG As String = "BtlFlag"
+
+ Public Const S_MACH As String = "Mach"
+ Public Const K_MACHINESDIR As String = "MachinesDir"
+ Public Const K_TOOLMAKERSDIR As String = "ToolMakersDir"
+ Public Const K_CURRMACH As String = "CurrMach"
+ Public Const K_PASSWORD As String = "Password"
+
+ Public Const S_SIMUL As String = "Simul"
+ Public Const K_SLIDERX As String = "SliderX"
+ Public Const K_SLIDERVAL As String = "SliderVal"
+
+ Public Const S_BEAM As String = "Beam"
+ Public Const K_CALCPATH As String = "CalcPath"
+ Public Const K_BEAMBASEDIR As String = "BaseDir"
+ Public Const K_BEAMBWEEXEC As String = "BweExec"
+
+ Public Const S_WALL As String = "Wall"
+ Public Const K_WALLBASEDIR As String = "BaseDir"
+ Public Const K_WALLBWEEXEC As String = "BweExec"
+
+ Public Const S_NEST As String = "Nest"
+ Public Const K_NESTDIR As String = "NestDir"
+ Public Const K_NESTEXEC As String = "NestExec"
+
+ Public Const S_BEAMWALL As String = "BeamWall"
+ Public Const K_BEAMWALLENABLE As String = "BtlEnable"
+ Public Const K_BEAMWALLBASEDIR As String = "BaseDir"
+ Public Const K_BEAMWALLBUTTON As String = "Button"
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstMachIni.vb b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstMachIni.vb
new file mode 100644
index 00000000..dbd4d542
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstMachIni.vb
@@ -0,0 +1,8 @@
+Module ConstMachIni
+
+ Public Const MACH_INI_FILE_NAME As String = "MachData.ini"
+
+ Public Const K_BEAM As String = "Beam"
+ Public Const K_NAME As String = "Name"
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstMsg.vb b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstMsg.vb
new file mode 100644
index 00000000..61cab73a
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstMsg.vb
@@ -0,0 +1,54 @@
+Module ConstMsg
+
+ Public Const MSG_SETUPERRORS As Integer = 5000 + 1470
+
+ Public Const MSG_MISSINGKEYWD As Integer = 10100
+ Public Const MSG_NUMERICKEYBOARDWD As Integer = 10200
+ Public Const MSG_MESSAGEBOX As Integer = 15000
+ Public Const MSG_EGTSAVEFILEDIALOG As Integer = 30000
+
+ Public Const MSG_OMAGCUT As Integer = 90000
+ Public Const MSG_GENERAL As Integer = MSG_OMAGCUT
+ Public Const MSG_WORKINPROGRESSPAGEUC As Integer = MSG_OMAGCUT + 100
+ Public Const MSG_DIRECTCUTPAGEUC As Integer = MSG_OMAGCUT + 200
+ Public Const MSG_MANUALAXESMOVEPAGEUC As Integer = MSG_OMAGCUT + 220
+ Public Const MSG_CADCUTPAGEUC As Integer = MSG_OMAGCUT + 300
+ Public Const MSG_NESTPAGEUC As Integer = MSG_OMAGCUT + 330
+ Public Const MSG_SPLITPAGEUC As Integer = MSG_OMAGCUT + 340
+ Public Const MSG_MOVERAWPAGEUC As Integer = MSG_OMAGCUT + 360
+ Public Const MSG_DRAWPAGEUC As Integer = MSG_OMAGCUT + 380
+ Public Const MSG_COMPONENTPAGEUC As Integer = MSG_OMAGCUT + 400
+ Public Const MSG_IMPORTPAGEUC As Integer = MSG_OMAGCUT + 450
+ Public Const MSG_OPENPAGEUC As Integer = MSG_OMAGCUT + 490
+ Public Const MSG_RAWPARTPAGEUC As Integer = MSG_OMAGCUT + 500
+ Public Const MSG_CHOOSEMACHININGPAGEUC As Integer = MSG_OMAGCUT + 535
+ Public Const MSG_SIMULATIONPAGEUC As Integer = MSG_OMAGCUT + 550
+ Public Const MSG_FRAMECUTPAGEUC As Integer = MSG_OMAGCUT + 600
+ Public Const MSG_MACHINEPAGEUC As Integer = MSG_OMAGCUT + 700
+ Public Const MSG_TOOLSDBPAGEUC As Integer = MSG_OMAGCUT + 720
+ Public Const MSG_MACHININGSDBPAGEUC As Integer = MSG_OMAGCUT + 760
+ Public Const MSG_COMBOBOXPARAM As Integer = MSG_OMAGCUT + 800
+ Public Const MSG_ALARMSPAGEUC As Integer = MSG_OMAGCUT + 900
+ Public Const MSG_MACHINECNPAGEUC As Integer = MSG_OMAGCUT + 950
+ Public Const MSG_OPTIONSPAGEUC As Integer = MSG_OMAGCUT + 980
+ Public Const MSG_EGTMSGBOX As Integer = MSG_OMAGCUT + 1100
+ Public Const MSG_CSVPAGEUC As Integer = MSG_OMAGCUT + 1200
+
+ Public Const MSG_OMAGOFFICE As Integer = 91400
+ Public Const MSG_OPTIONPANEL As Integer = MSG_OMAGOFFICE
+ Public Const MSG_MYMACHININGDBWINDOW As Integer = MSG_OMAGOFFICE + 50
+ Public Const MSG_TOPCMDBAR As Integer = MSG_OMAGOFFICE + 100
+ Public Const MSG_RAWPARTTAB As Integer = MSG_OMAGOFFICE + 150
+ Public Const MSG_VEINMATCHING As Integer = MSG_OMAGOFFICE + 200
+ Public Const MSG_GENERIC As Integer = MSG_OMAGOFFICE + 250
+
+ Public Const MSG_EGTWPFLIB5 As Integer = 30000
+ Public Const MSG_TOPCOMMANDBAR As Integer = MSG_EGTWPFLIB5 + 500
+ Public Const MSG_GRIDVIEWPANEL As Integer = MSG_EGTWPFLIB5 + 800
+ Public Const MSG_TOOLDB As Integer = MSG_EGTWPFLIB5 + 1000
+ Public Const MSG_TOOLDBERRORS As Integer = MSG_EGTWPFLIB5 + 1100
+ Public Const MSG_MACHININGDB As Integer = MSG_EGTWPFLIB5 + 1200
+ Public Const MSG_MACHININGDBERRORS As Integer = MSG_EGTWPFLIB5 + 1400
+ Public Const MSG_SIMULATION As Integer = MSG_EGTWPFLIB5 + 1600
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstWarehouseIni.vb b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstWarehouseIni.vb
new file mode 100644
index 00000000..d48e42de
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstWarehouseIni.vb
@@ -0,0 +1,16 @@
+Module ConstWarehouseIni
+
+ Public Const WH_BASIC_INI_FILE_NAME As String = "Basic.ini"
+ Public Const WH_MEDIUM_INI_FILE_NAME As String = "Medium.ini"
+
+ 'Public Const S_BEAM As String = "Beam"
+ 'Public Const S_WALL As String = "Wall"
+ Public Const K_CURRENTL As String = "CurrentL"
+ Public Const K_CURRENTS As String = "CurrentS"
+ Public Const K_STARTOFFSET As String = "StartOffset"
+ Public Const K_KERF As String = "Kerf"
+ Public Const K_OFFSET As String = "Offset"
+ Public Const K_L As String = "L"
+ Public Const K_S As String = "S"
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj b/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj
new file mode 100644
index 00000000..c24707b7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj
@@ -0,0 +1,547 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {57291955-F9C4-4466-8D53-476D43BA3659}
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ WinExe
+ EgtBEAMWALL.ViewerOptimizer
+ EgtBEAMWALL.ViewerOptimizer
+ v4.0
+ Custom
+ true
+
+
+
+
+ AnyCPU
+ true
+ full
+ true
+ true
+ true
+ bin\Debug\
+ EgtBEAMWALL.ViewerOptimizer.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+
+
+ AnyCPU
+ pdbonly
+ false
+ false
+ true
+ false
+ true
+ bin\Release\
+ EgtBEAMWALL.ViewerOptimizer.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+ true
+ true
+ true
+ bin\x64\Debug\
+ EgtBEAMWALL.ViewerOptimizer.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+ full
+ x64
+ MinimumRecommendedRules.ruleset
+
+
+ true
+ bin\x64\Release\
+ EgtBEAMWALL.ViewerOptimizer.xml
+ true
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+ pdbonly
+ x64
+ MinimumRecommendedRules.ruleset
+
+
+ true
+ true
+ true
+ bin\x86\Debug\
+ EgtBEAMWALL.ViewerOptimizer.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+ full
+ x86
+ MinimumRecommendedRules.ruleset
+
+
+ true
+ bin\x86\Release\
+ EgtBEAMWALL.ViewerOptimizer.xml
+ true
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+ pdbonly
+ x86
+ MinimumRecommendedRules.ruleset
+
+
+ Resources\EgtBEAMWALL.ico
+
+
+
+ ..\..\..\EgtProg\DllD32\EgtUILib.dll
+
+
+ ..\..\..\EgtProg\DllD32\EgtWPFLib5.dll
+
+
+ ..\packages\EntityFramework.6.4.4\lib\net40\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.4.4\lib\net40\EntityFramework.SqlServer.dll
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ AddSectionXMaterialWndV.xaml
+
+
+
+
+
+ WarehouseWndV.xaml
+
+
+
+
+ MacroFeatureWndV.xaml
+
+
+
+ AddFeatureWndV.xaml
+
+
+
+ AddPartWndV.xaml
+
+
+
+ AddRawPartWndV.xaml
+
+
+
+ BTLDataWndV.xaml
+
+
+
+ PartParametersV.xaml
+
+
+
+ ChangeParameterWndV.xaml
+
+
+
+ ConfigurationPageV.xaml
+
+
+
+
+ MachinePanelV.xaml
+
+
+
+ OpenProjectFileDialogV.xaml
+
+
+
+ OptimizePanelV.xaml
+
+
+
+ PartManagerV.xaml
+
+
+
+ ProdManagerV.xaml
+
+
+
+
+ ProjectV.xaml
+
+
+
+ ProjManagerV.xaml
+
+
+
+
+ SceneHostV.xaml
+
+
+
+
+ ShowPanelV.xaml
+
+
+ StatusBarV.xaml
+
+
+
+ TopPanelV.xaml
+
+
+
+
+
+ Dictionary.xaml
+
+
+
+
+
+
+
+ ViewPanelV.xaml
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Application.xaml
+ Code
+
+
+ BottomPanelV.xaml
+
+
+
+
+
+ FeatureListV.xaml
+
+
+ ParameterListV.xaml
+
+
+ PartInRawPartListV.xaml
+
+
+ PartListV.xaml
+
+
+ RawPartListV.xaml
+
+
+
+
+
+
+
+ FeatureManagerV.xaml
+
+
+
+ InstrumentPanelV.xaml
+
+
+
+ LeftPanelV.xaml
+
+
+
+
+ MainMenuV.xaml
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MainWindowV.xaml
+
+
+
+ Code
+
+
+ Microsoft.VisualBasic.WPF.MyExtension
+ 1.0.0.0
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.vb
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {f22835a1-83d8-4334-91bb-baaeb9cf59b1}
+ EgtBEAMWALL.Core
+
+
+ {24d7760e-662a-47e4-b729-b70126c24a31}
+ EgtBEAMWALL.DataLayer
+
+
+
+
+
+
+
+
+
+
+ IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\ViewerOptimizer\EgtBEAMWALL.ViewerOptimizerR32.exe
+IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\ViewerOptimizer\EgtBEAMWALL.ViewerOptimizerD32.exe
+IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\ViewerOptimizer\EgtBEAMWALL.ViewerOptimizerR64.exe
+IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\ViewerOptimizer\EgtBEAMWALL.ViewerOptimizerD64.exe
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/FeatureManager/FeatureManagerV.xaml b/EgtBEAMWALL.ViewerOptimizer/FeatureManager/FeatureManagerV.xaml
new file mode 100644
index 00000000..ed68e73a
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/FeatureManager/FeatureManagerV.xaml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/FeatureManager/FeatureManagerV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/FeatureManager/FeatureManagerV.xaml.vb
new file mode 100644
index 00000000..a0048d10
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/FeatureManager/FeatureManagerV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class FeatureManagerV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/FeatureManager/FeatureManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/FeatureManager/FeatureManagerVM.vb
new file mode 100644
index 00000000..5092535c
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/FeatureManager/FeatureManagerVM.vb
@@ -0,0 +1,3 @@
+Public Class FeatureManagerVM
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml
new file mode 100644
index 00000000..a89b81ed
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml.vb
new file mode 100644
index 00000000..b8adb880
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/InstrumentPanelV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class InstrumentPanelV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/MyInstrumentPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/MyInstrumentPanelVM.vb
new file mode 100644
index 00000000..bb15c9e7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/InstrumentPanel/MyInstrumentPanelVM.vb
@@ -0,0 +1,299 @@
+Imports System.Collections.ObjectModel
+Imports EgtWPFLib5
+Imports EgtBEAMWALL.Core
+
+Public Class MyInstrumentPanelVM
+ Inherits InstrumentPanelVM
+
+ ' Definizione comandi
+ Private m_cmdData As ICommand
+ Private m_cmdChangeParameter As ICommand
+ Private m_cmdVerify As ICommand
+ Private m_cmdSimulate As ICommand
+
+ Public Overrides Function OnPostGetDistIsChecked() As Boolean
+ Map.refSceneHostVM.MainScene.SetStatusNull()
+ Return True
+ End Function
+
+#Region "COMMANDS"
+
+#Region "Data"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property Data_Command As ICommand
+ Get
+ If m_cmdData Is Nothing Then
+ m_cmdData = New Command(AddressOf Data)
+ End If
+ Return m_cmdData
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub Data()
+ Dim BTLDataWnd As New BTLDataWndV(Application.Current.MainWindow, New BTLDataWndVM())
+ BTLDataWnd.ShowDialog()
+ End Sub
+
+#End Region ' Data
+
+#Region "ChangeParameter"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property ChangeParameter_Command As ICommand
+ Get
+ If m_cmdChangeParameter Is Nothing Then
+ m_cmdChangeParameter = New Command(AddressOf ChangeParameter)
+ End If
+ Return m_cmdChangeParameter
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub ChangeParameter()
+ Dim ChangeParameterWndVM As New ChangeParameterWndVM
+ Dim ChangeParameterWnd As New ChangeParameterWndV(Application.Current.MainWindow, ChangeParameterWndVM)
+ If ChangeParameterWnd.ShowDialog() Then
+ ' faccio passare pezzi
+ If Not IsNothing(ChangeParameterWndVM.SelParam) Then
+ For Each Part In Map.refProjectVM.BTLStructure.PartList
+ For Each Feature In Part.FeatureList.Where(Function(x) x.nPRC = ChangeParameterWndVM.SelPRC.nPRC AndAlso CalcBeamPrivateProfileGRP(x.nSelGRP) = ChangeParameterWndVM.SelPRC.nGRP)
+ If ChangeParameterWndVM.SelParam.nType = BTLParamType.CHECKBOX AndAlso Feature.bDO = ChangeParameterWndVM.SelParam.bActualValue Then
+ Feature.bDO = ChangeParameterWndVM.SelParam.bNewValue
+ Else
+ Dim ParamList As ObservableCollection(Of Core.BTLParam)
+ If ChangeParameterWndVM.SelParam.bIsP Then
+ ParamList = Feature.PParamList
+ Else
+ ParamList = Feature.QParamList
+ End If
+ For Each Param In ParamList.Where(Function(x) x.sName = ChangeParameterWndVM.SelParam.sName)
+ Select Case Param.nType
+ Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
+ If Param.dValue = ChangeParameterWndVM.SelParam.dActualValue Then
+ DirectCast(Param, BTLParam).UpdateParamValue(ChangeParameterWndVM.SelParam.dNewValue, "")
+ ' rinfresco valori parametri feature correntemente selezionata
+ If Not IsNothing(Map.refProjectVM.BTLStructure.SelPart) AndAlso
+ Not IsNothing(Map.refProjectVM.BTLStructure.SelPart.SelFeature) AndAlso
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature Is Feature Then
+ Param.NotifyPropertyChanged("sValue")
+ End If
+ End If
+ Case BTLParamType.STRING_
+ If Param.sValue = ChangeParameterWndVM.SelParam.sActualValue Then
+ DirectCast(Param, BTLParam).UpdateParamValue(0, ChangeParameterWndVM.SelParam.sNewValue)
+ ' rinfresco valori parametri feature correntemente selezionata
+ If Not IsNothing(Map.refProjectVM.BTLStructure.SelPart) AndAlso
+ Not IsNothing(Map.refProjectVM.BTLStructure.SelPart.SelFeature) AndAlso
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature.nPRC = ChangeParameterWndVM.SelPRC.nPRC AndAlso
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature.nSelGRP = ChangeParameterWndVM.SelPRC.nGRP Then
+ Param.NotifyPropertyChanged("sValue")
+ End If
+ End If
+ End Select
+ Next
+ End If
+ Next
+ '' faccio passare feature
+ 'For Each Feature In Part.FeatureList
+ ' If Feature.nPRC = ChangeParameterWndVM.SelPRC.nPRC Then
+ ' For Each Param In Feature.PParamList
+ ' If Param.sName = ChangeParameterWndVM.SelParam.sName Then
+ ' Select Case Param.nType
+ ' Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
+ ' If Param.dValue = ChangeParameterWndVM.SelParam.dActualValue Then
+ ' Param.dValue = ChangeParameterWndVM.SelParam.dValue
+ ' End If
+ ' Case BTLParamType.STRING_
+ ' If Param.sValue = ChangeParameterWndVM.SelParam.sActualValue Then
+ ' Param.sValue = ChangeParameterWndVM.SelParam.sValue
+ ' End If
+ ' End Select
+ ' End If
+ ' Next
+ ' End If
+ 'Next
+ Next
+ End If
+ End If
+ End Sub
+
+#End Region ' ChangeParameter
+
+#Region "Verify"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property Verify_Command As ICommand
+ Get
+ If m_cmdVerify Is Nothing Then
+ m_cmdVerify = New Command(AddressOf Verify)
+ End If
+ Return m_cmdVerify
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub Verify()
+ Dim Calc As New CalcIntegration
+ Dim BarList() As CalcIntegration.Bar
+ If Map.refMainMenuVM.SelPage = Pages.VIEW Then
+ If ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift) Then
+ Dim TempBarList(Map.refProjectVM.BTLStructure.PartList.Count - 1) As CalcIntegration.Bar
+ For PartIndex = 0 To Map.refProjectVM.BTLStructure.PartList.Count - 1
+ Dim CurrPart As BTLPart = Map.refProjectVM.BTLStructure.PartList(PartIndex)
+ Dim Bar As New CalcIntegration.Bar With {.nBarId = CurrPart.nPartId,
+ .nBarType = ProjectType.PROJ,
+ .bBarOk = True}
+ Select Case CurrPart.nState
+ Case Core.CalcStates.OK
+ Bar.nCmdType = CalcIntegration.CmdType.GENERATE
+ Case Else
+ Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN
+ End Select
+ TempBarList(PartIndex) = Bar
+ Next
+ BarList = TempBarList
+ ElseIf Not IsNothing(Map.refProjectVM.BTLStructure.SelPart) Then
+ Dim TempBarList(0) As CalcIntegration.Bar
+ Dim Bar As New CalcIntegration.Bar With {.nBarId = Map.refProjectVM.BTLStructure.SelPart.nPartId,
+ .nBarType = ProjectType.PROJ,
+ .bBarOk = True}
+ Select Case Map.refProjectVM.BTLStructure.SelPart.nState
+ Case Core.CalcStates.OK
+ Bar.nCmdType = CalcIntegration.CmdType.GENERATE
+ Case Else
+ Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN
+ End Select
+ TempBarList(0) = Bar
+ BarList = TempBarList
+ Else
+ Return
+ End If
+ Calc.Run(BarList, Map.refProjManagerVM.CurrProj.sProjDirPath, AddressOf ManageCalc)
+
+ ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
+ If ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift) Then
+ Dim TempBarList(Map.refMachGroupPanelVM.MachGroupList.Count - 1) As CalcIntegration.Bar
+ For PartIndex = 0 To Map.refMachGroupPanelVM.MachGroupList.Count - 1
+ Dim CurrPart As MyMachGroup = Map.refMachGroupPanelVM.MachGroupList(PartIndex)
+ Dim Bar As New CalcIntegration.Bar With {.nBarId = CurrPart.Id,
+ .nBarType = ProjectType.PROD,
+ .bBarOk = True}
+ Select Case CurrPart.nState
+ Case Core.CalcStates.OK
+ Bar.nCmdType = CalcIntegration.CmdType.GENERATE
+ Case Else
+ Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN
+ End Select
+ TempBarList(PartIndex) = Bar
+ Next
+ BarList = TempBarList
+ ElseIf Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
+ Dim TempBarList(0) As CalcIntegration.Bar
+ Dim Bar As New CalcIntegration.Bar With {.nBarId = Map.refMachGroupPanelVM.SelectedMachGroup.Id,
+ .nBarType = ProjectType.PROD,
+ .bBarOk = True}
+ Dim SelMachGroup As MyMachGroup = DirectCast(Map.refMachGroupPanelVM.SelectedMachGroup, MyMachGroup)
+ Select Case SelMachGroup.nState
+ Case Core.CalcStates.OK
+ Bar.nCmdType = CalcIntegration.CmdType.GENERATE
+ Case Else
+ Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN
+ End Select
+ TempBarList(0) = Bar
+ BarList = TempBarList
+ Else
+ Return
+ End If
+ Calc.Run(BarList, Map.refProdManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc)
+ End If
+ End Sub
+
+ Private Sub ManageCalc(dProgress As Double, sProgress As String, ByRef bCancel As Boolean)
+ If dProgress = 0 Then
+ Map.refMyStatusBarVM.SetLoadingProgress_Visibility(True)
+ Map.refMyStatusBarVM.SetStopProgress_IsActive(True)
+ Map.refMyStatusBarVM.SetStopProgress_IsEnabled(True)
+ Map.refMyStatusBarVM.SetOutputMessage(sProgress)
+ Map.refMyStatusBarVM.SetStopProgress_IsActive(True)
+ Map.refMyStatusBarVM.SetStopProgress_IsEnabled(True)
+ ElseIf dProgress = 1 Then
+ Map.refMyStatusBarVM.SetLoadingProgress_Visibility(False)
+ Map.refMyStatusBarVM.SetStopProgress_IsActive(False)
+ Map.refMyStatusBarVM.SetStopProgress_IsEnabled(False)
+ Map.refMyStatusBarVM.SetOutputMessage(sProgress, 3)
+ End If
+ bCancel = Map.refMyStatusBarVM.bStopProgress
+ Map.refMyStatusBarVM.SetLoadingProgress(dProgress * 100)
+ Map.refMyStatusBarVM.SetOutputMessage(sProgress)
+ End Sub
+
+#End Region ' Verify
+
+#Region "Simulate"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property Simulate_Command As ICommand
+ Get
+ If m_cmdSimulate Is Nothing Then
+ m_cmdSimulate = New Command(AddressOf Simulate)
+ End If
+ Return m_cmdSimulate
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub Simulate()
+ Dim Calc As New CalcIntegration
+ Dim BarList() As CalcIntegration.Bar
+ If Map.refMainMenuVM.SelPage = Pages.VIEW Then
+ If Not IsNothing(Map.refProjectVM.BTLStructure.SelPart) Then
+ Dim TempBarList(0) As CalcIntegration.Bar
+ Dim Bar As New CalcIntegration.Bar With {.nBarId = Map.refProjectVM.BTLStructure.SelPart.nPartId,
+ .nBarType = ProjectType.PROJ,
+ .bBarOk = True,
+ .nCmdType = CalcIntegration.CmdType.SIMULATE}
+ TempBarList(0) = Bar
+ BarList = TempBarList
+ Else
+ Return
+ End If
+ Calc.Run(BarList, Map.refProjManagerVM.CurrProj.sProjDirPath, AddressOf ManageCalc)
+ ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
+ If Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
+ Dim TempBarList(0) As CalcIntegration.Bar
+ Dim Bar As New CalcIntegration.Bar With {.nBarId = Map.refMachGroupPanelVM.SelectedMachGroup.Id,
+ .nBarType = ProjectType.PROD,
+ .bBarOk = True,
+ .nCmdType = CalcIntegration.CmdType.SIMULATE}
+ TempBarList(0) = Bar
+ BarList = TempBarList
+ Else
+ Return
+ End If
+ Calc.Run(BarList, Map.refProdManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc)
+ End If
+ End Sub
+
+#End Region ' Simulate
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb b/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb
new file mode 100644
index 00000000..2b2c934e
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb
@@ -0,0 +1,456 @@
+Imports System.IO
+Imports System.Threading
+Imports System.Globalization
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class CalcIntegration
+
+ Private _thread As System.Threading.Thread
+
+ Public Enum CmdType As Integer
+ GENERATE = 0
+ MODIFY = 1
+ SIMULATE = 2
+ CHECK = 3
+ CHECKGEN = 4
+ POINT_CLOUD = 5
+ RAWPART = 6
+ End Enum
+
+ Public Class Bar
+ 'Public piInfo As PatternInfo
+ Public nBarState As Integer
+ Public nBarId As Integer
+ Public sBarPath As String
+ Public bBarOk As Boolean
+ Public nCmdType As Integer
+ Public nBarType As ProjectType
+ End Class
+
+ Private Structure MyProc
+ Public bEnable As Boolean
+ Public Proc As Process
+ Public nBar As Integer
+ End Structure
+
+ Public Sub New()
+ End Sub
+
+ Delegate Sub CallbackDlg(dProgress As Double, sProgress As String, ByRef bCancel As Boolean)
+
+ Public Sub Run(vBar As Bar(), sProjDirPath As String, callback As CallbackDlg)
+ _thread = New Thread(Sub()
+ DoJob(vBar, sProjDirPath, callback)
+ End Sub)
+ _thread.Start()
+ End Sub
+
+ Private Shared Sub DoJob(vBar As Bar(), sProjDirPath As String, callback As CallbackDlg)
+ Dim bCancel As Boolean = False
+ callback(0, "Init", bCancel)
+
+ ' creo progetti a seconda del tipo
+ For Each Bar In vBar
+ If Bar.nBarType = ProjectType.PROJ Then
+ Bar.sBarPath = CreateNewProjectFromPart(Bar.nBarId, sProjDirPath)
+ ElseIf Bar.nBarType = ProjectType.PROD Then
+ Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath)
+ End If
+ Next
+
+ callback(0.1, "", bCancel)
+
+ Dim ExePath As String = String.Empty
+ GetMainPrivateProfileString(S_BEAM, K_CALCPATH, "", ExePath)
+ ' Numero di barre
+ Dim numBars As Integer = vBar.Count
+ If numBars = 0 Then Return
+
+ ' Numero di core logici da utilizzare (minimo tra presenti sul PC e imposti da INI)
+ Dim nMaxThread As Integer = Math.Min(Environment.ProcessorCount, Map.refMainWindowVM.MainWindowM.GetMaxInstances())
+
+ ' Frazione di avanzamento del lavoro (in piu)
+ Dim dProgress As Double = 0
+ 'indice incremento progress durante calcolo barra
+ Dim nPgsCurrBar As Integer = 0
+ Dim nPgsClock As Integer = 0
+
+
+ ' Lancio in parallelo più processi (senza superare il numero di core logici presenti)
+ Dim vProc As MyProc() = New MyProc(nMaxThread - 1) {}
+ For j As Integer = 0 To nMaxThread - 1
+ vProc(j).nBar = -1
+ vProc(j).bEnable = True
+ Next
+
+ ' Processo i Btl in parallelo
+ Dim nCurrBar As Integer = 0
+ Dim nDoneBar As Integer = 0
+ Dim nShiftBar As Integer = 0
+ Dim nActProc As Integer = 0
+
+ While nCurrBar < numBars + nShiftBar OrElse nActProc > 0
+
+ For j As Integer = 0 To nMaxThread - 1
+ If Not vProc(j).bEnable Then Continue For
+ Dim bDone As Boolean = False
+
+ If vProc(j).nBar = -1 Then
+
+ If nCurrBar < numBars + nShiftBar Then
+
+ If vBar(nCurrBar).bBarOk Then
+ vProc(j).Proc = New Process()
+ vProc(j).Proc.StartInfo.FileName = ExePath
+ vProc(j).Proc.StartInfo.Arguments = """" & vBar(nCurrBar).sBarPath & """ " &
+ """" & Map.refMachinePanelVM.SelectedMachine.nType & """ " &
+ """" & Map.refMachinePanelVM.SelectedMachine.Name & """ " & vBar(nCurrBar).nCmdType
+ vProc(j).Proc.StartInfo.UseShellExecute = False
+
+ If vProc(j).Proc.Start() Then
+ vProc(j).nBar = nCurrBar
+ nCurrBar += 1
+ nActProc += 1
+ End If
+ Else
+ If vBar(nCurrBar).nCmdType = CmdType.CHECK OrElse vBar(nCurrBar).nCmdType = CmdType.CHECKGEN Then ProcessResults(vBar(nCurrBar))
+ bDone = True
+ nCurrBar += 1
+ End If
+ End If
+ Else
+
+ If vProc(j).Proc.HasExited Then
+ ' se terminato con successo
+ If vProc(j).Proc.ExitCode = 0 Then
+ ' salvo il risultato
+ If vBar(vProc(j).nBar).nCmdType = CmdType.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdType.CHECKGEN Then ProcessResults(vBar(vProc(j).nBar))
+ bDone = True
+ vProc(j).nBar = -1
+ nActProc -= 1
+ ' se superato il numero di processi eseguibili in parallelo
+ ElseIf vProc(j).Proc.ExitCode = 1 Then
+ ' aggiungo il pezzo in coda
+ If numBars + nShiftBar < numBars + nMaxThread Then
+ vBar(numBars + nShiftBar) = vBar(vProc(j).nBar)
+ nShiftBar += 1
+ End If
+ ' disabilito il processo
+ vProc(j).bEnable = False
+ vProc(j).nBar = -1
+ nActProc -= 1
+ ' altrimenti (errore generico di esecuzione)
+ Else
+ ' salvo il risultato
+ If vBar(vProc(j).nBar).nCmdType = CmdType.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdType.CHECKGEN Then ProcessResults(vBar(vProc(j).nBar))
+ bDone = True
+ vProc(j).nBar = -1
+ nActProc -= 1
+ End If
+ Else
+ vProc(j).Proc.Refresh()
+ End If
+ End If
+
+ If bDone Then
+ ' Dialog con Progress Bar
+ nDoneBar += 1
+ dProgress = 1 / numBars * nDoneBar
+ Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
+ callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel)
+
+ If bCancel Then
+ ' fine
+ callback(1, "", bCancel)
+ Return
+ End If
+ nPgsCurrBar = 0
+ nPgsClock = 0
+ Else
+ If nPgsClock >= 100 AndAlso nPgsCurrBar < 149 Then
+ nPgsCurrBar += 1
+ dProgress = 1 / numBars * nDoneBar + 1 / numBars / 150 * nPgsCurrBar
+ Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
+ callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel)
+ nPgsClock = 0
+ End If
+ End If
+ nPgsClock += 1
+ Thread.Sleep(1)
+ Next
+
+ ' Verifico che i processi non siano andati tutti in errore
+ Dim bAllKO As Boolean = True
+
+ For j As Integer = 0 To nMaxThread - 1
+ If vProc(j).bEnable Then bAllKO = False
+ Next
+
+ If bAllKO Then
+ MessageBox.Show("Execution error (all processes are disabled)")
+ Exit While
+ End If
+
+ Thread.Sleep(10)
+ End While
+
+ Thread.Sleep(300)
+
+ ' fine
+ callback(1, "Done", bCancel)
+ Map.refMyStatusBarVM.ResetStopProgress()
+ End Sub
+
+ Private Shared Function CreateNewProjectFromPart(nPartId As Integer, sProjDirPath As String) As String
+
+ ' Aggiorno identificativi per segnalazione errori
+ UpdateCutIdAndTaskId(nPartId)
+
+ ' Disabilito segnalazione modificato
+ Dim bOldEnableModified As Boolean = EgtGetEnableModified()
+ If bOldEnableModified Then EgtDisableModified()
+
+ ' Recupero visibilita' pezzo e lo imposto a visibile
+ Dim nOldPartMode As Integer
+ EgtGetMode(nPartId, nOldPartMode)
+ EgtSetMode(nPartId, GDB_MD.STD)
+
+ ' Salvo pezzo nel suo progetto
+ Dim bOk As Boolean = False
+ Dim nPDN As Integer = 0
+ EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
+ Dim sPartFilePath As String = sProjDirPath & "\" & nPDN.ToString() & ".bwe"
+ bOk = EgtSaveObjToFile(nPartId, sPartFilePath, NGE.BIN)
+
+ ' Ripristino visibilita' pezzo
+ EgtSetMode(nPartId, nOldPartMode)
+
+ ' Ripristino stato segnalazione modifica
+ If bOldEnableModified Then EgtEnableModified()
+
+ Return If(bOk, sPartFilePath, String.Empty)
+ End Function
+
+ Private Shared Function CreateNewProjectFromMachGroup(nMachGroupId As Integer, sProjDirPath As String) As String
+
+ ' Aggiorno identificativi per segnalazione errori
+ Dim nOldMachGroup As Integer = EgtGetCurrMachGroup()
+ If nMachGroupId <> nOldMachGroup Then EgtSetCurrMachGroup(nMachGroupId)
+ Dim nRawId As Integer = EgtGetFirstRawPart()
+ While nRawId <> GDB_ID.NULL
+ If EgtVerifyRawPartPhase(nRawId, 1) Then
+ Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
+ While nPartId <> GDB_ID.NULL
+ UpdateCutIdAndTaskId(nPartId)
+ nPartId = EgtGetNextPartInRawPart(nPartId)
+ End While
+ End If
+ nRawId = EgtGetNextRawPart(nRawId)
+ End While
+ If nMachGroupId <> nOldMachGroup Then
+ If nOldMachGroup <> GDB_ID.NULL Then
+ EgtSetCurrMachGroup(nOldMachGroup)
+ Else
+ EgtResetCurrMachGroup()
+ End If
+ End If
+
+ ' Salvo gruppo di lavorazione nel suo progetto
+ Dim sMachGroupFilePath As String = sProjDirPath & "\" & nMachGroupId.ToString() & ".bwe"
+ If EgtSaveObjToFile(nMachGroupId, sMachGroupFilePath, NGE.BIN) Then
+ Return sMachGroupFilePath
+ End If
+ Return String.Empty
+ End Function
+
+ Private Shared Function UpdateCutIdAndTaskId(nPartId As Integer) As Boolean
+ ' Assegno Id a CutId per calcoli
+ EgtSetInfo(nPartId, "CUTID", nPartId, True)
+ ' Assegno TASKID alle feature per calcoli
+ Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
+ Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
+ While nFeatureId <> GDB_ID.NULL
+ ' verifico che sia una feature
+ Dim nGRP As Integer
+ If EgtGetInfo( nFeatureId, BTL_FTR_GRP, nGRP) Then
+ ' assegno TASKID alla feature per calcoli
+ EgtSetInfo( nFeatureId, "TASKID", nFeatureId, True)
+ End If
+ nFeatureId = EgtGetNext( nFeatureId)
+ End While
+ Return True
+ End Function
+
+ Private Shared Sub ProcessResults( Bar As Bar)
+
+ Dim BtlPath As String = Bar.sBarPath
+ Dim ResPath As String = Path.ChangeExtension( BtlPath, ".txt")
+ Dim bErrors As Boolean = False
+ Dim nLastErr As Integer = 0
+ Dim sLastMsg As String = ""
+ Dim nCurrCutId As Integer = 0
+ Dim nTotTime As Integer = 0
+
+ If File.Exists( ResPath) Then
+
+ Dim nErr As Integer = 0
+ Dim sMsg As String = ""
+ Dim dRot As Double = 0
+ Dim nFall As Integer = 0
+ Dim dPartRot As Double = 0
+ Dim dTotRot As Double = 0
+ Dim cutId As Integer = 0
+ Dim taskId As Integer = 0
+ Dim prevCutId As Integer = GDB_ID.NULL
+ Dim currBTLPart As BTLPart
+ Dim currPart As Core.Part
+
+ Dim lines As String() = System.IO.File.ReadAllLines( ResPath)
+ For Each line As String In lines
+
+ If line.StartsWith("ERR=") Then
+ Dim nVal As Integer? = GetVal(line, "ERR")
+ nErr = (If(nVal IsNot Nothing, nVal.Value, 0))
+ sMsg = ""
+ dRot = 0
+ cutId = 0
+ taskId = 0
+ ElseIf line.StartsWith("ROT=") Then
+ Dim nVal As Integer? = GetVal(line, "ROT")
+ Dim nRot As Integer = (If(nVal IsNot Nothing, nVal.Value, 0))
+ dRot = Math.Abs(((4 - nRot) Mod 4) * 90)
+ dPartRot = Math.Max(dPartRot, dRot)
+ dTotRot = Math.Max(dTotRot, dRot)
+ ElseIf line.StartsWith("CUTID=") Then
+ Dim nVal As Integer? = GetVal(line, "CUTID")
+ cutId = (If(nVal IsNot Nothing, nVal.Value, 0))
+ If cutId <> prevCutId Then
+ ' aggiornamento globale pezzo precedente
+ If prevCutId <> GDB_ID.NULL Then
+ EgtSetInfo(prevCutId, If(Bar.nBarType = ProjectType.PROJ, ITG_PROJ_ROT, ITG_PROD_ROT), dTotRot, True)
+ dTotRot = 0
+ End If
+ ' aggiornamento risultati in struttura BTL
+ If Bar.nBarType = ProjectType.PROJ Then
+ ' cerco pezzo in btl structure da id
+ For Each Part In Map.refProjectVM.BTLStructure.PartList
+ If Part.nPartId = cutId Then
+ currBTLPart = Part
+ End If
+ Next
+ ElseIf Bar.nBarType = ProjectType.PROD Then
+ For Each MachGroup As Core.MyMachGroup In Map.refMachGroupPanelVM.MachGroupList
+ For Each Part In MachGroup.PartList
+ If Part.nPartId = cutId Then
+ currPart = Part
+ End If
+ Next
+ Next
+ End If
+ prevCutId = cutId
+ End If
+
+ ElseIf line.StartsWith("TASKID=") Then
+ Dim nVal As Integer? = GetVal(line, "TASKID")
+ taskId = (If(nVal IsNot Nothing, nVal.Value, 0))
+ ' se taskid diverso da zero, errore feature
+ If taskId <> 0 Then
+ EgtSetInfo(taskId, If(Bar.nBarType = ProjectType.PROJ, ITG_PROJ_ERR, ITG_PROD_ERR), nErr, True)
+ EgtSetInfo(taskId, If(Bar.nBarType = ProjectType.PROJ, ITG_PROJ_MSG, ITG_PROD_MSG), sMsg, True)
+ EgtSetInfo(taskId, If(Bar.nBarType = ProjectType.PROJ, ITG_PROJ_ROT, ITG_PROD_ROT), dRot, True)
+ ' aggiornamento risultati in struttura BTL
+ If Bar.nBarType = ProjectType.PROJ Then
+ ' cerco task in btl structure da id
+ If Not IsNothing(currBTLPart) Then
+ For Each Feature In currBTLPart.FeatureList
+ If Feature.nFeatureId = taskId Then
+ DirectCast(Feature, BTLFeature).CalcFeatureUpdate(True, nErr, dRot, nFall, sMsg)
+ End If
+ Next
+ End If
+ ElseIf Bar.nBarType = ProjectType.PROD Then
+ ' cerco task in MachGroupList da id
+ If Not IsNothing(currPart) Then
+ For Each Feature In currPart.FeatureList
+ If Feature.nFeatureId = taskId Then
+ DirectCast(Feature, BTLFeature).CalcFeatureUpdate(True, nErr, dRot, nFall, sMsg)
+ End If
+ Next
+ End If
+ End If
+ ' se taskid uguale a zero, errore pezzo
+ ElseIf cutId <> 0 Then
+ EgtSetInfo(cutId, If(Bar.nBarType = ProjectType.PROJ, ITG_PROJ_ERR, ITG_PROD_ERR), nErr, True)
+ EgtSetInfo(cutId, If(Bar.nBarType = ProjectType.PROJ, ITG_PROJ_MSG, ITG_PROD_MSG), sMsg, True)
+ ' aggiorno in struttura btl
+ If Bar.nBarType = ProjectType.PROJ Then
+ If Not IsNothing(currBTLPart) Then currBTLPart.CalcPartUpdate(True, nErr, dRot, nFall, sMsg)
+ ElseIf Bar.nBarType = ProjectType.PROD Then
+ If Not IsNothing(currPart) Then currPart.CalcPartUpdate(True, nErr, dRot, nFall, sMsg)
+ End If
+ End If
+ ElseIf line.StartsWith("FALL=") Then
+ Dim nVal As Integer? = GetVal(line, "FALL")
+ If Not IsNothing(nVal) Then
+ nFall = nVal
+ Else
+ nFall = 0
+ End If
+ ElseIf line.StartsWith("TIME=") Then
+ Dim nVal As Integer? = GetVal(line, "TIME")
+ nTotTime = ( If( nVal IsNot Nothing, nVal.Value, 0))
+ If Bar.nBarType = ProjectType.PROJ AndAlso Not IsNothing( currBTLPart) Then
+ EgtSetInfo(currBTLPart.nPartId, If(Bar.nBarType = ProjectType.PROJ, ITG_PROJ_TIME, ITG_PROD_TIME), nTotTime, True)
+ End If
+
+ ElseIf Not String.IsNullOrWhiteSpace( line) AndAlso line <> "---" Then
+ sMsg = line
+ End If
+ Next
+
+ Else
+ bErrors = True
+ nLastErr = 25
+ sLastMsg = "Execution Error"
+ End If
+
+ ' aggiornamento risultati in struttura BTL
+ If Bar.nBarType = ProjectType.PROJ Then
+ ' cerco pezzo in btl structure da id
+ For Each Part In Map.refProjectVM.BTLStructure.PartList
+ If Part.nPartId = Bar.nBarId Then
+ ' leggo errori da geometria e li aggiorno in struttura btl
+ DirectCast(Part, BTLPart).CalcFeatureUpdate()
+ ' aggiungo nota che indica macchina
+
+ End If
+ Next
+ ElseIf Bar.nBarType = ProjectType.PROD Then
+ ' cerco pezzo in MachGroupList da id
+ For Each MachGroup As Core.MyMachGroup In Map.refMachGroupPanelVM.MachGroupList
+ If MachGroup.Id = Bar.nBarId Then
+ For Each Part In MachGroup.PartList
+ ' leggo errori da geometria e li aggiorno in struttura btl
+ DirectCast(Part, Core.Part).CalcFeatureUpdate()
+ Next
+ MachGroup.CalcMachGroupUpdate()
+ End If
+ Next
+ End If
+
+ End Sub
+
+ Private Shared Function GetVal( sText As String, sKey As String) As Integer?
+ Dim sParts As String() = sText.Split("="c)
+ If String.Compare(sParts(0), sKey) <> 0 Then Return Nothing
+ Dim nVal As Integer = Nothing
+
+ If Not Integer.TryParse(sParts(1), nVal) Then
+ Return Nothing
+ Else
+ Return nVal
+ End If
+ End Function
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/Integration/Constants.cs b/EgtBEAMWALL.ViewerOptimizer/Integration/Constants.cs
new file mode 100644
index 00000000..b0caff72
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Integration/Constants.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+class Constants
+{
+ // Le seguenti costanti stringa sono parti di testo del file BTL di output
+ public const string VERSION = "VERSION: BTL V10.6" ;
+ public const string BUILD = "BUILD: \"10600\"" ;
+ public const string GENERAL = "[GENERAL]" ;
+ public const string PART = "[PART]" ;
+ public const string PROJECT_NUMBER = "PROJECTNUMBER: " ;
+ public const string SCALE_UNIT = "SCALEUNIT: " ;
+ public const string SINGLE_MEMBER_NUMBER = "SINGLEMEMBERNUMBER: " ;
+ public const string DESIGNATION = "DESIGNATION: " ;
+ public const string COUNT = "COUNT: " ;
+ public const string LENGTH = "LENGTH: " ;
+ public const string HEIGHT = "HEIGHT: " ;
+ public const string WIDTH = "WIDTH: " ;
+ public const string OUTLINE_KEY = "OUTLINE: ";
+ public const string APERTURE_KEY = "APERTURE: ";
+ public const string SIDE = "SIDE: ";
+ public const string PROCESS_KEY = "PROCESSKEY: ";
+ public const string PROCESS_PARAMETERS = "PROCESSPARAMETERS: " ;
+ public const string REFERENCE_PLANE = "REFERENCEPLANE: " ;
+ public const string PROCESS_IDENT = "PROCESSIDENT: " ;
+ public const string PROCESS = "PROCESS: " ;
+ public const string COMMENT = "COMMENT: " ;
+ public const string USERATTRIBUTE = "USERATTRIBUTE: " ;
+ public const string EIGHT_ZEROS = "00000000" ;
+
+ // Numero di cifre decimali dei valori dei parametri BTL
+ public const int scaleUnit = 2 ;
+
+ // Allungamento della barra per pezzi singoli da Vista
+ public const double BarMaxLenForAdd = 2000 ;
+ public const double BarAddLen = 2000 ;
+
+ // Sovramateriale di testa per travi singole di Vista
+ public const double HeadOverMat = 10 ;
+
+ // Sovramateriale per pareti singole di Vista
+ public const double PanelOverMat = 10 ;
+
+ // Id base per punti di contorni liberi
+ public const int FcBaseId = 10000 ;
+}
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/Integration/Generator.cs b/EgtBEAMWALL.ViewerOptimizer/Integration/Generator.cs
new file mode 100644
index 00000000..3d9124d6
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Integration/Generator.cs
@@ -0,0 +1,1284 @@
+using System;
+using System.Windows.Forms;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Globalization ;
+using ib.essetre.integration;
+using ib.essetre.integration.egaltech;
+
+public class Generator : ib.essetre.integration.IGenerator
+{
+ private System.Threading.Thread _thread ;
+ private static DataSet _ds = new DataSet() ;
+ private static string _SqlConnectionStr = "" ;
+
+ private struct Bar
+ {
+ public PatternInfo piInfo ;
+ public int nBarState ;
+ public string sBtlPath ;
+ public bool bBtlOk ;
+ }
+
+ private struct MyProc
+ {
+ public bool bEnable ;
+ public Process Proc ;
+ public int nBar ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ public Generator()
+ {
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ public void Run(InOutParameters parameters, ICallBack callback)
+ {
+ _thread = new Thread(() => DoJob( parameters, callback)) ;
+ _thread.Start() ;
+ }
+
+ private delegate void dDoJob( InOutParameters parameters, ICallBack callback) ;
+
+ // Proj
+ // Creo progetto barra da pezzo
+ private static void CreateRawPartProjectFromPart(integer nPartId)
+ {
+ EgtNew
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // campo data ultima modifica nel DATABASE [lastModified]
+ private static void DoJob( InOutParameters parameters, ICallBack callback)
+ {
+ bool bCancel = false ;
+ callback.Progress( 0, "Init", ref bCancel) ;
+
+ // creo progetti per ogni barra
+
+
+
+ _SqlConnectionStr = parameters.ConnectionString ;
+
+ String ExePath = GetExePath( parameters) ;
+ String DataDir = GetDataDir( parameters) ;
+
+ // Numero di barre
+ int numBars = parameters.Patterns.Length ;
+ if ( numBars == 0)
+ return ;
+
+ // Se modalità Cloud, allora conta solo la prima barra
+ bool bCloud = ( parameters.UIMode == InOutParameters.UIModes.CLOUD) ;
+ if ( bCloud)
+ numBars = 1 ;
+
+ // Numero di core logici da utilizzare (minimo tra presenti sul PC e imposti da INI)
+ int nMaxThread = Math.Min( Environment.ProcessorCount, GetMaxInstances( parameters)) ;
+
+ // Frazione di avanzamento del lavoro (in pu)
+ double dProgress = 0 ;
+
+ // Genero i Btl di tutte le barre
+ Bar[] vBar = new Bar[ numBars + nMaxThread] ;
+ for ( int i = 0; i < numBars; i++) {
+
+ PatternInfo pattInfo = parameters.Patterns[i] ;
+
+ BTL btlObject = new BTL() ;
+
+ // Se il parametro IsFromProject è TRUE viene eseguita la query sulle tabelle Project,
+ // se invece è FALSE viene eseguita la query sulle tabelle Production
+ string sql = "" ;
+ if ( pattInfo.IsFromProject) {
+ sql = "SELECT E.projectId, " +
+ "E.elementId, 0 cutId, processId, info1, info2, enabled, level, " +
+ "inTools, outTools, isChecked, P.done, isoType, ax, ay, az, P.x, P.y, P.z, " +
+ "P.flagDeleted, P.[group], [key], face, edge, des, " +
+ "p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, " +
+ "q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, " +
+ "ox, oy, oz, xx, xy, xz, yx, yy, yz, " +
+ "priority, processIdent, processingQuality, sag1, text, E.projectId, E.elementId, P.processId, 0 cutStart, 0 cutEnd, " +
+ "E.inverted, E.rotated, 0 doneTime, 0 startAngle, 0 endAngle, -1 referenceCutId, E.length, E.width, E.height " +
+ "FROM dbo.vw_Process AS P " +
+ "RIGHT OUTER JOIN dbo.vw_Element AS E " +
+ "ON P.projectId=E.projectId AND P.elementId=E.elementId " +
+ "WHERE E.projectId = @firstId AND E.elementId = @secondId" ;
+ }
+ else {
+ sql = "SELECT vw_Cut.productionId, " +
+ "vw_Cut.patternId, vw_Cut.cutId, taskId, info1, info2, enabled, level, " +
+ "inTools, outTools, isChecked, vw_Task.done, isoType, ax, ay, az, vw_Cut.x, vw_Cut.y, vw_Cut.z, " +
+ "vw_Task.flagDeleted, [group], [key], face, edge, des, " +
+ "p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, " +
+ "q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, " +
+ "ox, oy, oz, xx, xy, xz, yx, yy, yz, " +
+ "priority, processIdent, processingQuality, sag1, text, vw_Cut.projectId, vw_Cut.elementId, cutStart, cutEnd, " +
+ "inverted, rotated, doneTime, startAngle, endAngle, referenceCutId, length, width, height " +
+ "FROM dbo.vw_Task " +
+ "RIGHT OUTER JOIN dbo.vw_Cut " +
+ "ON (vw_Task.cutId = vw_Cut.cutId AND vw_Task.patternId = vw_Cut.patternId AND vw_Task.productionId = vw_Cut.productionId) " +
+ "WHERE vw_Cut.productionId = @firstId AND vw_Cut.patternId = @secondId" ;
+ }
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using (SqlCommand cmd = new SqlCommand( sql, cn)) {
+ cmd.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ cmd.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ if ( pattInfo.IsFromProject) {
+ cmd.Parameters["@firstId"].Value = pattInfo.ProjectId ;
+ cmd.Parameters["@secondId"].Value = pattInfo.ElementId ;
+ }
+ else {
+ cmd.Parameters["@firstId"].Value = pattInfo.ProductionId ;
+ cmd.Parameters["@secondId"].Value = pattInfo.PatternId ;
+ }
+ var dataAdapter = new SqlDataAdapter( cmd) ;
+
+ // Lettura DB e riempimento DataSet
+ _ds.Clear() ;
+ dataAdapter.Fill( _ds) ;
+ }
+ }
+
+ // Verifica parametro isFromProject: nel caso Ordine viene ottenuta la lista dei Process,
+ // nel caso Produzione viene ottenuta la lista dei Task
+ if ( pattInfo.IsFromProject)
+ GetListaProcesses( btlObject) ;
+ else
+ GetListaTasks( btlObject) ;
+
+ // Recupero lo stato della barra
+ int nBarState = 0 ;
+ if ( ! pattInfo.IsFromProject)
+ nBarState = GetBarStateP( btlObject.patternId, btlObject.productionId) ;
+
+ // Dialog con Progress Bar
+ dProgress += 0.1 / numBars ;
+ string sProg = ( dProgress * 100).ToString("F1", CultureInfo.InvariantCulture) ;
+ callback.Progress( (float) dProgress,
+ " Progress: " + sProg + "%" + "\n",
+ ref bCancel) ;
+ if ( bCancel) {
+ callback.Done( parameters) ; //fine
+ return ;
+ }
+
+ // Scrittura del file BTL
+ // Path completa del nome del file da salvare
+ string BtlPath = GetBtlPath( DataDir, pattInfo) ;
+ bool BtlOk = btlObject.WriteIntoFile( BtlPath, pattInfo.IsFromProject) ;
+
+ // Se modalità cloud, scrittura del file di punti
+ bool bErrOnCloud = false ;
+ if ( bCloud) {
+ if ( pattInfo.Cloud != null) {
+ using ( var tw = new StreamWriter( Path.ChangeExtension( BtlPath, ".pnt"), false)) {
+ for ( int j = 0 ; j < pattInfo.Cloud.Count() ; j++) {
+ double dPosX = - pattInfo.Cloud[j].Y ;
+ double dPosY = pattInfo.Cloud[j].X ;
+ string sPosX = dPosX.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
+ string sPosY = dPosY.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
+ tw.WriteLine( sPosX + " " + sPosY) ;
+ }
+ }
+ }
+ else {
+ BtlOk = false ;
+ bErrOnCloud = true ;
+ }
+ }
+
+ // Se scrittura Btl non riuscita
+ if ( ! BtlOk) {
+ // scrivo direttamente il file di errore
+ int ErrCutId = ( pattInfo.IsFromProject ? pattInfo.ElementId : pattInfo.PatternId) ;
+ using ( var tw = new StreamWriter( Path.ChangeExtension( BtlPath, ".txt"), false)) {
+ tw.WriteLine( "ERR=10") ;
+ tw.WriteLine( bErrOnCloud ? "Cloud without points" : "BTL without processes") ;
+ tw.WriteLine( "CUTID=" + ErrCutId.ToString()) ;
+ tw.WriteLine( "TASKID=0") ;
+ }
+ // elimino eventuale file Cn già presente
+ if ( parameters.UIMode == InOutParameters.UIModes.HIDDEN) {
+ string CncPath = Path.ChangeExtension( BtlPath, ".cnc") ;
+ if ( File.Exists( CncPath))
+ File.Delete( CncPath) ;
+ }
+ }
+ // altrimenti
+ else {
+ // cancello eventuale file di errore già presente
+ string TxtPath = Path.ChangeExtension( BtlPath, ".txt") ;
+ if ( File.Exists( TxtPath))
+ File.Delete( TxtPath) ;
+ }
+
+ // Salvo dati
+ vBar[i].piInfo = pattInfo ;
+ vBar[i].nBarState = nBarState ;
+ vBar[i].sBtlPath = BtlPath ;
+ vBar[i].bBtlOk = BtlOk ;
+ }
+
+ // Lancio in parallelo più processi (senza superare il numero di core logici presenti)
+ MyProc[] vProc = new MyProc[nMaxThread] ;
+ for ( int j = 0 ; j < nMaxThread ; ++ j) {
+ vProc[j].nBar = -1 ;
+ vProc[j].bEnable = true ;
+ }
+
+ // Processo i Btl in parallelo
+ int nCurrBar = 0 ;
+ int nDoneBar = 0 ;
+ int nShiftBar = 0 ;
+ int nActProc = 0 ;
+ while ( nCurrBar < numBars + nShiftBar || nActProc > 0) {
+ for ( int j = 0 ; j < nMaxThread ; ++ j) {
+ if ( ! vProc[j].bEnable)
+ continue ;
+ bool bDone = false ;
+ if ( vProc[j].nBar == -1) {
+ if ( nCurrBar < numBars + nShiftBar) {
+ if ( vBar[nCurrBar].bBtlOk) {
+ vProc[j].Proc = new Process() ;
+ vProc[j].Proc.StartInfo.FileName = ExePath ;
+ int nMode = (int)parameters.UIMode ;
+ if ( parameters.UIMode == InOutParameters.UIModes.HIDDEN && vBar[nCurrBar].nBarState != 0)
+ nMode = 4 ;
+ vProc[j].Proc.StartInfo.Arguments = "\"" + vBar[nCurrBar].sBtlPath + "\" " + parameters.MachineName + " " + nMode.ToString() ;
+ vProc[j].Proc.StartInfo.UseShellExecute = false ;
+ if ( vProc[j].Proc.Start()) {
+ vProc[j].nBar = nCurrBar ;
+ nCurrBar ++ ;
+ nActProc ++ ;
+ }
+ }
+ else {
+ ProcessResults( vBar[nCurrBar].sBtlPath, vBar[nCurrBar].piInfo, parameters.UIMode) ;
+ bDone = true ;
+ nCurrBar ++ ;
+ }
+ }
+ }
+ else {
+ if ( vProc[j].Proc.HasExited) {
+ // se terminato con successo
+ if ( vProc[j].Proc.ExitCode == 0) {
+ // salvo il risultato
+ ProcessResults( vBar[vProc[j].nBar].sBtlPath, vBar[vProc[j].nBar].piInfo, parameters.UIMode) ;
+ bDone = true ;
+ vProc[j].nBar = -1 ;
+ nActProc -- ;
+ }
+ // se superato il numero di processi eseguibili in parallelo
+ else if ( vProc[j].Proc.ExitCode == 1) {
+ // aggiungo il pezzo in coda
+ if ( numBars + nShiftBar < numBars + nMaxThread) {
+ vBar[numBars + nShiftBar] = vBar[vProc[j].nBar] ;
+ nShiftBar ++ ;
+ }
+ // disabilito il processo
+ vProc[j].bEnable = false ;
+ vProc[j].nBar = -1 ;
+ nActProc -- ;
+ }
+ // altrimenti (errore generico di esecuzione)
+ else {
+ // salvo il risultato
+ ProcessResults( vBar[vProc[j].nBar].sBtlPath, vBar[vProc[j].nBar].piInfo, parameters.UIMode) ;
+ bDone = true ;
+ vProc[j].nBar = -1 ;
+ nActProc -- ;
+ }
+ }
+ else
+ vProc[j].Proc.Refresh() ;
+ }
+ if ( bDone) {
+ // Dialog con Progress Bar
+ dProgress += ( 0.9 / numBars) ;
+ nDoneBar ++ ;
+ string sProg = ( dProgress * 100 ).ToString("F1", CultureInfo.InvariantCulture) ;
+ callback.Progress((float)dProgress,
+ " Progress: " + sProg + "%" + "\n" +
+ " Count: " + nDoneBar + " / " + numBars,
+ ref bCancel);
+ if ( bCancel ) {
+ callback.Done( parameters) ; // fine
+ return ;
+ }
+ }
+ Thread.Sleep( 1) ;
+ }
+ // Verifico che i processi non siano andati tutti in errore
+ bool bAllKO = true ;
+ for ( int j = 0 ; j < nMaxThread ; ++ j) {
+ if ( vProc[j].bEnable)
+ bAllKO = false ;
+ }
+ if ( bAllKO) {
+ MessageBox.Show( "Execution error (all processes are disabled)") ;
+ break ;
+ }
+ Thread.Sleep( 10) ;
+ }
+
+ callback.Progress( 1, "End", ref bCancel) ;
+ Thread.Sleep( 300) ;
+
+ callback.Done( parameters) ; // fine
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ public void Abort()
+ {
+ //non implementata al momento
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ private static void ProcessResults( string BtlPath, PatternInfo pattInfo, InOutParameters.UIModes UIMode)
+ {
+ if ( UIMode == InOutParameters.UIModes.SHOWUI || UIMode == InOutParameters.UIModes.SIMULAZIONE)
+ return ;
+ bool bErrors = false ;
+ int nLastErr = 0 ;
+ string sLastMsg = "" ;
+ int nCurrCutId = 0 ;
+ Dictionary dctErr = new Dictionary() ;
+ Dictionary dctRot = new Dictionary() ;
+ int nTotTime = 0 ;
+ if ( File.Exists( Path.ChangeExtension( BtlPath, ".txt"))) {
+ int nErr = 0 ;
+ string sMsg = "" ;
+ double dRot = 0 ;
+ int cutId = 0 ;
+ int taskId = 0 ;
+ string[] lines = System.IO.File.ReadAllLines( Path.ChangeExtension( BtlPath, ".txt")) ;
+ foreach ( string line in lines) {
+ if ( line.StartsWith( "ERR=")) {
+ int? nVal = GetVal(line, "ERR") ;
+ nErr = ( nVal != null ? nVal.Value : 0) ;
+ sMsg = "" ;
+ cutId = 0 ;
+ taskId = 0 ;
+ }
+ else if ( line.StartsWith( "ROT=")) {
+ int? nVal = GetVal( line, "ROT") ;
+ int nRot = ( nVal != null ? nVal.Value : 0) ;
+ dRot = (( 4 - nRot) % 4) * 90 ;
+ }
+ else if ( line.StartsWith( "CUTID=")) {
+ int? nVal = GetVal( line, "CUTID") ;
+ cutId = ( nVal != null ? nVal.Value : 0) ;
+ if ( cutId != nCurrCutId) {
+ nCurrCutId = cutId ;
+ dctErr.Clear() ;
+ dctRot.Clear() ;
+ }
+ }
+ else if ( line.StartsWith( "TASKID=")) {
+ int? nVal = GetVal( line, "TASKID") ;
+ taskId = ( nVal != null ? nVal.Value : 0) ;
+ PatternInfo.Results resExe = PatternInfo.Results.OK ;
+ if ( nErr == 22) {
+ resExe = PatternInfo.Results.COLLISION ;
+ bErrors = true ;
+ // se non assegnata a feature la dichiaro globale
+ if ( cutId == 0 || taskId == 0) {
+ nLastErr = nErr ;
+ sLastMsg = sMsg ;
+ }
+ }
+ else if ( nErr > 0) {
+ resExe = PatternInfo.Results.WARNING ;
+ bErrors = true ;
+ // se non assegnata a feature la dichiaro globale
+ if ( cutId == 0 || taskId == 0) {
+ nLastErr = nErr ;
+ sLastMsg = sMsg ;
+ }
+ }
+ // gestione errore per feature identificata
+ if ( taskId != 0) {
+ // verifiche per feature con più parti
+ if ( dctErr.TryGetValue( taskId, out PatternInfo.Results resCurrExe)) {
+ if ( resExe > resCurrExe) {
+ dctErr[taskId] = resExe ;
+ pattInfo.SetTaskState( cutId, taskId, resExe, sMsg) ;
+ }
+ }
+ else {
+ dctErr[taskId] = resExe ;
+ pattInfo.SetTaskState( cutId, taskId, resExe, sMsg) ;
+ }
+ }
+ // altrimenti per feature generica
+ else {
+ pattInfo.SetTaskState( cutId, taskId, resExe, sMsg) ;
+ }
+ // gestione rotazione per feature identificata
+ if ( taskId != 0) {
+ // verifiche per feature con più parti
+ if ( dctRot.TryGetValue( taskId, out double dCurrRot)) {
+ if ( Math.Abs( dRot) > 1) {
+ if ( Math.Abs( dCurrRot) < 1)
+ dctRot[taskId] = dRot ;
+ }
+ else {
+ dRot = dCurrRot ;
+ }
+ }
+ else {
+ dctRot.Add( taskId, dRot) ;
+ }
+ }
+ // imposto la rotazione
+ if ( pattInfo.IsFromProject)
+ pattInfo.SetProcessInfoChosen( cutId, taskId, dRot, 0, false) ;
+ else
+ pattInfo.SetTaskInfoChosen( cutId, taskId, dRot, 0, false) ;
+ }
+ else if ( line.StartsWith( "TIME=")) {
+ int? nVal = GetVal( line, "TIME") ;
+ nTotTime = ( nVal != null ? nVal.Value : 0) ;
+ }
+ else if ( ! string.IsNullOrWhiteSpace( line) && line != "---")
+ sMsg = line ;
+ }
+ }
+ else {
+ bErrors = true ;
+ nLastErr = 25 ;
+ sLastMsg = "Execution Error" ;
+ }
+ pattInfo.IsDone = true ;
+ if ( ! bErrors) {
+ pattInfo.Result = PatternInfo.Results.OK ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.MEMORY ;
+ }
+ else {
+ // Sezione oltre i limiti
+ if ( nLastErr == 17) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_WARNING ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Errore nel calcolo lavorazione o movimento carrelli
+ else if ( nLastErr == 19) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Collisione non assegnata ad una feature
+ else if ( nLastErr == 22) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_COLLISION ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Extra corsa assi
+ else if ( nLastErr == 23) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Carri che scivolano sulla trave
+ else if ( nLastErr == 24) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Errore generico
+ else if ( nLastErr == 25) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Altro
+ else {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.MEMORY ;
+ }
+ }
+ pattInfo.EstimatedTime = nTotTime ;
+
+ // Lettura OutputFilename e scrittura nel parametro stringa Iso (caso UIModes.HIDDEN)
+ if ( ! bErrors &&
+ ( UIMode == InOutParameters.UIModes.HIDDEN || UIMode == InOutParameters.UIModes.CLOUD)) {
+
+ string CncPath = Path.ChangeExtension( BtlPath, ".cnc") ;
+ if ( File.Exists( CncPath)) {
+ string lines = System.IO.File.ReadAllText(CncPath) ;
+ pattInfo.Iso = lines ;
+ pattInfo.Result = PatternInfo.Results.OK ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_OK ;
+ }
+ else {
+ pattInfo.Iso = "" ;
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ }
+ }
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Il seguente metodo prende i record visualizzati in ds (Caso: Produzione) e li carica in un oggetto BTL
+ public static void GetListaTasks( BTL btlObject)
+ {
+ DataTable dTab = _ds.Tables[0] ;
+ Int32 listaTasksCount = dTab.Rows.Count ;
+ if ( listaTasksCount == 0)
+ return ;
+
+ DataRow dRow0 = dTab.Rows[0] ;
+ btlObject.projectNumber = dRow0["projectId"].ToString() ;
+ btlObject.barLength = GetBarLengthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.barLoad90 = GetBarLoad90P( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( CultureInfo.InvariantCulture) ;
+ btlObject.panelLength = GetBarLengthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.panelWidth = GetBarWidthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.productionId = (int)dRow0["productionId"] ;
+ btlObject.patternId = (int)dRow0["patternId"] ;
+ btlObject.parts = new List() ;
+
+ List ListaCutParts = GetListaCutIdP() ;
+
+ for ( int c = 0 ; c < ListaCutParts.Count ; c++) {
+
+ BTL.Part readPart = new BTL.Part() ;
+
+ bool bFirst = true ;
+ for ( int f = 0; f < listaTasksCount; f++) {
+
+ DataRow dRowF = dTab.Rows[f] ;
+ if ( (int)dRowF["cutId"] != ListaCutParts[c])
+ continue ;
+
+ if ( bFirst) {
+ readPart.singleMemberNumber = GetElementSN( (int)dRowF["elementId"], (int)dRowF["projectId"]) ;
+ readPart.count = "1" ;
+ readPart.length = dRowF["length"].ToString() ;
+ readPart.height = dRowF["height"].ToString() ;
+ readPart.width = dRowF["width"].ToString() ;
+ readPart.x = (double)dRowF["x"] ;
+ readPart.z = (double)dRowF["z"] ;
+ readPart.inverted = (double)dRowF["inverted"] ;
+ readPart.rotated = (double)dRowF["rotated"] ;
+ readPart.cutId = (int)dRowF["cutId"] ;
+ bFirst = false ;
+ readPart.features = new List() ;
+ }
+
+ if ( string.IsNullOrEmpty( dRowF["taskId"].ToString()))
+ continue ;
+
+ BTL.Feature readFeature = new BTL.Feature() {
+ taskId = dRowF["taskId"].ToString(),
+ processKey = dRowF["group"].ToString() +
+ "-" + dRowF["key"].ToString().Substring( 1, 3) +
+ "-" + dRowF["face"].ToString(),
+ designation = dRowF["des"].ToString(),
+ processIdent = dRowF["processIdent"].ToString(),
+ sag1 = dRowF["sag1"].ToString(),
+ text = dRowF["text"].ToString(),
+ process = ( Convert.ToInt16( dRowF["enabled"]) == 1) ? "YES" : "NO",
+ processParameters = new List( 46) {
+ dRowF["p01"].ToString(),
+ dRowF["p02"].ToString(),
+ dRowF["p03"].ToString(),
+ dRowF["p04"].ToString(),
+ dRowF["p05"].ToString(),
+ dRowF["p06"].ToString(),
+ dRowF["p07"].ToString(),
+ dRowF["p08"].ToString(),
+ dRowF["p09"].ToString(),
+ dRowF["p10"].ToString(),
+ dRowF["p11"].ToString(),
+ dRowF["p12"].ToString(),
+ dRowF["p13"].ToString(),
+ dRowF["p14"].ToString(),
+ dRowF["p15"].ToString(),
+ dRowF["p16"].ToString(),
+ dRowF["p17"].ToString(),
+ dRowF["p18"].ToString(),
+ dRowF["p19"].ToString(),
+ dRowF["p20"].ToString(),
+ dRowF["p21"].ToString(),
+ dRowF["p22"].ToString(),
+ dRowF["p23"].ToString(),
+ dRowF["p24"].ToString(),
+ dRowF["p25"].ToString(),
+ dRowF["p26"].ToString(),
+ dRowF["q01"].ToString(),
+ dRowF["q02"].ToString(),
+ dRowF["q03"].ToString(),
+ dRowF["q04"].ToString(),
+ dRowF["q05"].ToString(),
+ dRowF["q06"].ToString(),
+ dRowF["q07"].ToString(),
+ dRowF["q08"].ToString(),
+ dRowF["q09"].ToString(),
+ dRowF["q10"].ToString(),
+ dRowF["q11"].ToString(),
+ dRowF["q12"].ToString(),
+ dRowF["q13"].ToString(),
+ dRowF["q14"].ToString(),
+ dRowF["q15"].ToString(),
+ dRowF["q16"].ToString(),
+ dRowF["q17"].ToString(),
+ dRowF["q18"].ToString(),
+ dRowF["q19"].ToString(),
+ dRowF["q20"].ToString()
+ },
+ processReference = new List( 9) {
+ dRowF["ox"].ToString(),
+ dRowF["oy"].ToString(),
+ dRowF["oz"].ToString(),
+ dRowF["xx"].ToString(),
+ dRowF["xy"].ToString(),
+ dRowF["xz"].ToString(),
+ dRowF["yx"].ToString(),
+ dRowF["yy"].ToString(),
+ dRowF["yz"].ToString()
+ },
+ } ;
+ readPart.features.Add( readFeature) ;
+ }
+ btlObject.parts.Add( readPart) ;
+ }
+ // L'ordinamento delle Part in un oggetto BTL avviene col confronto del parametro x, estratto dalla tabella vw_Cut
+ btlObject.parts.Sort( (p, q) => p.x.CompareTo( q.x)) ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ private static int? GetVal( string sText, string sKey)
+ {
+ string[] sParts = sText.Split( new Char[] { '=' }) ;
+ if ( string.Compare( sParts[0], sKey) != 0)
+ return null ;
+ if ( ! int.TryParse( sParts[1], out int nVal))
+ return null ;
+ else
+ return nVal ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Il seguente metodo prende i record visualizzati in ds (Caso: Ordine) e li carica in un oggetto BTL
+ public static void GetListaProcesses( BTL btlObject)
+ {
+ DataTable dTab = _ds.Tables[0] ;
+ int listaProcessesCount = dTab.Rows.Count ;
+ if ( listaProcessesCount == 0) {
+ btlObject.parts = null ;
+ return ;
+ }
+
+ DataRow dRow0 = dTab.Rows[0] ;
+ btlObject.projectNumber = dRow0["projectId"].ToString() ;
+ btlObject.barLength = GetBarLengthO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.barLoad90 = "0" ;
+ btlObject.panelLength = GetPanelLengthO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.panelWidth = GetPanelWidthO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.projectId = (int)dRow0["projectId"] ;
+ btlObject.elementId = (int)dRow0["elementId"] ;
+ btlObject.parts = new List() ;
+
+ List ListaCutParts = new List( 1) ;
+ ListaCutParts.Add( (int)dRow0["elementId"]) ;
+
+ for ( int c = 0 ; c < ListaCutParts.Count ; c++) {
+
+ BTL.Part readPart = new BTL.Part() ;
+
+ bool bFirst = true ;
+ for ( int f = 0 ; f < listaProcessesCount ; f++) {
+
+ DataRow dRowF = dTab.Rows[f] ;
+ if ( (int)dRowF["elementId"] != ListaCutParts[c])
+ continue ;
+
+ if ( bFirst) {
+ readPart.singleMemberNumber = GetElementSN( (int)dRow0["elementId"], (int)dRow0["projectId"]) ;
+ readPart.count = "1" ;
+ readPart.length = dRowF["length"].ToString() ;
+ readPart.height = dRowF["height"].ToString() ;
+ readPart.width = dRowF["width"].ToString() ;
+ readPart.x = Constants.HeadOverMat ;
+ readPart.z = Constants.HeadOverMat ;
+ readPart.inverted = (double)dRowF["inverted"] ;
+ readPart.rotated = (double)dRowF["rotated"] ;
+ readPart.elementId = (int)dRowF["elementId"] ;
+ bFirst = false ;
+ readPart.features = new List() ;
+ }
+
+ if ( string.IsNullOrEmpty( dRowF["processId"].ToString()))
+ continue ;
+
+ BTL.Feature readFeature = new BTL.Feature() {
+ processId = dRowF["processId"].ToString(),
+ processKey = dRowF["group"].ToString() +
+ "-" + dRowF["key"].ToString().Substring( 1, 3) +
+ "-" + dRowF["face"].ToString(),
+ designation = dRowF["des"].ToString(),
+ processIdent = dRowF["processIdent"].ToString(),
+ sag1 = dRowF["sag1"].ToString(),
+ text = dRowF["text"].ToString(),
+ process = ( Convert.ToInt16( dRowF["enabled"]) == 1) ? "YES" : "NO",
+ processParameters = new List( 46) {
+ dRowF["p01"].ToString(),
+ dRowF["p02"].ToString(),
+ dRowF["p03"].ToString(),
+ dRowF["p04"].ToString(),
+ dRowF["p05"].ToString(),
+ dRowF["p06"].ToString(),
+ dRowF["p07"].ToString(),
+ dRowF["p08"].ToString(),
+ dRowF["p09"].ToString(),
+ dRowF["p10"].ToString(),
+ dRowF["p11"].ToString(),
+ dRowF["p12"].ToString(),
+ dRowF["p13"].ToString(),
+ dRowF["p14"].ToString(),
+ dRowF["p15"].ToString(),
+ dRowF["p16"].ToString(),
+ dRowF["p17"].ToString(),
+ dRowF["p18"].ToString(),
+ dRowF["p19"].ToString(),
+ dRowF["p20"].ToString(),
+ dRowF["p21"].ToString(),
+ dRowF["p22"].ToString(),
+ dRowF["p23"].ToString(),
+ dRowF["p24"].ToString(),
+ dRowF["p25"].ToString(),
+ dRowF["p26"].ToString(),
+ dRowF["q01"].ToString(),
+ dRowF["q02"].ToString(),
+ dRowF["q03"].ToString(),
+ dRowF["q04"].ToString(),
+ dRowF["q05"].ToString(),
+ dRowF["q06"].ToString(),
+ dRowF["q07"].ToString(),
+ dRowF["q08"].ToString(),
+ dRowF["q09"].ToString(),
+ dRowF["q10"].ToString(),
+ dRowF["q11"].ToString(),
+ dRowF["q12"].ToString(),
+ dRowF["q13"].ToString(),
+ dRowF["q14"].ToString(),
+ dRowF["q15"].ToString(),
+ dRowF["q16"].ToString(),
+ dRowF["q17"].ToString(),
+ dRowF["q18"].ToString(),
+ dRowF["q19"].ToString(),
+ dRowF["q20"].ToString()
+ },
+ processReference = new List( 9) {
+ dRowF["ox"].ToString(),
+ dRowF["oy"].ToString(),
+ dRowF["oz"].ToString(),
+ dRowF["xx"].ToString(),
+ dRowF["xy"].ToString(),
+ dRowF["xz"].ToString(),
+ dRowF["yx"].ToString(),
+ dRowF["yy"].ToString(),
+ dRowF["yz"].ToString()
+ },
+ } ;
+ readPart.features.Add( readFeature) ;
+ }
+ btlObject.parts.Add( readPart) ;
+ }
+ // L'ordinamento delle Part in un oggetto BTL avviene col confronto del parametro x, estratto dalla tabella vw_Cut
+ btlObject.parts.Sort( (p, q) => p.x.CompareTo( q.x)) ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Il seguente metodo si connette al DB per estrarre tramite una query i cutId della tabella vw_Cut
+ // aventi patternId e ProductionId che corrispondono a quelli passati come argomento
+ private static List GetListaCutIdP()
+ {
+ List ListaCutId = new List() ;
+
+ DataTable dTab = _ds.Tables[0] ;
+ int listaTasksCount = dTab.Rows.Count ;
+ for ( int f = 0 ; f < listaTasksCount ; f++) {
+ int nCut = (int) dTab.Rows[f]["cutId"] ;
+ if ( ! ListaCutId.Contains( nCut))
+ ListaCutId.Add( nCut) ;
+ }
+
+ return ListaCutId ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera il singlemembernumber dell'Elemento (colonna "sn")
+ private static string GetElementSN( int ElementId, int ProjectId)
+ {
+ string SN = "000" ;
+
+ string sqlElementSN = "SELECT sn " +
+ "FROM dbo.vw_Element " +
+ "WHERE elementId = @firstId " +
+ "AND projectId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlElementSN, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = ElementId ;
+ sqlCommand.Parameters["@secondId"].Value = ProjectId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ SN = Convert.ToString( reader["sn"]) ;
+ }
+ }
+ }
+
+ return SN ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la lunghezza della barra nel caso Produzione (colonna "l")
+ private static double GetBarLengthP( int patternId, int productionId)
+ {
+ double barLength = 0 ;
+
+ string sqlBarLength = "SELECT l " +
+ "FROM dbo.vw_Pattern " +
+ "WHERE patternId = @firstId " +
+ "AND productionId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlBarLength, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = patternId ;
+ sqlCommand.Parameters["@secondId"].Value = productionId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ barLength = Convert.ToDouble( reader["l"]) ;
+ }
+ }
+ }
+
+ return barLength ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la larghezza della barra nel caso Produzione (colonna "w")
+ private static double GetBarWidthP( int patternId, int productionId)
+ {
+ double barWidth = 0 ;
+
+ string sqlBarWidth = "SELECT w " +
+ "FROM dbo.vw_Pattern " +
+ "WHERE patternId = @firstId " +
+ "AND productionId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlBarWidth, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = patternId ;
+ sqlCommand.Parameters["@secondId"].Value = productionId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ barWidth = Convert.ToDouble( reader["w"]) ;
+ }
+ }
+ }
+
+ return barWidth ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera il flag di carico con rotazione di 90° nel caso Produzione (colonna "load90")
+ private static int GetBarLoad90P( int patternId, int productionId)
+ {
+ int nLoad90 = 0 ;
+
+ string sqlBarLength = "SELECT load90 " +
+ "FROM dbo.vw_Pattern " +
+ "WHERE patternId = @firstId " +
+ "AND productionId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlBarLength, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = patternId ;
+ sqlCommand.Parameters["@secondId"].Value = productionId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ nLoad90 = Convert.ToInt32( reader["load90"]) ;
+ }
+ }
+ }
+
+ return nLoad90 ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera lo stato della barra nel caso Produzione (colonna "state")
+ private static int GetBarStateP( int patternId, int productionId)
+ {
+ int barState = 16 ;
+
+ string sqlBarLength = "SELECT state " +
+ "FROM dbo.vw_Pattern " +
+ "WHERE patternId = @firstId " +
+ "AND productionId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlBarLength, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = patternId ;
+ sqlCommand.Parameters["@secondId"].Value = productionId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ barState = Convert.ToInt32( reader["state"]) ;
+ }
+ }
+ }
+
+ return barState ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la lunghezza della barra nel caso Ordine (colonna "length", ovvero la lunghezza della singola trave)
+ // a cui aggiungiamo un valore fisso (es. 2000)
+ private static double GetBarLengthO( int elementId, int projectId)
+ {
+ double barLength = 0 ;
+
+ DataTable dTab = _ds.Tables[0] ;
+ int listaProcessesCount = dTab.Rows.Count ;
+ if ( listaProcessesCount > 0) {
+ double beamLength = Convert.ToDouble( dTab.Rows[0]["length"]) ;
+ if ( beamLength < Constants.BarMaxLenForAdd)
+ barLength = beamLength + Constants.BarAddLen ;
+ else
+ barLength = beamLength + 2 * Constants.HeadOverMat ;
+ }
+
+ return barLength ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la lunghezza del pannello nel caso Ordine (colonna "length", ovvero la lunghezza della singola parete)
+ // a cui aggiungiamo un valore fisso (es. 200)
+ private static double GetPanelLengthO( int elementId, int projectId)
+ {
+ double panelLength = 0 ;
+
+ DataTable dTab = _ds.Tables[0] ;
+ int listaProcessesCount = dTab.Rows.Count ;
+ if ( listaProcessesCount > 0) {
+ double wallLength = Convert.ToDouble( dTab.Rows[0]["length"]) ;
+ panelLength = wallLength + 2 * Constants.PanelOverMat ;
+ }
+
+ return panelLength ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la lunghezza del pannello nel caso Ordine (colonna "width", ovvero la larghezza della singola parete)
+ // a cui aggiungiamo un valore fisso (es. 200)
+ private static double GetPanelWidthO( int elementId, int projectId)
+ {
+ double panelWidth = 0 ;
+
+ DataTable dTab = _ds.Tables[0] ;
+ int listaProcessesCount = dTab.Rows.Count ;
+ if ( listaProcessesCount > 0) {
+ double wallWidth = Convert.ToDouble( dTab.Rows[0]["width"]) ;
+ panelWidth = wallWidth + 2 * Constants.PanelOverMat ;
+ }
+
+ return panelWidth ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Restituisce la path di esecuzione di EgtCam5
+ private static String GetExePath( InOutParameters parameters)
+ {
+ return parameters.Read( "EGALTECH", "PATH_EXE", "") ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Restituisce il direttorio per i file con i dati macchina
+ private static String GetDataDir( InOutParameters parameters)
+ {
+ String DataDir = parameters.Read( "EGALTECH", "DIR_DATA", "") ;
+ // Se la directory non esiste viene creata
+ DirectoryInfo di = new DirectoryInfo( DataDir) ;
+ if ( ! di.Exists)
+ di.Create() ;
+ return DataDir ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Restituisce la path completa per il file BTL
+ private static String GetBtlPath( String DataDir, PatternInfo pattInfo)
+ {
+ String BtlDir, BtlName ;
+ // Se progetto
+ if ( pattInfo.IsFromProject) {
+ BtlDir = Path.Combine( DataDir, "Projs", pattInfo.ProjectId.ToString( "D4")) ;
+ BtlName = "Part_" + pattInfo.ProjectId.ToString() + "_" + pattInfo.ElementId.ToString() + ".btl" ;
+ }
+ // altrimenti produzione
+ else {
+ BtlDir = Path.Combine( DataDir, "Prods", pattInfo.ProductionId.ToString( "D4")) ;
+ BtlName = "Bar_" + pattInfo.ProductionId.ToString() + "_" + pattInfo.PatternId.ToString() + ".btl" ;
+ }
+ // Se la directory non esiste viene creata
+ DirectoryInfo di = new DirectoryInfo( BtlDir) ;
+ if ( ! di.Exists)
+ di.Create() ;
+ // restituisco la path completa
+ return Path.Combine( BtlDir, BtlName) ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Restituisce il massimo numero di istanze di EgtCAM5 eseguibili contemporaneamente
+ private static int GetMaxInstances( InOutParameters parameters)
+ {
+ String sMaxInst = parameters.Read( "EGALTECH", "MaxInstances", "1") ;
+ if ( ! int.TryParse( sMaxInst, out int nVal))
+ return 1 ;
+ else
+ return Math.Max( nVal, 1) ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Visualizzazione finestra gestione DB utensili
+ public bool ShowTools( InOutParameters parameters)
+ {
+ // Recupero dati
+ string ExePath = GetExePath( parameters) ;
+ string DataDir = GetDataDir( parameters) ;
+ string BtlPath = Path.Combine( DataDir, "QQQ.btl") ;
+ // Esecuzione di EgtCAM5 con parametri path BTL, nome macchina e modo
+ Process process = new Process() ;
+ process.StartInfo.FileName = ExePath ;
+ process.StartInfo.Arguments = "\"" + BtlPath + "\" " + parameters.MachineName + " 11" ;
+ process.StartInfo.UseShellExecute = false ;
+ process.Start() ;
+ // Attendo il termine del processo
+ while ( ! process.HasExited) {
+ process.Refresh() ;
+ Thread.Sleep( 50) ;
+ }
+ return true ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Visualizzazione finestra gestione DB lavorazioni
+ public bool ShowJobs( InOutParameters parameters)
+ {
+ // Recupero dati
+ string ExePath = GetExePath( parameters) ;
+ string DataDir = GetDataDir( parameters) ;
+ string BtlPath = Path.Combine( DataDir, "QQQ.btl") ;
+ // Esecuzione di EgtCAM5 con parametri path BTL, nome macchina e modo
+ Process process = new Process() ;
+ process.StartInfo.FileName = ExePath ;
+ process.StartInfo.Arguments = "\"" + BtlPath + "\" " + parameters.MachineName + " 12" ;
+ process.StartInfo.UseShellExecute = false ;
+ process.Start() ;
+ // Attendo il termine del processo
+ while ( ! process.HasExited) {
+ process.Refresh() ;
+ Thread.Sleep( 50) ;
+ }
+ return true ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Aggiornamento dati macchina
+ public bool UpdateMachine( InOutParameters parameters)
+ {
+ GetMachineParams( parameters) ;
+
+ return true ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Dati utensili e macchina
+ //-------------------------------------------------------------------------------------------------------------
+ // Import della funzione di sistema per la scrittura su file INI
+ [DllImport("kernel32", CharSet = CharSet.Unicode)]
+ static extern long WritePrivateProfileString( string Section, string Key, string Value, string FilePath) ;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Scrive il file Essetre-[MachineName].data che riporta i parametri macchina del DB
+ private static void GetMachineParams( InOutParameters parameters)
+ {
+ // Direttorio di scrittura del file
+ String DataDir = GetDataDir( parameters) ;
+
+ // Path del file di dati e sua cancellazione se già esiste
+ string DataName = "Essetre-" + parameters.MachineName + ".data" ;
+ string DataPath = Path.Combine( DataDir, DataName) ;
+ if ( File.Exists( DataPath))
+ File.Delete( DataPath) ;
+
+ // Preparazione interrogazione per Offsets del DB
+ _SqlConnectionStr = parameters.ConnectionString ;
+ DataSet dsOffsets = new DataSet() ;
+
+ string sqlOffsets = "SELECT [group], [key], [value] " +
+ "FROM [ESSETRE].[dbo].[vw_MachineParam] " +
+ "WHERE [group] = 'OFFSETS' AND configurationId = @ConfigId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection(_SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand cmd = new SqlCommand(sqlOffsets, cn)) {
+ cmd.Parameters.Add( "@ConfigId", SqlDbType.Int) ;
+ cmd.Parameters["@ConfigId"].Value = parameters.ConfigurationId ;
+ var dataAdapter = new SqlDataAdapter( cmd) ;
+ // Lettura DB e riempimento DataSet
+ dsOffsets.Clear() ;
+ dataAdapter.Fill(dsOffsets) ;
+ }
+ }
+
+ // Preparazione interrogazione per Trave del DB
+ _SqlConnectionStr = parameters.ConnectionString ;
+ DataSet dsTrave = new DataSet() ;
+
+ string sqlTrave = "SELECT [group], [key], [value] " +
+ "FROM [ESSETRE].[dbo].[vw_MachineParam] " +
+ "WHERE [group] = 'TRAVE' AND configurationId = @ConfigId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection(_SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand cmd = new SqlCommand( sqlTrave, cn)) {
+ cmd.Parameters.Add( "@ConfigId", SqlDbType.Int) ;
+ cmd.Parameters["@ConfigId"].Value = parameters.ConfigurationId ;
+ var dataAdapter = new SqlDataAdapter( cmd) ;
+ // Lettura DB e riempimento DataSet
+ dsTrave.Clear() ;
+ dataAdapter.Fill( dsTrave) ;
+ }
+ }
+
+ // Preparazione interrogazione per Dati Utente del DB
+ _SqlConnectionStr = parameters.ConnectionString;
+ DataSet dsUser = new DataSet();
+
+ string sqlUser = "SELECT [group], [key], [value] " +
+ "FROM [ESSETRE].[dbo].[vw_ConfigurationParam] " +
+ "WHERE [group] <> 'TEXTS' AND [group] <> 'PARAMS' AND configurationId = @ConfigId";
+
+ // Connessione al DB ed esecuzione query
+ using (SqlConnection cn = new SqlConnection(_SqlConnectionStr))
+ {
+ cn.Open();
+ using (SqlCommand cmd = new SqlCommand(sqlUser, cn))
+ {
+ cmd.Parameters.Add("@ConfigId", SqlDbType.Int);
+ cmd.Parameters["@ConfigId"].Value = parameters.ConfigurationId;
+ var dataAdapter = new SqlDataAdapter(cmd);
+ // Lettura DB e riempimento DataSet
+ dsUser.Clear();
+ dataAdapter.Fill(dsUser);
+ }
+ }
+
+ // Apro file
+ using ( var tw = new StreamWriter( DataPath, false)) {
+
+ // Scrittura intestazione
+ tw.WriteLine( "-- " + DataPath) ;
+ tw.WriteLine( "") ;
+
+ // Scrittura dei dati di Offsets
+ tw.WriteLine( "local Offsets = {") ;
+ foreach ( DataTable table in dsOffsets.Tables) {
+ foreach ( DataRow row in table.Rows) {
+ String Key = row["key"].ToString() ;
+ String Value = row["value"].ToString() ;
+ tw.WriteLine( " " + Key + "=" + Value + ",") ;
+ }
+ }
+ tw.WriteLine( " Zzz=1") ;
+ tw.WriteLine( "}") ;
+ tw.WriteLine( "") ;
+
+ // Scrittura dei dati di Trave
+ tw.WriteLine( "local Trave = {") ;
+ foreach ( DataTable table in dsTrave.Tables) {
+ foreach ( DataRow row in table.Rows) {
+ String Key = row["key"].ToString() ;
+ String Value = row["value"].ToString() ;
+ tw.WriteLine( " " + Key + "=" + Value + ",") ;
+ }
+ }
+ tw.WriteLine( " Zzz=1") ;
+ tw.WriteLine( "}") ;
+ tw.WriteLine( "") ;
+
+ // Scrittura dei dati di Utente
+ tw.WriteLine("local User = {");
+ foreach (DataTable table in dsUser.Tables)
+ {
+ foreach (DataRow row in table.Rows)
+ {
+ String Group = row["group"].ToString();
+ String Key = row["key"].ToString();
+ String Value = row["value"].ToString();
+ tw.WriteLine(" " + Group + "_" + Key + "=" + Value + ",");
+ }
+ }
+ tw.WriteLine(" Zzz=1");
+ tw.WriteLine("}");
+ tw.WriteLine("");
+
+ // Scrittura tabella da restituire
+ tw.WriteLine( "local Machine = { Offsets=Offsets, Trave=Trave, User=User}") ;
+
+ tw.WriteLine( "return Machine") ;
+ }
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Indica direttori e file per backup
+ public void CollectFile( InOutParameters parameters, FileCollector collector)
+ {
+ // Direttori notevoli
+ String sRoot = parameters.Read( "EGALTECH", "DIR_EGT", "C:\\TechnoEssetre7\\EgalTech") ;
+ String sBeamDir = "EgtCAM5\\Beam" ;
+ String sMachDir = "EgtCAM5\\Machines\\Essetre-" + parameters.MachineName ;
+ // Impostazione
+ collector.SetRoot(sRoot) ;
+ collector.AddDirectory(Path.Combine(sRoot, sBeamDir)) ;
+ collector.AddDirectory(Path.Combine(sRoot, sMachDir)) ;
+ }
+
+}
diff --git a/EgtBEAMWALL.ViewerOptimizer/Integration/Generator.orig.cs b/EgtBEAMWALL.ViewerOptimizer/Integration/Generator.orig.cs
new file mode 100644
index 00000000..f8b3417b
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Integration/Generator.orig.cs
@@ -0,0 +1,1276 @@
+using System;
+using System.Windows.Forms;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Globalization ;
+using ib.essetre.integration;
+using ib.essetre.integration.egaltech;
+
+namespace ib.essetre.integration.egaltech
+{
+ public class Generator : ib.essetre.integration.IGenerator
+ {
+ private System.Threading.Thread _thread ;
+ private static DataSet _ds = new DataSet() ;
+ private static string _SqlConnectionStr = "" ;
+
+ private struct Bar
+ {
+ public PatternInfo piInfo ;
+ public int nBarState ;
+ public string sBtlPath ;
+ public bool bBtlOk ;
+ }
+
+ private struct MyProc
+ {
+ public bool bEnable ;
+ public Process Proc ;
+ public int nBar ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ public Generator()
+ {
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ public void Run(InOutParameters parameters, ICallBack callback)
+ {
+ _thread = new Thread(() => DoJob( parameters, callback)) ;
+ _thread.Start() ;
+ }
+
+ private delegate void dDoJob( InOutParameters parameters, ICallBack callback) ;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // campo data ultima modifica nel DATABASE [lastModified]
+ private static void DoJob( InOutParameters parameters, ICallBack callback)
+ {
+ bool bCancel = false ;
+ callback.Progress( 0, "Init", ref bCancel) ;
+
+ _SqlConnectionStr = parameters.ConnectionString ;
+
+ String ExePath = GetExePath( parameters) ;
+ String DataDir = GetDataDir( parameters) ;
+
+ // Numero di barre
+ int numBars = parameters.Patterns.Length ;
+ if ( numBars == 0)
+ return ;
+
+ // Se modalità Cloud, allora conta solo la prima barra
+ bool bCloud = ( parameters.UIMode == InOutParameters.UIModes.CLOUD) ;
+ if ( bCloud)
+ numBars = 1 ;
+
+ // Numero di core logici da utilizzare (minimo tra presenti sul PC e imposti da INI)
+ int nMaxThread = Math.Min( Environment.ProcessorCount, GetMaxInstances( parameters)) ;
+
+ // Frazione di avanzamento del lavoro (in pu)
+ double dProgress = 0 ;
+
+ // Genero i Btl di tutte le barre
+ Bar[] vBar = new Bar[ numBars + nMaxThread] ;
+ for ( int i = 0; i < numBars; i++) {
+
+ PatternInfo pattInfo = parameters.Patterns[i] ;
+
+ BTL btlObject = new BTL() ;
+
+ // Se il parametro IsFromProject è TRUE viene eseguita la query sulle tabelle Project,
+ // se invece è FALSE viene eseguita la query sulle tabelle Production
+ string sql = "" ;
+ if ( pattInfo.IsFromProject) {
+ sql = "SELECT E.projectId, " +
+ "E.elementId, 0 cutId, processId, info1, info2, enabled, level, " +
+ "inTools, outTools, isChecked, P.done, isoType, ax, ay, az, P.x, P.y, P.z, " +
+ "P.flagDeleted, P.[group], [key], face, edge, des, " +
+ "p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, " +
+ "q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, " +
+ "ox, oy, oz, xx, xy, xz, yx, yy, yz, " +
+ "priority, processIdent, processingQuality, sag1, text, E.projectId, E.elementId, P.processId, 0 cutStart, 0 cutEnd, " +
+ "E.inverted, E.rotated, 0 doneTime, 0 startAngle, 0 endAngle, -1 referenceCutId, E.length, E.width, E.height " +
+ "FROM dbo.vw_Process AS P " +
+ "RIGHT OUTER JOIN dbo.vw_Element AS E " +
+ "ON P.projectId=E.projectId AND P.elementId=E.elementId " +
+ "WHERE E.projectId = @firstId AND E.elementId = @secondId" ;
+ }
+ else {
+ sql = "SELECT vw_Cut.productionId, " +
+ "vw_Cut.patternId, vw_Cut.cutId, taskId, info1, info2, enabled, level, " +
+ "inTools, outTools, isChecked, vw_Task.done, isoType, ax, ay, az, vw_Cut.x, vw_Cut.y, vw_Cut.z, " +
+ "vw_Task.flagDeleted, [group], [key], face, edge, des, " +
+ "p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, " +
+ "q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, " +
+ "ox, oy, oz, xx, xy, xz, yx, yy, yz, " +
+ "priority, processIdent, processingQuality, sag1, text, vw_Cut.projectId, vw_Cut.elementId, cutStart, cutEnd, " +
+ "inverted, rotated, doneTime, startAngle, endAngle, referenceCutId, length, width, height " +
+ "FROM dbo.vw_Task " +
+ "RIGHT OUTER JOIN dbo.vw_Cut " +
+ "ON (vw_Task.cutId = vw_Cut.cutId AND vw_Task.patternId = vw_Cut.patternId AND vw_Task.productionId = vw_Cut.productionId) " +
+ "WHERE vw_Cut.productionId = @firstId AND vw_Cut.patternId = @secondId" ;
+ }
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using (SqlCommand cmd = new SqlCommand( sql, cn)) {
+ cmd.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ cmd.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ if ( pattInfo.IsFromProject) {
+ cmd.Parameters["@firstId"].Value = pattInfo.ProjectId ;
+ cmd.Parameters["@secondId"].Value = pattInfo.ElementId ;
+ }
+ else {
+ cmd.Parameters["@firstId"].Value = pattInfo.ProductionId ;
+ cmd.Parameters["@secondId"].Value = pattInfo.PatternId ;
+ }
+ var dataAdapter = new SqlDataAdapter( cmd) ;
+
+ // Lettura DB e riempimento DataSet
+ _ds.Clear() ;
+ dataAdapter.Fill( _ds) ;
+ }
+ }
+
+ // Verifica parametro isFromProject: nel caso Ordine viene ottenuta la lista dei Process,
+ // nel caso Produzione viene ottenuta la lista dei Task
+ if ( pattInfo.IsFromProject)
+ GetListaProcesses( btlObject) ;
+ else
+ GetListaTasks( btlObject) ;
+
+ // Recupero lo stato della barra
+ int nBarState = 0 ;
+ if ( ! pattInfo.IsFromProject)
+ nBarState = GetBarStateP( btlObject.patternId, btlObject.productionId) ;
+
+ // Dialog con Progress Bar
+ dProgress += 0.1 / numBars ;
+ string sProg = ( dProgress * 100).ToString("F1", CultureInfo.InvariantCulture) ;
+ callback.Progress( (float) dProgress,
+ " Progress: " + sProg + "%" + "\n",
+ ref bCancel) ;
+ if ( bCancel) {
+ callback.Done( parameters) ; //fine
+ return ;
+ }
+
+ // Scrittura del file BTL
+ // Path completa del nome del file da salvare
+ string BtlPath = GetBtlPath( DataDir, pattInfo) ;
+ bool BtlOk = btlObject.WriteIntoFile( BtlPath, pattInfo.IsFromProject) ;
+
+ // Se modalità cloud, scrittura del file di punti
+ bool bErrOnCloud = false ;
+ if ( bCloud) {
+ if ( pattInfo.Cloud != null) {
+ using ( var tw = new StreamWriter( Path.ChangeExtension( BtlPath, ".pnt"), false)) {
+ for ( int j = 0 ; j < pattInfo.Cloud.Count() ; j++) {
+ double dPosX = - pattInfo.Cloud[j].Y ;
+ double dPosY = pattInfo.Cloud[j].X ;
+ string sPosX = dPosX.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
+ string sPosY = dPosY.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
+ tw.WriteLine( sPosX + " " + sPosY) ;
+ }
+ }
+ }
+ else {
+ BtlOk = false ;
+ bErrOnCloud = true ;
+ }
+ }
+
+ // Se scrittura Btl non riuscita
+ if ( ! BtlOk) {
+ // scrivo direttamente il file di errore
+ int ErrCutId = ( pattInfo.IsFromProject ? pattInfo.ElementId : pattInfo.PatternId) ;
+ using ( var tw = new StreamWriter( Path.ChangeExtension( BtlPath, ".txt"), false)) {
+ tw.WriteLine( "ERR=10") ;
+ tw.WriteLine( bErrOnCloud ? "Cloud without points" : "BTL without processes") ;
+ tw.WriteLine( "CUTID=" + ErrCutId.ToString()) ;
+ tw.WriteLine( "TASKID=0") ;
+ }
+ // elimino eventuale file Cn già presente
+ if ( parameters.UIMode == InOutParameters.UIModes.HIDDEN) {
+ string CncPath = Path.ChangeExtension( BtlPath, ".cnc") ;
+ if ( File.Exists( CncPath))
+ File.Delete( CncPath) ;
+ }
+ }
+ // altrimenti
+ else {
+ // cancello eventuale file di errore già presente
+ string TxtPath = Path.ChangeExtension( BtlPath, ".txt") ;
+ if ( File.Exists( TxtPath))
+ File.Delete( TxtPath) ;
+ }
+
+ // Salvo dati
+ vBar[i].piInfo = pattInfo ;
+ vBar[i].nBarState = nBarState ;
+ vBar[i].sBtlPath = BtlPath ;
+ vBar[i].bBtlOk = BtlOk ;
+ }
+
+ // Lancio in parallelo più processi (senza superare il numero di core logici presenti)
+ MyProc[] vProc = new MyProc[nMaxThread] ;
+ for ( int j = 0 ; j < nMaxThread ; ++ j) {
+ vProc[j].nBar = -1 ;
+ vProc[j].bEnable = true ;
+ }
+
+ // Processo i Btl in parallelo
+ int nCurrBar = 0 ;
+ int nDoneBar = 0 ;
+ int nShiftBar = 0 ;
+ int nActProc = 0 ;
+ while ( nCurrBar < numBars + nShiftBar || nActProc > 0) {
+ for ( int j = 0 ; j < nMaxThread ; ++ j) {
+ if ( ! vProc[j].bEnable)
+ continue ;
+ bool bDone = false ;
+ if ( vProc[j].nBar == -1) {
+ if ( nCurrBar < numBars + nShiftBar) {
+ if ( vBar[nCurrBar].bBtlOk) {
+ vProc[j].Proc = new Process() ;
+ vProc[j].Proc.StartInfo.FileName = ExePath ;
+ int nMode = (int)parameters.UIMode ;
+ if ( parameters.UIMode == InOutParameters.UIModes.HIDDEN && vBar[nCurrBar].nBarState != 0)
+ nMode = 4 ;
+ vProc[j].Proc.StartInfo.Arguments = "\"" + vBar[nCurrBar].sBtlPath + "\" " + parameters.MachineName + " " + nMode.ToString() ;
+ vProc[j].Proc.StartInfo.UseShellExecute = false ;
+ if ( vProc[j].Proc.Start()) {
+ vProc[j].nBar = nCurrBar ;
+ nCurrBar ++ ;
+ nActProc ++ ;
+ }
+ }
+ else {
+ ProcessResults( vBar[nCurrBar].sBtlPath, vBar[nCurrBar].piInfo, parameters.UIMode) ;
+ bDone = true ;
+ nCurrBar ++ ;
+ }
+ }
+ }
+ else {
+ if ( vProc[j].Proc.HasExited) {
+ // se terminato con successo
+ if ( vProc[j].Proc.ExitCode == 0) {
+ // salvo il risultato
+ ProcessResults( vBar[vProc[j].nBar].sBtlPath, vBar[vProc[j].nBar].piInfo, parameters.UIMode) ;
+ bDone = true ;
+ vProc[j].nBar = -1 ;
+ nActProc -- ;
+ }
+ // se superato il numero di processi eseguibili in parallelo
+ else if ( vProc[j].Proc.ExitCode == 1) {
+ // aggiungo il pezzo in coda
+ if ( numBars + nShiftBar < numBars + nMaxThread) {
+ vBar[numBars + nShiftBar] = vBar[vProc[j].nBar] ;
+ nShiftBar ++ ;
+ }
+ // disabilito il processo
+ vProc[j].bEnable = false ;
+ vProc[j].nBar = -1 ;
+ nActProc -- ;
+ }
+ // altrimenti (errore generico di esecuzione)
+ else {
+ // salvo il risultato
+ ProcessResults( vBar[vProc[j].nBar].sBtlPath, vBar[vProc[j].nBar].piInfo, parameters.UIMode) ;
+ bDone = true ;
+ vProc[j].nBar = -1 ;
+ nActProc -- ;
+ }
+ }
+ else
+ vProc[j].Proc.Refresh() ;
+ }
+ if ( bDone) {
+ // Dialog con Progress Bar
+ dProgress += ( 0.9 / numBars) ;
+ nDoneBar ++ ;
+ string sProg = ( dProgress * 100 ).ToString("F1", CultureInfo.InvariantCulture) ;
+ callback.Progress((float)dProgress,
+ " Progress: " + sProg + "%" + "\n" +
+ " Count: " + nDoneBar + " / " + numBars,
+ ref bCancel);
+ if ( bCancel ) {
+ callback.Done( parameters) ; // fine
+ return ;
+ }
+ }
+ Thread.Sleep( 1) ;
+ }
+ // Verifico che i processi non siano andati tutti in errore
+ bool bAllKO = true ;
+ for ( int j = 0 ; j < nMaxThread ; ++ j) {
+ if ( vProc[j].bEnable)
+ bAllKO = false ;
+ }
+ if ( bAllKO) {
+ MessageBox.Show( "Execution error (all processes are disabled)") ;
+ break ;
+ }
+ Thread.Sleep( 10) ;
+ }
+
+ callback.Progress( 1, "End", ref bCancel) ;
+ Thread.Sleep( 300) ;
+
+ callback.Done( parameters) ; // fine
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ public void Abort()
+ {
+ //non implementata al momento
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ private static void ProcessResults( string BtlPath, PatternInfo pattInfo, InOutParameters.UIModes UIMode)
+ {
+ if ( UIMode == InOutParameters.UIModes.SHOWUI || UIMode == InOutParameters.UIModes.SIMULAZIONE)
+ return ;
+ bool bErrors = false ;
+ int nLastErr = 0 ;
+ string sLastMsg = "" ;
+ int nCurrCutId = 0 ;
+ Dictionary dctErr = new Dictionary() ;
+ Dictionary dctRot = new Dictionary() ;
+ int nTotTime = 0 ;
+ if ( File.Exists( Path.ChangeExtension( BtlPath, ".txt"))) {
+ int nErr = 0 ;
+ string sMsg = "" ;
+ double dRot = 0 ;
+ int cutId = 0 ;
+ int taskId = 0 ;
+ string[] lines = System.IO.File.ReadAllLines( Path.ChangeExtension( BtlPath, ".txt")) ;
+ foreach ( string line in lines) {
+ if ( line.StartsWith( "ERR=")) {
+ int? nVal = GetVal(line, "ERR") ;
+ nErr = ( nVal != null ? nVal.Value : 0) ;
+ sMsg = "" ;
+ cutId = 0 ;
+ taskId = 0 ;
+ }
+ else if ( line.StartsWith( "ROT=")) {
+ int? nVal = GetVal( line, "ROT") ;
+ int nRot = ( nVal != null ? nVal.Value : 0) ;
+ dRot = (( 4 - nRot) % 4) * 90 ;
+ }
+ else if ( line.StartsWith( "CUTID=")) {
+ int? nVal = GetVal( line, "CUTID") ;
+ cutId = ( nVal != null ? nVal.Value : 0) ;
+ if ( cutId != nCurrCutId) {
+ nCurrCutId = cutId ;
+ dctErr.Clear() ;
+ dctRot.Clear() ;
+ }
+ }
+ else if ( line.StartsWith( "TASKID=")) {
+ int? nVal = GetVal( line, "TASKID") ;
+ taskId = ( nVal != null ? nVal.Value : 0) ;
+ PatternInfo.Results resExe = PatternInfo.Results.OK ;
+ if ( nErr == 22) {
+ resExe = PatternInfo.Results.COLLISION ;
+ bErrors = true ;
+ // se non assegnata a feature la dichiaro globale
+ if ( cutId == 0 || taskId == 0) {
+ nLastErr = nErr ;
+ sLastMsg = sMsg ;
+ }
+ }
+ else if ( nErr > 0) {
+ resExe = PatternInfo.Results.WARNING ;
+ bErrors = true ;
+ // se non assegnata a feature la dichiaro globale
+ if ( cutId == 0 || taskId == 0) {
+ nLastErr = nErr ;
+ sLastMsg = sMsg ;
+ }
+ }
+ // gestione errore per feature identificata
+ if ( taskId != 0) {
+ // verifiche per feature con più parti
+ if ( dctErr.TryGetValue( taskId, out PatternInfo.Results resCurrExe)) {
+ if ( resExe > resCurrExe) {
+ dctErr[taskId] = resExe ;
+ pattInfo.SetTaskState( cutId, taskId, resExe, sMsg) ;
+ }
+ }
+ else {
+ dctErr[taskId] = resExe ;
+ pattInfo.SetTaskState( cutId, taskId, resExe, sMsg) ;
+ }
+ }
+ // altrimenti per feature generica
+ else {
+ pattInfo.SetTaskState( cutId, taskId, resExe, sMsg) ;
+ }
+ // gestione rotazione per feature identificata
+ if ( taskId != 0) {
+ // verifiche per feature con più parti
+ if ( dctRot.TryGetValue( taskId, out double dCurrRot)) {
+ if ( Math.Abs( dRot) > 1) {
+ if ( Math.Abs( dCurrRot) < 1)
+ dctRot[taskId] = dRot ;
+ }
+ else {
+ dRot = dCurrRot ;
+ }
+ }
+ else {
+ dctRot.Add( taskId, dRot) ;
+ }
+ }
+ // imposto la rotazione
+ if ( pattInfo.IsFromProject)
+ pattInfo.SetProcessInfoChosen( cutId, taskId, dRot, 0, false) ;
+ else
+ pattInfo.SetTaskInfoChosen( cutId, taskId, dRot, 0, false) ;
+ }
+ else if ( line.StartsWith( "TIME=")) {
+ int? nVal = GetVal( line, "TIME") ;
+ nTotTime = ( nVal != null ? nVal.Value : 0) ;
+ }
+ else if ( ! string.IsNullOrWhiteSpace( line) && line != "---")
+ sMsg = line ;
+ }
+ }
+ else {
+ bErrors = true ;
+ nLastErr = 25 ;
+ sLastMsg = "Execution Error" ;
+ }
+ pattInfo.IsDone = true ;
+ if ( ! bErrors) {
+ pattInfo.Result = PatternInfo.Results.OK ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.MEMORY ;
+ }
+ else {
+ // Sezione oltre i limiti
+ if ( nLastErr == 17) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_WARNING ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Errore nel calcolo lavorazione o movimento carrelli
+ else if ( nLastErr == 19) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Collisione non assegnata ad una feature
+ else if ( nLastErr == 22) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_COLLISION ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Extra corsa assi
+ else if ( nLastErr == 23) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Carri che scivolano sulla trave
+ else if ( nLastErr == 24) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Errore generico
+ else if ( nLastErr == 25) {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ pattInfo.Message = sLastMsg ;
+ }
+ // Altro
+ else {
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.MEMORY ;
+ }
+ }
+ pattInfo.EstimatedTime = nTotTime ;
+
+ // Lettura OutputFilename e scrittura nel parametro stringa Iso (caso UIModes.HIDDEN)
+ if ( ! bErrors &&
+ ( UIMode == InOutParameters.UIModes.HIDDEN || UIMode == InOutParameters.UIModes.CLOUD)) {
+
+ string CncPath = Path.ChangeExtension( BtlPath, ".cnc") ;
+ if ( File.Exists( CncPath)) {
+ string lines = System.IO.File.ReadAllText(CncPath) ;
+ pattInfo.Iso = lines ;
+ pattInfo.Result = PatternInfo.Results.OK ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_OK ;
+ }
+ else {
+ pattInfo.Iso = "" ;
+ pattInfo.Result = PatternInfo.Results.ERROR ;
+ pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
+ }
+ }
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Il seguente metodo prende i record visualizzati in ds (Caso: Produzione) e li carica in un oggetto BTL
+ public static void GetListaTasks( BTL btlObject)
+ {
+ DataTable dTab = _ds.Tables[0] ;
+ Int32 listaTasksCount = dTab.Rows.Count ;
+ if ( listaTasksCount == 0)
+ return ;
+
+ DataRow dRow0 = dTab.Rows[0] ;
+ btlObject.projectNumber = dRow0["projectId"].ToString() ;
+ btlObject.barLength = GetBarLengthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.barLoad90 = GetBarLoad90P( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( CultureInfo.InvariantCulture) ;
+ btlObject.panelLength = GetBarLengthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.panelWidth = GetBarWidthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.productionId = (int)dRow0["productionId"] ;
+ btlObject.patternId = (int)dRow0["patternId"] ;
+ btlObject.parts = new List() ;
+
+ List ListaCutParts = GetListaCutIdP() ;
+
+ for ( int c = 0 ; c < ListaCutParts.Count ; c++) {
+
+ BTL.Part readPart = new BTL.Part() ;
+
+ bool bFirst = true ;
+ for ( int f = 0; f < listaTasksCount; f++) {
+
+ DataRow dRowF = dTab.Rows[f] ;
+ if ( (int)dRowF["cutId"] != ListaCutParts[c])
+ continue ;
+
+ if ( bFirst) {
+ readPart.singleMemberNumber = GetElementSN( (int)dRowF["elementId"], (int)dRowF["projectId"]) ;
+ readPart.count = "1" ;
+ readPart.length = dRowF["length"].ToString() ;
+ readPart.height = dRowF["height"].ToString() ;
+ readPart.width = dRowF["width"].ToString() ;
+ readPart.x = (double)dRowF["x"] ;
+ readPart.z = (double)dRowF["z"] ;
+ readPart.inverted = (double)dRowF["inverted"] ;
+ readPart.rotated = (double)dRowF["rotated"] ;
+ readPart.cutId = (int)dRowF["cutId"] ;
+ bFirst = false ;
+ readPart.features = new List() ;
+ }
+
+ if ( string.IsNullOrEmpty( dRowF["taskId"].ToString()))
+ continue ;
+
+ BTL.Feature readFeature = new BTL.Feature() {
+ taskId = dRowF["taskId"].ToString(),
+ processKey = dRowF["group"].ToString() +
+ "-" + dRowF["key"].ToString().Substring( 1, 3) +
+ "-" + dRowF["face"].ToString(),
+ designation = dRowF["des"].ToString(),
+ processIdent = dRowF["processIdent"].ToString(),
+ sag1 = dRowF["sag1"].ToString(),
+ text = dRowF["text"].ToString(),
+ process = ( Convert.ToInt16( dRowF["enabled"]) == 1) ? "YES" : "NO",
+ processParameters = new List( 46) {
+ dRowF["p01"].ToString(),
+ dRowF["p02"].ToString(),
+ dRowF["p03"].ToString(),
+ dRowF["p04"].ToString(),
+ dRowF["p05"].ToString(),
+ dRowF["p06"].ToString(),
+ dRowF["p07"].ToString(),
+ dRowF["p08"].ToString(),
+ dRowF["p09"].ToString(),
+ dRowF["p10"].ToString(),
+ dRowF["p11"].ToString(),
+ dRowF["p12"].ToString(),
+ dRowF["p13"].ToString(),
+ dRowF["p14"].ToString(),
+ dRowF["p15"].ToString(),
+ dRowF["p16"].ToString(),
+ dRowF["p17"].ToString(),
+ dRowF["p18"].ToString(),
+ dRowF["p19"].ToString(),
+ dRowF["p20"].ToString(),
+ dRowF["p21"].ToString(),
+ dRowF["p22"].ToString(),
+ dRowF["p23"].ToString(),
+ dRowF["p24"].ToString(),
+ dRowF["p25"].ToString(),
+ dRowF["p26"].ToString(),
+ dRowF["q01"].ToString(),
+ dRowF["q02"].ToString(),
+ dRowF["q03"].ToString(),
+ dRowF["q04"].ToString(),
+ dRowF["q05"].ToString(),
+ dRowF["q06"].ToString(),
+ dRowF["q07"].ToString(),
+ dRowF["q08"].ToString(),
+ dRowF["q09"].ToString(),
+ dRowF["q10"].ToString(),
+ dRowF["q11"].ToString(),
+ dRowF["q12"].ToString(),
+ dRowF["q13"].ToString(),
+ dRowF["q14"].ToString(),
+ dRowF["q15"].ToString(),
+ dRowF["q16"].ToString(),
+ dRowF["q17"].ToString(),
+ dRowF["q18"].ToString(),
+ dRowF["q19"].ToString(),
+ dRowF["q20"].ToString()
+ },
+ processReference = new List( 9) {
+ dRowF["ox"].ToString(),
+ dRowF["oy"].ToString(),
+ dRowF["oz"].ToString(),
+ dRowF["xx"].ToString(),
+ dRowF["xy"].ToString(),
+ dRowF["xz"].ToString(),
+ dRowF["yx"].ToString(),
+ dRowF["yy"].ToString(),
+ dRowF["yz"].ToString()
+ },
+ } ;
+ readPart.features.Add( readFeature) ;
+ }
+ btlObject.parts.Add( readPart) ;
+ }
+ // L'ordinamento delle Part in un oggetto BTL avviene col confronto del parametro x, estratto dalla tabella vw_Cut
+ btlObject.parts.Sort( (p, q) => p.x.CompareTo( q.x)) ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ private static int? GetVal( string sText, string sKey)
+ {
+ string[] sParts = sText.Split( new Char[] { '=' }) ;
+ if ( string.Compare( sParts[0], sKey) != 0)
+ return null ;
+ if ( ! int.TryParse( sParts[1], out int nVal))
+ return null ;
+ else
+ return nVal ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Il seguente metodo prende i record visualizzati in ds (Caso: Ordine) e li carica in un oggetto BTL
+ public static void GetListaProcesses( BTL btlObject)
+ {
+ DataTable dTab = _ds.Tables[0] ;
+ int listaProcessesCount = dTab.Rows.Count ;
+ if ( listaProcessesCount == 0) {
+ btlObject.parts = null ;
+ return ;
+ }
+
+ DataRow dRow0 = dTab.Rows[0] ;
+ btlObject.projectNumber = dRow0["projectId"].ToString() ;
+ btlObject.barLength = GetBarLengthO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.barLoad90 = "0" ;
+ btlObject.panelLength = GetPanelLengthO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.panelWidth = GetPanelWidthO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ;
+ btlObject.projectId = (int)dRow0["projectId"] ;
+ btlObject.elementId = (int)dRow0["elementId"] ;
+ btlObject.parts = new List() ;
+
+ List ListaCutParts = new List( 1) ;
+ ListaCutParts.Add( (int)dRow0["elementId"]) ;
+
+ for ( int c = 0 ; c < ListaCutParts.Count ; c++) {
+
+ BTL.Part readPart = new BTL.Part() ;
+
+ bool bFirst = true ;
+ for ( int f = 0 ; f < listaProcessesCount ; f++) {
+
+ DataRow dRowF = dTab.Rows[f] ;
+ if ( (int)dRowF["elementId"] != ListaCutParts[c])
+ continue ;
+
+ if ( bFirst) {
+ readPart.singleMemberNumber = GetElementSN( (int)dRow0["elementId"], (int)dRow0["projectId"]) ;
+ readPart.count = "1" ;
+ readPart.length = dRowF["length"].ToString() ;
+ readPart.height = dRowF["height"].ToString() ;
+ readPart.width = dRowF["width"].ToString() ;
+ readPart.x = Constants.HeadOverMat ;
+ readPart.z = Constants.HeadOverMat ;
+ readPart.inverted = (double)dRowF["inverted"] ;
+ readPart.rotated = (double)dRowF["rotated"] ;
+ readPart.elementId = (int)dRowF["elementId"] ;
+ bFirst = false ;
+ readPart.features = new List() ;
+ }
+
+ if ( string.IsNullOrEmpty( dRowF["processId"].ToString()))
+ continue ;
+
+ BTL.Feature readFeature = new BTL.Feature() {
+ processId = dRowF["processId"].ToString(),
+ processKey = dRowF["group"].ToString() +
+ "-" + dRowF["key"].ToString().Substring( 1, 3) +
+ "-" + dRowF["face"].ToString(),
+ designation = dRowF["des"].ToString(),
+ processIdent = dRowF["processIdent"].ToString(),
+ sag1 = dRowF["sag1"].ToString(),
+ text = dRowF["text"].ToString(),
+ process = ( Convert.ToInt16( dRowF["enabled"]) == 1) ? "YES" : "NO",
+ processParameters = new List( 46) {
+ dRowF["p01"].ToString(),
+ dRowF["p02"].ToString(),
+ dRowF["p03"].ToString(),
+ dRowF["p04"].ToString(),
+ dRowF["p05"].ToString(),
+ dRowF["p06"].ToString(),
+ dRowF["p07"].ToString(),
+ dRowF["p08"].ToString(),
+ dRowF["p09"].ToString(),
+ dRowF["p10"].ToString(),
+ dRowF["p11"].ToString(),
+ dRowF["p12"].ToString(),
+ dRowF["p13"].ToString(),
+ dRowF["p14"].ToString(),
+ dRowF["p15"].ToString(),
+ dRowF["p16"].ToString(),
+ dRowF["p17"].ToString(),
+ dRowF["p18"].ToString(),
+ dRowF["p19"].ToString(),
+ dRowF["p20"].ToString(),
+ dRowF["p21"].ToString(),
+ dRowF["p22"].ToString(),
+ dRowF["p23"].ToString(),
+ dRowF["p24"].ToString(),
+ dRowF["p25"].ToString(),
+ dRowF["p26"].ToString(),
+ dRowF["q01"].ToString(),
+ dRowF["q02"].ToString(),
+ dRowF["q03"].ToString(),
+ dRowF["q04"].ToString(),
+ dRowF["q05"].ToString(),
+ dRowF["q06"].ToString(),
+ dRowF["q07"].ToString(),
+ dRowF["q08"].ToString(),
+ dRowF["q09"].ToString(),
+ dRowF["q10"].ToString(),
+ dRowF["q11"].ToString(),
+ dRowF["q12"].ToString(),
+ dRowF["q13"].ToString(),
+ dRowF["q14"].ToString(),
+ dRowF["q15"].ToString(),
+ dRowF["q16"].ToString(),
+ dRowF["q17"].ToString(),
+ dRowF["q18"].ToString(),
+ dRowF["q19"].ToString(),
+ dRowF["q20"].ToString()
+ },
+ processReference = new List( 9) {
+ dRowF["ox"].ToString(),
+ dRowF["oy"].ToString(),
+ dRowF["oz"].ToString(),
+ dRowF["xx"].ToString(),
+ dRowF["xy"].ToString(),
+ dRowF["xz"].ToString(),
+ dRowF["yx"].ToString(),
+ dRowF["yy"].ToString(),
+ dRowF["yz"].ToString()
+ },
+ } ;
+ readPart.features.Add( readFeature) ;
+ }
+ btlObject.parts.Add( readPart) ;
+ }
+ // L'ordinamento delle Part in un oggetto BTL avviene col confronto del parametro x, estratto dalla tabella vw_Cut
+ btlObject.parts.Sort( (p, q) => p.x.CompareTo( q.x)) ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Il seguente metodo si connette al DB per estrarre tramite una query i cutId della tabella vw_Cut
+ // aventi patternId e ProductionId che corrispondono a quelli passati come argomento
+ private static List GetListaCutIdP()
+ {
+ List ListaCutId = new List() ;
+
+ DataTable dTab = _ds.Tables[0] ;
+ int listaTasksCount = dTab.Rows.Count ;
+ for ( int f = 0 ; f < listaTasksCount ; f++) {
+ int nCut = (int) dTab.Rows[f]["cutId"] ;
+ if ( ! ListaCutId.Contains( nCut))
+ ListaCutId.Add( nCut) ;
+ }
+
+ return ListaCutId ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera il singlemembernumber dell'Elemento (colonna "sn")
+ private static string GetElementSN( int ElementId, int ProjectId)
+ {
+ string SN = "000" ;
+
+ string sqlElementSN = "SELECT sn " +
+ "FROM dbo.vw_Element " +
+ "WHERE elementId = @firstId " +
+ "AND projectId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlElementSN, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = ElementId ;
+ sqlCommand.Parameters["@secondId"].Value = ProjectId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ SN = Convert.ToString( reader["sn"]) ;
+ }
+ }
+ }
+
+ return SN ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la lunghezza della barra nel caso Produzione (colonna "l")
+ private static double GetBarLengthP( int patternId, int productionId)
+ {
+ double barLength = 0 ;
+
+ string sqlBarLength = "SELECT l " +
+ "FROM dbo.vw_Pattern " +
+ "WHERE patternId = @firstId " +
+ "AND productionId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlBarLength, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = patternId ;
+ sqlCommand.Parameters["@secondId"].Value = productionId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ barLength = Convert.ToDouble( reader["l"]) ;
+ }
+ }
+ }
+
+ return barLength ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la larghezza della barra nel caso Produzione (colonna "w")
+ private static double GetBarWidthP( int patternId, int productionId)
+ {
+ double barWidth = 0 ;
+
+ string sqlBarWidth = "SELECT w " +
+ "FROM dbo.vw_Pattern " +
+ "WHERE patternId = @firstId " +
+ "AND productionId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlBarWidth, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = patternId ;
+ sqlCommand.Parameters["@secondId"].Value = productionId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ barWidth = Convert.ToDouble( reader["w"]) ;
+ }
+ }
+ }
+
+ return barWidth ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera il flag di carico con rotazione di 90° nel caso Produzione (colonna "load90")
+ private static int GetBarLoad90P( int patternId, int productionId)
+ {
+ int nLoad90 = 0 ;
+
+ string sqlBarLength = "SELECT load90 " +
+ "FROM dbo.vw_Pattern " +
+ "WHERE patternId = @firstId " +
+ "AND productionId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlBarLength, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = patternId ;
+ sqlCommand.Parameters["@secondId"].Value = productionId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ nLoad90 = Convert.ToInt32( reader["load90"]) ;
+ }
+ }
+ }
+
+ return nLoad90 ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera lo stato della barra nel caso Produzione (colonna "state")
+ private static int GetBarStateP( int patternId, int productionId)
+ {
+ int barState = 16 ;
+
+ string sqlBarLength = "SELECT state " +
+ "FROM dbo.vw_Pattern " +
+ "WHERE patternId = @firstId " +
+ "AND productionId = @secondId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand sqlCommand = new SqlCommand( sqlBarLength, cn)) {
+ sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ;
+ sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ;
+ sqlCommand.Parameters["@firstId"].Value = patternId ;
+ sqlCommand.Parameters["@secondId"].Value = productionId ;
+ SqlDataReader reader = sqlCommand.ExecuteReader() ;
+ while ( reader.Read()) {
+ barState = Convert.ToInt32( reader["state"]) ;
+ }
+ }
+ }
+
+ return barState ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la lunghezza della barra nel caso Ordine (colonna "length", ovvero la lunghezza della singola trave)
+ // a cui aggiungiamo un valore fisso (es. 2000)
+ private static double GetBarLengthO( int elementId, int projectId)
+ {
+ double barLength = 0 ;
+
+ DataTable dTab = _ds.Tables[0] ;
+ int listaProcessesCount = dTab.Rows.Count ;
+ if ( listaProcessesCount > 0) {
+ double beamLength = Convert.ToDouble( dTab.Rows[0]["length"]) ;
+ if ( beamLength < Constants.BarMaxLenForAdd)
+ barLength = beamLength + Constants.BarAddLen ;
+ else
+ barLength = beamLength + 2 * Constants.HeadOverMat ;
+ }
+
+ return barLength ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la lunghezza del pannello nel caso Ordine (colonna "length", ovvero la lunghezza della singola parete)
+ // a cui aggiungiamo un valore fisso (es. 200)
+ private static double GetPanelLengthO( int elementId, int projectId)
+ {
+ double panelLength = 0 ;
+
+ DataTable dTab = _ds.Tables[0] ;
+ int listaProcessesCount = dTab.Rows.Count ;
+ if ( listaProcessesCount > 0) {
+ double wallLength = Convert.ToDouble( dTab.Rows[0]["length"]) ;
+ panelLength = wallLength + 2 * Constants.PanelOverMat ;
+ }
+
+ return panelLength ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Recupera la lunghezza del pannello nel caso Ordine (colonna "width", ovvero la larghezza della singola parete)
+ // a cui aggiungiamo un valore fisso (es. 200)
+ private static double GetPanelWidthO( int elementId, int projectId)
+ {
+ double panelWidth = 0 ;
+
+ DataTable dTab = _ds.Tables[0] ;
+ int listaProcessesCount = dTab.Rows.Count ;
+ if ( listaProcessesCount > 0) {
+ double wallWidth = Convert.ToDouble( dTab.Rows[0]["width"]) ;
+ panelWidth = wallWidth + 2 * Constants.PanelOverMat ;
+ }
+
+ return panelWidth ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Restituisce la path di esecuzione di EgtCam5
+ private static String GetExePath( InOutParameters parameters)
+ {
+ return parameters.Read( "EGALTECH", "PATH_EXE", "") ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Restituisce il direttorio per i file con i dati macchina
+ private static String GetDataDir( InOutParameters parameters)
+ {
+ String DataDir = parameters.Read( "EGALTECH", "DIR_DATA", "") ;
+ // Se la directory non esiste viene creata
+ DirectoryInfo di = new DirectoryInfo( DataDir) ;
+ if ( ! di.Exists)
+ di.Create() ;
+ return DataDir ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Restituisce la path completa per il file BTL
+ private static String GetBtlPath( String DataDir, PatternInfo pattInfo)
+ {
+ String BtlDir, BtlName ;
+ // Se progetto
+ if ( pattInfo.IsFromProject) {
+ BtlDir = Path.Combine( DataDir, "Projs", pattInfo.ProjectId.ToString( "D4")) ;
+ BtlName = "Part_" + pattInfo.ProjectId.ToString() + "_" + pattInfo.ElementId.ToString() + ".btl" ;
+ }
+ // altrimenti produzione
+ else {
+ BtlDir = Path.Combine( DataDir, "Prods", pattInfo.ProductionId.ToString( "D4")) ;
+ BtlName = "Bar_" + pattInfo.ProductionId.ToString() + "_" + pattInfo.PatternId.ToString() + ".btl" ;
+ }
+ // Se la directory non esiste viene creata
+ DirectoryInfo di = new DirectoryInfo( BtlDir) ;
+ if ( ! di.Exists)
+ di.Create() ;
+ // restituisco la path completa
+ return Path.Combine( BtlDir, BtlName) ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Restituisce il massimo numero di istanze di EgtCAM5 eseguibili contemporaneamente
+ private static int GetMaxInstances( InOutParameters parameters)
+ {
+ String sMaxInst = parameters.Read( "EGALTECH", "MaxInstances", "1") ;
+ if ( ! int.TryParse( sMaxInst, out int nVal))
+ return 1 ;
+ else
+ return Math.Max( nVal, 1) ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Visualizzazione finestra gestione DB utensili
+ public bool ShowTools( InOutParameters parameters)
+ {
+ // Recupero dati
+ string ExePath = GetExePath( parameters) ;
+ string DataDir = GetDataDir( parameters) ;
+ string BtlPath = Path.Combine( DataDir, "QQQ.btl") ;
+ // Esecuzione di EgtCAM5 con parametri path BTL, nome macchina e modo
+ Process process = new Process() ;
+ process.StartInfo.FileName = ExePath ;
+ process.StartInfo.Arguments = "\"" + BtlPath + "\" " + parameters.MachineName + " 11" ;
+ process.StartInfo.UseShellExecute = false ;
+ process.Start() ;
+ // Attendo il termine del processo
+ while ( ! process.HasExited) {
+ process.Refresh() ;
+ Thread.Sleep( 50) ;
+ }
+ return true ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Visualizzazione finestra gestione DB lavorazioni
+ public bool ShowJobs( InOutParameters parameters)
+ {
+ // Recupero dati
+ string ExePath = GetExePath( parameters) ;
+ string DataDir = GetDataDir( parameters) ;
+ string BtlPath = Path.Combine( DataDir, "QQQ.btl") ;
+ // Esecuzione di EgtCAM5 con parametri path BTL, nome macchina e modo
+ Process process = new Process() ;
+ process.StartInfo.FileName = ExePath ;
+ process.StartInfo.Arguments = "\"" + BtlPath + "\" " + parameters.MachineName + " 12" ;
+ process.StartInfo.UseShellExecute = false ;
+ process.Start() ;
+ // Attendo il termine del processo
+ while ( ! process.HasExited) {
+ process.Refresh() ;
+ Thread.Sleep( 50) ;
+ }
+ return true ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Aggiornamento dati macchina
+ public bool UpdateMachine( InOutParameters parameters)
+ {
+ GetMachineParams( parameters) ;
+
+ return true ;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Dati utensili e macchina
+ //-------------------------------------------------------------------------------------------------------------
+ // Import della funzione di sistema per la scrittura su file INI
+ [DllImport("kernel32", CharSet = CharSet.Unicode)]
+ static extern long WritePrivateProfileString( string Section, string Key, string Value, string FilePath) ;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Scrive il file Essetre-[MachineName].data che riporta i parametri macchina del DB
+ private static void GetMachineParams( InOutParameters parameters)
+ {
+ // Direttorio di scrittura del file
+ String DataDir = GetDataDir( parameters) ;
+
+ // Path del file di dati e sua cancellazione se già esiste
+ string DataName = "Essetre-" + parameters.MachineName + ".data" ;
+ string DataPath = Path.Combine( DataDir, DataName) ;
+ if ( File.Exists( DataPath))
+ File.Delete( DataPath) ;
+
+ // Preparazione interrogazione per Offsets del DB
+ _SqlConnectionStr = parameters.ConnectionString ;
+ DataSet dsOffsets = new DataSet() ;
+
+ string sqlOffsets = "SELECT [group], [key], [value] " +
+ "FROM [ESSETRE].[dbo].[vw_MachineParam] " +
+ "WHERE [group] = 'OFFSETS' AND configurationId = @ConfigId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection(_SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand cmd = new SqlCommand(sqlOffsets, cn)) {
+ cmd.Parameters.Add( "@ConfigId", SqlDbType.Int) ;
+ cmd.Parameters["@ConfigId"].Value = parameters.ConfigurationId ;
+ var dataAdapter = new SqlDataAdapter( cmd) ;
+ // Lettura DB e riempimento DataSet
+ dsOffsets.Clear() ;
+ dataAdapter.Fill(dsOffsets) ;
+ }
+ }
+
+ // Preparazione interrogazione per Trave del DB
+ _SqlConnectionStr = parameters.ConnectionString ;
+ DataSet dsTrave = new DataSet() ;
+
+ string sqlTrave = "SELECT [group], [key], [value] " +
+ "FROM [ESSETRE].[dbo].[vw_MachineParam] " +
+ "WHERE [group] = 'TRAVE' AND configurationId = @ConfigId" ;
+
+ // Connessione al DB ed esecuzione query
+ using ( SqlConnection cn = new SqlConnection(_SqlConnectionStr)) {
+ cn.Open() ;
+ using ( SqlCommand cmd = new SqlCommand( sqlTrave, cn)) {
+ cmd.Parameters.Add( "@ConfigId", SqlDbType.Int) ;
+ cmd.Parameters["@ConfigId"].Value = parameters.ConfigurationId ;
+ var dataAdapter = new SqlDataAdapter( cmd) ;
+ // Lettura DB e riempimento DataSet
+ dsTrave.Clear() ;
+ dataAdapter.Fill( dsTrave) ;
+ }
+ }
+
+ // Preparazione interrogazione per Dati Utente del DB
+ _SqlConnectionStr = parameters.ConnectionString;
+ DataSet dsUser = new DataSet();
+
+ string sqlUser = "SELECT [group], [key], [value] " +
+ "FROM [ESSETRE].[dbo].[vw_ConfigurationParam] " +
+ "WHERE [group] <> 'TEXTS' AND [group] <> 'PARAMS' AND configurationId = @ConfigId";
+
+ // Connessione al DB ed esecuzione query
+ using (SqlConnection cn = new SqlConnection(_SqlConnectionStr))
+ {
+ cn.Open();
+ using (SqlCommand cmd = new SqlCommand(sqlUser, cn))
+ {
+ cmd.Parameters.Add("@ConfigId", SqlDbType.Int);
+ cmd.Parameters["@ConfigId"].Value = parameters.ConfigurationId;
+ var dataAdapter = new SqlDataAdapter(cmd);
+ // Lettura DB e riempimento DataSet
+ dsUser.Clear();
+ dataAdapter.Fill(dsUser);
+ }
+ }
+
+ // Apro file
+ using ( var tw = new StreamWriter( DataPath, false)) {
+
+ // Scrittura intestazione
+ tw.WriteLine( "-- " + DataPath) ;
+ tw.WriteLine( "") ;
+
+ // Scrittura dei dati di Offsets
+ tw.WriteLine( "local Offsets = {") ;
+ foreach ( DataTable table in dsOffsets.Tables) {
+ foreach ( DataRow row in table.Rows) {
+ String Key = row["key"].ToString() ;
+ String Value = row["value"].ToString() ;
+ tw.WriteLine( " " + Key + "=" + Value + ",") ;
+ }
+ }
+ tw.WriteLine( " Zzz=1") ;
+ tw.WriteLine( "}") ;
+ tw.WriteLine( "") ;
+
+ // Scrittura dei dati di Trave
+ tw.WriteLine( "local Trave = {") ;
+ foreach ( DataTable table in dsTrave.Tables) {
+ foreach ( DataRow row in table.Rows) {
+ String Key = row["key"].ToString() ;
+ String Value = row["value"].ToString() ;
+ tw.WriteLine( " " + Key + "=" + Value + ",") ;
+ }
+ }
+ tw.WriteLine( " Zzz=1") ;
+ tw.WriteLine( "}") ;
+ tw.WriteLine( "") ;
+
+ // Scrittura dei dati di Utente
+ tw.WriteLine("local User = {");
+ foreach (DataTable table in dsUser.Tables)
+ {
+ foreach (DataRow row in table.Rows)
+ {
+ String Group = row["group"].ToString();
+ String Key = row["key"].ToString();
+ String Value = row["value"].ToString();
+ tw.WriteLine(" " + Group + "_" + Key + "=" + Value + ",");
+ }
+ }
+ tw.WriteLine(" Zzz=1");
+ tw.WriteLine("}");
+ tw.WriteLine("");
+
+ // Scrittura tabella da restituire
+ tw.WriteLine( "local Machine = { Offsets=Offsets, Trave=Trave, User=User}") ;
+
+ tw.WriteLine( "return Machine") ;
+ }
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Indica direttori e file per backup
+ public void CollectFile( InOutParameters parameters, FileCollector collector)
+ {
+ // Direttori notevoli
+ String sRoot = parameters.Read( "EGALTECH", "DIR_EGT", "C:\\TechnoEssetre7\\EgalTech") ;
+ String sBeamDir = "EgtCAM5\\Beam" ;
+ String sMachDir = "EgtCAM5\\Machines\\Essetre-" + parameters.MachineName ;
+ // Impostazione
+ collector.SetRoot(sRoot) ;
+ collector.AddDirectory(Path.Combine(sRoot, sBeamDir)) ;
+ collector.AddDirectory(Path.Combine(sRoot, sMachDir)) ;
+ }
+
+ }
+}
diff --git a/EgtBEAMWALL.ViewerOptimizer/Integration/Original.vb b/EgtBEAMWALL.ViewerOptimizer/Integration/Original.vb
new file mode 100644
index 00000000..b25d3637
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Integration/Original.vb
@@ -0,0 +1,1211 @@
+Imports System
+Imports System.Windows.Forms
+Imports System.Collections.Generic
+Imports System.Data
+Imports System.Data.SqlClient
+Imports System.Diagnostics
+Imports System.IO
+Imports System.Linq
+Imports System.Runtime.InteropServices
+Imports System.Text
+Imports System.Threading
+Imports System.Threading.Tasks
+Imports System.Globalization
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class CalcIntegration
+
+ Private _thread As System.Threading.Thread
+ Private Shared _ds As DataSet = New DataSet()
+ Private Shared _SqlConnectionStr As String = ""
+
+ Public Enum CmdType As Integer
+ GENERATE = 0
+ MODIFY = 1
+ SIMULATE = 2
+ CHECK = 3
+ CHECKGEN = 4
+ POINT_CLOUD = 5
+ RAWPART = 6
+ End Enum
+
+ Public Class Bar
+ 'Public piInfo As PatternInfo
+ Public nBarState As Integer
+ Public nBarId As Integer
+ Public sBarPath As String
+ Public bBarOk As Boolean
+ Public nCmdType As Integer
+ Public nBarType As ProjectType
+ End Class
+
+ Private Structure MyProc
+ Public bEnable As Boolean
+ Public Proc As Process
+ Public nBar As Integer
+ End Structure
+
+ Public Sub New()
+ End Sub
+
+ Public Sub Run(vBar As Bar(), sProjDirPath As String, callback As Action(Of Double, String, Boolean)) 'ByVal parameters As InOutParameters, ByVal callback As ICallBack)
+ _thread = New Thread(Sub()
+ DoJob(vBar, sProjDirPath, callback)
+ End Sub) ',parameters, callback))
+ _thread.Start()
+ End Sub
+
+ 'Private Delegate Sub dDoJob(ByVal parameters As InOutParameters, ByVal callback As ICallBack)
+
+ Private Shared Function CreateNewProjectFromPart(nPartId As Integer, sProjDirPath As String) As String
+ ' assegno Id a CutId per calcoli
+ EgtSetInfo(nPartId, "CUTID", nPartId)
+ ' assegno TASKID alla feature per calcoli
+ Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
+ Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
+ While nFeatureId <> GDB_ID.NULL
+ ' verifico che sia una feature
+ Dim nGRP As Integer
+ If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
+ ' assegno TASKID alla feature per calcoli
+ EgtSetInfo(nFeatureId, "TASKID", nFeatureId)
+ End If
+ nFeatureId = EgtGetNext(nFeatureId)
+ End While
+
+ ' recupero visibilita' pezzo e lo imposto a visibile
+ Dim nPartMode As Integer
+ EgtGetMode(nPartId, nPartMode)
+ EgtSetMode(nPartId, GDB_MD.STD)
+
+ ' salvo pezzo nel suo progetto
+ Dim bOk As Boolean = False
+ Dim nPDN As Integer = 0
+ EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
+ Dim sPartFilePath As String = sProjDirPath & "/" & nPDN & ".bwe"
+ bOk = EgtSaveObjToFile(nPartId, sPartFilePath, NGE.BIN)
+
+ 'ripristino visibilita' pezzo
+ EgtSetMode(nPartId, nPartMode)
+ Return If(bOk, sPartFilePath, String.Empty)
+ End Function
+
+ Private Shared Function CreateNewProjectFromMachGroup(nMachGroupId As Integer, sProjDirPath As String) As String
+ Dim sMachGroupFilePath As String = sProjDirPath & "\" & nMachGroupId & ".bwe"
+ ' salvo gruppo di lavorazione nel suo progetto
+ If EgtSaveObjToFile(nMachGroupId, sMachGroupFilePath, NGE.BIN) Then
+ Return sMachGroupFilePath
+ End If
+ Return String.Empty
+ End Function
+
+ Private Shared Sub DoJob(vBar As Bar(), sProjDirPath As String, callback As Action(Of Double, String, Boolean)) ', parameters As InOutParameters, callback As ICallBack)
+ Dim bCancel As Boolean = False
+ callback(0, "Init", bCancel)
+
+ ' creo progetti a seconda del tipo
+ For Each Bar In vBar
+ If Bar.nBarType = ProjectType.PROJ Then
+ Bar.sBarPath = CreateNewProjectFromPart(Bar.nBarId, sProjDirPath)
+ ElseIf Bar.nBarType = ProjectType.PROD Then
+ Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath)
+ End If
+ Next
+
+ callback(0.1, "", bCancel)
+
+ '_SqlConnectionStr = parameters.ConnectionString
+ Dim ExePath As String = String.Empty
+ GetMainPrivateProfileString(S_BEAM, K_CALCPATH, "", ExePath)
+ 'Dim DataDir As String = GetDataDir(parameters)
+ ' Numero di barre
+ Dim numBars As Integer = vBar.Count
+ If numBars = 0 Then Return
+ '' Se modalità Cloud, allora conta solo la prima barra
+ 'Dim bCloud As Boolean = (parameters.UIMode = InOutParameters.UIModes.CLOUD)
+ 'If bCloud Then numBars = 1
+
+ ' Numero di core logici da utilizzare (minimo tra presenti sul PC e imposti da INI)
+ Dim nMaxThread As Integer = Math.Min(Environment.ProcessorCount, Map.refMainWindowVM.MainWindowM.GetMaxInstances())
+
+ ' Frazione di avanzamento del lavoro (in pu)
+ Dim dProgress As Double = 0
+ '' Genero i Btl di tutte le barre
+ 'Dim vBar As Bar() = New Bar(numBars + nMaxThread - 1) {}
+
+ 'For i As Integer = 0 To numBars - 1
+ ' Dim pattInfo As PatternInfo = parameters.Patterns(i)
+ ' Dim btlObject As BTL = New BTL()
+ ' ' Se il parametro IsFromProject è TRUE viene eseguita la query sulle tabelle Project,
+ ' ' se invece è FALSE viene eseguita la query sulle tabelle Production
+
+ ' Dim sql As String = ""
+
+ ' If pattInfo.IsFromProject Then
+ ' sql = "SELECT E.projectId, " & "E.elementId, 0 cutId, processId, info1, info2, enabled, level, " & "inTools, outTools, isChecked, P.done, isoType, ax, ay, az, P.x, P.y, P.z, " & "P.flagDeleted, P.[group], [key], face, edge, des, " & "p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, " & "q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, " & "ox, oy, oz, xx, xy, xz, yx, yy, yz, " & "priority, processIdent, processingQuality, sag1, text, E.projectId, E.elementId, P.processId, 0 cutStart, 0 cutEnd, " & "E.inverted, E.rotated, 0 doneTime, 0 startAngle, 0 endAngle, -1 referenceCutId, E.length, E.width, E.height " & "FROM dbo.vw_Process AS P " & "RIGHT OUTER JOIN dbo.vw_Element AS E " & "ON P.projectId=E.projectId AND P.elementId=E.elementId " & "WHERE E.projectId = @firstId AND E.elementId = @secondId"
+ ' Else
+ ' sql = "SELECT vw_Cut.productionId, " & "vw_Cut.patternId, vw_Cut.cutId, taskId, info1, info2, enabled, level, " & "inTools, outTools, isChecked, vw_Task.done, isoType, ax, ay, az, vw_Cut.x, vw_Cut.y, vw_Cut.z, " & "vw_Task.flagDeleted, [group], [key], face, edge, des, " & "p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, " & "q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, " & "ox, oy, oz, xx, xy, xz, yx, yy, yz, " & "priority, processIdent, processingQuality, sag1, text, vw_Cut.projectId, vw_Cut.elementId, cutStart, cutEnd, " & "inverted, rotated, doneTime, startAngle, endAngle, referenceCutId, length, width, height " & "FROM dbo.vw_Task " & "RIGHT OUTER JOIN dbo.vw_Cut " & "ON (vw_Task.cutId = vw_Cut.cutId AND vw_Task.patternId = vw_Cut.patternId AND vw_Task.productionId = vw_Cut.productionId) " & "WHERE vw_Cut.productionId = @firstId AND vw_Cut.patternId = @secondId"
+ ' End If
+
+ ' ' Connessione al DB ed esecuzione query
+ ' Using cn As SqlConnection = New SqlConnection(_SqlConnectionStr)
+ ' cn.Open()
+
+ ' Using cmd As SqlCommand = New SqlCommand(sql, cn)
+ ' cmd.Parameters.Add("@firstId", SqlDbType.Int)
+ ' cmd.Parameters.Add("@secondId", SqlDbType.Int)
+
+ ' If pattInfo.IsFromProject Then
+ ' cmd.Parameters("@firstId").Value = pattInfo.ProjectId
+ ' cmd.Parameters("@secondId").Value = pattInfo.ElementId
+ ' Else
+ ' cmd.Parameters("@firstId").Value = pattInfo.ProductionId
+ ' cmd.Parameters("@secondId").Value = pattInfo.PatternId
+ ' End If
+
+ ' Dim dataAdapter = New SqlDataAdapter(cmd)
+ ' ' Lettura DB e riempimento DataSet
+ ' _ds.Clear()
+ ' dataAdapter.Fill(_ds)
+ ' End Using
+ ' End Using
+
+ ' ' Verifica parametro isFromProject nel caso Ordine viene ottenuta la lista dei Process,
+ ' ' nel caso Produzione viene ottenuta la lista dei Task
+ ' If pattInfo.IsFromProject Then
+ ' GetListaProcesses(btlObject)
+ ' Else
+ ' GetListaTasks(btlObject)
+ ' End If
+
+ ' ' Recupero lo stato della barra
+ ' Dim nBarState As Integer = 0
+ ' If Not pattInfo.IsFromProject Then nBarState = GetBarStateP(btlObject.patternId, btlObject.productionId)
+ ' ' Dialog con Progress Bar
+ ' dProgress += 0.1 / numBars
+ ' Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
+ ' callback.Progress(CSng(dProgress), " Progress: " & sProg & "%" & vbLf, bCancel)
+
+ ' If bCancel Then
+ ' callback.Done(parameters)
+ ' Return
+ ' End If
+
+ ' ' Scrittura del file BTL
+ ' ' Path completa del nome del file da salvare
+ ' Dim BtlPath As String = GetBtlPath(DataDir, pattInfo)
+ ' Dim BtlOk As Boolean = btlObject.WriteIntoFile(BtlPath, pattInfo.IsFromProject)
+ ' ' Se modalità cloud, scrittura del file di punti
+ ' Dim bErrOnCloud As Boolean = False
+
+ ' If bCloud Then
+
+ ' If pattInfo.Cloud IsNot Nothing Then
+
+ ' Using tw = New StreamWriter(Path.ChangeExtension(BtlPath, ".pnt"), False)
+
+ ' For j As Integer = 0 To pattInfo.Cloud.Count() - 1
+ ' Dim dPosX As Double = -pattInfo.Cloud(j).Y
+ ' Dim dPosY As Double = pattInfo.Cloud(j).X
+ ' Dim sPosX As String = dPosX.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)
+ ' Dim sPosY As String = dPosY.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)
+ ' tw.WriteLine(sPosX & " " & sPosY)
+ ' Next
+ ' End Using
+ ' Else
+ ' BtlOk = False
+ ' bErrOnCloud = True
+ ' End If
+ ' End If
+ ' ' Se scrittura Btl non riuscita
+ ' If Not BtlOk Then
+ ' ' scrivo direttamente il file di errore
+ ' Dim ErrCutId As Integer = (If(pattInfo.IsFromProject, pattInfo.ElementId, pattInfo.PatternId))
+
+ ' Using tw = New StreamWriter(Path.ChangeExtension(BtlPath, ".txt"), False)
+ ' tw.WriteLine("ERR=10")
+ ' tw.WriteLine(If(bErrOnCloud, "Cloud without points", "BTL without processes"))
+ ' tw.WriteLine("CUTID=" & ErrCutId.ToString())
+ ' tw.WriteLine("TASKID=0")
+ ' End Using
+ ' ' elimino eventuale file Cn già presente
+ ' If parameters.UIMode = InOutParameters.UIModes.HIDDEN Then
+ ' Dim CncPath As String = Path.ChangeExtension(BtlPath, ".cnc")
+ ' If File.Exists(CncPath) Then File.Delete(CncPath)
+ ' End If
+ ' ' altrimenti
+ ' Else
+ ' ' cancello eventuale file di errore già presente
+ ' Dim TxtPath As String = Path.ChangeExtension(BtlPath, ".txt")
+ ' If File.Exists(TxtPath) Then File.Delete(TxtPath)
+ ' End If
+ ' ' Salvo dati
+ ' vBar(i).piInfo = pattInfo
+ ' vBar(i).nBarState = nBarState
+ ' vBar(i).sBtlPath = BtlPath
+ ' vBar(i).bBtlOk = BtlOk
+ 'Next
+
+ ' Lancio in parallelo più processi (senza superare il numero di core logici presenti)
+ Dim vProc As MyProc() = New MyProc(nMaxThread - 1) {}
+ For j As Integer = 0 To nMaxThread - 1
+ vProc(j).nBar = -1
+ vProc(j).bEnable = True
+ Next
+
+ ' Processo i Btl in parallelo
+ Dim nCurrBar As Integer = 0
+ Dim nDoneBar As Integer = 0
+ Dim nShiftBar As Integer = 0
+ Dim nActProc As Integer = 0
+
+ While nCurrBar < numBars + nShiftBar OrElse nActProc > 0
+
+ For j As Integer = 0 To nMaxThread - 1
+ If Not vProc(j).bEnable Then Continue For
+ Dim bDone As Boolean = False
+
+ If vProc(j).nBar = -1 Then
+
+ If nCurrBar < numBars + nShiftBar Then
+
+ If vBar(nCurrBar).bBarOk Then
+ vProc(j).Proc = New Process()
+ vProc(j).Proc.StartInfo.FileName = ExePath
+ 'Dim nMode As Integer = CInt(parameters.UIMode)
+ 'If parameters.UIMode = InOutParameters.UIModes.HIDDEN AndAlso vBar(nCurrBar).nBarState <> 0 Then nMode = 4
+ vProc(j).Proc.StartInfo.Arguments = """" & vBar(nCurrBar).sBarPath & """ " & """" & Map.refMachinePanelVM.SelectedMachine.nType & """ " &
+ """" & Map.refMachinePanelVM.SelectedMachine.Name & """ " & vBar(nCurrBar).nCmdType
+ vProc(j).Proc.StartInfo.UseShellExecute = False
+
+ If vProc(j).Proc.Start() Then
+ vProc(j).nBar = nCurrBar
+ nCurrBar += 1
+ nActProc += 1
+ End If
+ Else
+ ProcessResults(vBar(nCurrBar)) ', vBar(nCurrBar).piInfo, parameters.UIMode)
+ bDone = True
+ nCurrBar += 1
+ End If
+ End If
+ Else
+
+ If vProc(j).Proc.HasExited Then
+ ' se terminato con successo
+ If vProc(j).Proc.ExitCode = 0 Then
+ ' salvo il risultato
+ ProcessResults(vBar(vProc(j).nBar)) ', vBar(vProc(j).nBar).piInfo, parameters.UIMode)
+ bDone = True
+ vProc(j).nBar = -1
+ nActProc -= 1
+ ' se superato il numero di processi eseguibili in parallelo
+ ElseIf vProc(j).Proc.ExitCode = 1 Then
+ ' aggiungo il pezzo in coda
+ If numBars + nShiftBar < numBars + nMaxThread Then
+ vBar(numBars + nShiftBar) = vBar(vProc(j).nBar)
+ nShiftBar += 1
+ End If
+ ' disabilito il processo
+ vProc(j).bEnable = False
+ vProc(j).nBar = -1
+ nActProc -= 1
+ ' altrimenti (errore generico di esecuzione)
+ Else
+ ' salvo il risultato
+ ProcessResults(vBar(vProc(j).nBar)) ', parameters.UIMode)
+ bDone = True
+ vProc(j).nBar = -1
+ nActProc -= 1
+ End If
+ Else
+ vProc(j).Proc.Refresh()
+ End If
+ End If
+
+ If bDone Then
+ ' Dialog con Progress Bar
+ dProgress += (0.9 / numBars)
+ nDoneBar += 1
+ Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
+ callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel)
+
+ If bCancel Then
+ ' fine
+ callback(1, "", bCancel)
+ Return
+ End If
+ End If
+
+ Thread.Sleep(1)
+ Next
+
+ ' Verifico che i processi non siano andati tutti in errore
+ Dim bAllKO As Boolean = True
+
+ For j As Integer = 0 To nMaxThread - 1
+ If vProc(j).bEnable Then bAllKO = False
+ Next
+
+ If bAllKO Then
+ MessageBox.Show("Execution error (all processes are disabled)")
+ Exit While
+ End If
+
+ Thread.Sleep(10)
+ End While
+
+ 'callback.Progress(1, "End", bCancel)
+ Thread.Sleep(300)
+ ' fine
+ callback(1, "Done", bCancel)
+ End Sub
+
+ 'Public Sub Abort()
+ 'End Sub
+
+ Private Shared Sub ProcessResults(ByVal Bar As Bar) ' , ByVal pattInfo As PatternInfo, ByVal UIMode As InOutParameters.UIModes)
+ 'If UIMode = InOutParameters.UIModes.SHOWUI OrElse UIMode = InOutParameters.UIModes.SIMULAZIONE Then Return
+ Dim BtlPath As String = Bar.sBarPath
+ Dim bErrors As Boolean = False
+ Dim nLastErr As Integer = 0
+ Dim sLastMsg As String = ""
+ Dim nCurrCutId As Integer = 0
+ 'Dim dctErr As Dictionary(Of Integer, PatternInfo.Results) = New Dictionary(Of Integer, PatternInfo.Results)()
+ 'Dim dctRot As Dictionary(Of Integer, Double) = New Dictionary(Of Integer, Double)()
+ Dim nTotTime As Integer = 0
+ 'Dim resCurrExe As PatternInfo.Results = Nothing, dCurrRot As Double = Nothing
+
+ If File.Exists(Path.ChangeExtension(BtlPath, ".txt")) Then
+ Dim nErr As Integer = 0
+ Dim sMsg As String = ""
+ Dim dRot As Double = 0
+ Dim cutId As Integer = 0
+ Dim prevCutId As Integer = GDB_ID.NULL
+ Dim currBTLPart As BTLPart
+ Dim taskId As Integer = 0
+ Dim lines As String() = System.IO.File.ReadAllLines(Path.ChangeExtension(BtlPath, ".txt"))
+
+ For Each line As String In lines
+
+ If line.StartsWith("ERR=") Then
+ Dim nVal As Integer? = GetVal(line, "ERR")
+ nErr = (If(nVal IsNot Nothing, nVal.Value, 0))
+ sMsg = ""
+ cutId = 0
+ taskId = 0
+ ElseIf line.StartsWith("ROT=") Then
+ Dim nVal As Integer? = GetVal(line, "ROT")
+ Dim nRot As Integer = (If(nVal IsNot Nothing, nVal.Value, 0))
+ dRot = ((4 - nRot) Mod 4) * 90
+ ElseIf line.StartsWith("CUTID=") Then
+ Dim nVal As Integer? = GetVal(line, "CUTID")
+ cutId = (If(nVal IsNot Nothing, nVal.Value, 0))
+ If cutId <> prevCutId Then
+ ' aggiornamento globale pezzo precedente
+ If cutId <> GDB_ID.NULL AndAlso cutId <> 0 Then
+ 'currBTLPart.CalcGlobalUpdate()
+ End If
+ ' aggiornamento risultati in struttura BTL
+ If Bar.nBarType = ProjectType.PROJ Then
+ ' cerco pezzo in btl structure da id
+ For Each Part In Map.refProjectVM.BTLStructure.PartList
+ If Part.nPartId = cutId Then
+ currBTLPart = Part
+ End If
+ Next
+ End If
+ End If
+ prevCutId = cutId
+
+ 'If cutId <> nCurrCutId Then
+ ' nCurrCutId = cutId
+ ' dctErr.Clear()
+ ' dctRot.Clear()
+ 'End If
+ ElseIf line.StartsWith("TASKID=") Then
+ Dim nVal As Integer? = GetVal(line, "TASKID")
+ taskId = (If(nVal IsNot Nothing, nVal.Value, 0))
+ 'Dim resExe As PatternInfo.Results = PatternInfo.Results.OK
+
+ 'If nErr = 22 Then
+ ' resExe = PatternInfo.Results.COLLISION
+ ' bErrors = True
+
+ ' If cutId = 0 OrElse taskId = 0 Then
+ ' nLastErr = nErr
+ ' sLastMsg = sMsg
+ ' End If
+ 'ElseIf nErr > 0 Then
+ ' resExe = PatternInfo.Results.WARNING
+ ' bErrors = True
+
+ ' If cutId = 0 OrElse taskId = 0 Then
+ ' nLastErr = nErr
+ ' sLastMsg = sMsg
+ ' End If
+ 'End If
+
+ 'se taskid diverso da zero, errore feature
+ If taskId <> 0 Then
+ EgtSetInfo(taskId, ITG_ERR, nErr)
+ EgtSetInfo(taskId, ITG_MSG, sMsg)
+ EgtSetInfo(taskId, ITG_ROT, dRot)
+ ' aggiornamento risultati in struttura BTL
+ If Bar.nBarType = ProjectType.PROJ Then
+ ' cerco task in btl structure da id
+ If Not IsNothing(currBTLPart) Then
+ For Each Feature In currBTLPart.FeatureList
+ If Feature.nFeatureId = taskId Then
+ Feature.CalcFeatureUpdate(True, nErr, dRot, sMsg)
+ End If
+ Next
+ End If
+ End If
+
+ 'se taskid uguale a zero, errore pezzo
+ Else
+ EgtSetInfo(cutId, ITG_ERR, nErr)
+ EgtSetInfo(cutId, ITG_MSG, sMsg)
+ EgtSetInfo(cutId, ITG_ROT, dRot)
+ ' aggiorno in struttura btl
+ If Not IsNothing(currBTLPart) Then currBTLPart.CalcPartUpdate(True, nErr, dRot, sMsg)
+
+ End If
+
+
+ 'If taskId <> 0 Then
+
+ ' If dctErr.TryGetValue(taskId, resCurrExe) Then
+
+ ' If resExe > resCurrExe Then
+ ' dctErr(taskId) = resExe
+ ' pattInfo.SetTaskState(cutId, taskId, resExe, sMsg)
+ ' End If
+ ' Else
+ ' dctErr(taskId) = resExe
+ ' pattInfo.SetTaskState(cutId, taskId, resExe, sMsg)
+ ' End If
+ 'Else
+ ' pattInfo.SetTaskState(cutId, taskId, resExe, sMsg)
+ 'End If
+
+ 'If taskId <> 0 Then
+
+ ' If dctRot.TryGetValue(taskId, dCurrRot) Then
+
+ ' If Math.Abs(dRot) > 1 Then
+ ' If Math.Abs(dCurrRot) < 1 Then dctRot(taskId) = dRot
+ ' Else
+ ' dRot = dCurrRot
+ ' End If
+ ' Else
+ ' dctRot.Add(taskId, dRot)
+ ' End If
+ 'End If
+
+ 'If pattInfo.IsFromProject Then
+ ' pattInfo.SetProcessInfoChosen(cutId, taskId, dRot, 0, False)
+ 'Else
+ ' pattInfo.SetTaskInfoChosen(cutId, taskId, dRot, 0, False)
+ 'End If
+ ElseIf line.StartsWith("TIME=") Then
+ Dim nVal As Integer? = GetVal(line, "TIME")
+ nTotTime = (If(nVal IsNot Nothing, nVal.Value, 0))
+ EgtSetInfo(cutId, ITG_TIME, nTotTime)
+ ElseIf Not String.IsNullOrWhiteSpace(line) AndAlso line <> "---" Then
+ sMsg = line
+ End If
+ Next
+ Else
+ bErrors = True
+ nLastErr = 25
+ sLastMsg = "Execution Error"
+ End If
+
+ ' aggiornamento risultati in struttura BTL
+ If Bar.nBarType = ProjectType.PROJ Then
+ ' cerco pezzo in btl structure da id
+ For Each Part In Map.refProjectVM.BTLStructure.PartList
+ If Part.nPartId = Bar.nBarId Then
+ ' leggo errori da geometria e li aggiorno in struttura btl
+ Part.CalcFeatureUpdate()
+ End If
+ Next
+
+ End If
+
+ 'pattInfo.IsDone = True
+
+ 'If Not bErrors Then
+ ' pattInfo.Result = PatternInfo.Results.OK
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.MEMORY
+ 'Else
+
+ ' If nLastErr = 17 Then
+ ' pattInfo.Result = PatternInfo.Results.[ERROR]
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.ALL_WARNING
+ ' pattInfo.Message = sLastMsg
+ ' ElseIf nLastErr = 19 Then
+ ' pattInfo.Result = PatternInfo.Results.[ERROR]
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR
+ ' pattInfo.Message = sLastMsg
+ ' ElseIf nLastErr = 22 Then
+ ' pattInfo.Result = PatternInfo.Results.[ERROR]
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.ALL_COLLISION
+ ' pattInfo.Message = sLastMsg
+ ' ElseIf nLastErr = 23 Then
+ ' pattInfo.Result = PatternInfo.Results.[ERROR]
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR
+ ' pattInfo.Message = sLastMsg
+ ' ElseIf nLastErr = 24 Then
+ ' pattInfo.Result = PatternInfo.Results.[ERROR]
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR
+ ' pattInfo.Message = sLastMsg
+ ' ElseIf nLastErr = 25 Then
+ ' pattInfo.Result = PatternInfo.Results.[ERROR]
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR
+ ' pattInfo.Message = sLastMsg
+ ' Else
+ ' pattInfo.Result = PatternInfo.Results.[ERROR]
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.MEMORY
+ ' End If
+ 'End If
+
+ 'pattInfo.EstimatedTime = nTotTime
+
+ 'If Not bErrors AndAlso (UIMode = InOutParameters.UIModes.HIDDEN OrElse UIMode = InOutParameters.UIModes.CLOUD) Then
+ ' Dim CncPath As String = Path.ChangeExtension(BtlPath, ".cnc")
+
+ ' If File.Exists(CncPath) Then
+ ' Dim lines As String = System.IO.File.ReadAllText(CncPath)
+ ' pattInfo.Iso = lines
+ ' pattInfo.Result = PatternInfo.Results.OK
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.ALL_OK
+ ' Else
+ ' pattInfo.Iso = ""
+ ' pattInfo.Result = PatternInfo.Results.[ERROR]
+ ' pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR
+ ' End If
+ 'End If
+ End Sub
+
+ 'Public Shared Sub GetListaTasks(ByVal btlObject As BTL)
+ ' Dim dTab As DataTable = _ds.Tables(0)
+ ' Dim listaTasksCount As Int32 = dTab.Rows.Count
+ ' If listaTasksCount = 0 Then Return
+ ' Dim dRow0 As DataRow = dTab.Rows(0)
+ ' btlObject.projectNumber = dRow0("projectId").ToString()
+ ' btlObject.barLength = GetBarLengthP(CInt(dRow0("patternId")), CInt(dRow0("productionId"))).ToString("F3", CultureInfo.InvariantCulture)
+ ' btlObject.barLoad90 = GetBarLoad90P(CInt(dRow0("patternId")), CInt(dRow0("productionId"))).ToString(CultureInfo.InvariantCulture)
+ ' btlObject.panelLength = GetBarLengthP(CInt(dRow0("patternId")), CInt(dRow0("productionId"))).ToString("F3", CultureInfo.InvariantCulture)
+ ' btlObject.panelWidth = GetBarWidthP(CInt(dRow0("patternId")), CInt(dRow0("productionId"))).ToString("F3", CultureInfo.InvariantCulture)
+ ' btlObject.productionId = CInt(dRow0("productionId"))
+ ' btlObject.patternId = CInt(dRow0("patternId"))
+ ' btlObject.parts = New List(Of BTL.Part)()
+ ' Dim ListaCutParts As List(Of Integer) = GetListaCutIdP()
+
+ ' For c As Integer = 0 To ListaCutParts.Count - 1
+ ' Dim readPart As BTL.Part = New BTL.Part()
+ ' Dim bFirst As Boolean = True
+
+ ' For f As Integer = 0 To listaTasksCount - 1
+ ' Dim dRowF As DataRow = dTab.Rows(f)
+ ' If CInt(dRowF("cutId")) <> ListaCutParts(c) Then Continue For
+
+ ' If bFirst Then
+ ' readPart.singleMemberNumber = GetElementSN(CInt(dRowF("elementId")), CInt(dRowF("projectId")))
+ ' readPart.count = "1"
+ ' readPart.length = dRowF("length").ToString()
+ ' readPart.height = dRowF("height").ToString()
+ ' readPart.width = dRowF("width").ToString()
+ ' readPart.x = CDbl(dRowF("x"))
+ ' readPart.z = CDbl(dRowF("z"))
+ ' readPart.inverted = CDbl(dRowF("inverted"))
+ ' readPart.rotated = CDbl(dRowF("rotated"))
+ ' readPart.cutId = CInt(dRowF("cutId"))
+ ' bFirst = False
+ ' readPart.features = New List(Of BTL.Feature)()
+ ' End If
+
+ ' If String.IsNullOrEmpty(dRowF("taskId").ToString()) Then Continue For
+ ' Dim readFeature As BTL.Feature = New BTL.Feature() With {
+ ' .taskId = dRowF("taskId").ToString(),
+ ' .processKey = dRowF("group").ToString() & "-" & dRowF("key").ToString().Substring(1, 3) & "-" & dRowF("face").ToString(),
+ ' .designation = dRowF("des").ToString(),
+ ' .processIdent = dRowF("processIdent").ToString(),
+ ' .sag1 = dRowF("sag1").ToString(),
+ ' .Text = dRowF("text").ToString(),
+ ' .Process = If((Convert.ToInt16(dRowF("enabled")) = 1), "YES", "NO"),
+ ' .processParameters = New List(Of String)(46) From {
+ ' dRowF("p01").ToString(),
+ ' dRowF("p02").ToString(),
+ ' dRowF("p03").ToString(),
+ ' dRowF("p04").ToString(),
+ ' dRowF("p05").ToString(),
+ ' dRowF("p06").ToString(),
+ ' dRowF("p07").ToString(),
+ ' dRowF("p08").ToString(),
+ ' dRowF("p09").ToString(),
+ ' dRowF("p10").ToString(),
+ ' dRowF("p11").ToString(),
+ ' dRowF("p12").ToString(),
+ ' dRowF("p13").ToString(),
+ ' dRowF("p14").ToString(),
+ ' dRowF("p15").ToString(),
+ ' dRowF("p16").ToString(),
+ ' dRowF("p17").ToString(),
+ ' dRowF("p18").ToString(),
+ ' dRowF("p19").ToString(),
+ ' dRowF("p20").ToString(),
+ ' dRowF("p21").ToString(),
+ ' dRowF("p22").ToString(),
+ ' dRowF("p23").ToString(),
+ ' dRowF("p24").ToString(),
+ ' dRowF("p25").ToString(),
+ ' dRowF("p26").ToString(),
+ ' dRowF("q01").ToString(),
+ ' dRowF("q02").ToString(),
+ ' dRowF("q03").ToString(),
+ ' dRowF("q04").ToString(),
+ ' dRowF("q05").ToString(),
+ ' dRowF("q06").ToString(),
+ ' dRowF("q07").ToString(),
+ ' dRowF("q08").ToString(),
+ ' dRowF("q09").ToString(),
+ ' dRowF("q10").ToString(),
+ ' dRowF("q11").ToString(),
+ ' dRowF("q12").ToString(),
+ ' dRowF("q13").ToString(),
+ ' dRowF("q14").ToString(),
+ ' dRowF("q15").ToString(),
+ ' dRowF("q16").ToString(),
+ ' dRowF("q17").ToString(),
+ ' dRowF("q18").ToString(),
+ ' dRowF("q19").ToString(),
+ ' dRowF("q20").ToString()
+ ' },
+ ' .processReference = New List(Of String)(9) From {
+ ' dRowF("ox").ToString(),
+ ' dRowF("oy").ToString(),
+ ' dRowF("oz").ToString(),
+ ' dRowF("xx").ToString(),
+ ' dRowF("xy").ToString(),
+ ' dRowF("xz").ToString(),
+ ' dRowF("yx").ToString(),
+ ' dRowF("yy").ToString(),
+ ' dRowF("yz").ToString()
+ ' }
+ ' }
+ ' readPart.features.Add(readFeature)
+ ' Next
+
+ ' btlObject.parts.Add(readPart)
+ ' Next
+
+ ' btlObject.parts.Sort(Function(p, q) p.x.CompareTo(q.x))
+ 'End Sub
+
+ Private Shared Function GetVal(ByVal sText As String, ByVal sKey As String) As Integer?
+ Dim sParts As String() = sText.Split("="c)
+ If String.Compare(sParts(0), sKey) <> 0 Then Return Nothing
+ Dim nVal As Integer = Nothing
+
+ If Not Integer.TryParse(sParts(1), nVal) Then
+ Return Nothing
+ Else
+ Return nVal
+ End If
+ End Function
+
+ 'Public Shared Sub GetListaProcesses(ByVal btlObject As BTL)
+ ' Dim dTab As DataTable = _ds.Tables(0)
+ ' Dim listaProcessesCount As Integer = dTab.Rows.Count
+
+ ' If listaProcessesCount = 0 Then
+ ' btlObject.parts = Nothing
+ ' Return
+ ' End If
+
+ ' Dim dRow0 As DataRow = dTab.Rows(0)
+ ' btlObject.projectNumber = dRow0("projectId").ToString()
+ ' btlObject.barLength = GetBarLengthO(CInt(dRow0("elementId")), CInt(dRow0("projectId"))).ToString("F3", CultureInfo.InvariantCulture)
+ ' btlObject.barLoad90 = "0"
+ ' btlObject.panelLength = GetPanelLengthO(CInt(dRow0("elementId")), CInt(dRow0("projectId"))).ToString("F3", CultureInfo.InvariantCulture)
+ ' btlObject.panelWidth = GetPanelWidthO(CInt(dRow0("elementId")), CInt(dRow0("projectId"))).ToString("F3", CultureInfo.InvariantCulture)
+ ' btlObject.projectId = CInt(dRow0("projectId"))
+ ' btlObject.elementId = CInt(dRow0("elementId"))
+ ' btlObject.parts = New List(Of BTL.Part)()
+ ' Dim ListaCutParts As List(Of Integer) = New List(Of Integer)(1)
+ ' ListaCutParts.Add(CInt(dRow0("elementId")))
+
+ ' For c As Integer = 0 To ListaCutParts.Count - 1
+ ' Dim readPart As BTL.Part = New BTL.Part()
+ ' Dim bFirst As Boolean = True
+
+ ' For f As Integer = 0 To listaProcessesCount - 1
+ ' Dim dRowF As DataRow = dTab.Rows(f)
+ ' If CInt(dRowF("elementId")) <> ListaCutParts(c) Then Continue For
+
+ ' If bFirst Then
+ ' readPart.singleMemberNumber = GetElementSN(CInt(dRow0("elementId")), CInt(dRow0("projectId")))
+ ' readPart.count = "1"
+ ' readPart.length = dRowF("length").ToString()
+ ' readPart.height = dRowF("height").ToString()
+ ' readPart.width = dRowF("width").ToString()
+ ' readPart.x = Constants.HeadOverMat
+ ' readPart.z = Constants.HeadOverMat
+ ' readPart.inverted = CDbl(dRowF("inverted"))
+ ' readPart.rotated = CDbl(dRowF("rotated"))
+ ' readPart.elementId = CInt(dRowF("elementId"))
+ ' bFirst = False
+ ' readPart.features = New List(Of BTL.Feature)()
+ ' End If
+
+ ' If String.IsNullOrEmpty(dRowF("processId").ToString()) Then Continue For
+ ' Dim readFeature As BTL.Feature = New BTL.Feature() With {
+ ' .processId = dRowF("processId").ToString(),
+ ' .processKey = dRowF("group").ToString() & "-" & dRowF("key").ToString().Substring(1, 3) & "-" & dRowF("face").ToString(),
+ ' .designation = dRowF("des").ToString(),
+ ' .processIdent = dRowF("processIdent").ToString(),
+ ' .sag1 = dRowF("sag1").ToString(),
+ ' .Text = dRowF("text").ToString(),
+ ' .Process = If((Convert.ToInt16(dRowF("enabled")) = 1), "YES", "NO"),
+ ' .processParameters = New List(Of String)(46) From {
+ ' dRowF("p01").ToString(),
+ ' dRowF("p02").ToString(),
+ ' dRowF("p03").ToString(),
+ ' dRowF("p04").ToString(),
+ ' dRowF("p05").ToString(),
+ ' dRowF("p06").ToString(),
+ ' dRowF("p07").ToString(),
+ ' dRowF("p08").ToString(),
+ ' dRowF("p09").ToString(),
+ ' dRowF("p10").ToString(),
+ ' dRowF("p11").ToString(),
+ ' dRowF("p12").ToString(),
+ ' dRowF("p13").ToString(),
+ ' dRowF("p14").ToString(),
+ ' dRowF("p15").ToString(),
+ ' dRowF("p16").ToString(),
+ ' dRowF("p17").ToString(),
+ ' dRowF("p18").ToString(),
+ ' dRowF("p19").ToString(),
+ ' dRowF("p20").ToString(),
+ ' dRowF("p21").ToString(),
+ ' dRowF("p22").ToString(),
+ ' dRowF("p23").ToString(),
+ ' dRowF("p24").ToString(),
+ ' dRowF("p25").ToString(),
+ ' dRowF("p26").ToString(),
+ ' dRowF("q01").ToString(),
+ ' dRowF("q02").ToString(),
+ ' dRowF("q03").ToString(),
+ ' dRowF("q04").ToString(),
+ ' dRowF("q05").ToString(),
+ ' dRowF("q06").ToString(),
+ ' dRowF("q07").ToString(),
+ ' dRowF("q08").ToString(),
+ ' dRowF("q09").ToString(),
+ ' dRowF("q10").ToString(),
+ ' dRowF("q11").ToString(),
+ ' dRowF("q12").ToString(),
+ ' dRowF("q13").ToString(),
+ ' dRowF("q14").ToString(),
+ ' dRowF("q15").ToString(),
+ ' dRowF("q16").ToString(),
+ ' dRowF("q17").ToString(),
+ ' dRowF("q18").ToString(),
+ ' dRowF("q19").ToString(),
+ ' dRowF("q20").ToString()
+ ' },
+ ' .processReference = New List(Of String)(9) From {
+ ' dRowF("ox").ToString(),
+ ' dRowF("oy").ToString(),
+ ' dRowF("oz").ToString(),
+ ' dRowF("xx").ToString(),
+ ' dRowF("xy").ToString(),
+ ' dRowF("xz").ToString(),
+ ' dRowF("yx").ToString(),
+ ' dRowF("yy").ToString(),
+ ' dRowF("yz").ToString()
+ ' }
+ ' }
+ ' readPart.features.Add(readFeature)
+ ' Next
+
+ ' btlObject.parts.Add(readPart)
+ ' Next
+
+ ' btlObject.parts.Sort(Function(p, q) p.x.CompareTo(q.x))
+ 'End Sub
+
+ 'Private Shared Function GetListaCutIdP() As List(Of Integer)
+ ' Dim ListaCutId As List(Of Integer) = New List(Of Integer)()
+ ' Dim dTab As DataTable = _ds.Tables(0)
+ ' Dim listaTasksCount As Integer = dTab.Rows.Count
+
+ ' For f As Integer = 0 To listaTasksCount - 1
+ ' Dim nCut As Integer = CInt(dTab.Rows(f)("cutId"))
+ ' If Not ListaCutId.Contains(nCut) Then ListaCutId.Add(nCut)
+ ' Next
+
+ ' Return ListaCutId
+ 'End Function
+
+ 'Private Shared Function GetElementSN(ByVal ElementId As Integer, ByVal ProjectId As Integer) As String
+ ' Dim SN As String = "000"
+ ' Dim sqlElementSN As String = "SELECT sn " & "FROM dbo.vw_Element " & "WHERE elementId = @firstId " & "AND projectId = @secondId"
+
+ ' Using cn As SqlConnection = New SqlConnection(_SqlConnectionStr)
+ ' cn.Open()
+
+ ' Using sqlCommand As SqlCommand = New SqlCommand(sqlElementSN, cn)
+ ' sqlCommand.Parameters.Add("@firstId", SqlDbType.Int)
+ ' sqlCommand.Parameters.Add("@secondId", SqlDbType.Int)
+ ' sqlCommand.Parameters("@firstId").Value = ElementId
+ ' sqlCommand.Parameters("@secondId").Value = ProjectId
+ ' Dim reader As SqlDataReader = sqlCommand.ExecuteReader()
+
+ ' While reader.Read()
+ ' SN = Convert.ToString(reader("sn"))
+ ' End While
+ ' End Using
+ ' End Using
+
+ ' Return SN
+ 'End Function
+
+ 'Private Shared Function GetBarLengthP(ByVal patternId As Integer, ByVal productionId As Integer) As Double
+ ' Dim barLength As Double = 0
+ ' Dim sqlBarLength As String = "SELECT l " & "FROM dbo.vw_Pattern " & "WHERE patternId = @firstId " & "AND productionId = @secondId"
+
+ ' Using cn As SqlConnection = New SqlConnection(_SqlConnectionStr)
+ ' cn.Open()
+
+ ' Using sqlCommand As SqlCommand = New SqlCommand(sqlBarLength, cn)
+ ' sqlCommand.Parameters.Add("@firstId", SqlDbType.Int)
+ ' sqlCommand.Parameters.Add("@secondId", SqlDbType.Int)
+ ' sqlCommand.Parameters("@firstId").Value = patternId
+ ' sqlCommand.Parameters("@secondId").Value = productionId
+ ' Dim reader As SqlDataReader = sqlCommand.ExecuteReader()
+
+ ' While reader.Read()
+ ' barLength = Convert.ToDouble(reader("l"))
+ ' End While
+ ' End Using
+ ' End Using
+
+ ' Return barLength
+ 'End Function
+
+ 'Private Shared Function GetBarWidthP(ByVal patternId As Integer, ByVal productionId As Integer) As Double
+ ' Dim barWidth As Double = 0
+ ' Dim sqlBarWidth As String = "SELECT w " & "FROM dbo.vw_Pattern " & "WHERE patternId = @firstId " & "AND productionId = @secondId"
+
+ ' Using cn As SqlConnection = New SqlConnection(_SqlConnectionStr)
+ ' cn.Open()
+
+ ' Using sqlCommand As SqlCommand = New SqlCommand(sqlBarWidth, cn)
+ ' sqlCommand.Parameters.Add("@firstId", SqlDbType.Int)
+ ' sqlCommand.Parameters.Add("@secondId", SqlDbType.Int)
+ ' sqlCommand.Parameters("@firstId").Value = patternId
+ ' sqlCommand.Parameters("@secondId").Value = productionId
+ ' Dim reader As SqlDataReader = sqlCommand.ExecuteReader()
+
+ ' While reader.Read()
+ ' barWidth = Convert.ToDouble(reader("w"))
+ ' End While
+ ' End Using
+ ' End Using
+
+ ' Return barWidth
+ 'End Function
+
+ 'Private Shared Function GetBarLoad90P(ByVal patternId As Integer, ByVal productionId As Integer) As Integer
+ ' Dim nLoad90 As Integer = 0
+ ' Dim sqlBarLength As String = "SELECT load90 " & "FROM dbo.vw_Pattern " & "WHERE patternId = @firstId " & "AND productionId = @secondId"
+
+ ' Using cn As SqlConnection = New SqlConnection(_SqlConnectionStr)
+ ' cn.Open()
+
+ ' Using sqlCommand As SqlCommand = New SqlCommand(sqlBarLength, cn)
+ ' sqlCommand.Parameters.Add("@firstId", SqlDbType.Int)
+ ' sqlCommand.Parameters.Add("@secondId", SqlDbType.Int)
+ ' sqlCommand.Parameters("@firstId").Value = patternId
+ ' sqlCommand.Parameters("@secondId").Value = productionId
+ ' Dim reader As SqlDataReader = sqlCommand.ExecuteReader()
+
+ ' While reader.Read()
+ ' nLoad90 = Convert.ToInt32(reader("load90"))
+ ' End While
+ ' End Using
+ ' End Using
+
+ ' Return nLoad90
+ 'End Function
+
+ 'Private Shared Function GetBarStateP(ByVal patternId As Integer, ByVal productionId As Integer) As Integer
+ ' Dim barState As Integer = 16
+ ' Dim sqlBarLength As String = "SELECT state " & "FROM dbo.vw_Pattern " & "WHERE patternId = @firstId " & "AND productionId = @secondId"
+
+ ' Using cn As SqlConnection = New SqlConnection(_SqlConnectionStr)
+ ' cn.Open()
+
+ ' Using sqlCommand As SqlCommand = New SqlCommand(sqlBarLength, cn)
+ ' sqlCommand.Parameters.Add("@firstId", SqlDbType.Int)
+ ' sqlCommand.Parameters.Add("@secondId", SqlDbType.Int)
+ ' sqlCommand.Parameters("@firstId").Value = patternId
+ ' sqlCommand.Parameters("@secondId").Value = productionId
+ ' Dim reader As SqlDataReader = sqlCommand.ExecuteReader()
+
+ ' While reader.Read()
+ ' barState = Convert.ToInt32(reader("state"))
+ ' End While
+ ' End Using
+ ' End Using
+
+ ' Return barState
+ 'End Function
+
+ 'Private Shared Function GetBarLengthO(ByVal elementId As Integer, ByVal projectId As Integer) As Double
+ ' Dim barLength As Double = 0
+ ' Dim dTab As DataTable = _ds.Tables(0)
+ ' Dim listaProcessesCount As Integer = dTab.Rows.Count
+
+ ' If listaProcessesCount > 0 Then
+ ' Dim beamLength As Double = Convert.ToDouble(dTab.Rows(0)("length"))
+
+ ' If beamLength < Constants.BarMaxLenForAdd Then
+ ' barLength = beamLength + Constants.BarAddLen
+ ' Else
+ ' barLength = beamLength + 2 * Constants.HeadOverMat
+ ' End If
+ ' End If
+
+ ' Return barLength
+ 'End Function
+
+ 'Private Shared Function GetPanelLengthO(ByVal elementId As Integer, ByVal projectId As Integer) As Double
+ ' Dim panelLength As Double = 0
+ ' Dim dTab As DataTable = _ds.Tables(0)
+ ' Dim listaProcessesCount As Integer = dTab.Rows.Count
+
+ ' If listaProcessesCount > 0 Then
+ ' Dim wallLength As Double = Convert.ToDouble(dTab.Rows(0)("length"))
+ ' panelLength = wallLength + 2 * Constants.PanelOverMat
+ ' End If
+
+ ' Return panelLength
+ 'End Function
+
+ 'Private Shared Function GetPanelWidthO(ByVal elementId As Integer, ByVal projectId As Integer) As Double
+ ' Dim panelWidth As Double = 0
+ ' Dim dTab As DataTable = _ds.Tables(0)
+ ' Dim listaProcessesCount As Integer = dTab.Rows.Count
+
+ ' If listaProcessesCount > 0 Then
+ ' Dim wallWidth As Double = Convert.ToDouble(dTab.Rows(0)("width"))
+ ' panelWidth = wallWidth + 2 * Constants.PanelOverMat
+ ' End If
+
+ ' Return panelWidth
+ 'End Function
+
+ 'Private Shared Function GetExePath(ByVal parameters As InOutParameters) As String
+ ' Return parameters.Read("EGALTECH", "PATH_EXE", "")
+ 'End Function
+
+ 'Private Shared Function GetDataDir(ByVal parameters As InOutParameters) As String
+ ' Dim DataDir As String = parameters.Read("EGALTECH", "DIR_DATA", "")
+ ' Dim di As DirectoryInfo = New DirectoryInfo(DataDir)
+ ' If Not di.Exists Then di.Create()
+ ' Return DataDir
+ 'End Function
+
+ 'Private Shared Function GetBtlPath(ByVal DataDir As String, ByVal pattInfo As PatternInfo) As String
+ ' Dim BtlDir, BtlName As String
+
+ ' If pattInfo.IsFromProject Then
+ ' BtlDir = Path.Combine(DataDir, "Projs", pattInfo.ProjectId.ToString("D4"))
+ ' BtlName = "Part_" & pattInfo.ProjectId.ToString() & "_" + pattInfo.ElementId.ToString() & ".btl"
+ ' Else
+ ' BtlDir = Path.Combine(DataDir, "Prods", pattInfo.ProductionId.ToString("D4"))
+ ' BtlName = "Bar_" & pattInfo.ProductionId.ToString() & "_" + pattInfo.PatternId.ToString() & ".btl"
+ ' End If
+
+ ' Dim di As DirectoryInfo = New DirectoryInfo(BtlDir)
+ ' If Not di.Exists Then di.Create()
+ ' Return Path.Combine(BtlDir, BtlName)
+ 'End Function
+
+ 'Private Shared Function GetMaxInstances(ByVal parameters As InOutParameters) As Integer
+ ' Dim sMaxInst As String = parameters.Read("EGALTECH", "MaxInstances", "1")
+ ' Dim nVal As Integer = Nothing
+
+ ' If Not Integer.TryParse(sMaxInst, nVal) Then
+ ' Return 1
+ ' Else
+ ' Return Math.Max(nVal, 1)
+ ' End If
+ 'End Function
+
+ 'Public Function ShowTools(ByVal parameters As InOutParameters) As Boolean
+ ' Dim ExePath As String = GetExePath(parameters)
+ ' Dim DataDir As String = GetDataDir(parameters)
+ ' Dim BtlPath As String = Path.Combine(DataDir, "QQQ.btl")
+ ' Dim process As Process = New Process()
+ ' process.StartInfo.FileName = ExePath
+ ' process.StartInfo.Arguments = """" & BtlPath & """ " & parameters.MachineName & " 11"
+ ' process.StartInfo.UseShellExecute = False
+ ' process.Start()
+
+ ' While Not process.HasExited
+ ' process.Refresh()
+ ' Thread.Sleep(50)
+ ' End While
+
+ ' Return True
+ 'End Function
+
+ 'Public Function ShowJobs(ByVal parameters As InOutParameters) As Boolean
+ ' Dim ExePath As String = GetExePath(parameters)
+ ' Dim DataDir As String = GetDataDir(parameters)
+ ' Dim BtlPath As String = Path.Combine(DataDir, "QQQ.btl")
+ ' Dim process As Process = New Process()
+ ' process.StartInfo.FileName = ExePath
+ ' process.StartInfo.Arguments = """" & BtlPath & """ " & parameters.MachineName & " 12"
+ ' process.StartInfo.UseShellExecute = False
+ ' process.Start()
+
+ ' While Not process.HasExited
+ ' process.Refresh()
+ ' Thread.Sleep(50)
+ ' End While
+
+ ' Return True
+ 'End Function
+
+ 'Public Function UpdateMachine(ByVal parameters As InOutParameters) As Boolean
+ ' GetMachineParams(parameters)
+ ' Return True
+ 'End Function
+
+ '
+ 'Private Shared Function WritePrivateProfileString(ByVal Section As String, ByVal Key As String, ByVal Value As String, ByVal FilePath As String) As Long
+
+ ' Private Shared Sub GetMachineParams(ByVal parameters As InOutParameters)
+ ' Dim DataDir As String = GetDataDir(parameters)
+ ' Dim DataName As String = "Essetre-" & parameters.MachineName & ".data"
+ ' Dim DataPath As String = Path.Combine(DataDir, DataName)
+ ' If File.Exists(DataPath) Then File.Delete(DataPath)
+ ' _SqlConnectionStr = parameters.ConnectionString
+ ' Dim dsOffsets As DataSet = New DataSet()
+ ' Dim sqlOffsets As String = "SELECT [group], [key], [value] " & "FROM [ESSETRE].[dbo].[vw_MachineParam] " & "WHERE [group] = 'OFFSETS' AND configurationId = @ConfigId"
+
+ ' Using cn As SqlConnection = New SqlConnection(_SqlConnectionStr)
+ ' cn.Open()
+
+ ' Using cmd As SqlCommand = New SqlCommand(sqlOffsets, cn)
+ ' cmd.Parameters.Add("@ConfigId", SqlDbType.Int)
+ ' cmd.Parameters("@ConfigId").Value = parameters.ConfigurationId
+ ' Dim dataAdapter = New SqlDataAdapter(cmd)
+ ' dsOffsets.Clear()
+ ' dataAdapter.Fill(dsOffsets)
+ ' End Using
+ ' End Using
+
+ ' _SqlConnectionStr = parameters.ConnectionString
+ ' Dim dsTrave As DataSet = New DataSet()
+ ' Dim sqlTrave As String = "SELECT [group], [key], [value] " & "FROM [ESSETRE].[dbo].[vw_MachineParam] " & "WHERE [group] = 'TRAVE' AND configurationId = @ConfigId"
+
+ ' Using cn As SqlConnection = New SqlConnection(_SqlConnectionStr)
+ ' cn.Open()
+
+ ' Using cmd As SqlCommand = New SqlCommand(sqlTrave, cn)
+ ' cmd.Parameters.Add("@ConfigId", SqlDbType.Int)
+ ' cmd.Parameters("@ConfigId").Value = parameters.ConfigurationId
+ ' Dim dataAdapter = New SqlDataAdapter(cmd)
+ ' dsTrave.Clear()
+ ' dataAdapter.Fill(dsTrave)
+ ' End Using
+ ' End Using
+
+ ' _SqlConnectionStr = parameters.ConnectionString
+ ' Dim dsUser As DataSet = New DataSet()
+ ' Dim sqlUser As String = "SELECT [group], [key], [value] " & "FROM [ESSETRE].[dbo].[vw_ConfigurationParam] " & "WHERE [group] <> 'TEXTS' AND [group] <> 'PARAMS' AND configurationId = @ConfigId"
+
+ ' Using cn As SqlConnection = New SqlConnection(_SqlConnectionStr)
+ ' cn.Open()
+
+ ' Using cmd As SqlCommand = New SqlCommand(sqlUser, cn)
+ ' cmd.Parameters.Add("@ConfigId", SqlDbType.Int)
+ ' cmd.Parameters("@ConfigId").Value = parameters.ConfigurationId
+ ' Dim dataAdapter = New SqlDataAdapter(cmd)
+ ' dsUser.Clear()
+ ' dataAdapter.Fill(dsUser)
+ ' End Using
+ ' End Using
+
+ ' Using tw = New StreamWriter(DataPath, False)
+ ' tw.WriteLine("-- " & DataPath)
+ ' tw.WriteLine("")
+ ' tw.WriteLine("local Offsets = {")
+
+ ' For Each table As DataTable In dsOffsets.Tables
+
+ ' For Each row As DataRow In table.Rows
+ ' Dim Key As String = row("key").ToString()
+ ' Dim Value As String = row("value").ToString()
+ ' tw.WriteLine(" " & Key & "=" & Value & ",")
+ ' Next
+ ' Next
+
+ ' tw.WriteLine(" Zzz=1")
+ ' tw.WriteLine("}")
+ ' tw.WriteLine("")
+ ' tw.WriteLine("local Trave = {")
+
+ ' For Each table As DataTable In dsTrave.Tables
+
+ ' For Each row As DataRow In table.Rows
+ ' Dim Key As String = row("key").ToString()
+ ' Dim Value As String = row("value").ToString()
+ ' tw.WriteLine(" " & Key & "=" & Value & ",")
+ ' Next
+ ' Next
+
+ ' tw.WriteLine(" Zzz=1")
+ ' tw.WriteLine("}")
+ ' tw.WriteLine("")
+ ' tw.WriteLine("local User = {")
+
+ ' For Each table As DataTable In dsUser.Tables
+
+ ' For Each row As DataRow In table.Rows
+ ' Dim Group As String = row("group").ToString()
+ ' Dim Key As String = row("key").ToString()
+ ' Dim Value As String = row("value").ToString()
+ ' tw.WriteLine(" " & Group & "_" & Key & "=" & Value & ",")
+ ' Next
+ ' Next
+
+ ' tw.WriteLine(" Zzz=1")
+ ' tw.WriteLine("}")
+ ' tw.WriteLine("")
+ ' tw.WriteLine("local Machine = { Offsets=Offsets, Trave=Trave, User=User}")
+ ' tw.WriteLine("return Machine")
+ ' End Using
+ 'End Sub
+
+ 'Public Sub CollectFile(ByVal parameters As InOutParameters, ByVal collector As FileCollector)
+ ' Dim sRoot As String = parameters.Read("EGALTECH", "DIR_EGT", "C:\TechnoEssetre7\EgalTech")
+ ' Dim sBeamDir As String = "EgtCAM5\Beam"
+ ' Dim sMachDir As String = "EgtCAM5\Machines\Essetre-" & parameters.MachineName
+ ' collector.SetRoot(sRoot)
+ ' collector.AddDirectory(Path.Combine(sRoot, sBeamDir))
+ ' collector.AddDirectory(Path.Combine(sRoot, sMachDir))
+ 'End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml
new file mode 100644
index 00000000..7ea3866f
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml.vb
new file mode 100644
index 00000000..919aa0c7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class LeftPanelV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb
new file mode 100644
index 00000000..e03eef1b
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb
@@ -0,0 +1,578 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class LeftPanelVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Public ReadOnly Property ViewPage_Visibility As Visibility
+ Get
+ Return If(Map.refMainMenuVM.SelPage = Pages.VIEW, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+ Public ReadOnly Property MachiningPage_Visibility As Visibility
+ Get
+ Return If(Map.refMainMenuVM.SelPage = Pages.MACHINING, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdNewRawPart As ICommand
+ Private m_cmdAddToRawPart As ICommand
+ Private m_cmdCopyPart As ICommand
+ Private m_cmdAddPart As ICommand
+ Private m_cmdRemovePart As ICommand
+ Private m_cmdCopyFeature As ICommand
+ Private m_cmdMacroFeature As ICommand
+ Private m_cmdAddFeature As ICommand
+ Private m_cmdRemoveFeature As ICommand
+
+#End Region 'FIELDS & PROPERTIES
+
+ Sub New()
+ ' imposto riferimento su mappa
+ Map.SetRefLeftPanelVM(Me)
+ End Sub
+
+#Region "METHODS"
+
+ Friend Sub UpdateView()
+ NotifyPropertyChanged("ViewPage_Visibility")
+ NotifyPropertyChanged("MachiningPage_Visibility")
+ End Sub
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "NewRawPart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property NewRawPart_Command As ICommand
+ Get
+ If m_cmdNewRawPart Is Nothing Then
+ m_cmdNewRawPart = New Command(AddressOf NewRawPart)
+ End If
+ Return m_cmdNewRawPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub NewRawPart()
+ Dim SelPart As BTLPart = Map.refProjectVM.BTLStructure.SelPart
+ If IsNothing(SelPart) Then Return
+ ' Determino il tipo di macchina (travi o pareti)
+ Dim nMachType As MachineType = Map.refMachinePanelVM.SelectedMachine.nType
+ ' chiedo lunghezza grezzo
+ Dim AddRawPartWndVM As New AddRawPartWndVM(Map.refMachinePanelVM.SelectedMachine.nType, SelPart.dL, SelPart.dW, 0)
+ Dim AddRawPartWnd As New AddRawPartWndV(Application.Current.MainWindow, AddRawPartWndVM)
+ If Not AddRawPartWnd.ShowDialog() Then Return
+ ' creo nuovo gruppo di lavorazione
+ Map.refMachGroupPanelVM.AddMachGroup()
+ Dim nCurrMachGroup As Integer = EgtGetCurrMachGroup()
+ ' creo copia del pezzo
+ Dim nPartDuploId As Integer = EgtDuploNew(SelPart.nPartId)
+ Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ ' scrivo dati in gruppo di lavorazione
+ EgtSetInfo(nCurrMachGroup, MGR_RPT_BARLEN, AddRawPartWndVM.VariableList(0).dValue)
+ EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & AddRawPartWndVM.VariableList(1).dValue)
+ Dim BeamMachGroup As BeamMachGroup = DirectCast(Map.refMachGroupPanelVM.MachGroupList(Map.refMachGroupPanelVM.MachGroupList.Count - 1), BeamMachGroup)
+ ' eseguo script creazione grezzo
+ If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then
+ BeamMachGroup.DeleteMachGroup()
+ Dim LogFile As String() = File.ReadAllLines(sLogPath)
+ If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then
+ MessageBox.Show(LogFile(1), "Error", MessageBoxButton.OK, MessageBoxImage.Error)
+ End If
+ Return
+ End If
+ 'aggiorno lista pezzi
+ BeamMachGroup.RefreshPartList()
+ BeamMachGroup.RefreshGroupData()
+ ' aggiorno dati ultilizzo barra
+ BeamMachGroup.UpdateUsage()
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ ' scrivo dati in gruppo di lavorazione
+ EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELLEN, AddRawPartWndVM.VariableList(0).dValue)
+ EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELWIDTH, AddRawPartWndVM.VariableList(1).dValue)
+ EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & 10 & "," & 10 & "," & 0 & "," & 0)
+ Dim WallMachGroup As WallMachGroup = DirectCast(Map.refMachGroupPanelVM.MachGroupList(Map.refMachGroupPanelVM.MachGroupList.Count - 1), WallMachGroup)
+ ' eseguo script creazione grezzo
+ If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then
+ WallMachGroup.DeleteMachGroup()
+ Dim LogFile As String() = File.ReadAllLines(sLogPath)
+ If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then
+ MessageBox.Show(LogFile(1), "Error", MessageBoxButton.OK, MessageBoxImage.Error)
+ End If
+ Return
+ End If
+ 'aggiorno lista pezzi
+ WallMachGroup.RefreshPartList()
+ WallMachGroup.RefreshGroupData()
+ ' aggiorno dati ultilizzo barra
+ WallMachGroup.UpdateUsage()
+ End If
+ EgtSetView(VT.ISO_SW, False)
+ EgtZoom(ZM.ALL)
+ End Sub
+
+#End Region ' NewRawPart
+
+#Region "AddToRawPart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property AddToRawPart_Command As ICommand
+ Get
+ If m_cmdAddToRawPart Is Nothing Then
+ m_cmdAddToRawPart = New Command(AddressOf AddToRawPart)
+ End If
+ Return m_cmdAddToRawPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub AddToRawPart()
+ Dim SelPart As BTLPart = Map.refProjectVM.BTLStructure.SelPart
+ If IsNothing(SelPart) Then Return
+ Dim SelMachGroup As MachGroup = Map.refMachGroupPanelVM.SelectedMachGroup
+ If IsNothing(SelMachGroup) Then Return
+ Dim nCurrMachGroup As Integer = SelMachGroup.Id
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ Dim BeamMachGroup As BeamMachGroup = DirectCast(SelMachGroup, BeamMachGroup)
+ ' verifico sezione
+ If SelPart.dW < BeamMachGroup.dW - EPS_SMALL OrElse SelPart.dW > BeamMachGroup.dW + EPS_SMALL OrElse SelPart.dH < BeamMachGroup.dH - EPS_SMALL OrElse SelPart.dH > BeamMachGroup.dH + EPS_SMALL Then
+ MessageBox.Show("Il pezzo selezionato ha sezione diversa dalla barra selezionata. Impossibile aggiungerlo.", "Errore")
+ Return
+ End If
+ ' verifico lunghezza totale
+ If Not VerifyTotLength(BeamMachGroup, SelPart) Then
+ MessageBox.Show("Il pezzo selezionato supera la lunghezza dalla barra selezionata. Impossibile aggiungerlo.", "Errore")
+ Return
+ End If
+ AddPartToBeam(BeamMachGroup, SelPart)
+ ' aggiorno dati ultilizzo barra
+ BeamMachGroup.UpdateUsage()
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ Dim WallMachGroup As WallMachGroup = DirectCast(SelMachGroup, WallMachGroup)
+ ' verifico spessore
+ If SelPart.dH < WallMachGroup.dH - EPS_SMALL OrElse SelPart.dH > WallMachGroup.dH + EPS_SMALL Then
+ MessageBox.Show("Il pezzo selezionato ha spessore diverso dalla parete selezionata. Impossibile aggiungerlo.", "Errore")
+ Return
+ End If
+ ' Posizione di inserimento
+ Dim dPosX As Double = 10
+ Dim dPosY As Double = 10
+ ' Se ci sono pezzi già inseriti
+ If WallMachGroup.PartList.Count > 0 Then
+ Dim LastWall As Wall = DirectCast( WallMachGroup.PartList(WallMachGroup.PartList.Count - 1), Wall)
+ ' verifico se posso metterlo sopra in Y
+ Dim NextPosY = LastWall.dPOSY + LastWall.dW + RawPartConfiguration.dWallDist
+ If WallMachGroup.dW - NextPosY > SelPart.dW + 10 Then
+ dPosX = LastWall.dPOSX
+ dPosY = NextPosY
+ Else
+ dPosX = 10
+ For i As Integer = 0 To WallMachGroup.PartList.Count - 1
+ Dim CurrWall As Wall = DirectCast( WallMachGroup.PartList(i), Wall)
+ Dim NextPosX = CurrWall.dPOSX + CurrWall.dL + RawPartConfiguration.dWallDist
+ If NextPosX > dPosX Then
+ dPOSX = NextPosX
+ End If
+ Next
+ dPosY = 10
+ End If
+ End If
+ ' scrivo dati in gruppo di lavorazione
+ EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & WallMachGroup.PartList.Count + 1, SelPart.nPartId & "," & dPOSX & "," & dPosY & "," & 0 & "," & 0)
+ ' eseguo script creazione grezzo
+ Dim nRawId As Integer = EgtGetFirstRawPart()
+ While nRawId <> GDB_ID.NULL
+ EgtRemoveRawPart(nRawId)
+ nRawId = EgtGetFirstRawPart()
+ End While
+ If Not ExecWall(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then Return
+ 'aggiorno lista pezzi
+ WallMachGroup.RefreshPartList()
+ ' aggiorno dati ultilizzo barra
+ WallMachGroup.UpdateUsage()
+ End If
+ EgtSetView(VT.ISO_SW, False)
+ EgtZoom(ZM.ALL)
+ End Sub
+
+ Friend Function VerifyTotLength(BeamMachGroup As BeamMachGroup, PartToAdd As BTLPart) As Boolean
+ Dim dNewPartPos As Double = 0
+ If BeamMachGroup.PartList.Count > 0 Then
+ Dim LastPart As Core.Part = BeamMachGroup.PartList(BeamMachGroup.PartList.Count - 1)
+ dNewPartPos += LastPart.dPOSX + LastPart.dL
+ End If
+ dNewPartPos += RawPartConfiguration.dBeamDist + PartToAdd.dL
+ Return dNewPartPos < BeamMachGroup.dL
+ End Function
+
+ Friend Function AddPartToBeam(BeamMachGroup As BeamMachGroup, PartToAdd As BTLPart) As Boolean
+ ' calcolo posizione nuovo pezzo per rispettare ordine lunghezze
+ Dim nInsertIndex As Integer
+ ' creo copia del pezzo
+ Dim nPartDuploId As Integer = EgtDuploNew(PartToAdd.nPartId)
+ ' scrivo dati di tutti i pezzi
+ Dim dPosX As Double = BeamMachGroup.dStartCut
+ Dim bPartAdded As Boolean = False
+ Dim nIndex As Integer
+ ' ciclo sui pezzi
+ For nIndex = 0 To BeamMachGroup.PartList.Count - 1
+ ' se non ancora aggiunto e lunghezza minore del pezzo corrente, lo aggiungo
+ If Not bPartAdded AndAlso BeamMachGroup.PartList(nIndex).dL > PartToAdd.dL Then
+ ' se non è primo, aggiungo offset tra barre standard
+ If nIndex <> 0 Then
+ dPosX += RawPartConfiguration.dBeamDist
+ End If
+ EgtSetInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1, nPartDuploId & "," & dPosX)
+ ' incremento posizione della sua lunghezza
+ dPosX += PartToAdd.dL
+ ' conservo indice d'inserimento
+ nInsertIndex = nIndex
+ bPartAdded = True
+ End If
+ ' se non è primo, aggiungo offset del pezzo
+ If nIndex <> 0 Then
+ Dim Beam As Beam = DirectCast(BeamMachGroup.PartList(nIndex), Beam)
+ dPosX += Beam.dOffset
+ ' se sono a indice primo ed è stato aggiunto pezzo nuovo
+ ElseIf nIndex = 0 AndAlso bPartAdded Then
+ ' aggiungo offset tra barre standard
+ dPosX += RawPartConfiguration.dBeamDist
+ End If
+ EgtSetInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + If(bPartAdded, 2, 1), BeamMachGroup.PartList(nIndex).nPartId & "," & dPosX)
+ ' incremento posizione della sua lunghezza
+ dPosX += BeamMachGroup.PartList(nIndex).dL
+ Next
+ ' se non è ancora stato aggiunto
+ If Not bPartAdded Then
+ ' aggiungo offset tra barre standard
+ dPosX += RawPartConfiguration.dBeamDist
+ ' lo aggiungo in fondo
+ EgtSetInfo(BeamMachGroup.Id, MGR_RPT_PART & nIndex + 1, nPartDuploId & "," & dPosX)
+ ' conservo indice d'inserimento
+ nInsertIndex = nIndex
+ End If
+ ' elimino vecchio grezzo ed eseguo script creazione nuovo
+ Dim nRawId As Integer = EgtGetFirstRawPart()
+ While nRawId <> GDB_ID.NULL
+ EgtRemoveRawPart(nRawId)
+ nRawId = EgtGetFirstRawPart()
+ End While
+ If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then
+ Return False
+ End If
+ ' aggiorno lista pezzi
+ BeamMachGroup.RefreshPartList()
+ ' seleziono pezzo aggiunto
+ If BeamMachGroup.PartList.Count > nInsertIndex Then BeamMachGroup.SelPart = BeamMachGroup.PartList(nInsertIndex)
+ Return True
+ End Function
+
+#End Region ' AddToRawPart
+
+#Region "CopyPart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property CopyPart_Command As ICommand
+ Get
+ If m_cmdCopyPart Is Nothing Then
+ m_cmdCopyPart = New Command(AddressOf CopyPart)
+ End If
+ Return m_cmdCopyPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub CopyPart()
+ Dim SelPart As BTLPart = Map.refProjectVM.BTLStructure.SelPart
+ If IsNothing(SelPart) Then Return
+ ' creo copia
+ Dim NewPart = SelPart.Copy()
+ If Not IsNothing(NewPart) Then
+ Map.refProjectVM.BTLStructure.SelPart = NewPart
+ End If
+ End Sub
+
+#End Region ' CopyPart
+
+#Region "AddPart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property AddPart_Command As ICommand
+ Get
+ If m_cmdAddPart Is Nothing Then
+ m_cmdAddPart = New Command(AddressOf AddPart)
+ End If
+ Return m_cmdAddPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub AddPart(ByVal param As Object)
+ ' apro finestra di definizione nuovo part
+ Dim AddPartWndVM As New AddPartWndVM()
+ Dim AddPartWnd As New AddPartWndV(Application.Current.MainWindow, AddPartWndVM)
+ If AddPartWnd.ShowDialog() Then
+ ' creo nuovo part
+ Dim nNewPartId As Integer = EgtBeamCreatePart()
+ EgtBeamSetPartProdNbr(AddPartWndVM.nPDN)
+ If Not IsNothing(AddPartWndVM.sNAM) Then EgtBeamSetPartName(AddPartWndVM.sNAM)
+ EgtBeamSetPartCount(AddPartWndVM.nCNT)
+ EgtBeamSetPartBox(AddPartWndVM.dL, AddPartWndVM.dH, AddPartWndVM.dW)
+ ' aggiungo dati pezzo
+ Dim NewPart As New BTLPart(Map.refProjectVM.BTLStructure, nNewPartId)
+
+ ' aggiungo pezzo alla lista
+ Map.refProjectVM.BTLStructure.PartList.Add(NewPart)
+ Map.refProjectVM.BTLStructure.SelPart = NewPart
+ End If
+
+ End Sub
+
+#End Region ' AddPart
+
+#Region "RemovePart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property RemovePart_Command As ICommand
+ Get
+ If m_cmdRemovePart Is Nothing Then
+ m_cmdRemovePart = New Command(AddressOf RemovePart)
+ End If
+ Return m_cmdRemovePart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub RemovePart()
+ If IsNothing(Map.refProjectVM.BTLStructure.SelPart) Then Return
+ EgtBeamSetPart(Map.refProjectVM.BTLStructure.SelPart.nPartId)
+ If EgtBeamErasePart() Then
+ ' rimuovo dalla lista pezzi
+ Dim Index As Integer = Map.refProjectVM.BTLStructure.PartList.IndexOf(Map.refProjectVM.BTLStructure.SelPart)
+ If Index = 0 Then
+ If Map.refProjectVM.BTLStructure.PartList.Count > 0 Then
+ Map.refProjectVM.BTLStructure.SelPart = Map.refProjectVM.BTLStructure.PartList(0)
+ Else
+ Map.refProjectVM.BTLStructure.SelPart = Nothing
+ End If
+ ElseIf Index = Map.refProjectVM.BTLStructure.PartList.Count - 1 Then
+ If Map.refProjectVM.BTLStructure.PartList.Count > 1 Then
+ Map.refProjectVM.BTLStructure.SelPart = Map.refProjectVM.BTLStructure.PartList(Map.refProjectVM.BTLStructure.PartList.Count - 2)
+ Else
+ Map.refProjectVM.BTLStructure.SelPart = Nothing
+ End If
+ Else
+ Map.refProjectVM.BTLStructure.SelPart = Map.refProjectVM.BTLStructure.PartList(Index - 1)
+ End If
+ Map.refProjectVM.BTLStructure.PartList.RemoveAt(Index)
+ End If
+ End Sub
+
+#End Region ' RemovePart
+
+#Region "CopyFeature"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property CopyFeature_Command As ICommand
+ Get
+ If m_cmdCopyFeature Is Nothing Then
+ m_cmdCopyFeature = New Command(AddressOf CopyFeature)
+ End If
+ Return m_cmdCopyFeature
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub CopyFeature()
+ Dim SelPart As BTLPart = Map.refProjectVM.BTLStructure.SelPart
+ If IsNothing(SelPart) Then Return
+ Dim SelFeature As BTLFeature = SelPart.SelFeature
+ If IsNothing(SelFeature) Then Return
+ ' creo copia
+ Dim NewFeature = SelFeature.Copy()
+ If Not IsNothing(NewFeature) Then
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature = NewFeature
+ End If
+ End Sub
+
+#End Region ' CopyFeature
+
+#Region "MacroFeature"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property MacroFeature_Command As ICommand
+ Get
+ If m_cmdMacroFeature Is Nothing Then
+ m_cmdMacroFeature = New Command(AddressOf MacroFeature)
+ End If
+ Return m_cmdMacroFeature
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub MacroFeature()
+ If IsNothing(Map.refProjectVM.BTLStructure.SelPart) Then Return
+ ' apro finestra di creazione macro
+ Dim MacroFeatureWndVM As New MacroFeatureWndVM()
+ Dim MacroFeatureWnd As New MacroFeatureWndV(Application.Current.MainWindow, MacroFeatureWndVM)
+ If MacroFeatureWnd.ShowDialog() Then
+
+ End If
+ End Sub
+
+#End Region ' MacroFeature
+
+#Region "AddFeature"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property AddFeature_Command As ICommand
+ Get
+ If m_cmdAddFeature Is Nothing Then
+ m_cmdAddFeature = New Command(AddressOf AddFeature)
+ End If
+ Return m_cmdAddFeature
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub AddFeature(ByVal param As Object)
+ If IsNothing(Map.refProjectVM.BTLStructure.SelPart) Then Return
+ ' apro finestra di definizione nuova feature
+ Dim AddFeatureWndVM As New AddFeatureWndVM()
+ Dim AddFeatureWnd As New AddFeatureWndV(Application.Current.MainWindow, AddFeatureWndVM)
+ If AddFeatureWnd.ShowDialog() Then
+ Dim NewFeat As BTLFeature
+ Dim nNewFeatureId As Integer = 0
+ Dim bMacroFlag As Boolean = False
+ ' verifico se una Macro è selezionata
+ If AddFeatureWndVM.MacroList.Count > 0 AndAlso AddFeatureWndVM.nSelMacro >= 0 Then
+ ' Creo nuova feature sulla base della Macro selezionata
+ ' Creo table e setto variabili
+ EgtLuaCreateGlobTable("MACRO")
+ EgtLuaSetGlobNumVar("MACRO.L", Map.refProjectVM.BTLStructure.SelPart.dL)
+ EgtLuaSetGlobNumVar("MACRO.W", Map.refProjectVM.BTLStructure.SelPart.dW)
+ EgtLuaSetGlobNumVar("MACRO.H", Map.refProjectVM.BTLStructure.SelPart.dH)
+ EgtLuaSetGlobIntVar("MACRO.PROCID", Map.refProjectVM.BTLStructure.SelPart.NewProcId())
+ Dim bOk = EgtLuaExecFile(AddFeatureWndVM.m_MacroFilePathList(AddFeatureWndVM.nSelMacro))
+ ' Leggo variabili
+ EgtLuaGetGlobIntVar("MACRO.FEATUREID", nNewFeatureId)
+ ' Reset lua
+ EgtLuaResetGlobVar("MACRO")
+ If Not bOk Then
+ MessageBox.Show("Errore nell'esecuzione del file Macro!", "Errore")
+ Return
+ End If
+ bMacroFlag = True
+ Else
+ ' Creo nuova feature (Macro non selezionata)
+ NewFeat = New BTLFeature(AddFeatureWndVM.nSelPRC.nPRC, AddFeatureWndVM.nSelPRC.nGRP, AddFeatureWndVM.nSelPRC.nSIDE)
+ NewFeat.CreateFeatureParams()
+ NewFeat.SetDefaultValues()
+ Dim vPar() As Double
+ Dim sPar As String = String.Empty
+ NewFeat.CalcParamArray(vPar, sPar)
+ ' aggiorno la feature con nuovo valore
+ EgtBeamSetPart(Map.refProjectVM.BTLStructure.SelPart.nPartId)
+ nNewFeatureId = EgtBeamAddProcess(NewFeat.nSelGRP, NewFeat.nPRC, NewFeat.nSelSIDE, "", Map.refProjectVM.BTLStructure.SelPart.NewProcId(), New Frame3d(), vPar, sPar)
+ bMacroFlag = False
+ End If
+ ' se è stata creata
+ If nNewFeatureId <> GDB_ID.NULL Then
+ ' la aggiungo a struttura BTL corrente
+ NewFeat = New BTLFeature(Map.refProjectVM.BTLStructure.SelPart, nNewFeatureId)
+ If Not bMacroFlag Then NewFeat.SetDefaultValues()
+ Map.refProjectVM.BTLStructure.SelPart.FeatureList.Add(NewFeat)
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature = NewFeat
+ End If
+ End If
+ End Sub
+
+#End Region ' AddFeature
+
+#Region "RemoveFeature"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property RemoveFeature_Command As ICommand
+ Get
+ If m_cmdRemoveFeature Is Nothing Then
+ m_cmdRemoveFeature = New Command(AddressOf RemoveFeature)
+ End If
+ Return m_cmdRemoveFeature
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub RemoveFeature()
+ If EgtBeamEraseProcess(Map.refProjectVM.BTLStructure.SelPart.SelFeature.nFeatureId) Then
+ ' rimuovo dalla lista pezzi
+ Dim Index As Integer = Map.refProjectVM.BTLStructure.SelPart.FeatureList.IndexOf(Map.refProjectVM.BTLStructure.SelPart.SelFeature)
+ If Index = 0 Then
+ If Map.refProjectVM.BTLStructure.SelPart.FeatureList.Count > 0 Then
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature = Map.refProjectVM.BTLStructure.SelPart.FeatureList(0)
+ Else
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature = Nothing
+ End If
+ ElseIf Index = Map.refProjectVM.BTLStructure.SelPart.FeatureList.Count - 1 Then
+ If Map.refProjectVM.BTLStructure.SelPart.FeatureList.Count > 1 Then
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature = Map.refProjectVM.BTLStructure.SelPart.FeatureList(Map.refProjectVM.BTLStructure.SelPart.FeatureList.Count - 2)
+ Else
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature = Nothing
+ End If
+ Else
+ Map.refProjectVM.BTLStructure.SelPart.SelFeature = Map.refProjectVM.BTLStructure.SelPart.FeatureList(Index - 1)
+ End If
+ Map.refProjectVM.BTLStructure.SelPart.FeatureList.RemoveAt(Index)
+ EgtDraw()
+ End If
+ End Sub
+
+#End Region ' RemoveFeature
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb
new file mode 100644
index 00000000..db91bfff
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb
@@ -0,0 +1,726 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class MyMachGroupPanelVM
+ Inherits MachGroupPanelVM
+
+#Region "FIELDS & PROPERTIES"
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ MyBase.New()
+ ' Recupero la macchina di default
+ Dim sDefaultMachine As String = String.Empty
+ GetMainPrivateProfileString(S_MACH, K_CURRMACH, "", sDefaultMachine)
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefMachGroupPanelVM(Me)
+ InitMachGroupPanel(True, Map.refMachinePanelVM.MachineList.ToList(), sDefaultMachine)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Public Overrides Function InitMachGroupList(Optional bUseDefaults As Boolean = False) As Boolean
+ ' Svuoto precedente lista di MachGroup
+ MachGroupList.Clear()
+ ' aggiorno copie
+ UpdateDuplo()
+ ' verifico se esistono già gruppi di lavorazione o se devo creare il primo
+ Dim bOk As Boolean = False
+ Dim nId = EgtGetFirstMachGroup()
+ If nId <> GDB_ID.NULL Then
+ bOk = EgtSetCurrMachGroup(nId)
+ End If
+ If Not bOk Then Return True
+ ' carico lista dei gruppi di lavorazione
+ LoadMachGroupList()
+ ' elimino copie da cancellare
+ DeleteDuplo()
+ If bOk Then SelectedMachGroup = MachGroupList(0)
+ EgtZoom(ZM.ALL)
+ Return True
+ End Function
+
+ Public Overrides Sub AddMachGroup()
+ Dim nNewMachGroupID As Integer = EgtAddMachGroup(NewMachGroupID().ToString, Map.refMachinePanelVM.SelectedMachine.Name)
+ If nNewMachGroupID <> GDB_ID.NULL Then
+ ' creo oggetto gruppo creato
+ Dim sNewMachGroupName As String = String.Empty
+ Dim sNewMachGroupMachineName As String = String.Empty
+ EgtGetMachGroupName(nNewMachGroupID, sNewMachGroupName)
+ EgtGetMachGroupMachineName(nNewMachGroupID, sNewMachGroupMachineName)
+ Dim MyMachGroup As Core.MyMachGroup
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ MyMachGroup = New BeamMachGroup(nNewMachGroupID, sNewMachGroupName, sNewMachGroupMachineName)
+ Else
+ MyMachGroup = New WallMachGroup(nNewMachGroupID, sNewMachGroupName, sNewMachGroupMachineName)
+ End If
+ ' lo aggiungo alla lista
+ MachGroupList.Add(MyMachGroup)
+ ' e lo seleziono
+ SelectedMachGroup = MyMachGroup
+ End If
+ End Sub
+
+ Public Overrides Sub LoadMachGroupList()
+ ' Carico i gruppi di lavorazione nella lista
+ Dim nId = EgtGetFirstMachGroup()
+ While nId <> GDB_ID.NULL
+ EgtSetCurrMachGroup(nId)
+ Dim sName As String = String.Empty
+ Dim sMachine As String = String.Empty
+ EgtGetMachGroupName(nId, sName)
+ EgtGetMachGroupMachineName(nId, sMachine)
+ ' cerco la macchina tra quelle presenti
+ Dim MachGroupMachine As MyMachine = Nothing
+ Machine.SearchMachine(sMachine, Map.refMachinePanelVM.MachineList, MachGroupMachine)
+ If IsNothing(MachGroupMachine) OrElse MachGroupMachine.nType = MachineType.NULL Then
+ EgtOutLog("Machine incompatible with beam & wall machining!!")
+ Return
+ ElseIf MachGroupMachine.nType = MachineType.BEAM Then
+ MachGroupList.Add(New BeamMachGroup(nId, sName, sMachine))
+ ElseIf MachGroupMachine.nType = MachineType.WALL Then
+ MachGroupList.Add(New WallMachGroup(nId, sName, sMachine))
+ End If
+ nId = EgtGetNextMachGroup(nId)
+ End While
+ EgtResetCurrMachGroup()
+ End Sub
+
+ Public Overrides Function OnPreNewMachGroup() As Boolean
+ EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
+ Return True
+ End Function
+
+ ' NB: Anche se ho già aggiunto il nuovo gruppo di lavorazione, non l'ho ancora reso corrente (viene fatto dopo), quindi
+ ' non posso usare CurrentMachine perchè è ancora impostata quella precedente!!!
+ Public Overrides Function OnPostNewMachGroup() As Boolean
+ ' Salvo macchina del gruppo come nuovo default
+ Dim sCurrMachName As String = String.Empty
+ EgtGetCurrMachineName(sCurrMachName)
+ WriteMainPrivateProfileString(S_MACH, K_CURRMACH, sCurrMachName)
+ ' leggo nome attrezzaggio di default
+ Dim sDefaultSetUpName As String = String.Empty
+ Dim sMachineIniPath As String = Map.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sCurrMachName & "\" & sCurrMachName & ".ini"
+ EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", sDefaultSetUpName, sMachineIniPath)
+ ' se è attiva l'opzione, rendo corrente l'attrezzaggio di default
+ If Not String.IsNullOrEmpty(sDefaultSetUpName) Then
+ If Not EgtImportSetup(sDefaultSetUpName) Then
+ EgtOutLog("Error loading default setup " & sDefaultSetUpName)
+ MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 9) & " " & sDefaultSetUpName, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Exclamation)
+ End If
+ End If
+ Return True
+ End Function
+
+ Public Overrides Function OnPreSetCurrMachGroup() As Boolean
+ EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
+ Return True
+ End Function
+
+ Public Overrides Function OnPostSetCurrMachGroup() As Boolean
+ ' Imposto vista solo tavola
+ EgtSetMachineLook(MCH_LOOK.TAB)
+ EgtSetView(VT.ISO_SW, False)
+ EgtZoom(ZM.ALL)
+ Return True
+ End Function
+
+ Public Overrides Function OnPreRemoveCurrMachGroup() As Boolean
+ EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
+ Return True
+ End Function
+
+ Private Function NewMachGroupID() As Integer
+ If Not IsNothing(MachGroupList) AndAlso MachGroupList.Count > 0 Then Return MachGroupList.Max(Function(x) x.Name) + 1
+ Return 1
+ End Function
+
+ ' funzione che fa l'update di tutte le copie dei pezzi modificati
+ Friend Sub UpdateDuplo()
+ Dim nPartId As Integer = EgtGetFirstPart()
+ While nPartId <> GDB_ID.NULL
+ Dim bIsModified As Boolean = False
+ If EgtDuploGetModified(nPartId, bIsModified) AndAlso bIsModified Then
+ EgtDuploUpdate(nPartId)
+ End If
+ nPartId = EgtGetNextPart(nPartId)
+ End While
+ End Sub
+
+ ' funzione che cancella tutti i pezzi segnati da eliminare
+ Friend Sub DeleteDuplo()
+ Dim nPartId As Integer = EgtGetFirstPart()
+ While nPartId <> GDB_ID.NULL
+ Dim bIsToDelete As Boolean = False
+ If DuploGetToDelete(nPartId, bIsToDelete) AndAlso bIsToDelete Then
+ ' verifico se ci sono copie
+ Dim nDuploCount As Integer = 0
+ EgtDuploCount(nPartId, nDuploCount)
+ Dim DuploList As New List(Of Integer)
+ If nDuploCount > 0 AndAlso EgtDuploList(nPartId, DuploList) Then
+ ' cancello tutti i pezzi copia nelle barre
+ For Each nDuploId In DuploList
+ ' reset necessario per poter accedere direttamente al grezzo dalle info pezzo e al MachGroup tramite la gerarchia Db geometrico
+ EgtResetCurrMachGroup()
+ ' recupero grezzo cui appartiene
+ Dim nRawPartId As Integer
+ EgtGetInfo(nDuploId, "!LST", nRawPartId)
+ ' recupero gruppo di lavorazione
+ Dim nMachGroupId As Integer = EgtGetParent(EgtGetParent(EgtGetParent(nRawPartId)))
+ ' recupero gruppo di lavorazione e trave dell'interfaccia
+ Dim BeamMachGroup As BeamMachGroup = Map.refProjectVM.MachGroupPanelVM.MachGroupList.FirstOrDefault(Function(x) x.Id = nMachGroupId)
+ Dim Beam As Beam = BeamMachGroup.PartList.FirstOrDefault(Function(x) x.nPartId = nDuploId)
+ EgtSetCurrMachGroup(BeamMachGroup.Id)
+ Beam.DeletePart()
+ Next
+ End If
+ DuploResetToDelete(nPartId)
+ End If
+ nPartId = EgtGetNextPart(nPartId)
+ End While
+ EgtResetCurrMachGroup()
+ End Sub
+
+ Friend Shared Function DuploGetToDelete(nSouId As Integer, ByRef bToDelete As Boolean) As Boolean
+ If IsNothing(nSouId) Then Return False
+ Return EgtGetInfo(nSouId, DUPLO_TODELETE, bToDelete)
+ End Function
+
+ Friend Shared Function DuploSetToDelete(nSouId As Integer) As Boolean
+ If IsNothing(nSouId) Then Return False
+ Return EgtSetInfo(nSouId, DUPLO_TODELETE, True)
+ End Function
+
+ Private Function DuploResetToDelete(nSouId As Integer) As Boolean
+ If IsNothing(nSouId) Then Return False
+ Return EgtSetInfo(nSouId, DUPLO_TODELETE, "")
+ End Function
+
+ ' funzione che seleziona ultimo gruppo
+ Friend Sub SelLastMachGroup()
+ If Not IsNothing(Me) AndAlso Not IsNothing(MachGroupList) AndAlso MachGroupList.Count > 0 Then
+ SelectedMachGroup = MachGroupList(MachGroupList.Count - 1)
+ End If
+ End Sub
+
+#End Region ' METHODS
+
+End Class
+
+Public Class BeamMachGroup
+ Inherits Core.BeamMachGroup
+
+ Public Property sStartCut As String
+ Get
+ Return LenToString(m_dStartCut, 3)
+ End Get
+ Set(value As String)
+ Dim dValue As Double
+ If StringToLen(value, dValue) Then
+ Dim dOldValue As Double = m_dStartCut
+ m_dStartCut = dValue
+ If Not ReDrawBeamMachgroup() Then
+ ' rispristino vecchio valore
+ m_dStartCut = dOldValue
+ ReDrawBeamMachgroup()
+ End If
+ m_dStartCut = dValue
+ EgtDraw()
+ If PartList.Count > 0 Then
+ Dim Beam As Beam = DirectCast(PartList(0), Beam)
+ Beam.UpdateOffset()
+ Beam.NotifyPropertyChanged("sOffset")
+ End If
+ Else
+ NotifyPropertyChanged("sStartCut")
+ End If
+ End Set
+ End Property
+
+ ' definizione comandi
+ Private m_cmdDeleteMachGroup As ICommand
+
+ Sub New(nId As Integer, sName As String, sMachine As String)
+ MyBase.New(nId, sName, sMachine)
+ SetMachineType(MachineType.BEAM)
+ EgtGetInfo(nId, MGR_RPT_BARLEN, dL)
+ EgtGetInfo(nId, MGR_RPT_BARHEIGHT, dH)
+ EgtGetInfo(nId, MGR_RPT_BARWIDTH, dW)
+ m_dTotMat = dL
+ For Each Part In PartList
+ m_dMatForPart += Part.dL
+ Next
+ End Sub
+
+ Public Overrides Sub RefreshPartList()
+ ' leggo StartCut da posizione primo pezzo
+ Dim sInfo As String = ""
+ Dim sSplitInfo() As String
+ Dim bFound As Boolean = False
+ EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
+ If Not String.IsNullOrWhiteSpace(sInfo) Then
+ sSplitInfo = sInfo.Split(","c)
+ StringToDouble(sSplitInfo(1), m_dStartCut)
+ Else
+ m_dStartCut = 0
+ End If
+ ' aggiorno lista pezzi
+ PartList.Clear()
+ Dim nRawPartId As Integer = EgtGetFirstRawPart()
+ While nRawPartId <> GDB_ID.NULL
+ Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
+ If nPartId <> GDB_ID.NULL Then
+ Dim NewBeam As Beam = New Beam(Me, nPartId, nRawPartId)
+ PartList.Add(NewBeam)
+ NewBeam.UpdateOffset()
+ End If
+ nRawPartId = EgtGetNextRawPart(nRawPartId)
+ End While
+ End Sub
+
+ Friend Sub UpdateUsage()
+ m_dTotMat = dL
+ m_dMatForPart = 0
+ For Each Part In PartList
+ m_dMatForPart += Part.dL
+ Next
+ NotifyPropertyChanged("dUsage")
+ NotifyPropertyChanged("dWaste")
+ End Sub
+
+ Friend Function ReDrawBeamMachgroup() As Boolean
+ ' scrivo dati di tutti i pezzi
+ Dim dPosX As Double = dStartCut
+ Dim nIndex As Integer
+ For nIndex = 0 To PartList.Count - 1
+ If nIndex <> 0 Then
+ Dim Beam As Beam = DirectCast(PartList(nIndex), Beam)
+ dPosX += Beam.dOffset
+ End If
+ PartList(nIndex).dPOSX = dPosX
+ EgtSetInfo(Id, MGR_RPT_PART & nIndex + 1, PartList(nIndex).nPartId & "," & dPosX)
+ dPosX += PartList(nIndex).dL
+ Next
+ ' elimino eventuali successive info pezzi di troppo
+ nIndex = PartList.Count + 1
+ Dim sTemp As String = ""
+ While EgtGetInfo(Id, MGR_RPT_PART & nIndex, sTemp)
+ EgtSetInfo(Id, MGR_RPT_PART & nIndex, "")
+ End While
+ ' elimino vecchio grezzo ed eseguo script creazione nuovo
+ Dim nRawId As Integer = EgtGetFirstRawPart()
+ While nRawId <> GDB_ID.NULL
+ EgtRemoveRawPart(nRawId)
+ nRawId = EgtGetFirstRawPart()
+ End While
+ If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then Return False
+ Return True
+ End Function
+
+ Friend Sub MoveBeam(Beam As Beam, MoveDirection As MoveDirections)
+ Dim nBeamIndex As Integer = PartList.IndexOf(Beam)
+ If nBeamIndex = 0 AndAlso MoveDirection = MoveDirections.UP Then Return
+ If nBeamIndex = PartList.Count - 1 AndAlso MoveDirection = MoveDirections.DOWN Then Return
+ ' se pezzo mosso diventa primo
+ Dim FirstBeam As Beam
+ If (nBeamIndex = 1 AndAlso MoveDirection = MoveDirections.UP) OrElse (nBeamIndex = 0 AndAlso MoveDirection = MoveDirections.DOWN) Then
+ '' resetto offset per vecchio primo
+ FirstBeam = DirectCast(PartList(0), Beam)
+ FirstBeam.ResetOffset()
+ End If
+ PartList.Move(nBeamIndex, nBeamIndex + MoveDirection)
+ ReDrawBeamMachgroup()
+ ' aggiorno offset primo pezzo
+ FirstBeam = DirectCast(PartList(0), Beam)
+ FirstBeam.UpdateOffset()
+ FirstBeam.NotifyPropertyChanged("sOffset")
+ End Sub
+
+ Friend Sub ReorderBeam()
+ Dim TempPartList = PartList.OrderBy(Function(x) x.dL).ToList()
+ ' verifico se non sono già in oridne
+ Dim bSort As Boolean = False
+ For PartIndex = 0 To PartList.Count - 1
+ If PartList(PartIndex).nPartId <> TempPartList(PartIndex).nPartId Then
+ bSort = True
+ Exit For
+ End If
+ Next
+ If Not bSort Then Return
+ ' resetto offset primo pezzo
+ Dim FirstBeam As Beam = DirectCast(PartList(0), Beam)
+ FirstBeam.ResetOffset()
+ PartList.Clear()
+ For Each Part In TempPartList
+ PartList.Add(Part)
+ Next
+ ReDrawBeamMachgroup()
+ ' aggiorno offset primo pezzo
+ FirstBeam = DirectCast(PartList(0), Beam)
+ FirstBeam.UpdateOffset()
+ FirstBeam.NotifyPropertyChanged("sOffset")
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "DeleteMachGroup"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property DeleteMachGroup_Command As ICommand
+ Get
+ If m_cmdDeleteMachGroup Is Nothing Then
+ m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
+ End If
+ Return m_cmdDeleteMachGroup
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Overrides Sub DeleteMachGroup()
+ ' elimino tutte le copie
+ Dim nRawPartId As Integer = EgtGetFirstRawPart()
+ Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
+ While nRawPartId <> GDB_ID.NULL
+ EgtRemovePartFromRawPart(nBeamId)
+ EgtErase(nBeamId)
+ nRawPartId = EgtGetNextRawPart(nRawPartId)
+ nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
+ End While
+ ' elimino MachGroup
+ EgtRemoveMachGroup(Me.Id)
+ ' rimuovo dalla lista grezzi
+ Dim Index As Integer = Map.refMachGroupPanelVM.MachGroupList.IndexOf(Me)
+ If Index = 0 Then
+ If Map.refMachGroupPanelVM.MachGroupList.Count > 0 Then
+ Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupList(0)
+ Else
+ Map.refMachGroupPanelVM.SelectedMachGroup = Nothing
+ End If
+ ElseIf Index = Map.refMachGroupPanelVM.MachGroupList.Count - 1 Then
+ If Map.refMachGroupPanelVM.MachGroupList.Count > 1 Then
+ Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupList(Map.refMachGroupPanelVM.MachGroupList.Count - 2)
+ Else
+ Map.refMachGroupPanelVM.SelectedMachGroup = Nothing
+ End If
+ Else
+ Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupList(Index - 1)
+ End If
+ Map.refMachGroupPanelVM.MachGroupList.Remove(Me)
+ End Sub
+
+#End Region ' DeleteMachGroup
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class WallMachGroup
+ Inherits Core.WallMachGroup
+
+ ' definizione comandi
+ Private m_cmdDeleteMachGroup As ICommand
+
+ Sub New(nId As Integer, sName As String, sMachine As String)
+ MyBase.New(nId, sName, sMachine)
+ SetMachineType(MachineType.WALL)
+ m_nRawPartId = EgtGetFirstRawPart()
+ EgtGetInfo(nId, MGR_RPT_PANELLEN, dL)
+ EgtGetInfo(nId, MGR_RPT_PANELWIDTH, dW)
+ EgtGetInfo(nId, MGR_RPT_PANELHEIGHT, dH)
+ m_dTotMat = dL * dW
+ For Each Part In PartList
+ m_dMatForPart += (Part.dL * Part.dW)
+ Next
+ End Sub
+
+ Friend Sub UpdateUsage()
+ m_dTotMat = dL * dW
+ m_dMatForPart = 0
+ For Each Part In PartList
+ m_dMatForPart += (Part.dL * Part.dW)
+ Next
+ NotifyPropertyChanged("dUsage")
+ NotifyPropertyChanged("dWaste")
+ End Sub
+
+ Public Overrides Sub RefreshPartList()
+ m_nRawPartId = EgtGetFirstRawPart()
+ PartList.Clear()
+ Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_nRawPartId)
+ While nPartId <> GDB_ID.NULL
+ PartList.Add(New Wall(Me, nPartId))
+ nPartId = EgtGetNextPartInRawPart(nPartId)
+ End While
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "DeleteMachGroup"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property DeleteMachGroup_Command As ICommand
+ Get
+ If m_cmdDeleteMachGroup Is Nothing Then
+ m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
+ End If
+ Return m_cmdDeleteMachGroup
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Overrides Sub DeleteMachGroup()
+ ' elimino tutte le copie
+ Dim nRawPartId As Integer = EgtGetFirstRawPart()
+ Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
+ While nRawPartId <> GDB_ID.NULL
+ EgtRemovePartFromRawPart(nBeamId)
+ EgtErase(nBeamId)
+ nRawPartId = EgtGetNextRawPart(nRawPartId)
+ nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
+ End While
+ ' elimino MachGroup
+ EgtRemoveMachGroup(Me.Id)
+ ' rimuovo dalla lista grezzi
+ Dim Index As Integer = Map.refMachGroupPanelVM.MachGroupList.IndexOf(Me)
+ If Index = 0 Then
+ If Map.refMachGroupPanelVM.MachGroupList.Count > 0 Then
+ Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupList(0)
+ Else
+ Map.refMachGroupPanelVM.SelectedMachGroup = Nothing
+ End If
+ ElseIf Index = Map.refMachGroupPanelVM.MachGroupList.Count - 1 Then
+ If Map.refMachGroupPanelVM.MachGroupList.Count > 1 Then
+ Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupList(Map.refMachGroupPanelVM.MachGroupList.Count - 2)
+ Else
+ Map.refMachGroupPanelVM.SelectedMachGroup = Nothing
+ End If
+ Else
+ Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupList(Index - 1)
+ End If
+ Map.refMachGroupPanelVM.MachGroupList.Remove(Me)
+ End Sub
+
+#End Region ' DeleteMachGroup
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class Beam
+ Inherits Core.Beam
+
+ Public Property sOffset As String
+ Get
+ Return LenToString(m_dOffset, 3)
+ End Get
+ Set(value As String)
+ Dim dValue As Double
+ If StringToLen(value, dValue) Then
+ Dim dOldValue As Double = m_dOffset
+ m_dOffset = dValue
+ Dim BeamMachGroup As BeamMachGroup = DirectCast(ParentMachGroup, BeamMachGroup)
+ If Not BeamMachGroup.ReDrawBeamMachgroup() Then
+ ' rispristino vecchio valore
+ m_dOffset = dOldValue
+ BeamMachGroup.ReDrawBeamMachgroup()
+ End If
+ Else
+ NotifyPropertyChanged("sOffset")
+ End If
+ End Set
+ End Property
+ Friend Sub ResetOffset()
+ m_dOffset = RawPartConfiguration.dBeamDist
+ NotifyPropertyChanged("sOffset")
+ End Sub
+
+#Region "CONSTRUCTOR"
+
+ Sub New(nParentMachGroup As Core.MyMachGroup, nPartId As Integer, nRawPartId As Integer)
+ MyBase.New(nParentMachGroup, nPartId, nRawPartId)
+ ' leggo info pezzo
+ EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
+ EgtGetInfo(nPartId, BTL_PRT_NAM, sNAM)
+ EgtGetInfo(nPartId, BTL_PRT_L, dL)
+ EgtGetInfo(nPartId, BTL_PRT_W, dW)
+ EgtGetInfo(nPartId, BTL_PRT_H, dH)
+ EgtGetInfo(nPartId, BTL_PRT_CNT, nCNT)
+ Dim nTemp As Integer = 0
+ If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
+ nTemp = 0
+ End If
+ SetRotated(nTemp)
+ If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
+ nTemp = 0
+ End If
+ SetInverted(nTemp)
+ ' leggo PosX
+ Dim sInfo As String = ""
+ Dim Index = 1
+ Dim sSplitInfo() As String
+ Dim bFound As Boolean = False
+ While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
+ If Not String.IsNullOrWhiteSpace(sInfo) Then
+ sSplitInfo = sInfo.Split(","c)
+ If sSplitInfo(0) = nPartId Then
+ bFound = True
+ Exit While
+ End If
+ End If
+ Index += 1
+ End While
+ If bFound Then
+ StringToDouble(sSplitInfo(1), dPOSX)
+ End If
+ ' leggo feature
+ Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
+ Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
+ While nFeatureId <> GDB_ID.NULL
+ ' verifico che sia una feature
+ Dim nGRP As Integer
+ If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
+ ' creo la feature
+ FeatureList.Add(New BTLFeature(Nothing, nFeatureId))
+ End If
+ nFeatureId = EgtGetNext(nFeatureId)
+ End While
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+ Friend Sub UpdateOffset()
+ ' calcolo offset
+ Dim nBeamIndex As Integer = ParentMachGroup.PartList.IndexOf(Me)
+ If nBeamIndex > 0 Then
+ m_dOffset = dPOSX - (ParentMachGroup.PartList(nBeamIndex - 1).dPOSX + ParentMachGroup.PartList(nBeamIndex - 1).dL)
+ Else
+ Dim BeamMachGroup As BeamMachGroup = DirectCast(ParentMachGroup, BeamMachGroup)
+ m_dOffset = BeamMachGroup.dStartCut
+ End If
+ End Sub
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Overrides Sub DeletePart()
+ ' elimino pezzo copia
+ EgtRemovePartFromRawPart(Me.nPartId)
+ EgtErase(Me.nPartId)
+ ' rimuovo dalla lista pezzi
+ Dim Index As Integer = ParentMachGroup.PartList.IndexOf(Me)
+ If Index = 0 Then
+ If ParentMachGroup.PartList.Count > 0 Then
+ ParentMachGroup.SelPart = ParentMachGroup.PartList(0)
+ Else
+ ParentMachGroup.SelPart = Nothing
+ End If
+ ElseIf Index = ParentMachGroup.PartList.Count - 1 Then
+ If ParentMachGroup.PartList.Count > 1 Then
+ ParentMachGroup.SelPart = ParentMachGroup.PartList(ParentMachGroup.PartList.Count - 2)
+ Else
+ ParentMachGroup.SelPart = Nothing
+ End If
+ Else
+ ParentMachGroup.SelPart = ParentMachGroup.PartList(Index - 1)
+ End If
+ ParentMachGroup.PartList.Remove(Me)
+ Dim BeamParentMachGroup As BeamMachGroup = DirectCast(ParentMachGroup, BeamMachGroup)
+ If Not IsNothing(BeamParentMachGroup) Then BeamParentMachGroup.ReDrawBeamMachgroup()
+ EgtDraw()
+ End Sub
+
+End Class
+
+Public Class Wall
+ Inherits Core.Wall
+
+ Public Property sPOSY As String
+ Get
+ Return LenToString(m_dPOSY, 3)
+ End Get
+ Set(value As String)
+ StringToLen(value, m_dPOSY)
+ End Set
+ End Property
+
+ Public Property sROT As String
+ Get
+ Return LenToString(m_dROT, 3)
+ End Get
+ Set(value As String)
+ StringToLen(value, m_dROT)
+ End Set
+ End Property
+
+ Public Property sFLIP As String
+ Get
+ Return LenToString(m_dFLIP, 3)
+ End Get
+ Set(value As String)
+ StringToLen(value, m_dFLIP)
+ End Set
+ End Property
+
+#Region "CONSTRUCTOR"
+
+ Sub New(nParentMachGroup As Core.MyMachGroup, nPartId As Integer)
+ MyBase.New(nParentMachGroup, nPartId)
+ ' leggo info pezzo
+ EgtGetInfo(nPartId, BTL_PRT_PDN, m_nPDN)
+ EgtGetInfo(nPartId, BTL_PRT_NAM, m_sNAM)
+ EgtGetInfo(nPartId, BTL_PRT_L, m_dL)
+ EgtGetInfo(nPartId, BTL_PRT_W, m_dW)
+ EgtGetInfo(nPartId, BTL_PRT_H, dH)
+ EgtGetInfo(nPartId, BTL_PRT_CNT, nCNT)
+ Dim nTemp As Integer = 0
+ If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
+ nTemp = 0
+ End If
+ SetRotated(nTemp)
+ If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
+ nTemp = 0
+ End If
+ SetInverted(nTemp)
+ ' leggo PosX, PosY, Rot e Flip
+ Dim sInfo As String = ""
+ Dim Index = 1
+ Dim sSplitInfo() As String
+ Dim bFound As Boolean = False
+ While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
+ If Not String.IsNullOrWhiteSpace(sInfo) Then
+ sSplitInfo = sInfo.Split(","c)
+ If sSplitInfo(0) = nPartId Then
+ bFound = True
+ Exit While
+ End If
+ End If
+ Index += 1
+ End While
+ If bFound Then
+ StringToDouble(sSplitInfo(1), dPOSX)
+ StringToDouble(sSplitInfo(2), dPOSY)
+ StringToDouble(sSplitInfo(3), dROT)
+ StringToDouble(sSplitInfo(4), dFLIP)
+ End If
+ ' vado sul layer delle feature
+ Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
+ Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
+ While nFeatureId <> GDB_ID.NULL
+ ' verifico che sia una feature
+ Dim nGRP As Integer
+ If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
+ ' creo la feature
+ FeatureList.Add(New BTLFeature(Nothing, nFeatureId))
+ End If
+ nFeatureId = EgtGetNext(nFeatureId)
+ End While
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelV.xaml
new file mode 100644
index 00000000..834b2018
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelV.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelV.xaml.vb
new file mode 100644
index 00000000..83a5832c
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class MachinePanelV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelVM.vb
new file mode 100644
index 00000000..3dd82e72
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelVM.vb
@@ -0,0 +1,394 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class MachinePanelVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ ' Radice del direttorio delle macchine
+ Private m_sMachinesRoot As String
+
+ ' Lista delle macchine disponibili
+ Private m_MachineList As New ObservableCollection(Of Machine)
+ Public Property MachineList As ObservableCollection(Of Machine)
+ Get
+ Return m_MachineList
+ End Get
+ Set(value As ObservableCollection(Of Machine))
+ m_MachineList = value
+ End Set
+ End Property
+ ' Macchina correntemente selezionata e quindi attiva
+ Private m_SelectedMachine As Machine = Nothing
+ Public Property SelectedMachine As MyMachine
+ Get
+ Return m_SelectedMachine
+ End Get
+ Set(value As MyMachine)
+ If value IsNot m_SelectedMachine Then
+ 'EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
+ 'EgtResetCurrMachGroup()
+ ' se sono in modalità disegno
+ If Map.refMainMenuVM.SelPage = Pages.VIEW Then
+ If EgtSetCurrMachine(value.Name) Then
+ m_SelectedMachine = value
+ Else
+ NotifyPropertyChanged("SelectedMachine")
+ End If
+ Else
+ m_SelectedMachine = value
+ End If
+ ' inizializzo la macchina selezionata come macchina corrente
+ Core.SectionXMaterial.SetType(DirectCast(m_SelectedMachine, MyMachine).nType)
+ InitCurrentMachine(Map.refMainWindowVM.MainWindowM.sMachinesRoot, value.Name)
+ End If
+ End Set
+ End Property
+
+ Private m_SetUp_Background As Brush = New BrushConverter().ConvertFrom("#FFDDDDDD")
+ Public Property SetUp_Background As Brush
+ Get
+ Return m_SetUp_Background
+ End Get
+ Set(value As Brush)
+ m_SetUp_Background = value
+ NotifyPropertyChanged("SetUp_Background")
+ End Set
+ End Property
+
+ Private m_MachPanel_IsEnabled As Boolean = True
+ Public Property MachPanel_IsEnabled As Boolean
+ Get
+ Return m_MachPanel_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_MachPanel_IsEnabled = value
+ NotifyPropertyChanged("MachPanel_IsEnabled")
+ End Set
+ End Property
+
+#Region "Messages"
+
+ Public ReadOnly Property ToolDBMsg As String
+ Get
+ Return EgtMsg(MSG_MACHINEPAGEUC + 6)
+ End Get
+ End Property
+ Public ReadOnly Property MachiningDbMsg As String
+ Get
+ Return EgtMsg(MSG_MACHINEPAGEUC + 7)
+ End Get
+ End Property
+ Public ReadOnly Property SetUpMsg As String
+ Get
+ Return EgtMsg(MSG_ALARMSPAGEUC + 33)
+ End Get
+ End Property
+
+#End Region ' Messages
+
+#Region "ToolTip"
+
+ Public ReadOnly Property ToolDBToolTip As String
+ Get
+ Return "Tool DB"
+ End Get
+ End Property
+ Public ReadOnly Property MachiningDbToolTip As String
+ Get
+ Return "Machining DB"
+ End Get
+ End Property
+ Public ReadOnly Property SetUpToolTip As String
+ Get
+ Return "SetUp"
+ End Get
+ End Property
+
+#End Region ' ToolTip
+
+ ' Definizione comandi
+ Private m_cmdToolDb As ICommand
+ Private m_cmdMachDb As ICommand
+ Private m_cmdSetUp As ICommand
+ Private m_cmdMachOptions As ICommand
+
+#End Region 'FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefMachinePanelVM(Me)
+ ' recupero cartella radice delle macchine
+ m_sMachinesRoot = Map.refMainWindowVM.MainWindowM.sMachinesRoot
+ ' Carica macchine da cartella delle macchine
+ MyMachine.MachineListInit(m_sMachinesRoot, MachineList)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Friend Sub LoadCurrentMachine()
+ If m_MachineList.Count = 0 Then Return
+ Dim CurrMach As String = String.Empty
+ GetMainPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMach)
+ Dim bFound As Boolean = False
+ If Not String.IsNullOrEmpty(CurrMach) Then
+ For Each Mach In MachineList
+ If Mach.Name = CurrMach Then
+ bFound = True
+ SelectedMachine = Mach
+ Exit For
+ End If
+ Next
+ End If
+ If Not bFound And MachineList.Count > 0 Then
+ SelectedMachine = MachineList(0)
+ End If
+ If Not IsNothing( SelectedMachine) Then
+ if EgtSetCurrMachine( SelectedMachine.Name) Then
+ InitCurrentMachine( Map.refMainWindowVM.MainWindowM.sMachinesRoot, SelectedMachine.Name)
+ End If
+ End If
+ End Sub
+
+ Friend Sub SaveCurrentMachine()
+ If IsNothing(m_SelectedMachine) Then Return
+ WriteMainPrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name)
+ End Sub
+
+ Friend Sub UpdateCurrentMachine()
+ 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
+ Dim sMachName As String = String.Empty
+ If EgtGetCurrMachineName(sMachName) Then
+ For Each Mach In MachineList
+ If Mach.Name = sMachName Then
+ SelectedMachine = Mach
+ Exit For
+ End If
+ Next
+ End If
+ End Sub
+
+#End Region
+
+#Region "COMMANDS"
+
+#Region "ToolDbCommand"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property ToolDbCommand As ICommand
+ Get
+ If m_cmdToolDb Is Nothing Then
+ m_cmdToolDb = New Command(AddressOf ToolDb)
+ End If
+ Return m_cmdToolDb
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub ToolDb(ByVal param As Object)
+ If Not VerifyMachinesDir(m_sMachinesRoot) Then Return
+ ' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
+ If Not EgtTdbReload() Then
+ EgtOutLog("Impossible reloading tool Db")
+ MessageBox.Show(EgtMsg(MSG_TOOLDBERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
+ Return
+ End If
+
+ Dim ToolDbWindowVM As New ToolDbWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachIniFile, Map.refSceneHostVM.MainScene.GetCtx(), "Beam")
+ Dim ToolDbWindowV As New ToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
+ If ToolDbWindowVM.MatType <> 0 Then
+ ToolDbWindowV.Height = 640
+ ToolDbWindowV.Width = 1024
+ ToolDbWindowV.ShowDialog()
+ Else
+ Exit Sub
+ End If
+
+ If Not SetUpUtility.IsValidToolHeadExitInSetUp() Then
+ SetUp_Background = Brushes.Red
+ Else
+ SetUp_Background = OmagOFFICEDictionary.Button_Static_Background
+ End If
+ End Sub
+
+#End Region ' ToolDbCommand
+
+#Region "MachDbCommand"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property MachDbCommand As ICommand
+ Get
+ If m_cmdMachDb Is Nothing Then
+ m_cmdMachDb = New Command(AddressOf MachDb)
+ End If
+ Return m_cmdMachDb
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub MachDb(ByVal param As Object)
+ If Not VerifyMachinesDir(m_sMachinesRoot) Then Return
+ ' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
+ If Not EgtMdbReload() Then
+ EgtOutLog("Impossible reloading machining Db")
+ MessageBox.Show(EgtMsg(MSG_MACHININGDBERRORS + 8), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
+ Return
+ End If
+ Dim MachDbWindowVM As New EgtWPFLib5.MachiningDbWindowVM(CurrentMachine.sMachIniFile, Map.refSceneHostVM.MainScene.GetCtx(), "Stone")
+ Dim MachDbWindowV As New EgtWPFLib5.MachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM)
+
+ If EgtWPFLib5.MachiningTreeViewItem.m_MatType <> 0 Then
+ MachDbWindowV.Height = 768
+ MachDbWindowV.Width = 1024
+ MachDbWindowV.ShowDialog()
+ Else
+ Exit Sub
+ End If
+
+ End Sub
+
+#End Region ' MachDbCommand
+
+#Region "SetUpCommand"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property SetUpCommand As ICommand
+ Get
+ If m_cmdSetUp Is Nothing Then
+ m_cmdSetUp = New Command(AddressOf SetUp)
+ End If
+ Return m_cmdSetUp
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub SetUp(ByVal param As Object)
+ ' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
+ If Not File.Exists(CurrentMachine.sMachDir & "\Scripts\" & SETUP_LUA) Then
+ EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
+ MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
+ Return
+ End If
+ ' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
+ ' e testa e uscita dell'utensile attrezzato
+ EgtLuaExecFile(CurrentMachine.sMachDir & "\Scripts\" & SETUP_LUA)
+ ' verifico che le teste riportate in configurazione esistano
+ Dim Index As Integer = 1
+ Dim nErr As Integer = 0
+ While nErr = 0
+ Dim sHead As String = String.Empty
+ nErr = 999
+ EgtLuaSetGlobIntVar("STU.INDEX", Index)
+ EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
+ ' Leggo variabili
+ EgtLuaGetGlobStringVar("STU.HEAD", sHead)
+ EgtLuaGetGlobIntVar("STU.ERR", nErr)
+ If nErr = 0 Then
+ If EgtGetHeadExitCount(sHead) = 0 Then
+ MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
+ Return
+ End If
+ End If
+ Index += 1
+ End While
+ ' Reset lua
+ EgtLuaResetGlobVar("STU")
+
+ Dim SetUpWindow As New SetUpWindowV(Application.Current.MainWindow, New SetUpWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachineName))
+ SetUpWindow.Height = 614
+ SetUpWindow.Width = 1024
+ SetUpWindow.ShowDialog()
+
+ End Sub
+
+#End Region ' SetUpCommand
+
+#Region "MachOptionsCommand"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property MachOptionsCommand As ICommand
+ Get
+ If m_cmdMachOptions Is Nothing Then
+ m_cmdMachOptions = New Command(AddressOf MachOptions)
+ End If
+ Return m_cmdMachOptions
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub MachOptions(ByVal param As Object)
+
+ End Sub
+
+#End Region ' MachOptionsCommand
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class MyMachine
+ Inherits Machine
+
+ Private m_nType As MachineType
+ Friend ReadOnly Property nType As MachineType
+ Get
+ Return m_nType
+ End Get
+ End Property
+
+ Sub New(sDirPath As String, sIniPath As String)
+ MyBase.New(sDirPath, sIniPath)
+ ' verifico esistenza cartella beam per assegnare tipo
+ If Directory.Exists(sDirPath & "/Beam") Then
+ m_nType = MachineType.BEAM
+ ElseIf Directory.Exists(sDirPath & "/Wall") Then
+ m_nType = MachineType.WALL
+ Else
+ m_nType = MachineType.NULL
+ End If
+ End Sub
+
+ Public Shared Shadows Function MachineListInit(sMachinesRootDir As String, MachineList As IList(Of Machine)) As Boolean
+ ' Se direttorio base macchine non definito o non esiste, ritorno
+ If String.IsNullOrWhiteSpace(sMachinesRootDir) OrElse
+ Not Directory.Exists(sMachinesRootDir) Then
+ MachineList = Nothing
+ Return False
+ End If
+ ' Cerco le macchine
+ Dim Machines As String() = Directory.GetDirectories(sMachinesRootDir)
+ For i As Integer = 0 To Machines.Count - 1
+ Dim PathIni As String = Machines(i) & "\" & Path.GetFileName(Machines(i)) & ".ini"
+ Dim PathBeam As String = Machines(i) & "\" & "Beam"
+ Dim PathWall As String = Machines(i) & "\" & "Wall"
+ If File.Exists(PathIni) AndAlso (Directory.Exists(PathBeam) OrElse Directory.Exists(PathWall)) Then
+ MachineList.Add(New MyMachine(Machines(i), PathIni))
+ End If
+ Next
+ Return True
+ End Function
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/MachiningPage/MachiningPageV.xaml b/EgtBEAMWALL.ViewerOptimizer/MachiningPage/MachiningPageV.xaml
new file mode 100644
index 00000000..46a2a5e3
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MachiningPage/MachiningPageV.xaml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/MachiningPage/MachiningPageV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/MachiningPage/MachiningPageV.xaml.vb
new file mode 100644
index 00000000..5d9a7df7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MachiningPage/MachiningPageV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class MachiningPageV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/MachiningPage/MachiningPageVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachiningPage/MachiningPageVM.vb
new file mode 100644
index 00000000..54b9a5b3
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MachiningPage/MachiningPageVM.vb
@@ -0,0 +1,3 @@
+Public Class MachiningPageVM
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/MacroFeatureWnd/MacroFeatureWndV.xaml b/EgtBEAMWALL.ViewerOptimizer/MacroFeatureWnd/MacroFeatureWndV.xaml
new file mode 100644
index 00000000..fb331bce
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MacroFeatureWnd/MacroFeatureWndV.xaml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/MacroFeatureWnd/MacroFeatureWndV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/MacroFeatureWnd/MacroFeatureWndV.xaml.vb
new file mode 100644
index 00000000..f600f0dc
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MacroFeatureWnd/MacroFeatureWndV.xaml.vb
@@ -0,0 +1,18 @@
+Public Class MacroFeatureWndV
+
+ Private WithEvents m_MacroFeatureWndVM As MacroFeatureWndVM
+
+ Sub New(Owner As Window, MacroFeatureWndVM As MacroFeatureWndVM)
+ MyBase.New(Owner)
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = MacroFeatureWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_MacroFeatureWndVM = MacroFeatureWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_MacroFeatureWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/MacroFeatureWnd/MacroFeatureWndVM.vb b/EgtBEAMWALL.ViewerOptimizer/MacroFeatureWnd/MacroFeatureWndVM.vb
new file mode 100644
index 00000000..1e78bf1b
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MacroFeatureWnd/MacroFeatureWndVM.vb
@@ -0,0 +1,154 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+Imports EgtBEAMWALL.Core
+
+Public Class MacroFeatureWndVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ ' File template per scrittura Macro
+ Friend Const MACROTEMPLATE_FILE As String = "MacroTemplate.ini"
+ Friend Const DATETIME As String = "%DATE_TIME%"
+ Friend Const MACRO_NAME As String = "%MACRO_NAME%"
+ Friend Const MACRO_ORIG As String = "%x,y,z%"
+ Friend Const MACRO_DIRX As String = "%xx,xy,xz%"
+ Friend Const MACRO_DIRY As String = "%yx,yy,yz%"
+ Friend Const MACRO_DIRZ As String = "%zx,zy,zz%"
+ 'Friend Const MACRO_L As String = "%L%"
+ 'Friend Const MACRO_W As String = "%W%"
+ 'Friend Const MACRO_H As String = "%H%"
+ 'Friend Const MACRO_ID As String = "%Id%"
+ Friend Const MACRO_VPAR As String = "%vPar%"
+ Friend Const MACRO_SPAR As String = "%sPar%"
+ Friend Const MACRO_ADDFEATURE As String = "%AddFeature%"
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ Private m_FeatureList As New ObservableCollection(Of BTLFeature)
+ Public ReadOnly Property FeatureList As ObservableCollection(Of BTLFeature)
+ Get
+ Return m_FeatureList
+ End Get
+ End Property
+
+ Private m_nSelFeature As BTLFeature = Nothing
+ Public Property nSelFeature As BTLFeature
+ Get
+ Return m_nSelFeature
+ End Get
+ Set(value As BTLFeature)
+ If value IsNot m_nSelFeature Then
+ m_nSelFeature = value
+ End If
+ End Set
+ End Property
+
+ Private m_sFeatureName As String
+ Public Property sFeatureName As String
+ Get
+ Return m_sFeatureName
+ End Get
+ Set(value As String)
+ If value <> m_sFeatureName Then
+ m_sFeatureName = value
+ End If
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ For Each FeatureItem In Map.refProjectVM.BTLStructure.SelPart.FeatureList
+ FeatureList.Add(FeatureItem)
+ Next
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "Ok"
+
+ Public ReadOnly Property Ok_Command As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ Public Sub Ok()
+ 'verifico che tutti i campi contengano un valore valido
+ If Not IsNothing(nSelFeature) AndAlso Not String.IsNullOrEmpty(sFeatureName) Then
+ WriteMacro(sFeatureName)
+ RaiseEvent m_CloseWindow(True)
+ Else
+ MessageBox.Show("Errore! Impossibile creare una Macro senza selezionare una Feature o col Nome vuoto", "Errore")
+ End If
+ End Sub
+
+#End Region ' Ok
+
+#End Region ' COMMANDS
+
+#Region "METHODS"
+
+#Region "Ok"
+
+ Friend Sub WriteMacro(sMacroName As String)
+ ' inizio routine di scrittura
+ Dim FileContent As String() = File.ReadAllLines(Map.refMainWindowVM.MainWindowM.sMacroDir & "\" & MACROTEMPLATE_FILE)
+ Dim FileName As String = CalcBeamPrivateProfileGRP(nSelFeature.nSelGRP) & "." & nSelFeature.nPRC & FILENAMESEPARATOR & sMacroName
+ For LineIndex As Integer = 0 To FileContent.Count - 1
+ Dim sCurrLine As String = FileContent(LineIndex)
+ FileContent(LineIndex) = FileContent(LineIndex).Replace(DATETIME, System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"))
+ FileContent(LineIndex) = FileContent(LineIndex).Replace(MACRO_NAME, FileName)
+ FileContent(LineIndex) = FileContent(LineIndex).Replace(MACRO_ORIG, LenToString(nSelFeature.frFRAME.Orig.x, 6) & ", " &
+ LenToString(nSelFeature.frFRAME.Orig.y, 6) & ", " &
+ LenToString(nSelFeature.frFRAME.Orig.z, 6))
+ FileContent(LineIndex) = FileContent(LineIndex).Replace(MACRO_DIRX, DoubleToString(nSelFeature.frFRAME.VersX.x, 6) & ", " &
+ DoubleToString(nSelFeature.frFRAME.VersX.y, 6) & ", " &
+ DoubleToString(nSelFeature.frFRAME.VersX.z, 6))
+ FileContent(LineIndex) = FileContent(LineIndex).Replace(MACRO_DIRY, DoubleToString(nSelFeature.frFRAME.VersY.x, 6) & ", " &
+ DoubleToString(nSelFeature.frFRAME.VersY.y, 6) & ", " &
+ DoubleToString(nSelFeature.frFRAME.VersY.z, 6))
+ FileContent(LineIndex) = FileContent(LineIndex).Replace(MACRO_DIRZ, DoubleToString(nSelFeature.frFRAME.VersZ.x, 6) & ", " &
+ DoubleToString(nSelFeature.frFRAME.VersZ.y, 6) & ", " &
+ DoubleToString(nSelFeature.frFRAME.VersZ.z, 6))
+ If FileContent(LineIndex).Contains(MACRO_VPAR) Or FileContent(LineIndex).Contains(MACRO_SPAR) Then
+ ' recupero i valori di vPar (e sPar) e li separo opportunamente
+ Dim vPar() As Double = Nothing
+ Dim sPar As String = String.Empty
+ Dim s_vPar As String = String.Empty
+ nSelFeature.CalcParamArray(vPar, sPar)
+ For Each vParItem In vPar
+ s_vPar = s_vPar & " " & DoubleToString(vParItem, 3) & ","
+ Next
+ s_vPar = s_vPar.TrimStart()
+ s_vPar = s_vPar.TrimEnd(", ")
+ FileContent(LineIndex) = FileContent(LineIndex).Replace(MACRO_VPAR, s_vPar)
+ FileContent(LineIndex) = FileContent(LineIndex).Replace(MACRO_SPAR, If(String.IsNullOrWhiteSpace(sPar), "''", sPar))
+ End If
+ FileContent(LineIndex) = FileContent(LineIndex).Replace(MACRO_ADDFEATURE, nSelFeature.nSelGRP & ", " &
+ nSelFeature.nPRC & ", " &
+ nSelFeature.nSelSIDE & ", " &
+ "'" & nSelFeature.sDES & "', " &
+ "MACRO.PROCID") 'nSelFeature.ParentPart.NewProcId() &
+ Next
+ File.WriteAllLines(Map.refMainWindowVM.MainWindowM.sMacroDir & "\" & FileName & ".lua", FileContent, Text.Encoding.UTF8)
+ End Sub
+
+#End Region ' Ok
+
+#End Region ' METHODS
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuV.xaml b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuV.xaml
new file mode 100644
index 00000000..4bdc4752
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuV.xaml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuV.xaml.vb
new file mode 100644
index 00000000..874fb85d
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class MainMenuV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb
new file mode 100644
index 00000000..81882a08
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb
@@ -0,0 +1,205 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class MainMenuVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Public Property View_IsChecked As Boolean
+ Get
+ Return m_SelPage = Pages.VIEW
+ End Get
+ Set(value As Boolean)
+ If value Then SelPage = Pages.VIEW
+ End Set
+ End Property
+
+ Public Property Machining_IsChecked As Boolean
+ Get
+ Return m_SelPage = Pages.MACHINING
+ End Get
+ Set(value As Boolean)
+ If value Then SelPage = Pages.MACHINING
+ End Set
+ End Property
+
+ Public Property Supervisor_IsChecked As Boolean
+ Get
+ Return m_SelPage = Pages.SUPERVISOR
+ End Get
+ Set(value As Boolean)
+ If value Then SelPage = Pages.SUPERVISOR
+ End Set
+ End Property
+
+ Public Property Config_IsChecked As Boolean
+ Get
+ Return m_SelPage = Pages.CONFIG
+ End Get
+ Set(value As Boolean)
+ If value Then SelPage = Pages.CONFIG
+ End Set
+ End Property
+
+ Private m_SelPage As Integer = -1
+ Public Property SelPage As Integer
+ Get
+ Return m_SelPage
+ End Get
+ Set(value As Integer)
+ ' lancio selezione pagina con verifica file modificato
+ SetSelPage(value)
+ End Set
+ End Property
+ ' funzione che permette di cambiare pagina
+ ' bVerifyModification: se vero verifica modifiche su file e chiede di salvare
+ Friend Sub SetSelPage(Page As Pages, Optional bVerifyModification As Boolean = True)
+ ' Esco dallo stato corrente
+ Select Case m_SelPage
+ Case Pages.VIEW
+ ExitVIEW(bVerifyModification)
+ Case Pages.MACHINING
+ ExitMACHINING(bVerifyModification)
+ Case Pages.SUPERVISOR
+ 'Map.refSUPERVISORTabVM.ExitSUPERVISOR()
+ Case Pages.CONFIG
+ ExitCONFIG()
+ End Select
+ ' Entro nel nuovo stato
+ m_SelPage = Page
+ Select Case m_SelPage
+ Case Pages.VIEW
+ ' Map.refMachGroupPanelVM.SetMachGroupState(False)
+ InitVIEW()
+ 'Map.refTopCommandBarVM.IsEnabled = False
+ Case Pages.MACHINING
+ ' Map.refMachGroupPanelVM.SetMachGroupState(True)
+ InitMACHINING()
+ 'Map.refTopCommandBarVM.IsEnabled = True
+ Case Pages.SUPERVISOR
+ 'Map.refMachGroupPanelVM.SetMachGroupState(False)
+ 'Map.refSUPERVISORTabVM.InitSUPERVISOR()
+ 'Map.refTopCommandBarVM.IsEnabled = False
+ Case Pages.CONFIG
+ InitCONFIG()
+ 'Map.refMachGroupPanelVM.SetMachGroupState(False)
+ 'Map.refCONFIGTabVM.InitCONFIGation()
+ 'Map.refTopCommandBarVM.IsEnabled = False
+ End Select
+ ' aggiorno visualizzazione RadioButton
+ NotifyPropertyChanged("View_IsChecked")
+ NotifyPropertyChanged("Machining_IsChecked")
+ NotifyPropertyChanged("Supervisor_IsChecked")
+ NotifyPropertyChanged("Config_IsChecked")
+ Map.refProjectVM.NotifyPropertyChanged("SelItem")
+ End Sub
+
+#End Region ' Fields & Properties
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in EgtCAM5Map
+ Map.SetRefMainMenuVM(Me)
+
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Private Function InitVIEW() As Boolean
+ Map.refProjectVM.SetBottomPanel_Visibility(True)
+ Map.refProjectVM.SetLeftPanel_Visibility(True)
+ Map.refLeftPanelVM.UpdateView()
+ Map.refProjectVM.SetPartManager_Visibility(True)
+ Map.refProjectVM.SetFeatureManager_Visibility(True)
+ Map.refProjectVM.SetTopPanel_Visibility(False)
+ Map.refProjectVM.SetShowBeamPanel_Visibility(True)
+ Map.refProjectVM.SetProjManager_Visibility(True)
+ Map.refProjectVM.SetProdManager_Visibility(False)
+ Map.refProjectVM.NotifyAllPanelVisibility()
+ ' apro progetto proj
+ If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
+ Map.refProjManagerVM.OpenProject(Map.refProjManagerVM.CurrProj)
+ End If
+ Map.refMainWindowVM.NotifyPropertyChanged("nSelTabPage")
+ Return True
+ End Function
+
+ Private Function ExitVIEW(bVerifyModification As Boolean) As Boolean
+ Map.refProjectVM.SetBottomPanel_Visibility(False)
+ Map.refProjectVM.SetLeftPanel_Visibility(True)
+ Map.refProjectVM.SetPartManager_Visibility(False)
+ Map.refProjectVM.SetFeatureManager_Visibility(False)
+ Map.refProjectVM.SetTopPanel_Visibility(True)
+ Map.refProjectVM.SetShowBeamPanel_Visibility(False)
+ Map.refProjectVM.SetProjManager_Visibility(False)
+ Map.refProjectVM.SetProdManager_Visibility(True)
+ ' verifico se progetto modificato, e chiedo se salvare
+ If bVerifyModification Then ProjectFile.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ)
+ Return True
+ End Function
+
+ Private Function InitMACHINING() As Boolean
+ Map.refProjectVM.SetBottomPanel_Visibility(False)
+ Map.refProjectVM.SetLeftPanel_Visibility(True)
+ Map.refLeftPanelVM.UpdateView()
+ Map.refProjectVM.SetPartManager_Visibility(False)
+ Map.refProjectVM.SetFeatureManager_Visibility(False)
+ Map.refProjectVM.SetTopPanel_Visibility(True)
+ Map.refProjectVM.SetShowBeamPanel_Visibility(False)
+ Map.refProjectVM.SetProjManager_Visibility(False)
+ Map.refProjectVM.SetProdManager_Visibility(True)
+ Map.refProjectVM.NotifyAllPanelVisibility()
+ ' inizializzo gruppi di lavorazione
+ If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Not IsNothing(Map.refProdManagerVM.CurrProd.nProdId) AndAlso Map.refProdManagerVM.CurrProd.nProdId > 0 Then
+ If File.Exists(Map.refProdManagerVM.CurrProd.sProdPath) Then
+ ' apro progetto
+ Map.refSceneHostVM.MainController.OpenProject(Map.refProdManagerVM.CurrProd.sProdPath, False)
+ ' inizializzo gruppi di lavorazione
+ Map.refMachGroupPanelVM.InitMachGroupList()
+ Else
+ MessageBox.Show("File non trovato!!")
+ End If
+ Else
+ Map.refSceneHostVM.MainController.NewProject()
+ Map.refProjectVM.BTLStructure = Nothing
+ End If
+ Map.refMainWindowVM.NotifyPropertyChanged("nSelTabPage")
+ Return True
+ End Function
+
+ Private Function ExitMACHINING(bVerifyModification As Boolean) As Boolean
+ Map.refProjectVM.SetBottomPanel_Visibility(True)
+ Map.refProjectVM.SetLeftPanel_Visibility(False)
+ Map.refProjectVM.SetPartManager_Visibility(True)
+ Map.refProjectVM.SetFeatureManager_Visibility(True)
+ Map.refProjectVM.SetTopPanel_Visibility(False)
+ Map.refProjectVM.SetShowBeamPanel_Visibility(True)
+ Map.refProjectVM.SetProjManager_Visibility(True)
+ Map.refProjectVM.SetProdManager_Visibility(False)
+ ' verifico se progetto modificato, e chiedo se salvare
+ If bVerifyModification Then ProjectFile.VerifyProjectModification(Map.refProdManagerVM.CurrProd, ProjectType.PROD)
+ EgtResetCurrMachGroup()
+ Return True
+ End Function
+
+ Private Function InitCONFIG() As Boolean
+ Map.refMainWindowVM.NotifyPropertyChanged("nSelTabPage")
+ Return True
+ End Function
+
+ Private Function ExitCONFIG() As Boolean
+ Map.refConfigurationPageVM.VerifyConfigPageModification()
+ ' resetto flag inserimento password
+ Map.refConfigurationPageVM.bModifyMachParam = False
+ Return True
+ End Function
+
+#End Region ' METHODS
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowM.vb b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowM.vb
new file mode 100644
index 00000000..b0de59fe
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowM.vb
@@ -0,0 +1,358 @@
+Imports System.Threading
+Imports System.Math
+Imports EgtUILib
+Imports EgtWPFLib5
+Imports EgtBEAMWALL.Core
+
+Public Class MainWindowM
+
+#Region "FIELDS"
+
+ ' massimo numero di istanze del programma ammesse
+ Const MAX_INST As Integer = 32
+
+ Private m_sDataRoot As String = String.Empty
+ Friend ReadOnly Property sDataRoot As String
+ Get
+ Return m_sDataRoot
+ End Get
+ End Property
+
+ Private m_sConfigDir As String = String.Empty
+ Public ReadOnly Property sConfigDir As String
+ Get
+ Return m_sConfigDir
+ End Get
+ End Property
+
+ Private m_nDebug As Integer = 0
+
+ Private m_objMutex As Mutex
+
+ Private m_bFirstInstance As Boolean = False
+ Friend ReadOnly Property bFirstInstance As Boolean
+ Get
+ Return m_bFirstInstance
+ End Get
+ End Property
+
+ Private m_nInstance As Integer = 0
+ Friend ReadOnly Property nInstance As Integer
+ Get
+ Return m_nInstance
+ End Get
+ End Property
+
+ Private m_nUserLevel As Integer = 1
+ Friend ReadOnly Property nUserLevel As Integer
+ Get
+ Return m_nUserLevel
+ End Get
+ End Property
+
+ Private m_nKeyLevel As Integer = 0
+ Friend ReadOnly Property nKeyLevel As Integer
+ Get
+ Return m_nKeyLevel
+ End Get
+ End Property
+
+ Private m_nKeyOptions As UInteger = 0
+ Friend ReadOnly Property nKeyOptions As Integer
+ Get
+ Return m_nKeyOptions
+ End Get
+ End Property
+
+ Private m_bAutoNestOption As Boolean = False
+ Friend ReadOnly Property AutoNestOption As Boolean
+ Get
+ Return m_bAutoNestOption
+ End Get
+ End Property
+
+ Friend ReadOnly Property sVersion As String
+ Get
+ Return My.Application.Info.Version.Major.ToString() & "." &
+ My.Application.Info.Version.Minor.ToString() &
+ (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
+ My.Application.Info.Version.Revision.ToString()
+ End Get
+ End Property
+
+ Private m_sTempDir As String
+ Friend ReadOnly Property sTempDir As String
+ Get
+ Return m_sTempDir
+ End Get
+ End Property
+ Private m_sMachinesRoot As String
+ Friend ReadOnly Property sMachinesRoot As String
+ Get
+ Return m_sMachinesRoot
+ End Get
+ End Property
+ Private m_sBeamRoot As String
+ Friend ReadOnly Property sBeamRoot As String
+ Get
+ Return m_sBeamRoot
+ End Get
+ End Property
+ Private m_sWallRoot As String
+ Friend ReadOnly Property sWallRoot As String
+ Get
+ Return m_sWallRoot
+ End Get
+ End Property
+ Private m_sWarehouseRoot As String
+ Friend ReadOnly Property sWarehouseRoot As String
+ Get
+ Return m_sWarehouseRoot
+ End Get
+ End Property
+ Private m_sToolMakersDir As String
+ Friend ReadOnly Property sToolMakersDir As String
+ Get
+ Return m_sToolMakersDir
+ End Get
+ End Property
+ Private m_sResourcesRoot As String
+ Friend ReadOnly Property sResourcesRoot As String
+ Get
+ Return m_sResourcesRoot
+ End Get
+ End Property
+ Private m_sLogFile As String
+ Friend ReadOnly Property sLogFile As String
+ Get
+ Return m_sLogFile
+ End Get
+ End Property
+
+ Friend ReadOnly Property sProjsDir As String
+ Get
+ Return m_sDataRoot & "\" & PROJS_DIR
+ End Get
+ End Property
+ Friend ReadOnly Property sProdsDir As String
+ Get
+ Return m_sDataRoot & "\" & PRODS_DIR
+ End Get
+ End Property
+
+ Friend ReadOnly Property sMacroDir As String
+ Get
+ Return m_sDataRoot & "\" & MACRO_DIR
+ End Get
+ End Property
+
+ Friend ReadOnly Property sWarehouseDir As String
+ Get
+ Return m_sDataRoot & "\" & WAREHOUSE_DIR
+ End Get
+ End Property
+
+#End Region ' FIELDS
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ InitializeEgtEnvironment()
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Private Sub InitializeEgtEnvironment()
+ '' Abilito drag and drop
+ 'Me.AllowDrop = True
+ ' Impostazione path radice per i dati
+ m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
+ If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
+ m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
+ End If
+ ' Impostazione direttorio di configurazione
+ m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
+ ' Impostazione direttorio per file temporanei
+ m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
+ ' Impostazione path Ini file
+ IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
+ ' Impostazione path BTL Ini File
+ BTLIniFile.m_sBTLIniFile = m_sConfigDir & "\" & BTLFEATURES_FILE_NAME
+ ' Impostazione path resources dir
+ m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
+ ' Impostazione direttorio per le macchine
+ If GetMainPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot) = 0 Then
+ m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR
+ End If
+ ' Impostazione direttorio per toolmakers
+ If GetMainPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", m_sToolMakersDir) = 0 Then
+ m_sToolMakersDir = m_sDataRoot & "\" & TOOLMAKERS_DFL_DIR
+ End If
+ ' Impostazione direttori Beam e Wall
+ If GetMainPrivateProfileString(S_BEAM, K_BEAMBASEDIR, "", m_sBeamRoot) = 0 Then
+ m_sBeamRoot = m_sDataRoot & "\" & BEAM_DIR
+ End If
+ If GetMainPrivateProfileString(S_WALL, K_WALLBASEDIR, "", m_sWallRoot) = 0 Then
+ m_sWallRoot = m_sDataRoot & "\" & WALL_DIR
+ End If
+ m_sWarehouseRoot = m_sDataRoot & "\" & WAREHOUSE_DIR
+ ' Verifico indice di istanza
+ ManageInstance()
+ ' Imposto tipo di chiave
+ EgtSetLockType(KEY_TYPE.HW)
+ ' Leggo e imposto chiave di protezione
+ Dim sLicFileName As String = String.Empty
+ GetMainPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
+ Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName
+ Dim sKey As String = String.Empty
+ EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
+ EgtSetKey(sKey)
+ Dim sNestKey As String = ""
+ EgtUILib.GetPrivateProfileString(S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile)
+ EgtSetNestKey(sNestKey)
+ ' Verifico abilitazione nesting automatico
+ m_bAutoNestOption = Not String.IsNullOrWhiteSpace(sNestKey)
+ ' Recupero livello e opzioni della chiave
+ Dim bKey As Boolean = EgtGetKeyLevel(3279, 2301, 1, m_nKeyLevel) And
+ EgtGetKeyOptions(3279, 2301, 1, m_nKeyOptions)
+ ' Inizializzazione generale di EgtInterface
+ m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
+ m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
+ Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf &
+ My.Application.Info.Title.ToString() & " ver. " &
+ My.Application.Info.Version.Major.ToString() &
+ "." & My.Application.Info.Version.Minor.ToString() &
+ (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
+ My.Application.Info.Version.Revision.ToString()
+ EgtInit(m_nDebug, m_sLogFile, sLogMsg)
+ EgtSetTempDir(m_sTempDir)
+ EgtSetIniFile(IniFile.m_sIniFile)
+ ' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
+ Dim sMsgDir As String = String.Empty
+ If GetMainPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then
+ sMsgDir = m_sConfigDir
+ End If
+ ' Leggo lingua corrente
+ Dim sLanguage As String = String.Empty
+ GetMainPrivateProfileString(S_GENERAL, K_MESSAGES, "", sLanguage)
+ ' Recupero nome file dei messaggi della lingua corrente
+ Dim sMsgName As String = "EgalTechIta.txt"
+ Dim nIndex As Integer = 1
+ While True
+ Dim ReadLanguage As Language = GetMainPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
+ If IsNothing(ReadLanguage) Then Exit While
+ If String.Compare(ReadLanguage.Name, sLanguage, True) = 0 Then
+ sMsgName = ReadLanguage.FilePath
+ Exit While
+ End If
+ nIndex += 1
+ End While
+ ' Leggo file messaggi
+ Dim sMsgFilePath As String = sMsgDir & "\" & sMsgName
+ If Not EgtLoadMessages(sMsgFilePath) Then
+ EgtOutLog("Error in EgtLoadMessages")
+ End If
+ ' Leggo e imposto unità di misura per interfaccia utente
+ EgtSetUiUnits(GetMainPrivateProfileInt(S_GENERAL, K_MMUNITS, 1) <> 0)
+ ' Leggo e imposto livello utilizzatore
+ m_nUserLevel = Math.Min(m_nKeyLevel, GetMainPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
+ ' Imposto dir font Nfe e font default
+ Dim sNfeDir As String = String.Empty
+ GetMainPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir)
+ Dim sDefFont As String = String.Empty
+ GetMainPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, "", sDefFont)
+ EgtSetFont(sNfeDir, sDefFont)
+ ' imposto dir di default per libreria Lua e lancio libreria di base
+ Dim sLuaLibsDir As String = String.Empty
+ GetMainPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir)
+ EgtSetLuaLibs(sLuaLibsDir)
+ Dim sLuaBaseLib As String = String.Empty
+ GetMainPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib)
+ EgtLuaRequire(sLuaBaseLib)
+ ' Info su opzioni chiave
+ EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString())
+ End Sub
+
+ Private Sub ManageInstance()
+ Dim bCreated As Boolean
+ Try
+ m_objMutex = New Mutex(False, "Global\OmagOFFICE", bCreated)
+ Catch
+ bCreated = False
+ End Try
+ m_bFirstInstance = bCreated
+ If bCreated Then
+ ' Prima istanza
+ m_nInstance = 1
+ ' Aggiorno stato istanze attive
+ WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance.ToString())
+ Else
+ ' Leggo il massimo numero di istanze ammesse
+ Dim nMaxInst As Integer = GetMaxInstances()
+ ' Cerco il primo indice di istanza libero
+ Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
+ m_nInstance = 1
+ Dim nMask As Integer = 1
+ While (nTmp And nMask) <> 0 And m_nInstance < MAX_INST
+ m_nInstance += 1
+ nMask *= 2
+ End While
+ ' Se l'indice supera il massimo
+ If m_nInstance > nMaxInst Then
+ ' porto in primo piano la prima istanza
+ Dim bFound As Boolean = False
+ ' processi del programma a 32 bit
+ Dim localProc As Process() = Process.GetProcessesByName("OmagOFFICER32")
+ For Each p As Process In localProc
+ If p.Id <> Process.GetCurrentProcess().Id Then
+ bFound = True
+ ShowWindow(p.MainWindowHandle, 1)
+ Exit For
+ End If
+ Next
+ ' se non trovati processi a 32 bit provo a 64 bit
+ If Not bFound Then
+ localProc = Process.GetProcessesByName("OmagOFFICER64")
+ For Each p As Process In localProc
+ If p.Id <> Process.GetCurrentProcess().Id Then
+ bFound = True
+ ShowWindow(p.MainWindowHandle, SW.RESTORE)
+ Exit For
+ End If
+ Next
+ End If
+ ' esco dal programma
+ End
+ End If
+ ' Aggiorno stato istanze attive
+ nTmp += (1 << (m_nInstance - 1))
+ WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
+ End If
+ End Sub
+
+ Friend Function GetKeyOption(nKeyOpt As KEY_OPT) As Boolean
+ Return ((m_nKeyOptions And nKeyOpt) <> 0)
+ End Function
+
+ Friend Function GetMaxInstances() As Integer
+ ' Leggo il massimo numero di istanze ammesse
+ Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
+ Return Max(1, Min(nMaxInst, MAX_INST))
+ End Function
+
+ Friend Sub Close()
+ ' Terminazione generale di EgtInterface
+ EgtExit()
+ ' Rilascio mutex
+ If Not IsNothing(m_objMutex) Then m_objMutex.Close()
+ ' Aggiorno istanze usate
+ Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
+ nTmp -= (1 << (m_nInstance - 1))
+ WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
+ End Sub
+
+#End Region ' METHODS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowV.xaml b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowV.xaml
new file mode 100644
index 00000000..f64dd63f
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowV.xaml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowV.xaml.vb
new file mode 100644
index 00000000..d9b16096
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowV.xaml.vb
@@ -0,0 +1,38 @@
+Imports EgtWPFLib5
+
+Class MainWindowV
+
+ Private m_MainWindowVM As MainWindowVM
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Funzione che interpreta l'xaml
+ InitializeComponent()
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_MainWindowVM = DirectCast(Me.DataContext, MainWindowVM)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "EVENTS"
+
+ Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
+ ' Carico e imposto posizione finestra
+ WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me)
+ End Sub
+
+ Private Sub MainWindowV_ContentRendered(sender As Object, e As EventArgs) Handles Me.ContentRendered
+ m_MainWindowVM.ContentRendered()
+ End Sub
+
+ Private Sub MainWindowV_Unloaded(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles Me.Closing
+ ' Salvo posizione finestra (se non minimizzata)
+ If WindowState <> WindowState.Minimized Then
+ WinPosFromWindowToIni(Me, S_GENERAL, K_WINPLACE)
+ End If
+ End Sub
+
+#End Region ' EVENTS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb
new file mode 100644
index 00000000..5e3dda61
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb
@@ -0,0 +1,159 @@
+Imports EgtUILib
+Imports EgtWPFLib5
+Imports System.IO
+
+Public Class MainWindowVM
+ Inherits VMBase
+
+ ' Riferimento al Model della MainWindow
+ Private m_MainWindowM As MainWindowM
+ Friend ReadOnly Property MainWindowM As MainWindowM
+ Get
+ Return m_MainWindowM
+ End Get
+ End Property
+
+ ' Variabile che indica che il programma è stato avviato correttamente (sia la mappa che l'ambiente Egt)
+ Private m_bInitStatus As Boolean
+ Friend ReadOnly Property bInitStatus As Boolean
+ Get
+ Return m_bInitStatus
+ End Get
+ End Property
+
+ ' Titolo
+ Private m_Title As String
+ Public ReadOnly Property Title As String
+ Get
+ Return m_Title
+ End Get
+ End Property
+
+ ' proprietà che seleziona la giusta pagina del TabControl
+ Public Property nSelTabPage As Integer
+ Get
+ Return If(IsNothing(Map.refMainMenuVM.SelPage) OrElse Map.refMainMenuVM.SelPage = -1 OrElse Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING, 0, 1)
+ End Get
+ Set(value As Integer)
+ End Set
+ End Property
+
+ ' definizione comandi
+ Private m_cmdAboutBox As ICommand
+ Private m_cmdCloseApplication As ICommand
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
+ Map.BeginInit(Me)
+ ' Creo Model della MainWindow
+ m_MainWindowM = New MainWindowM
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Friend Sub SetTitle(sTitle As String)
+ m_Title = sTitle
+ NotifyPropertyChanged("Title")
+ End Sub
+
+ Friend Sub ContentRendered()
+ ' Verifico che l'inizializzazione di tutte le parti del programma sia andata a buon fine
+ If Map.EndInit() Then
+ m_bInitStatus = True
+ ' altrimenti chiudo il programma
+ Else
+ m_bInitStatus = False
+ End If
+ ' Aggiorno visualizzazione unità di misura
+ 'Map.refStatusBarVM.SetMeasureUnit(If(EgtUiUnitsAreMM(), MeasureUnitOpt.MM, MeasureUnitOpt.INCH))
+ ' Se istanza oltre la prima, chiedo cosa aprire
+ If Not m_MainWindowM.bFirstInstance Then
+ ' Map.refProjectManagerVM.Open()
+ ' ' altrimenti verifico se richiesto ultimo progetto
+ 'ElseIf GetMainPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0) = 1 Then
+ ' Dim sLastProjectPath As String = String.Empty
+ ' GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, String.Empty, sLastProjectPath)
+ ' If Not String.IsNullOrWhiteSpace(sLastProjectPath) AndAlso File.Exists(sLastProjectPath) Then
+ ' Map.refProjectManagerVM.OpenProject(sLastProjectPath)
+ ' Else
+ ' Map.refProjectManagerVM.NewCmd()
+ ' End If
+ ' ' altrimenti nuovo progetto
+ 'Else
+ ' Map.refProjectManagerVM.NewCmd()
+ End If
+ ' apro in modalita' VIEW
+ Map.refMainMenuVM.SelPage = Pages.VIEW
+
+ End Sub
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "AboutBoxCommand"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property AboutBoxCommand() As ICommand
+ Get
+ If m_cmdAboutBox Is Nothing Then
+ m_cmdAboutBox = New Command(AddressOf AboutBox)
+ End If
+ Return m_cmdAboutBox
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Sub AboutBox(ByVal param As Object)
+ 'Dim AboutBoxWindow As New AboutBoxV
+ 'AboutBoxWindow.Owner = Application.Current.MainWindow
+ 'AboutBoxWindow.ShowDialog()
+ End Sub
+
+#End Region ' AboutBoxCommand
+
+#Region "CloseApplicationCommand"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property CloseApplicationCommand() As ICommand
+ Get
+ If m_cmdCloseApplication Is Nothing Then
+ m_cmdCloseApplication = New Command(AddressOf CloseApplication)
+ End If
+ Return m_cmdCloseApplication
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Sub CloseApplication(ByVal param As Object)
+ 'If Map.refOptionPanelVM.SelItem = OptionPanelVM.Tabs.SIMUL Then
+ ' Map.refSimulTabVM.ResetSimulation()
+ 'End If
+ ' Imposto contesto principale
+ 'EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
+ ' Verifica modifica parametri Macchina e chiedo il salvataggio
+ Map.refConfigurationPageVM.VerifyConfigPageModification()
+ ' Gestisco eventuale file corrente modificato
+ Dim bAllowClose As Boolean = Map.refSceneHostVM.MainController.ManageModified()
+ ' Salvo impostazione macchina corrente
+ Map.refMachinePanelVM.SaveCurrentMachine()
+ ' Se non confermata chiusura, esco
+ If Not bAllowClose Then Return
+ ' Salvo nome ultimo file (per gestire bene multi istanza)
+ Dim sFilePath As String = String.Empty
+ If EgtGetCurrFilePath(sFilePath) Then WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFilePath)
+ ' Termino il Model
+ m_MainWindowM.Close()
+ ' Termino il programma
+ Application.Current.Shutdown()
+ End Sub
+
+#End Region ' CloseApplicationCommand
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/My Project/AssemblyInfo.vb b/EgtBEAMWALL.ViewerOptimizer/My Project/AssemblyInfo.vb
new file mode 100644
index 00000000..c2ff8ed9
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/My Project/AssemblyInfo.vb
@@ -0,0 +1,59 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+Imports System.Globalization
+Imports System.Resources
+Imports System.Windows
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+'In order to begin building localizable applications, set
+'CultureYouAreCodingWith in your .vbproj file
+'inside a . For example, if you are using US english
+'in your source files, set the to "en-US". Then uncomment the
+'NeutralResourceLanguage attribute below. Update the "en-US" in the line
+'below to match the UICulture setting in the project file.
+
+'
+
+
+'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
+'1st parameter: where theme specific resource dictionaries are located
+'(used if a resource is not found in the page,
+' or application resource dictionaries)
+
+'2nd parameter: where the generic resource dictionary is located
+'(used if a resource is not found in the page,
+'app, and any theme specific resource dictionaries)
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/My Project/MyExtensions/MyWpfExtension.vb b/EgtBEAMWALL.ViewerOptimizer/My Project/MyExtensions/MyWpfExtension.vb
new file mode 100644
index 00000000..22f84b7d
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/My Project/MyExtensions/MyWpfExtension.vb
@@ -0,0 +1,121 @@
+#If _MyType <> "Empty" Then
+
+Namespace My
+ '''
+ ''' Module used to define the properties that are available in the My Namespace for WPF
+ '''
+ '''
+ _
+ Module MyWpfExtension
+ Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer)
+ Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User)
+ Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows)
+ Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log)
+ '''
+ ''' Returns the application object for the running application
+ '''
+ _
+ Friend ReadOnly Property Application() As Application
+ Get
+ Return CType(Global.System.Windows.Application.Current, Application)
+ End Get
+ End Property
+ '''
+ ''' Returns information about the host computer.
+ '''
+ _
+ Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer
+ Get
+ Return s_Computer.GetInstance()
+ End Get
+ End Property
+ '''
+ ''' Returns information for the current user. If you wish to run the application with the current
+ ''' Windows user credentials, call My.User.InitializeWithWindowsUser().
+ '''
+ _
+ Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User
+ Get
+ Return s_User.GetInstance()
+ End Get
+ End Property
+ '''
+ ''' Returns the application log. The listeners can be configured by the application's configuration file.
+ '''
+ _
+ Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log
+ Get
+ Return s_Log.GetInstance()
+ End Get
+ End Property
+
+ '''
+ ''' Returns the collection of Windows defined in the project.
+ '''
+ _
+ Friend ReadOnly Property Windows() As MyWindows
+ _
+ Get
+ Return s_Windows.GetInstance()
+ End Get
+ End Property
+ _
+ _
+ Friend NotInheritable Class MyWindows
+ _
+ Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T
+ If Instance Is Nothing Then
+ If s_WindowBeingCreated IsNot Nothing Then
+ If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then
+ Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.")
+ End If
+ Else
+ s_WindowBeingCreated = New Global.System.Collections.Hashtable()
+ End If
+ s_WindowBeingCreated.Add(GetType(T), Nothing)
+ Return New T()
+ s_WindowBeingCreated.Remove(GetType(T))
+ Else
+ Return Instance
+ End If
+ End Function
+ _
+ _
+ Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T)
+ instance = Nothing
+ End Sub
+ _
+ _
+ Public Sub New()
+ MyBase.New()
+ End Sub
+ Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable
+ Public Overrides Function Equals(ByVal o As Object) As Boolean
+ Return MyBase.Equals(o)
+ End Function
+ Public Overrides Function GetHashCode() As Integer
+ Return MyBase.GetHashCode
+ End Function
+ _
+ _
+ Friend Overloads Function [GetType]() As Global.System.Type
+ Return GetType(MyWindows)
+ End Function
+ Public Overrides Function ToString() As String
+ Return MyBase.ToString
+ End Function
+ End Class
+ End Module
+End Namespace
+Partial Class Application
+ Inherits Global.System.Windows.Application
+ _
+ _
+ Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo
+ _
+ Get
+ Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly())
+ End Get
+ End Property
+End Class
+#End If
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/My Project/Resources.Designer.vb b/EgtBEAMWALL.ViewerOptimizer/My Project/Resources.Designer.vb
new file mode 100644
index 00000000..b22e10f7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/My Project/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:$clrversion$
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("$safeprojectname$.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/EgtBEAMWALL.ViewerOptimizer/My Project/Resources.resx b/EgtBEAMWALL.ViewerOptimizer/My Project/Resources.resx
new file mode 100644
index 00000000..af7dbebb
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/My Project/Settings.Designer.vb b/EgtBEAMWALL.ViewerOptimizer/My Project/Settings.Designer.vb
new file mode 100644
index 00000000..406fadbc
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.EgtBEAMWALL.ViewerOptimizer.My.MySettings
+ Get
+ Return Global.EgtBEAMWALL.ViewerOptimizer.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/EgtBEAMWALL.ViewerOptimizer/My Project/Settings.settings b/EgtBEAMWALL.ViewerOptimizer/My Project/Settings.settings
new file mode 100644
index 00000000..40ed9fdb
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml
new file mode 100644
index 00000000..2e433708
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml.vb
new file mode 100644
index 00000000..18f6be20
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml.vb
@@ -0,0 +1,71 @@
+Imports System.ComponentModel
+Imports System.IO
+Imports EgtUILib
+
+Public Class OpenProjectFileDialogV
+
+ Private WithEvents m_OpenProjFileDialogVM As OpenProjectFileDialogVM
+
+#Region "CONSTRUCTOR"
+
+ Sub New(Owner As Window, OpenProjFileDialogVM As OpenProjectFileDialogVM)
+ ' Funzione che interpreta l'xaml
+ InitializeComponent()
+ Me.Owner = Owner
+ Me.DataContext = OpenProjFileDialogVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_OpenProjFileDialogVM = OpenProjFileDialogVM
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Public Function EgtShowDialog(ProjectType As ProjectType) As Boolean?
+ m_OpenProjFileDialogVM.Init(ProjectType)
+ ' mostro la finestra di dialogo
+ Return Me.ShowDialog()
+ End Function
+ Public Function EgtShowDialog(ProjectType As ProjectType, ProjectList As List(Of ProjectFile)) As Boolean?
+ m_OpenProjFileDialogVM.Init(ProjectType, ProjectList)
+ ' mostro la finestra di dialogo
+ Return Me.ShowDialog()
+ End Function
+
+#End Region ' METHODS
+
+#Region "EVENTS"
+
+
+ 'Private Sub MainWindowV_ContentRendered(sender As Object, e As EventArgs) Handles Me.ContentRendered
+ ' m_MainWindowVM.ContentRendered()
+ 'End Sub
+
+#End Region ' EVENTS
+
+
+ 'Private Sub m_FileNameTxBl_MouseDown(sender As Object, e As Windows.Input.MouseButtonEventArgs) Handles FileNameList.MouseDoubleClick
+ ' Dim src As DependencyObject = VisualTreeHelper.GetParent(DirectCast(e.OriginalSource, DependencyObject))
+ ' ' verifico che venga clickato un item, non lo spazio vuoto o la scrollbar
+ ' If Not TypeOf src Is ListBoxItem Then
+ ' src = Utility.FindAncestor(Of ListBoxItem)(src)
+ ' End If
+ ' If IsNothing(src) OrElse src.[GetType]() <> GetType(ListBoxItem) Then
+ ' e.Handled = True
+ ' Else
+ ' If Not IsNothing(m_SelectedFile) Then
+ ' m_FileName = SelectedFile
+ ' DialogResult = True
+ ' End If
+ ' End If
+ 'End Sub
+
+ Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
+ DialogResult = m_OpenProjFileDialogVM.VerifySelected()
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_OpenProjFileDialogVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb
new file mode 100644
index 00000000..544ae066
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb
@@ -0,0 +1,189 @@
+Imports System.IO
+Imports EgtUILib
+
+Public Class OpenProjectFileDialogVM
+ Inherits VMBase
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ Private m_ProjectType As ProjectType
+
+ Private m_FileNameTxBl As TextBlock
+
+ Private m_sDirectory As String
+ Public Property Directory As String
+ Get
+ Return m_sDirectory
+ End Get
+ Set(value As String)
+ m_sDirectory = value
+ End Set
+ End Property
+
+ Private m_sFilter As String
+ Public Property Filter As String
+ Get
+ Return m_sFilter
+ End Get
+ Set(value As String)
+ m_sFilter = value
+ End Set
+ End Property
+
+ Private m_sFileNameFilter As Predicate(Of String)
+ Public Property FileNameFilter As Predicate(Of String)
+ Get
+ Return m_sFileNameFilter
+ End Get
+ Set(value As Predicate(Of String))
+ m_sFileNameFilter = value
+ End Set
+ End Property
+
+ Private m_sExtensions As New List(Of String)
+ Public ReadOnly Property Extensions As List(Of String)
+ Get
+ Return m_sExtensions
+ End Get
+ End Property
+
+ Private m_ProjectList As New List(Of ProjectFile)
+ Public ReadOnly Property ProjectList As List(Of ProjectFile)
+ Get
+ Return m_ProjectList
+ End Get
+ 'Set(value As List(Of ProjFile))
+ ' m_ProjList = value
+ ' NotifyPropertyChanged("ProjList")
+ 'End Set
+ End Property
+
+ Private m_SelProject As ProjectFile
+ Public Property SelProject As ProjectFile
+ Get
+ Return m_SelProject
+ End Get
+ Set(value As ProjectFile)
+ m_SelProject = value
+ End Set
+ End Property
+
+ Private m_FileName As String
+ Public Property FileName As String
+ Get
+ Return m_FileName
+ End Get
+ Set(value As String)
+ m_FileName = value
+ End Set
+ End Property
+
+#Region "Messages"
+
+ Public ReadOnly Property OpenMsg As String
+ Get
+ Return EgtMsg(MSG_EGTSAVEFILEDIALOG + 6)
+ End Get
+ End Property
+ Public ReadOnly Property CancelMsg As String
+ Get
+ Return EgtMsg(MSG_EGTSAVEFILEDIALOG + 2)
+ End Get
+ End Property
+
+#End Region
+
+ ' Definizione comandi
+ Private m_cmdProjectDoubleClick As ICommand
+
+ Public Function Init(ProjectType As ProjectType, Optional ProjectList As List(Of ProjectFile) = Nothing) As Boolean?
+ m_ProjectType = ProjectType
+ If IsNothing(ProjectList) OrElse ProjectList.Count = 0 Then
+ ' cartella da cui leggere i programmi
+ Dim sFolderPath As String
+ If m_ProjectType = ProjectType.PROJ Then
+ sFolderPath = Map.refMainWindowVM.MainWindowM.sProjsDir
+ Else
+ sFolderPath = Map.refMainWindowVM.MainWindowM.sProdsDir
+ End If
+ ' leggo i file che contiene
+ Dim AllDirsInDir As IEnumerable(Of String) = IO.Directory.EnumerateDirectories(sFolderPath)
+ For Each CurrDirectory In AllDirsInDir
+ VerifyFiles(CurrDirectory)
+ Next
+ Else
+ m_ProjectList = ProjectList
+ End If
+ End Function
+
+ Private Sub VerifyFiles(CurrDirectory As String)
+ Dim AllFilesInDir As IEnumerable(Of String) = IO.Directory.EnumerateFiles(CurrDirectory)
+ For Each File In AllFilesInDir
+ If Path.GetExtension(File).ToLower() = ".nge" Then
+ Dim nProjId As Integer = 0
+ Dim nProdId As Integer = 0
+ Dim sBTLFileName As String = ""
+ If ProjectFile.VerifyProjectFile(m_ProjectType, Path.GetFileNameWithoutExtension(File), nProjId, nProdId, sBTLFileName) Then
+ m_ProjectList.Add(New ProjectFile(m_ProjectType, nProjId, nProdId, sBTLFileName))
+ End If
+ End If
+ Next
+ End Sub
+
+ Friend Function VerifySelected() As Boolean
+ Return Not IsNothing(SelProject)
+ End Function
+
+ 'Private Sub m_FileNameTxBl_MouseDown(sender As Object, e As Windows.Input.MouseButtonEventArgs) Handles FileNameList.MouseDoubleClick
+ ' Dim src As DependencyObject = VisualTreeHelper.GetParent(DirectCast(e.OriginalSource, DependencyObject))
+ ' ' verifico che venga clickato un item, non lo spazio vuoto o la scrollbar
+ ' If Not TypeOf src Is ListBoxItem Then
+ ' src = Utility.FindAncestor(Of ListBoxItem)(src)
+ ' End If
+ ' If IsNothing(src) OrElse src.[GetType]() <> GetType(ListBoxItem) Then
+ ' e.Handled = True
+ ' Else
+ ' If Not IsNothing(m_SelectedFile) Then
+ ' m_FileName = SelectedFile
+ ' DialogResult = True
+ ' End If
+ ' End If
+ 'End Sub
+
+ 'Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
+ ' If Not IsNothing(m_SelectedFile) Then
+ ' m_FileName = SelectedFile
+ ' DialogResult = True
+ ' End If
+ 'End Sub
+
+#Region "COMMANDS"
+
+#Region "ProjectDoubleClick"
+
+ '''
+ ''' Returns a command that do New.
+ '''
+ Public ReadOnly Property ProjectDoubleClick_Command As ICommand
+ Get
+ If m_cmdProjectDoubleClick Is Nothing Then
+ m_cmdProjectDoubleClick = New Command(AddressOf ProjDoubleClick)
+ End If
+ Return m_cmdProjectDoubleClick
+ End Get
+ End Property
+
+ '''
+ ''' Execute the New. This method is invoked by the NewCommand.
+ '''
+ Friend Sub ProjDoubleClick(ByVal param As Object)
+ If VerifySelected() Then
+ RaiseEvent m_CloseWindow(True)
+ End If
+ End Sub
+
+#End Region ' ProjectDoubleClick
+
+#End Region ' Commands
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelV.xaml
new file mode 100644
index 00000000..fcc03e1f
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelV.xaml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelV.xaml.vb
new file mode 100644
index 00000000..b073a2a4
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelV.xaml.vb
@@ -0,0 +1,11 @@
+Public Class OptimizePanelV
+
+ Private Sub OptimizeBtn_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
+ Dim OptimizeBtn = TryCast(sender, FrameworkElement)
+
+ If OptimizeBtn IsNot Nothing Then
+ OptimizeBtn.ContextMenu.IsOpen = True
+ End If
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb
new file mode 100644
index 00000000..cf59f380
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb
@@ -0,0 +1,204 @@
+Imports System.Collections.ObjectModel
+Imports EgtWPFLib5
+
+Public Class OptimizePanelVM
+
+ Friend Enum PartType As Integer
+ MATERIAL = 0
+ ALL = 1
+ End Enum
+
+ Friend Enum OriginType As Integer
+ STANDARD = 0
+ FROM_BTL = 1
+ End Enum
+
+ Private m_PartTypeList As New List(Of IdNameStruct)({New IdNameStruct(PartType.MATERIAL, "Materiale"),
+ New IdNameStruct(PartType.ALL, "Tutti")})
+ Public ReadOnly Property PartTypeList As List(Of IdNameStruct)
+ Get
+ Return m_PartTypeList
+ End Get
+ End Property
+
+ Private m_SelPartType As IdNameStruct
+ Public Property SelPartType As IdNameStruct
+ Get
+ Return m_SelPartType
+ End Get
+ Set(value As IdNameStruct)
+ m_SelPartType = value
+ End Set
+ End Property
+
+ Private m_OriginTypeList As New List(Of IdNameStruct)({New IdNameStruct(OriginType.STANDARD, "Standard"),
+ New IdNameStruct(OriginType.FROM_BTL, "Da BTL")})
+ Public ReadOnly Property OriginTypeList As List(Of IdNameStruct)
+ Get
+ Return m_OriginTypeList
+ End Get
+ End Property
+
+ Private m_SelOriginType As IdNameStruct
+ Public Property SelOriginType As IdNameStruct
+ Get
+ Return m_SelOriginType
+ End Get
+ Set(value As IdNameStruct)
+ m_SelOriginType = value
+ End Set
+ End Property
+
+
+ ' Definizione comandi
+ Private m_cmdOptimize As ICommand
+ Private m_cmdWarehouse As ICommand
+
+ Sub New()
+ m_SelPartType = PartTypeList(0)
+ m_SelOriginType = OriginTypeList(0)
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "Optimize"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property Optimize_Command As ICommand
+ Get
+ If m_cmdOptimize Is Nothing Then
+ m_cmdOptimize = New Command(AddressOf Optimize)
+ End If
+ Return m_cmdOptimize
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub Optimize()
+ If IsNothing(m_SelPartType) OrElse IsNothing(m_SelOriginType) Then Return
+ If IsNothing(Map.refProjectVM.BTLStructure.PartList) OrElse Map.refProjectVM.BTLStructure.PartList.Count = 0 Then Return
+ Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
+ Dim SectionList As New List(Of SParam)
+ ' se ho selezionato nest per materiale e c'è una sezione selezionata diversa da sezione nulla
+ If m_SelPartType.Id = PartType.MATERIAL AndAlso Not IsNothing(Map.refProjectVM.BTLStructure.SelSection) AndAlso Map.refProjectVM.BTLStructure.SelSection.dH <> -1 Then
+ SectionList.Add(New SParam(Map.refProjectVM.BTLStructure.SelSection, 0, 0))
+ Else
+ For Each Section In Map.refProjectVM.BTLStructure.SectionList
+ If Section.dH = -1 Then Continue For
+ SectionList.Add(New SParam(Section, 0, 0))
+ Next
+ End If
+ Dim dRawL As Double = 0
+ Dim dRawW As Double = 0
+ Dim WhType = GetMainPrivateProfileInt(S_GENERAL, K_WAREHOUSE, 1)
+ Dim sWarehouseIniPath As String = ""
+ Dim dOffset As Double = 0
+ Dim dStartOffset As Double = 0
+ Dim dKerf As Double = 0
+ Select Case WhType
+ Case WarehouseType.BASIC
+ sWarehouseIniPath = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ ' leggo lunghezza barra
+ Dim nCurrentL As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_CURRENT & WRH_S, 1, sWarehouseIniPath)
+ dRawL = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_L & nCurrentL, 0, sWarehouseIniPath)
+ ' leggo start offset ed offset
+ dStartOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_STARTOFFSET, 0, sWarehouseIniPath)
+ dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_OFFSET, 0, sWarehouseIniPath)
+ ' riporto la stessa lunghezza in tutte le sezioni
+ For Each Section In SectionList
+ Section.dL = dRawL
+ Next
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ Dim nCurrentS As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_WALL, WRH_CURRENT & WRH_S, nCurrentS, sWarehouseIniPath)
+ Dim sPanelDim As String = ""
+ Dim sPanelDims() As String
+ EgtUILib.GenInterface.GetPrivateProfileString(WRH_WALL, WRH_S & nCurrentS, "", sPanelDim, sWarehouseIniPath)
+ If Not String.IsNullOrWhiteSpace(sPanelDim) Then sPanelDims = sPanelDim.Split(","c)
+ If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then Return
+ dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, sWarehouseIniPath)
+ dKerf = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, sWarehouseIniPath)
+ ' riporto le stesse dimensioni in tutte le sezioni
+ For Each Section In SectionList
+ Section.dL = dRawL
+ Section.dW = dRawW
+ Next
+ End If
+ Case WarehouseType.MEDIUM
+ sWarehouseIniPath = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
+ ' aggiungo le sezioni con diverse lunghezze in base al warehouse
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ ' leggo lunghezza barra
+ Dim nCurrentL As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_CURRENT & WRH_S, 1, sWarehouseIniPath)
+ dRawL = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_L & nCurrentL, 0, sWarehouseIniPath)
+ ' leggo start offset ed offset
+ dStartOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_STARTOFFSET, 0, sWarehouseIniPath)
+ dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_OFFSET, 0, sWarehouseIniPath)
+ ' riporto la stessa lunghezza in tutte le sezioni
+ For Each Section In SectionList
+ Section.dL = dRawL
+ Next
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ Dim nCurrentS As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_WALL, WRH_CURRENT & WRH_S, nCurrentS, sWarehouseIniPath)
+ Dim sPanelDim As String = ""
+ Dim sPanelDims() As String
+ EgtUILib.GenInterface.GetPrivateProfileString(WRH_WALL, WRH_S & nCurrentS, "", sPanelDim, sWarehouseIniPath)
+ If Not String.IsNullOrWhiteSpace(sPanelDim) Then sPanelDims = sPanelDim.Split(","c)
+ If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then Return
+ dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, sWarehouseIniPath)
+ dKerf = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, sWarehouseIniPath)
+ ' riporto le stesse dimensioni in tutte le sezioni
+ For Each Section In SectionList
+ Section.dL = dRawL
+ Section.dW = dRawW
+ Next
+ End If
+ End Select
+ ' attivo loading progress
+ Map.refMyStatusBarVM.StartLoading("Nesting started", True)
+ For Each Section In SectionList
+ Dim SectionPartList As New List(Of BTLPart)(Map.refProjectVM.BTLStructure.PartList.Where(Function(x) x.Section = Section.SectXMat).ToList)
+ ' passo a lua lista id pezzi da nestare
+ ExecNesting(sLogPath, CurrentMachine.sMachineName, SectionPartList, Section.dL, Section.dW, dStartOffset, dOffset, dKerf)
+ Next
+ ' update liste grezzi e pezzi della grafica
+ Map.refProjectVM.MachGroupPanelVM.InitMachGroupList()
+ ' disattivo loading progress
+ Map.refMyStatusBarVM.EndLoading("Nesting completed")
+ ' seleziono ultimo gruppo
+ Map.refProjectVM.MachGroupPanelVM.SelLastMachGroup()
+ End Sub
+
+#End Region ' Optimize
+
+#Region "Warehouse"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property Warehouse_Command As ICommand
+ Get
+ If m_cmdWarehouse Is Nothing Then
+ m_cmdWarehouse = New Command(AddressOf Warehouse)
+ End If
+ Return m_cmdWarehouse
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub Warehouse()
+ Dim WarehouseWnd As New WarehouseWndV(Application.Current.MainWindow, New WarehouseWndVM())
+ WarehouseWnd.ShowDialog()
+ End Sub
+
+#End Region ' Warehouse
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml b/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml
new file mode 100644
index 00000000..5684568b
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml.vb
new file mode 100644
index 00000000..430cfd1c
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class PartManagerV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerVM.vb
new file mode 100644
index 00000000..8081bddb
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/PartManager/PartManagerVM.vb
@@ -0,0 +1,3 @@
+Public Class PartManagerVM
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerV.xaml b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerV.xaml
new file mode 100644
index 00000000..31c3dc61
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerV.xaml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerV.xaml.vb
new file mode 100644
index 00000000..d9d92d39
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class ProdManagerV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb
new file mode 100644
index 00000000..07a7492f
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb
@@ -0,0 +1,231 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class ProdManagerVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Private m_CurrProd As ProjectFile
+ Friend Property CurrProd As ProjectFile
+ Get
+ Return m_CurrProd
+ End Get
+ Set(value As ProjectFile)
+ m_CurrProd = value
+ End Set
+ End Property
+
+ ' indice ultimo progetto
+ Private m_nLastProdId As Integer
+ Friend ReadOnly Property nLastProdId As Integer
+ Get
+ Return m_nLastProdId
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdOpen As ICommand
+ Private m_cmdSave As ICommand
+ Private m_cmdGoToProj As ICommand
+
+#Region "ToolTip"
+
+ 'Proprietà ToolTip
+ Public ReadOnly Property OpenToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
+ End Get
+ End Property
+ Public ReadOnly Property SaveToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 3)
+ End Get
+ End Property
+
+#End Region ' ToolTip
+
+#End Region ' Fields & Properties
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefProdManagerVM(Me)
+ ' Leggo ultimo indice di progetto
+ m_nLastProdId = GetMainPrivateProfileInt(S_GENERAL, K_PRODSINDEX, 1)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "OpenCommand"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property OpenCommand As ICommand
+ Get
+ If m_cmdOpen Is Nothing Then
+ m_cmdOpen = New Command(AddressOf Open)
+ End If
+ Return m_cmdOpen
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub Open()
+ OpenProject(String.Empty)
+ End Sub
+
+ Friend Sub OpenProject(sFilePath As String)
+ ' verifico se progetto modificato, e chiedo se salvare
+ ProjectFile.VerifyProjectModification(CurrProd, ProjectType.PROD)
+ ' se la string è vuota
+ Dim TempCurrProd As ProjectFile
+ Dim OpenProjectFileDialogVM As OpenProjectFileDialogVM = Nothing
+ If String.IsNullOrEmpty(sFilePath) Then
+ ' apro dialogo di scelta file
+ OpenProjectFileDialogVM = New OpenProjectFileDialogVM
+ Dim OpenFile As New OpenProjectFileDialogV(Application.Current.MainWindow, OpenProjectFileDialogVM)
+ Dim DialogResult As Boolean? = OpenFile.EgtShowDialog(ProjectType.PROD)
+ If IsNothing(DialogResult) OrElse Not DialogResult Then Return
+ sFilePath = OpenProjectFileDialogVM.SelProject.sProdPath
+ TempCurrProd = OpenProjectFileDialogVM.SelProject
+ Else
+ Dim nProjId As Integer = 0
+ Dim nProdId As Integer = 0
+ Dim sBTLFileName As String = ""
+ If ProjectFile.VerifyProjectFile(ProjectType.PROD, Path.GetFileNameWithoutExtension(sFilePath), nProjId, nProdId, sBTLFileName) Then
+ TempCurrProd = New ProjectFile(ProjectType.PROD, nProjId, nProdId, sBTLFileName)
+ Else
+ MessageBox.Show("Error in file name!!")
+ Return
+ End If
+ End If
+ If File.Exists(sFilePath) Then
+ If Map.refSceneHostVM.MainController.OpenProject(sFilePath, False) Then
+ If Map.refMachGroupPanelVM.InitMachGroupList() Then
+ m_CurrProd = TempCurrProd
+ Map.refMainWindowVM.SetTitle(CurrProd.nProdId.ToString("0000") & " - EgtBEAMWALL")
+ Else
+ MessageBox.Show("Impossibile aprire gruppi di lavorazione del file!!")
+ Map.refSceneHostVM.MainController.NewProject()
+ Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
+ End If
+ Else
+ MessageBox.Show("Impossibile aprire il file!!")
+ Map.refSceneHostVM.MainController.NewProject()
+ Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
+ End If
+ Else
+ MessageBox.Show("File non trovato!!")
+ Map.refSceneHostVM.MainController.NewProject()
+ Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
+ End If
+
+ End Sub
+
+#End Region ' OpenCommand
+
+#Region "SaveCommand"
+
+ '''
+ ''' Returns a command that do Save.
+ '''
+ Public ReadOnly Property SaveCommand As ICommand
+ Get
+ If m_cmdSave Is Nothing Then
+ m_cmdSave = New Command(AddressOf Save)
+ End If
+ Return m_cmdSave
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Save. This method is invoked by the SaveCommand.
+ '''
+ Public Sub Save()
+ Map.refSceneHostVM.SaveProject()
+ Map.refMainWindowVM.SetTitle(CurrProd.nProdId.ToString("0000") & " - EgtBEAMWALL")
+ ' se nuovo progetto, incremento l'indice di progetto
+ If m_CurrProd.NewProd Then
+ m_nLastProdId = m_nLastProdId + 1
+ WriteMainPrivateProfileString(S_GENERAL, K_PRODSINDEX, (m_nLastProdId).ToString())
+ m_CurrProd.NewProd = False
+ End If
+ End Sub
+
+#End Region ' SaveCommand
+
+#Region "GoToProj"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property GoToProj_Command As ICommand
+ Get
+ If m_cmdGoToProj Is Nothing Then
+ m_cmdGoToProj = New Command(AddressOf GoToProj)
+ End If
+ Return m_cmdGoToProj
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub GoToProj()
+ ' verifico se salvare progetto corrente
+ ProjectFile.VerifyProjectModification(Map.refProdManagerVM.CurrProd, ProjectType.PROD)
+ ' cerco proj associato
+ Dim ProjList As New List(Of ProjectFile)
+ Dim AllDirsInDir As IEnumerable(Of String) = IO.Directory.EnumerateDirectories(Map.refMainWindowVM.MainWindowM.sProjsDir)
+ For Each Directory In AllDirsInDir
+ Dim AllFilesInDir As IEnumerable(Of String) = IO.Directory.EnumerateFiles(Directory)
+ For Each File In AllFilesInDir
+ If Path.GetExtension(File).ToLower() = ".nge" Then
+ If File.Contains(FILENAMESEPARATOR) Then
+ Dim DataFromFileName As String() = File.Split(FILENAMESEPARATOR)
+ If DataFromFileName.Count = 3 Then
+ If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
+ Dim nTempProdId As Integer = 0
+ Integer.TryParse(DataFromFileName(1), nTempProdId)
+ If nTempProdId = CurrProd.nProdId Then
+ ProjList.Add(New ProjectFile(ProjectType.PROJ, Path.GetFileNameWithoutExtension(File)))
+ End If
+ End If
+ End If
+ End If
+ End If
+ Next
+ Next
+ If ProjList.Count = 0 Then Return
+ ' se c'è più di un proj
+ Dim Proj As ProjectFile
+ If ProjList.Count > 1 Then
+ ' apro dialogo di scelta file
+ Dim OpenProjectFileDialogVM As New OpenProjectFileDialogVM
+ Dim OpenFile As New OpenProjectFileDialogV(Application.Current.MainWindow, OpenProjectFileDialogVM)
+ Dim DialogResult As Boolean? = OpenFile.EgtShowDialog(ProjectType.PROJ, ProjList)
+ If IsNothing(DialogResult) OrElse Not DialogResult Then Return
+ Proj = OpenProjectFileDialogVM.SelProject
+ Else
+ Proj = ProjList(0)
+ End If
+ ' apro progetto proj
+ Map.refProjManagerVM.CurrProj = Proj
+ ' vado in pagina prod
+ Map.refMainMenuVM.SetSelPage(Pages.VIEW, False)
+ End Sub
+
+#End Region ' GoToProj
+
+#End Region ' Commands
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerV.xaml b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerV.xaml
new file mode 100644
index 00000000..4929b0e6
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerV.xaml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerV.xaml.vb
new file mode 100644
index 00000000..74e0c1c0
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class ProjManagerV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb
new file mode 100644
index 00000000..3da25e76
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb
@@ -0,0 +1,427 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class ProjManagerVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Private m_CurrProj As ProjectFile
+ Friend Property CurrProj As ProjectFile
+ Get
+ Return m_CurrProj
+ End Get
+ Set(value As ProjectFile)
+ m_CurrProj = value
+ End Set
+ End Property
+
+ Private m_IsEnabled As Boolean
+ Public Property IsEnabled As Boolean
+ Get
+ Return m_IsEnabled
+ End Get
+ Set(value As Boolean)
+ If value <> m_IsEnabled Then
+ m_IsEnabled = value
+ NotifyPropertyChanged("IsEnabled")
+ End If
+ End Set
+ End Property
+
+ ' indice ultimo progetto
+ Private m_nLastProjId As Integer
+ Friend ReadOnly Property nLastProjId As Integer
+ Get
+ Return m_nLastProjId
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdNew As ICommand
+ Private m_cmdOpen As ICommand
+ Private m_cmdOpenMruFile As ICommand
+ Private m_cmdSave As ICommand
+ Private m_cmdSaveAs As ICommand
+ Private m_cmdExport As ICommand
+ Private m_cmdDxfOut As ICommand
+ Private m_cmdImport As ICommand
+ Private m_cmdGoToProd As ICommand
+ Private m_cmdSendFeedback As ICommand
+
+#Region "ToolTip"
+
+ 'Proprietà ToolTip
+ Public ReadOnly Property NewToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 1)
+ End Get
+ End Property
+ Public ReadOnly Property OpenToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
+ End Get
+ End Property
+ Public ReadOnly Property SaveToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 3)
+ End Get
+ End Property
+ Public ReadOnly Property SaveAsToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 4)
+ End Get
+ End Property
+ Public ReadOnly Property InsertToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 5)
+ End Get
+ End Property
+ Public ReadOnly Property ImportToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 6)
+ End Get
+ End Property
+ Public ReadOnly Property ExportToolTip As String
+ Get
+ Return EgtMsg(91505) 'Esporta in macchina
+ End Get
+ End Property
+ Public ReadOnly Property DxfOutToolTip As String
+ Get
+ Return EgtMsg(91506) 'Esporta DXF
+ End Get
+ End Property
+ Public ReadOnly Property OptionsToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 9)
+ End Get
+ End Property
+ Public ReadOnly Property SendFeedbackToolTip As String
+ Get
+ Return EgtMsg(MSG_TOPCOMMANDBAR + 13)
+ End Get
+ End Property
+
+#End Region ' ToolTip
+
+#End Region ' Fields & Properties
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefProjManagerVM(Me)
+ ' Leggo ultimo indice di progetto
+ m_nLastProjId = GetMainPrivateProfileInt(S_GENERAL, K_PROJSINDEX, 1)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Private Sub NewProdFromProj()
+ ' verifico se progetto modificato, e chiedo se salvare
+ ProjectFile.VerifyProjectModification(CurrProj, ProjectType.PROJ)
+ ' creo nuova ottimizzazione
+ ' leggo indice di ottimizzazione
+ Dim nProdsIndex As Integer = GetMainPrivateProfileInt(S_GENERAL, K_PRODSINDEX, 1)
+ Dim sProdsDir As String = refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdsIndex.ToString("0000")
+ ' creo cartella nuova ottimizzazione
+ If Not Directory.Exists(sProdsDir) Then
+ Directory.CreateDirectory(sProdsDir)
+ Else
+ Dim di As System.IO.DirectoryInfo = New DirectoryInfo(sProdsDir)
+ For Each file As FileInfo In di.EnumerateFiles()
+ file.Delete()
+ Next
+ For Each dir As DirectoryInfo In di.EnumerateDirectories()
+ dir.Delete(True)
+ Next
+ End If
+
+ ' copio file progetto
+ Dim sProjPath As String = String.Empty
+ Dim bOk = False
+ Dim sProdPath As String = sProdsDir & "\" & nProdsIndex.ToString("0000") & ".nge"
+ If EgtGetCurrFilePath(sProjPath) AndAlso Not String.IsNullOrEmpty(sProjPath) Then
+ Try
+ File.Copy(sProjPath, sProdPath)
+ 'Map.refSceneHostVM.MainController.OpenProject(sProdPath)
+ bOk = True
+ Catch ex As Exception
+ EgtOutLog("Impossibile copiare il file")
+ bOk = False
+ End Try
+ End If
+ If bOk Then
+ ' aggiorno path proj
+ Map.refProjManagerVM.CurrProj.SetProdId(nProdsIndex)
+ ' imposto currprod
+ Map.refProdManagerVM.CurrProd = New ProjectFile(ProjectType.PROD, Path.GetFileNameWithoutExtension(sProdPath))
+ ' setto flag nuovo progetto in prod
+ Map.refProdManagerVM.CurrProd.NewProd = True
+ End If
+ End Sub
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "OpenCommand"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property OpenCommand As ICommand
+ Get
+ If m_cmdOpen Is Nothing Then
+ m_cmdOpen = New Command(AddressOf Open)
+ End If
+ Return m_cmdOpen
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub Open()
+ ' verifico se progetto modificato, e chiedo se salvare
+ ProjectFile.VerifyProjectModification(CurrProj, ProjectType.PROJ)
+ OpenProject(Nothing)
+ End Sub
+
+ Friend Sub OpenProject(TempCurrProj As ProjectFile)
+ ' se la string è vuota
+ Dim OpenProjectFileDialogVM As OpenProjectFileDialogVM = Nothing
+ If IsNothing(TempCurrProj) Then
+ ' apro dialogo di scelta file
+ OpenProjectFileDialogVM = New OpenProjectFileDialogVM
+ Dim OpenFile As New OpenProjectFileDialogV(Application.Current.MainWindow, OpenProjectFileDialogVM)
+ Dim DialogResult As Boolean? = OpenFile.EgtShowDialog(ProjectType.PROJ)
+ If IsNothing(DialogResult) OrElse Not DialogResult Then Return
+ TempCurrProj = OpenProjectFileDialogVM.SelProject
+ End If
+ ' se esiste prod prendo quello, altrimenti proj
+ Dim sFilePath As String = ""
+ If Not IsNothing(TempCurrProj.nProdId) AndAlso TempCurrProj.nProdId > 0 Then
+ sFilePath = TempCurrProj.sProdPath
+ Else
+ sFilePath = TempCurrProj.sProjPath
+ End If
+ If Map.refSceneHostVM.MainController.OpenProject(sFilePath, False) Then
+ m_CurrProj = TempCurrProj
+ Map.refMainWindowVM.SetTitle(CurrProj.nProjId.ToString("0000") & " - " & CurrProj.BTLFileName & " - EgtBEAMWALL")
+ Else
+ MessageBox.Show("Impossibile aprire il file!!")
+ Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
+ Map.refSceneHostVM.MainController.NewProject()
+ End If
+ End Sub
+
+#End Region ' OpenCommand
+
+#Region "SaveCommand"
+
+ '''
+ ''' Returns a command that do Save.
+ '''
+ Public ReadOnly Property SaveCommand As ICommand
+ Get
+ If m_cmdSave Is Nothing Then
+ m_cmdSave = New Command(AddressOf Save)
+ End If
+ Return m_cmdSave
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Save. This method is invoked by the SaveCommand.
+ '''
+ Public Sub Save()
+ Map.refSceneHostVM.SaveProject()
+ Map.refMainWindowVM.SetTitle(CurrProj.nProjId.ToString("0000") & " - " & CurrProj.BTLFileName & " - EgtBEAMWALL")
+ ' se nuovo progetto, incremento l'indice di progetto
+ If m_CurrProj.NewProj Then
+ m_nLastProjId = m_nLastProjId + 1
+ WriteMainPrivateProfileString(S_GENERAL, K_PROJSINDEX, (m_nLastProjId).ToString())
+ m_CurrProj.NewProj = False
+
+ ' bozza salvataggio su DB
+ Dim DbMan As New DataLayer.DbManager
+ Dim newDbProj As DataLayer.DatabaseModels.ProjModel
+ newDbProj = DbMan.ProjCtr.Create(m_CurrProj.nProjId, m_CurrProj.BTLFileName)
+
+ If (False) Then
+
+ ' caso FALSE ADV
+ DataLayer.DbManager.AdvDataModel = False
+
+ ' creo le parts
+ Dim BTLPartList As New List(Of DataLayer.DatabaseModels.BTLPartModel)
+
+ For Each part As BTLPart In Map.refProjectVM.BTLStructure.PartList
+ BTLPartList.Add(New DataLayer.DatabaseModels.BTLPartModel() With {.PartId = part.nPartId})
+ Next
+
+ DbMan.BtlPartCtr.Create(newDbProj.ProjDbId, BTLPartList)
+ Else
+ DataLayer.DbManager.AdvDataModel = True
+
+ ' creo le parts
+ Dim BTLPartList As New List(Of DataLayer.DatabaseModels.BTLPartModel)
+
+ For Each part As Core.BTLPart In Map.refProjectVM.BTLStructure.PartList
+ BTLPartList.Add(DbMan.BtlPartCtr.Convert(part))
+ Next
+
+ DbMan.BtlPartCtr.Create(newDbProj.ProjDbId, BTLPartList)
+ End If
+
+ End If
+
+
+
+
+ End Sub
+
+#End Region ' SaveCommand
+
+#Region "Import"
+
+ '''
+ ''' Returns a command that do Export.
+ '''
+ Public ReadOnly Property Import_Command As ICommand
+ Get
+ If m_cmdImport Is Nothing Then
+ m_cmdImport = New Command(AddressOf Import)
+ End If
+ Return m_cmdImport
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Export. This method is invoked by the ExportCommand.
+ '''
+ Public Sub Import()
+ ProjectFile.VerifyProjectModification(CurrProj, ProjectType.PROJ)
+ Dim sDir As String = String.Empty
+ GetMainPrivateProfileString(S_GENERAL, K_LASTIMPDIR, "", sDir)
+ ' apro finestra scelta file
+ Dim BTLDlg As New Microsoft.Win32.OpenFileDialog() With {
+ .DefaultExt = ".btl",
+ .Filter = "BTL (*.btl)|*.btl" &
+ "|BTLX (*.btlx)|*.btlx",
+ .CheckFileExists = True,
+ .ValidateNames = True}
+ If BTLDlg.ShowDialog() <> True Then Return
+ ' leggo indice di progetto
+ Dim nProjId As Integer = GetMainPrivateProfileInt(S_GENERAL, K_PROJSINDEX, 1)
+ Dim sProjsDir As String = refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000")
+ ' creo cartella nuovo progetto
+ If Not Directory.Exists(sProjsDir) Then
+ Directory.CreateDirectory(sProjsDir)
+ Else
+ Dim di As System.IO.DirectoryInfo = New DirectoryInfo(sProjsDir)
+ For Each file As FileInfo In di.EnumerateFiles()
+ file.Delete()
+ Next
+ For Each dir As DirectoryInfo In di.EnumerateDirectories()
+ dir.Delete(True)
+ Next
+ End If
+
+ ' copio file BTL
+ Dim sBtlCopyPath As String = sProjsDir & "\" & Path.GetFileName(BTLDlg.FileName)
+ Dim bOk = False
+ Try
+ File.Copy(BTLDlg.FileName, sBtlCopyPath)
+ bOk = True
+ Catch ex As Exception
+ EgtOutLog("Impossibile copiare il file")
+ bOk = False
+ End Try
+ ' importo file
+ If bOk Then
+ bOk = Map.refSceneHostVM.MainController.ImportProject(sBtlCopyPath, False)
+ End If
+ Dim sProjFileName As String = sProjsDir & "\" & nProjId.ToString("0000") & FILENAMESEPARATOR & FILENAMESEPARATOR & Path.GetFileNameWithoutExtension(sBtlCopyPath) & ".nge"
+ If bOk Then
+ ' salvo il progetto
+ bOk = EgtSaveFile(sProjFileName, NGE.BIN)
+ Else
+ EgtOutLog("Errore nell'importazione BTL")
+ End If
+ If bOk Then
+ m_CurrProj = New ProjectFile(ProjectType.PROJ, Path.GetFileNameWithoutExtension(sProjFileName))
+ m_CurrProj.NewProj = True
+ Map.refMainWindowVM.SetTitle(CurrProj.nProjId.ToString("0000") & " - " & CurrProj.BTLFileName & " - EgtBEAMWALL")
+ End If
+ End Sub
+
+#End Region ' Import
+
+#Region "GoToProd"
+
+ '''
+ ''' Returns a command that do GoToProd.
+ '''
+ Public ReadOnly Property GoToProd_Command As ICommand
+ Get
+ If m_cmdGoToProd Is Nothing Then
+ m_cmdGoToProd = New Command(AddressOf GoToProd)
+ End If
+ Return m_cmdGoToProd
+ End Get
+ End Property
+
+ '''
+ ''' Execute the GoToProd. This method is invoked by the GoToProd_Command.
+ '''
+ Public Sub GoToProd(ByVal param As Object)
+ ' verifico se progetto modificato, e chiedo se salvare
+ If EgtGetModified() Then
+ If MessageBox.Show("Salvare progetto modificato prima di continuare?", "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
+ Map.refSceneHostVM.SaveProject()
+ Else
+ ' resetto stato modificato
+ Map.refSceneHostVM.MainController.ResetModified()
+ End If
+ End If
+ If m_CurrProj.nProdId > 0 Then
+ 'Map.refSceneHostVM.MainController.OpenProject(m_CurrProj.sProdPath, False)
+ Map.refProdManagerVM.CurrProd = New ProjectFile(ProjectType.PROD, Path.GetFileNameWithoutExtension(m_CurrProj.sProdPath))
+ Else
+ ' chiedo se aggiungere ad ottimizzazione già presente o creare nuova
+ Select Case MessageBox.Show("Si: crea nuova ottimizzazione; No: aggiungi ad ottimizzazione già presente", "", MessageBoxButton.YesNoCancel, MessageBoxImage.Information)
+ Case MessageBoxResult.Yes
+ ' creo nuova ottimizzazione da progetto corrente
+ NewProdFromProj()
+ Case MessageBoxResult.No
+ ' chiedo in quale ottimizzazione aggiungere il progetto corrente
+ Dim OpenProjectFileDialogVM As New OpenProjectFileDialogVM
+ Dim ChooseProdFileDialog As New OpenProjectFileDialogV(Application.Current.MainWindow, OpenProjectFileDialogVM)
+ Dim DialogResult As Boolean? = ChooseProdFileDialog.EgtShowDialog(ProjectType.PROD)
+ If IsNothing(DialogResult) OrElse Not DialogResult Then Return
+ ' se prod selezionato
+ If Not IsNothing(OpenProjectFileDialogVM.SelProject.nProdId) AndAlso OpenProjectFileDialogVM.SelProject.nProdId > 0 Then
+ ' aggiungo proj al prod selezionato
+ '' DA FARE!!!!!!
+ End If
+
+ Case MessageBoxResult.Cancel
+ Return
+ End Select
+ End If
+ ' vado in pagina prod
+ Map.refMainMenuVM.SetSelPage(Pages.MACHINING, False)
+ End Sub
+
+#End Region ' GoToProd
+
+#End Region ' Commands
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/Project/ProjectV.xaml b/EgtBEAMWALL.ViewerOptimizer/Project/ProjectV.xaml
new file mode 100644
index 00000000..670c760d
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Project/ProjectV.xaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/Project/ProjectV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/Project/ProjectV.xaml.vb
new file mode 100644
index 00000000..32a2c3bb
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Project/ProjectV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class ProjectV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/Project/ProjectVM.vb b/EgtBEAMWALL.ViewerOptimizer/Project/ProjectVM.vb
new file mode 100644
index 00000000..4f3715fb
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Project/ProjectVM.vb
@@ -0,0 +1,155 @@
+Public Class ProjectVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Private m_BTLStructure As BTLStructure
+ Public Property BTLStructure As BTLStructure
+ Get
+ Return m_BTLStructure
+ End Get
+ Set(value As BTLStructure)
+ m_BTLStructure = value
+ NotifyPropertyChanged("BTLStructure")
+ End Set
+ End Property
+
+ Private m_MachGroupPanelVM As New MyMachGroupPanelVM
+ Public Property MachGroupPanelVM As MyMachGroupPanelVM
+ Get
+ Return m_MachGroupPanelVM
+ End Get
+ Set(value As MyMachGroupPanelVM)
+ m_MachGroupPanelVM = value
+ NotifyPropertyChanged("MachGroupPanelVM")
+ End Set
+ End Property
+
+ Private m_LeftPanel_Visibility As Boolean = True
+ Public Property LeftPanel_Visibility As Visibility
+ Get
+ Return If(m_LeftPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_LeftPanel_Visibility = (value = Visibility.Visible)
+ End Set
+ End Property
+ Friend Sub SetLeftPanel_Visibility(IsVisible As Boolean)
+ m_LeftPanel_Visibility = IsVisible
+ End Sub
+
+ Private m_TopPanel_Visibility As Boolean = False
+ Public Property TopPanel_Visibility As Visibility
+ Get
+ Return If(m_TopPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_TopPanel_Visibility = (value = Visibility.Visible)
+ End Set
+ End Property
+ Friend Sub SetTopPanel_Visibility(IsVisible As Boolean)
+ m_TopPanel_Visibility = IsVisible
+ End Sub
+
+ Private m_BottomPanel_Visibility As Boolean = True
+ Public Property BottomPanel_Visibility As Visibility
+ Get
+ Return If(m_BottomPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_BottomPanel_Visibility = (value = Visibility.Visible)
+ End Set
+ End Property
+ Friend Sub SetBottomPanel_Visibility(IsVisible As Boolean)
+ m_BottomPanel_Visibility = IsVisible
+ End Sub
+
+ Private m_PartManager_Visibility As Boolean = True
+ Public Property PartManager_Visibility As Visibility
+ Get
+ Return If(m_PartManager_Visibility, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_PartManager_Visibility = (value = Visibility.Visible)
+ End Set
+ End Property
+ Friend Sub SetPartManager_Visibility(IsVisible As Boolean)
+ m_PartManager_Visibility = IsVisible
+ End Sub
+
+ Private m_FeatureManager_Visibility As Boolean = True
+ Public Property FeatureManager_Visibility As Visibility
+ Get
+ Return If(m_FeatureManager_Visibility, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_FeatureManager_Visibility = (value = Visibility.Visible)
+ End Set
+ End Property
+ Friend Sub SetFeatureManager_Visibility(IsVisible As Boolean)
+ m_FeatureManager_Visibility = IsVisible
+ End Sub
+
+ Private m_ShowBeamPanel_Visibility As Boolean = True
+ Public Property ShowBeamPanel_Visibility As Visibility
+ Get
+ Return If(m_ShowBeamPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_ShowBeamPanel_Visibility = (value = Visibility.Visible)
+ End Set
+ End Property
+ Friend Sub SetShowBeamPanel_Visibility(IsVisible As Boolean)
+ m_ShowBeamPanel_Visibility = IsVisible
+ End Sub
+
+ Private m_ProjManager_Visibility As Boolean = True
+ Public Property ProjManager_Visibility As Visibility
+ Get
+ Return If(m_ProjManager_Visibility, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_ProjManager_Visibility = (value = Visibility.Visible)
+ End Set
+ End Property
+ Friend Sub SetProjManager_Visibility(IsVisible As Boolean)
+ m_ProjManager_Visibility = IsVisible
+ End Sub
+
+ Private m_ProdManager_Visibility As Boolean = True
+ Public Property ProdManager_Visibility As Visibility
+ Get
+ Return If(m_ProdManager_Visibility, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_ProdManager_Visibility = (value = Visibility.Visible)
+ End Set
+ End Property
+ Friend Sub SetProdManager_Visibility(IsVisible As Boolean)
+ m_ProdManager_Visibility = IsVisible
+ End Sub
+
+ Friend Sub NotifyAllPanelVisibility()
+ NotifyPropertyChanged("LeftPanel_Visibility")
+ NotifyPropertyChanged("TopPanel_Visibility")
+ NotifyPropertyChanged("BottomPanel_Visibility")
+ NotifyPropertyChanged("PartManager_Visibility")
+ NotifyPropertyChanged("FeatureManager_Visibility")
+ NotifyPropertyChanged("ShowBeamPanel_Visibility")
+ NotifyPropertyChanged("ProjManager_Visibility")
+ NotifyPropertyChanged("ProdManager_Visibility")
+ End Sub
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefProjectVM(Me)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+End Class
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProdFile.vb b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProdFile.vb
new file mode 100644
index 00000000..f2fddca8
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProdFile.vb
@@ -0,0 +1,69 @@
+Imports System.IO
+
+Public Class ProdFile
+
+ 'Private m_nProjId As Integer = 0
+ 'Public ReadOnly Property nProjId As Integer
+ ' Get
+ ' Return m_nProjId
+ ' End Get
+ 'End Property
+
+ 'Friend ReadOnly Property sProjPath As String
+ ' Get
+ ' Dim sPath As String = String.Empty
+ ' If IsNothing(m_nProjId) OrElse m_nProjId = 0 Then Return String.Empty
+ ' sPath = refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000") & "\" & nProjId.ToString("0000") & FILENAMESEPARATOR
+ ' If Not IsNothing(m_nProdId) AndAlso m_nProdId > 0 Then
+ ' sPath &= nProjId.ToString("0000")
+ ' End If
+ ' sPath &= FILENAMESEPARATOR & BTLFileName & ".nge"
+ ' Return sPath
+ ' End Get
+ 'End Property
+
+ Private m_nProdId As Integer = 0
+ Public ReadOnly Property nProdId As Integer
+ Get
+ Return m_nProdId
+ End Get
+ End Property
+ Friend ReadOnly Property sProdPath As String
+ Get
+ Dim sPath As String = String.Empty
+ If IsNothing(m_nProdId) OrElse m_nProdId = 0 Then Return String.Empty
+ Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000") & "\" & nProdId.ToString("0000") & ".nge"
+ End Get
+ End Property
+
+ 'Private m_BTLFileName As String = String.Empty
+ 'Public ReadOnly Property BTLFileName As String
+ ' Get
+ ' Return m_BTLFileName
+ ' End Get
+ 'End Property
+
+ Private m_NewProd As Boolean
+ Friend Property NewProd As Boolean
+ Get
+ Return m_NewProd
+ End Get
+ Set(value As Boolean)
+ m_NewProd = value
+ End Set
+ End Property
+ Public ReadOnly Property ProjectFileName As String
+ Get
+ Return m_nProdId.ToString("0000")
+ End Get
+ End Property
+
+ Sub New(ProdFileName As String)
+ Integer.TryParse(Path.GetFileNameWithoutExtension(ProdFileName), m_nProdId)
+ End Sub
+
+ Friend Sub SetProdId(nProdId As Integer)
+ m_nProdId = nProdId
+ End Sub
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjectFile.vb b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjectFile.vb
new file mode 100644
index 00000000..215beb59
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjectFile.vb
@@ -0,0 +1,278 @@
+Imports System.IO
+Imports EgtUILib
+
+Public Class ProjectFile
+
+ Private m_nProjectType As ProjectType
+ Public ReadOnly Property nProjectType As ProjectType
+ Get
+ Return m_nProjectType
+ End Get
+ End Property
+ Friend Sub SetProjectType(nProjectType As ProjectType)
+ m_nProjectType = nProjectType
+ End Sub
+
+ Private m_nProjId As Integer = 0
+ Public ReadOnly Property nProjId As Integer
+ Get
+ Return m_nProjId
+ End Get
+ End Property
+
+ Friend ReadOnly Property sProjDirPath As String
+ Get
+ If IsNothing(m_nProjId) OrElse m_nProjId = 0 Then Return String.Empty
+ Return refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000")
+ End Get
+ End Property
+ Friend ReadOnly Property sProjPath As String
+ Get
+ Dim sPath As String = String.Empty
+ If IsNothing(m_nProjId) OrElse m_nProjId = 0 Then Return String.Empty
+ sPath = refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000") & "\" & nProjId.ToString("0000") & FILENAMESEPARATOR
+ If Not IsNothing(m_nProdId) AndAlso m_nProdId > 0 Then
+ sPath &= nProdId.ToString("0000")
+ End If
+ sPath &= FILENAMESEPARATOR & BTLFileName & ".nge"
+ Return sPath
+ End Get
+ End Property
+
+ Private m_nProdId As Integer = 0
+ Public ReadOnly Property nProdId As Integer
+ Get
+ Return m_nProdId
+ End Get
+ End Property
+ Friend ReadOnly Property sProdDirPath As String
+ Get
+ Dim sPath As String = String.Empty
+ If IsNothing(m_nProdId) OrElse m_nProdId = 0 Then Return String.Empty
+ Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000")
+ End Get
+ End Property
+ Friend ReadOnly Property sProdPath As String
+ Get
+ Dim sPath As String = String.Empty
+ If IsNothing(m_nProdId) OrElse m_nProdId = 0 Then Return String.Empty
+ Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000") & "\" & nProdId.ToString("0000") & ".nge"
+ End Get
+ End Property
+
+ Private m_BTLFileName As String = String.Empty
+ Public ReadOnly Property BTLFileName As String
+ Get
+ Return m_BTLFileName
+ End Get
+ End Property
+
+ Private m_NewProj As Boolean
+ Friend Property NewProj As Boolean
+ Get
+ Return m_NewProj
+ End Get
+ Set(value As Boolean)
+ m_NewProj = value
+ End Set
+ End Property
+
+ Private m_NewProd As Boolean
+ Friend Property NewProd As Boolean
+ Get
+ Return m_NewProd
+ End Get
+ Set(value As Boolean)
+ m_NewProd = value
+ End Set
+ End Property
+
+ ' nome del file mostrato nella finestra OpenProjFileDialog
+ Public ReadOnly Property OpenFileName As String
+ Get
+ If m_nProjectType = ProjectType.PROJ Then
+ Return m_nProjId.ToString("0000") & " " & BTLFileName
+ ElseIf m_nProjectType = ProjectType.PROD Then
+ Return m_nProdId.ToString("0000")
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Sub New(nProjectType As ProjectType, ProjectFileName As String)
+ m_nProjectType = nProjectType
+ If m_nProjectType = ProjectType.PROJ Then
+ Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
+ If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
+ Integer.TryParse(DataFromFileName(0), m_nProjId)
+ End If
+ If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
+ Integer.TryParse(DataFromFileName(1), m_nProdId)
+ Else
+ m_nProdId = 0
+ End If
+ If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
+ m_BTLFileName = DataFromFileName(2)
+ End If
+ ElseIf m_nProjectType = ProjectType.PROD Then
+ Integer.TryParse(ProjectFileName, m_nProdId)
+ End If
+ End Sub
+
+ Sub New(nProjectType As ProjectType, nProjId As Integer, nProdId As Integer, sBTLFileName As String)
+ m_nProjectType = nProjectType
+ If m_nProjectType = ProjectType.PROJ Then
+ m_nProjId = nProjId
+ m_nProdId = nProdId
+ m_BTLFileName = sBTLFileName
+ ElseIf m_nProjectType = ProjectType.PROD Then
+ m_nProdId = nProdId
+ End If
+ End Sub
+
+ Friend Sub SetProdId(nProdId As Integer)
+ ' rinomino proj con riferimento a prod
+ Dim OldPath As String = sProjPath
+ m_nProdId = nProdId
+ Dim NewPath As String = sProjPath
+ File.Move(OldPath, NewPath)
+ End Sub
+
+ Friend Sub ResetProdId()
+ SetProdId(0)
+ End Sub
+
+ ' funzione che restituisce le parti di nome file
+ Friend Shared Function VerifyProjectFile(nProjectType As ProjectType, ProjectFileName As String, ByRef nProjId As Integer, ByRef nProdId As Integer, ByRef sBTLFileName As String) As Boolean
+ If nProjectType = ProjectType.PROJ Then
+ Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
+ If DataFromFileName.Count = 3 Then
+ If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
+ Integer.TryParse(DataFromFileName(0), nProjId)
+ Else Return False
+ End If
+ If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
+ Integer.TryParse(DataFromFileName(1), nProdId)
+ Else
+ nProdId = 0
+ End If
+ If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
+ sBTLFileName = DataFromFileName(2)
+ End If
+ Return True
+ Else Return False
+ End If
+ ElseIf nProjectType = ProjectType.PROD Then
+ Return Integer.TryParse(ProjectFileName, nProdId)
+ Else Return False
+ End If
+ End Function
+
+ ' funzione che dato un nome file e il tipo restituisce il corretto numero di progetto
+ Friend Shared Function GetProjectNumber(nProjectType As ProjectType, ProjectFileName As String, ByRef nProjId As Integer, ByRef nProdId As Integer, ByRef sBTLFileName As String) As Boolean
+ If String.IsNullOrWhiteSpace(ProjectFileName) Then
+ nProjId = 0
+ nProdId = 0
+ sBTLFileName = ""
+ Return False
+ ElseIf ProjectFileName.Contains(FILENAMESEPARATOR) Then
+ Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
+ If DataFromFileName.Count = 3 Then
+ If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
+ Integer.TryParse(DataFromFileName(0), nProjId)
+ Else Return False
+ End If
+ If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
+ Integer.TryParse(DataFromFileName(1), nProdId)
+ Else
+ nProdId = 0
+ End If
+ If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
+ sBTLFileName = DataFromFileName(2)
+ End If
+ Return True
+ Else Return False
+ End If
+ ElseIf nProjectType = ProjectType.PROJ Then
+ Dim ProjectFileNameProd As String = Integer.TryParse(ProjectFileName, nProdId)
+ Dim nTempProjId As Integer = 0
+ Dim nTempProdId As Integer = 0
+ Dim sTempBTLFileName As String = ""
+ ' ricavo lista cartelle proj
+ Dim AllDirsInDir As IEnumerable(Of String) = IO.Directory.EnumerateDirectories(Map.refMainWindowVM.MainWindowM.sProjsDir)
+ For Each Directory In AllDirsInDir
+ Dim AllFilesInDir As IEnumerable(Of String) = IO.Directory.EnumerateFiles(Directory)
+ For Each File In AllFilesInDir
+ If Path.GetExtension(File).ToLower() = ".nge" Then
+ If File.Contains(FILENAMESEPARATOR) Then
+ Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
+ If DataFromFileName.Count = 3 Then
+ If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
+ Integer.TryParse(DataFromFileName(0), nTempProjId)
+ Else Return False
+ End If
+ If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
+ Integer.TryParse(DataFromFileName(1), nTempProdId)
+ Else
+ nProdId = 0
+ End If
+ If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
+ sTempBTLFileName = DataFromFileName(2)
+ End If
+ If ProjectFileNameProd = nTempProdId Then
+ nProjId = nTempProjId
+ nProdId = nTempProdId
+ sTempBTLFileName = sBTLFileName
+ Return True
+ End If
+ Else Return False
+ End If
+ End If
+ End If
+ Next
+ Next
+ End If
+ Return False
+ End Function
+
+ Friend Shared Function VerifyProjectModification(CurrProject As ProjectFile, Type As ProjectType) As Boolean
+ If IsNothing(CurrProject) Then Return False
+ Dim bNewProject As Boolean = False
+ Dim sProjectDirPath As String = ""
+ If Type = ProjectType.PROJ Then
+ bNewProject = CurrProject.NewProj
+ sProjectDirPath = CurrProject.sProjDirPath
+ Else
+ bNewProject = CurrProject.NewProd
+ sProjectDirPath = CurrProject.sProdDirPath
+ End If
+ ' verifico se progetto modificato, e chiedo se salvare
+ If (EgtGetModified() Or bNewProject) Then
+ If MessageBox.Show("Salvare le modifiche apportate al progetto?", "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
+ ' salvo proj
+ If Type = ProjectType.PROJ Then
+ Map.refProjManagerVM.Save()
+ Else
+ Map.refProdManagerVM.Save()
+ End If
+ Return True
+ Else
+ ' se da non salvare e nuovo proj
+ If bNewProject Then
+ ' lo elimino
+ Directory.Delete(sProjectDirPath, True)
+ If Type = ProjectType.PROD AndAlso CurrProject.m_nProdId = Map.refProjManagerVM.CurrProj.m_nProdId Then
+ ' reset prod in path proj
+ Map.refProjManagerVM.CurrProj.ResetProdId()
+ End If
+ CurrProject = Nothing
+ End If
+ EgtResetModified()
+ Return False
+ End If
+ End If
+ Return True
+ End Function
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/EgtBEAMWALL.ico b/EgtBEAMWALL.ViewerOptimizer/Resources/EgtBEAMWALL.ico
new file mode 100644
index 00000000..90d62965
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/EgtBEAMWALL.ico differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/InstrumentPanel/Analyze.png b/EgtBEAMWALL.ViewerOptimizer/Resources/InstrumentPanel/Analyze.png
new file mode 100644
index 00000000..e322f1d5
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/InstrumentPanel/Analyze.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/InstrumentPanel/GetDist.png b/EgtBEAMWALL.ViewerOptimizer/Resources/InstrumentPanel/GetDist.png
new file mode 100644
index 00000000..520e4065
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/InstrumentPanel/GetDist.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/DxfOut.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/DxfOut.png
new file mode 100644
index 00000000..85420e4e
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/DxfOut.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Export.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Export.png
new file mode 100644
index 00000000..472f5dd9
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Export.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Import.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Import.png
new file mode 100644
index 00000000..1e19eab7
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Import.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/New.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/New.png
new file mode 100644
index 00000000..78a5a0b3
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/New.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Open.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Open.png
new file mode 100644
index 00000000..616c02b0
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Open.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Options.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Options.png
new file mode 100644
index 00000000..6fb84bbc
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Options.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Save.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Save.png
new file mode 100644
index 00000000..0eca2603
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Save.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/SaveAs.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/SaveAs.png
new file mode 100644
index 00000000..1d5cfaef
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/SaveAs.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Send.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Send.png
new file mode 100644
index 00000000..a9bcbe4c
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ProjectManager/Send.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ShowBeamPanel/ShowAll.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowBeamPanel/ShowAll.png
new file mode 100644
index 00000000..37a0de81
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowBeamPanel/ShowAll.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ShowBeamPanel/ShowBuilding.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowBeamPanel/ShowBuilding.png
new file mode 100644
index 00000000..419a9555
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowBeamPanel/ShowBuilding.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ShowBeamPanel/ShowSolid.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowBeamPanel/ShowSolid.png
new file mode 100644
index 00000000..383a95ef
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowBeamPanel/ShowSolid.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ShowPanel/RenderingHL.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowPanel/RenderingHL.png
new file mode 100644
index 00000000..8aa5a3ac
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowPanel/RenderingHL.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ShowPanel/RenderingSH.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowPanel/RenderingSH.png
new file mode 100644
index 00000000..0c6690d1
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowPanel/RenderingSH.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ShowPanel/RenderingWF.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowPanel/RenderingWF.png
new file mode 100644
index 00000000..1f2de621
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ShowPanel/RenderingWF.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/TreeView/Folder.png b/EgtBEAMWALL.ViewerOptimizer/Resources/TreeView/Folder.png
new file mode 100644
index 00000000..2c1339d0
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/TreeView/Folder.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromBACK.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromBACK.png
new file mode 100644
index 00000000..0c2790cd
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromBACK.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromBOTTOM.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromBOTTOM.png
new file mode 100644
index 00000000..6a48b645
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromBOTTOM.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromFRONT.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromFRONT.png
new file mode 100644
index 00000000..08abc995
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromFRONT.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_NE.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_NE.png
new file mode 100644
index 00000000..e0c71baf
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_NE.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_NW.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_NW.png
new file mode 100644
index 00000000..203e2903
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_NW.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_SE.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_SE.png
new file mode 100644
index 00000000..28910889
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_SE.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_SW.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_SW.png
new file mode 100644
index 00000000..909e25e5
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromISO_SW.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromLEFT.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromLEFT.png
new file mode 100644
index 00000000..d4a4e85d
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromLEFT.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromRIGHT.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromRIGHT.png
new file mode 100644
index 00000000..f182c1a2
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromRIGHT.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromTOP.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromTOP.png
new file mode 100644
index 00000000..214358d0
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/LookFromTOP.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/ZoomAll.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/ZoomAll.png
new file mode 100644
index 00000000..e1a27d16
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/ZoomAll.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/ZoomIn.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/ZoomIn.png
new file mode 100644
index 00000000..b370a3e0
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/ZoomIn.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/ZoomOut.png b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/ZoomOut.png
new file mode 100644
index 00000000..187a1a02
Binary files /dev/null and b/EgtBEAMWALL.ViewerOptimizer/Resources/ViewPanel/ZoomOut.png differ
diff --git a/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb b/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb
new file mode 100644
index 00000000..b27447b1
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb
@@ -0,0 +1,613 @@
+Imports System.Windows.Interop
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class MySceneHostVM
+ Inherits EgtWPFLib5.SceneHostVM
+
+ ' Identificativi per pezzo da selezionare/deselezionare
+ Private m_nIdToSel As Integer = GDB_ID.NULL
+ Private m_nIdToDesel As Integer = GDB_ID.NULL
+ ' Dati movimento
+ Private m_dMaxStep As Double = 0
+ ' Dati per Drag
+ Private m_nRestRadius As Integer = 3
+ Private m_bDrag As Boolean = False
+ Private m_bDragToStart As Boolean = False
+ Private m_bVerify As Boolean = False
+ Private m_bFromParking As Boolean = False
+ Private m_bDragging As Boolean = False
+ Private m_locPrev As System.Drawing.Point
+ Private m_ptPrev As Point3d
+ Private m_vtTotMove As Vector3d
+ Private m_dSnapDist As Double = 0
+
+
+ Private bReducedCut As Boolean = False
+ Private m_bMagnetic As Boolean
+
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ MyBase.New()
+ AddHandler MainController.OnNewProject, AddressOf OnNewProject
+ AddHandler MainController.OnOpenProject, AddressOf OnOpenProject
+ AddHandler MainController.OnSavingProject, AddressOf OnSavingProject
+ AddHandler MainController.OnSavedProject, AddressOf OnSavedProject
+ AddHandler MainController.OnImportingProject, AddressOf OnImportingProject
+ AddHandler MainController.OnImportedProject, AddressOf OnImportedProject
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Overrides Sub InitScene()
+ InitSceneEvents()
+ ' Inizializzazione Scena
+ PreInitializeScene()
+ ' Se tutto bene
+ If MainScene.Init() Then 'And Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.OFFICE_BASE) Then
+ PostInitializeScene()
+ ' Imposto stato gestione mouse diretto della scena a nessuno
+ MainScene.SetStatusNull()
+ ' Recupero e imposto handle finestra principale
+ Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle
+ EgtSetMainWindowHandle(hMainWnd)
+ EgtSetCurrentContext(MainScene.GetCtx())
+ ' inizializzo gestore travi e pareti
+ EgtInitBeamMgr(EIB_FL.TS3_POS + EIB_FL.USEUATTR)
+ ' inizializzo gestore lavorazioni
+ EgtInitMachMgr(Map.refMainWindowVM.MainWindowM.sMachinesRoot, Map.refMainWindowVM.MainWindowM.sToolMakersDir)
+ ' Seleziono la macchina impostata nel file ini
+ Map.refMachinePanelVM.LoadCurrentMachine()
+ Return
+ End If
+ ' Problemi
+ ' Se manca la chiave
+ If Map.refMainWindowVM.MainWindowM.nKeyLevel = -1 Or Map.refMainWindowVM.MainWindowM.nKeyLevel = -2 Then
+ EgtOutLog("Missing Dongle")
+ ' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore"
+ Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3)
+ Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
+ MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
+ ' Altrimenti manca la licenza
+ Else
+ EgtOutLog("Problems with Licence")
+ ' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore"
+ Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6)
+ Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
+ If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then
+ ' Apro dialogo per richiesta file licenza
+ Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With {
+ .DefaultExt = ".lic",
+ .Filter = "Licences (.lic)|*.lic",
+ .CheckFileExists = True,
+ .ValidateNames = True
+ }
+ If LicDlg.ShowDialog() = True Then
+ ' Recupero il direttorio del file
+ Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName)
+ ' Se il file non è già nel direttorio di configurazione lo copio
+ If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(Map.refMainWindowVM.MainWindowM.sConfigDir), StringComparison.OrdinalIgnoreCase) Then
+ Try
+ File.Copy(LicDlg.FileName, Path.Combine(Map.refMainWindowVM.MainWindowM.sConfigDir, LicDlg.SafeFileName), True)
+ Catch ex As Exception
+ End Try
+ End If
+ ' Imposto il nuovo file di licenza nell'Ini
+ WriteMainPrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName)
+ End If
+ End If
+ End If
+ ' Chiudo il programma
+ End
+ End Sub
+
+ Public Overrides Sub InitSceneEvents()
+ AddHandler MainScene.OnMouseDownScene, AddressOf OnMouseDownScene
+ AddHandler MainScene.OnMouseMoveScene, AddressOf OnMouseMoveScene
+ AddHandler MainScene.OnMouseUpScene, AddressOf OnMouseUpScene
+ AddHandler MainScene.KeyDown, AddressOf OnKeyDownScene
+ AddHandler MainScene.OnCursorPos, AddressOf OnCursorPos
+ AddHandler MainScene.OnShowDistance, AddressOf OnShowDistance
+ AddHandler MainScene.OnChangedSnapPointType, AddressOf OnChangedSnapPointType
+ End Sub
+
+ Private Sub PreInitializeScene()
+ ' imposto colore di default
+ Dim DefColor As New Color3d(0, 0, 0)
+ GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
+ MainScene.SetDefaultMaterial(DefColor)
+ ' imposto colori sfondo
+ Dim BackTopColor As New Color3d(192, 192, 192)
+ GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
+ Dim BackBotColor As New Color3d(BackTopColor)
+ GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
+ MainScene.SetViewBackground(BackTopColor, BackBotColor)
+ ' imposto colore di evidenziazione
+ Dim MarkColor As New Color3d(255, 255, 0)
+ GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
+ MainScene.SetMarkMaterial(MarkColor)
+ ' imposto colore per superfici selezionate
+ Dim SelSurfColor As New Color3d(255, 255, 192)
+ GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
+ MainScene.SetSelSurfMaterial(SelSurfColor)
+ ' imposto tipo e colore del rettangolo di zoom
+ Dim bOutline As Boolean = True
+ Dim ZwColor As New Color3d(0, 0, 0)
+ GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor)
+ MainScene.SetZoomWinAttribs(bOutline, ZwColor)
+ ' imposto colore della linea di distanza
+ Dim DstLnColor As New Color3d(255, 0, 0)
+ GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
+ MainScene.SetDistLineMaterial(DstLnColor)
+ ' imposto parametri OpenGL
+ Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3)
+ Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0)
+ Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32)
+ Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32)
+ MainScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
+ End Sub
+
+ Private Sub PostInitializeScene()
+ ' Impostazioni Controller
+ MainController.SetScene(MainScene)
+ ' imposto tipo coordinate
+ MainScene.SetGridCursorPos(True)
+ ' modo di visualizzazione
+ Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING)
+ ' Map.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM))
+ ' visualizzazione avanzata dei triangoli costituenti le superfici
+ Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
+ EgtSetShowTriaAdv(bShowTriaAdv)
+ ' tipo visualizzazione per Zmap
+ Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
+ EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False)
+ ' dimensione lineare max in pixel delle textures
+ Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096)
+ EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
+ ' tipo snap point
+ MainScene.SetSnapPointType(SP.PT_SKETCH)
+ End Sub
+
+#End Region ' METHODS
+
+#Region "ProjectManager"
+
+ Public Overrides Sub NewProject()
+ EgtSetCurrentContext(MainScene.GetCtx())
+ Dim bOk As Boolean = MainController.NewProject()
+ MainScene.SetStatusNull()
+ End Sub
+
+ Public Overrides Sub OpenProject(sFilePath As String)
+ EgtSetCurrentContext(MainScene.GetCtx())
+ Dim bOk As Boolean = False
+ If String.IsNullOrEmpty(sFilePath) Then
+ ' Recupero cartella dell'ultimo progetto aperto
+ Dim sDir As String = MainController.GetCurrFile()
+ If String.IsNullOrWhiteSpace(sDir) Then
+ GetMainPrivateProfileString(S_MRUFILES, K_FILE, "", sDir)
+ End If
+ If Not String.IsNullOrWhiteSpace(sDir) Then
+ sDir = Path.GetDirectoryName(sDir)
+ End If
+ bOk = MainController.OpenProject(sDir)
+ Else
+ bOk = MainController.OpenProject(sFilePath, False)
+ End If
+ MainScene.SetStatusNull()
+ End Sub
+
+ Public Overrides Sub SaveProject()
+ MyBase.SaveProject()
+ ' Imposto stato gestione mouse diretto della scena a nessuno
+ MainScene.SetStatusNull()
+ End Sub
+
+ Public Overrides Sub SaveAsProject()
+ MyBase.SaveAsProject()
+ ' Imposto stato gestione mouse diretto della scena a nessuno
+ MainScene.SetStatusNull()
+ End Sub
+
+ Public Overrides Sub ImportProject()
+ Dim sDir As String = String.Empty
+ GetMainPrivateProfileString(S_MRUIMPORT, K_FILE & "1", "", sDir)
+ If Not String.IsNullOrWhiteSpace(sDir) Then
+ sDir = Path.GetDirectoryName(sDir)
+ End If
+ sDir.TrimEnd("\"c)
+ MainController.ImportProject(sDir)
+ End Sub
+
+#End Region ' ProjectManager
+
+#Region "EVENTS"
+
+ Private Sub OnNewProject(sender As Object, bOk As Boolean)
+ Map.refMainWindowVM.SetTitle(" New - EgtBEAMWALL")
+ Map.refProjectVM.BTLStructure = BTLStructure.Empty
+ End Sub
+
+ Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean)
+ ' Procedo a seconda del risultato
+ If bOk Then
+ ' leggo struttura BTL
+ Map.refProjectVM.BTLStructure = BTLStructure.Init()
+ If Map.refMainMenuVM.SelPage = Pages.MACHINING Then
+ Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM
+ End If
+ Map.refProjectVM.BTLStructure.ShowAll()
+ WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
+ Else
+ EgtNewFile()
+ Map.refMainWindowVM.SetTitle(" New - EgtBEAMWALL")
+ Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file
+ MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
+ End If
+ MainScene.SetStatusNull()
+ End Sub
+
+ Private Sub OnSavingProject(ByVal sender As Object, sFile As String)
+ End Sub
+
+ Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
+ ' Se salvataggio non riuscito, esco subito
+ If Not bOk Then
+ Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file
+ MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
+ Return
+ End If
+ ' Salvo nome ultimo file
+ WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
+ End Sub
+
+ Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer)
+ If nType = FT.BTL Or nType = FT.BTLX Then
+ nFlag = GetMainPrivateProfileInt(S_IMPORT, K_BTLFLAG, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
+ Else
+ MessageBox.Show(Application.Current.MainWindow, EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error
+ End If
+ End Sub
+
+ Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
+ WriteMainPrivateProfileString(S_GENERAL, K_LASTIMPDIR, Path.GetDirectoryName(sFile))
+ If bOk Then
+ ' leggo struttura BTL
+ Map.refProjectVM.BTLStructure = BTLStructure.Init()
+ ' Ricavo il tipo di Warehouse settato nell'INI
+ Dim nDefault As Integer = 1
+ If GetMainPrivateProfileInt(S_GENERAL, K_WAREHOUSE, nDefault) = WarehouseType.MEDIUM Then
+ ' Se di tipo Medium confronto le Sezioni del BTL importato con quelle in Warehouse
+ WarehouseWndVM.CheckExistingSectionXMaterial()
+ End If
+ ' scrivo in ogni pezzo identificativo proj
+ Dim nPartId As Integer = EgtGetFirstPart()
+ While nPartId <> GDB_ID.NULL
+ ' guardo se esiste info numero progetto a cui appartiene
+ If Not EgtGetInfo(nPartId, PROJ, Map.refProjManagerVM.nLastProjId) Then
+ EgtSetInfo(nPartId, PROJ, Map.refProjManagerVM.nLastProjId)
+ End If
+ nPartId = EgtGetNextPart(nPartId)
+ End While
+ ' mostro tutti i pezzi
+ Map.refProjectVM.BTLStructure.ShowAll()
+ Else
+ Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file
+ MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
+ End If
+ End Sub
+
+ Private Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
+ If e.Button = Forms.MouseButtons.Middle Then Return
+ Select Case Map.refMainMenuVM.SelPage
+ Case Pages.VIEW
+ If Not IsNothing(Map.refProjectVM.BTLStructure) Then
+ View_OnMouseDownScene(sender, e)
+ End If
+ Case Pages.MACHINING
+ If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
+ Dim SelectedMachGroup As Core.MyMachGroup = DirectCast(Map.refMachGroupPanelVM.SelectedMachGroup, Core.MyMachGroup)
+ If SelectedMachGroup.nMachineType = MachineType.WALL Then
+ Wall_OnMouseDownScene(sender, e)
+ End If
+ End If
+ End Select
+ End Sub
+
+ Private Sub OnMouseMoveScene(sender As Object, e As Windows.Forms.MouseEventArgs)
+ If e.Button = Forms.MouseButtons.Middle Then Return
+ Select Case Map.refMainMenuVM.SelPage
+ Case Pages.VIEW
+ If Not IsNothing(Map.refProjectVM.BTLStructure) Then
+ View_OnMouseMoveScene(sender, e)
+ End If
+ Case Pages.MACHINING
+ If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
+ Dim SelectedMachGroup As Core.MyMachGroup = DirectCast(Map.refMachGroupPanelVM.SelectedMachGroup, Core.MyMachGroup)
+ If SelectedMachGroup.nMachineType = MachineType.WALL Then
+ Wall_OnMouseMoveScene(sender, e)
+ End If
+ End If
+ End Select
+ End Sub
+
+ Private Sub OnMouseUpScene(sender As Object, e As Windows.Forms.MouseEventArgs)
+ If e.Button = Forms.MouseButtons.Middle Then Return
+ Select Case Map.refMainMenuVM.SelPage
+ Case Pages.VIEW
+ If Not IsNothing(Map.refProjectVM.BTLStructure) Then
+ View_OnMouseUpScene(sender, e)
+ End If
+ Case Pages.MACHINING
+ If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
+ Dim SelectedMachGroup As Core.MyMachGroup = DirectCast(Map.refMachGroupPanelVM.SelectedMachGroup, Core.MyMachGroup)
+ If SelectedMachGroup.nMachineType = MachineType.WALL Then
+ Wall_OnMouseUpScene(sender, e)
+ End If
+ End If
+ End Select
+
+ End Sub
+
+ Private Sub OnKeyDownScene(sender As Object, e As System.Windows.Forms.KeyEventArgs)
+ End Sub
+
+ Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String)
+ 'Map.refStatusBarVM.SetCurrPos(sCursorPos)
+ End Sub
+
+ Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String)
+ Map.refMyStatusBarVM.SetOutputMessage(sDistance)
+ End Sub
+
+ Private Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean)
+ Dim BtnColor As Brush
+ If bUser Then
+ BtnColor = New SolidColorBrush(SystemColors.ControlColor)
+ Else
+ BtnColor = Brushes.Bisque
+ End If
+ 'Select Case nSpType
+ ' Case SP.PT_SKETCH
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1102), BtnColor) 'Sketch Point
+ ' Case SP.PT_GRID
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1104), BtnColor) 'Grid Point
+ ' Case SP.PT_END
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1106), BtnColor) 'End Point
+ ' Case SP.PT_MID
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1108), BtnColor) 'Mid Point
+ ' Case SP.CENTER
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1110), BtnColor) 'Center
+ ' Case SP.CENTROID
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1112), BtnColor) 'Centroid
+ ' Case SP.PT_NEAR
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1114), BtnColor) 'Near Point
+ ' Case SP.PT_INTERS
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1116), BtnColor) 'Inters Point
+ ' Case SP.PT_TANGENT
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1118), BtnColor) 'Tang Point
+ ' Case SP.PT_PERPENDICULAR
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1120), BtnColor) 'Perp Point
+ ' Case SP.PT_MINDIST
+ ' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1122), BtnColor) 'MinDist Point
+ ' Case Else
+ ' Map.refStatusBarVM.SetSnapPointType("---", BtnColor)
+ 'End Select
+ End Sub
+
+#End Region ' EVENTS
+
+#Region "WALL EVENTS"
+
+ Friend Sub Wall_OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
+ ' Per default no drag
+ m_bDrag = False
+ ' Verifico se selezionato indicativo di pezzo
+ EgtSetObjFilterForSelWin(True, True, True, True, True)
+ Dim nSel As Integer
+ EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
+ Dim nId As Integer = EgtGetFirstObjInSelWin()
+ While nId <> GDB_ID.NULL
+ ' Recupero l'identificativo del pezzo cui appartiene
+ Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
+ Dim WallMachGroup As WallMachGroup = DirectCast(Map.refMachGroupPanelVM.SelectedMachGroup, WallMachGroup)
+ Dim bPartInTable As Boolean = (EgtGetParent(nPartId) = WallMachGroup.nRawPartId)
+ If EgtIsPart(nPartId) OrElse EgtIsDuplo(nPartId) OrElse bPartInTable Then
+ Dim nStat As Integer = GDB_ST.ON_
+ EgtGetStatus(nPartId, nStat)
+ ' Se già selezionato
+ If nStat = GDB_ST.SEL Then
+ ' Memorizzo Id da deselezionare
+ m_nIdToDesel = nPartId
+ Else
+ ' Memorizzo Id da selezionare
+ m_nIdToSel = nPartId
+ End If
+ ' Drag possibile
+ m_bDrag = True
+ Exit While
+ End If
+ nId = EgtGetNextObjInSelWin()
+ End While
+ ' Dati per drag
+ m_locPrev = e.Location
+ m_bDrag = m_bDrag AndAlso EgtUnProjectPoint(e.Location, m_ptPrev)
+ m_bDragToStart = m_bDrag
+ m_bVerify = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) > 0
+ m_vtTotMove = Vector3d.NULL()
+ End Sub
+
+ Friend Sub Wall_OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
+ ' Se drag non abilitato o già in esecuzione, esco
+ If Not m_bDrag Or m_bDragging Then Return
+ ' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
+ If m_bDragToStart Then
+ 'If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
+ ' Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
+ ' Return
+ 'End If
+ m_bDragToStart = False
+ End If
+ ' Determino cosa muovere
+ Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
+ ' Inizio esecuzione di drag
+ m_bDragging = True
+ ' Ricavo il punto corrente in coordinate mondo
+ Dim ptCurr As Point3d
+ EgtUnProjectPoint(e.Location, ptCurr)
+ ' Ricavo il vettore di movimento
+ Dim vtMove As Vector3d = ptCurr - m_ptPrev
+ ' Muovo i pezzi selezionati di quanto possibile
+ If vtMove.SqLen() > EPS_SMALL * EPS_SMALL Then
+ ' Se movimento con sola verifica finale
+ If m_bVerify Then
+ Dim x = EgtMove(nMoveId, vtMove)
+ m_vtTotMove += vtMove
+ ' altrimenti caso con verifica durante il movimento
+ Else
+ '' Aggiorno regioni per nesting
+ 'UpdateNestRegions() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ 'EnableReferenceRegion(False)
+ ' muovo il pezzo
+ Dim x = EgtMovePartInRawPart(nMoveId, vtMove) 'EgtMovePart(nMoveId, bReducedCut, vtMove)
+ EgtSaveCollInfo()
+ ' se movimento risultante nullo, provo con movimento tangente
+ Dim bTgMoved As Boolean = False
+ If vtMove.IsSmall() Then
+ ' riprovo con movimento tangente
+ Dim vtTgMove As Vector3d = ptCurr - m_ptPrev
+ EgtTgMovePartOnCollision(nMoveId, bReducedCut, vtTgMove)
+ bTgMoved = (Not vtTgMove.IsSmall())
+ End If
+ ' se abilitato magnetico (allineamento + snap), lo provo
+ Dim bAlignMoved As Boolean = False
+ Dim bSnapMoved As Boolean = False
+ If m_bMagnetic Then
+ 'If Not GetLockOnRotation(nMoveId) Then
+ EgtAlignPartOnCollision(nMoveId, bReducedCut, bAlignMoved)
+ 'End If
+ If m_dSnapDist > EPS_SMALL Then
+ EgtRestoreCollInfo()
+ EgtMovePartToSnapPointOnCollision(nMoveId, bReducedCut, m_dSnapDist, bSnapMoved)
+ End If
+ End If
+ End If
+ EgtDraw()
+ End If
+ ' Aggiorno il punto precedente
+ m_ptPrev = ptCurr
+ ' Terminata esecuzione di drag
+ m_bDragging = False
+ End Sub
+
+ Friend Sub Wall_OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
+ ' Se eseguito drag
+ If Not m_bDragToStart Then
+ ' Se movimento con sola verifica finale
+ If m_bVerify Then
+ ' Determino cosa verificare
+ Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
+ '' Aggiorno regioni per nesting
+ 'UpdateNestRegions() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ 'EnableReferenceRegion(False)
+ ' Eseguo verifica
+ If EgtVerifyPart(nMoveId, bReducedCut) Then
+ ' Non superata riporto alla posizione iniziale
+ Else
+ EgtMove(nMoveId, -m_vtTotMove)
+ End If
+ 'm_bFromParking = False
+ ' altrimenti caso con verifica durante il movimento
+ Else
+ ' Basta reset alla fine
+ End If
+ ' Se selezione da eseguire
+ ElseIf m_nIdToSel <> GDB_ID.NULL Then
+ ' Eseguo la selezione
+ EgtSelectObj(m_nIdToSel)
+ ' Se deselezione da eseguire
+ ElseIf m_nIdToDesel <> GDB_ID.NULL Then
+ EgtDeselectObj(m_nIdToDesel)
+ End If
+ ' Reset
+ m_bDrag = False
+ m_nIdToSel = GDB_ID.NULL
+ m_nIdToDesel = GDB_ID.NULL
+ '' Se nessun pezzo selezionato, reset flag posizione selezionati
+ 'If EgtGetSelectedObjCount() = 0 Then
+ ' m_nPartPos = PART_POS.NONE_TABLE
+ 'End If
+ EgtDraw()
+ End Sub
+
+#End Region ' WALL EVENTS
+
+#Region "VIEW EVENTS"
+
+ Friend Sub View_OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
+ ' Verifico se selezionato indicativo di pezzo
+ EgtSetObjFilterForSelWin(True, True, True, True, True)
+ Dim nSel As Integer
+ EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
+ Dim nId As Integer = EgtGetFirstObjInSelWin()
+ While nId <> GDB_ID.NULL
+ ' Recupero l'identificativo del pezzo cui appartiene
+ Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
+ If EgtIsPart(nPartId) Then
+ Dim nStat As Integer = GDB_ST.ON_
+ EgtGetStatus(nPartId, nStat)
+ ' Se già selezionato
+ If nStat = GDB_ST.SEL Then
+ ' Memorizzo Id da deselezionare
+ m_nIdToDesel = nPartId
+ Else
+ ' Memorizzo Id da selezionare
+ m_nIdToSel = nPartId
+ End If
+ Exit While
+ End If
+ nId = EgtGetNextObjInSelWin()
+ End While
+ ' Dati per drag
+ m_bDragToStart = True
+ End Sub
+
+ Friend Sub View_OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
+ ' Se drag non abilitato o già in esecuzione, esco
+ If Not m_bDragToStart Then Return
+ ' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
+ If m_bDragToStart Then
+ If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
+ Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
+ Return
+ End If
+ m_bDragToStart = False
+ End If
+ End Sub
+
+ Friend Sub View_OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
+ ' Se eseguito drag
+ If Not m_bDragToStart Then
+ ' Se selezione da eseguire
+ ElseIf m_nIdToSel <> GDB_ID.NULL Then
+ ' Se pezzo da selezionare non è già selezionato
+ If IsNothing(Map.refProjectVM.BTLStructure.SelPart) OrElse Map.refProjectVM.BTLStructure.SelPart.nPartId <> m_nIdToSel Then
+ ' Eseguo la selezione
+ Map.refProjectVM.BTLStructure.SelPart = Map.refProjectVM.BTLStructure.PartList.First(Function(x) x.nPartId = m_nIdToSel)
+ End If
+ End If
+ ' Reset
+ m_bDrag = False
+ m_nIdToSel = GDB_ID.NULL
+ m_nIdToDesel = GDB_ID.NULL
+ EgtDraw()
+ End Sub
+
+#End Region ' VIEW EVENTS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/SceneHost/SceneHostV.xaml b/EgtBEAMWALL.ViewerOptimizer/SceneHost/SceneHostV.xaml
new file mode 100644
index 00000000..7210e7b9
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/SceneHost/SceneHostV.xaml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/SceneHost/SceneHostV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/SceneHost/SceneHostV.xaml.vb
new file mode 100644
index 00000000..3bcf798f
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/SceneHost/SceneHostV.xaml.vb
@@ -0,0 +1,19 @@
+Imports System.Windows.Interop
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class SceneHostV
+
+ Private m_MySceneHostVM As MySceneHostVM
+
+ Sub New()
+ ' This call is required by the designer.
+ InitializeComponent()
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ Me.DataContext = New MySceneHostVM
+ m_MySceneHostVM = DirectCast(Me.DataContext, MySceneHostVM)
+ m_MySceneHostVM.SetMainScene(MainScene)
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ShowBeamPanel/ShowBeamPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/ShowBeamPanel/ShowBeamPanelV.xaml
new file mode 100644
index 00000000..d98edf48
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ShowBeamPanel/ShowBeamPanelV.xaml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ShowBeamPanel/ShowBeamPanelV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/ShowBeamPanel/ShowBeamPanelV.xaml.vb
new file mode 100644
index 00000000..0375f3ea
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ShowBeamPanel/ShowBeamPanelV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class ShowBeamPanelV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ShowBeamPanel/ShowBeamPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/ShowBeamPanel/ShowBeamPanelVM.vb
new file mode 100644
index 00000000..1228f61d
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ShowBeamPanel/ShowBeamPanelVM.vb
@@ -0,0 +1,142 @@
+Imports EgtUILib
+
+Public Class ShowBeamPanelVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+#Region "ToolTip"
+
+ Public ReadOnly Property RenderingWFToolTip As String
+ Get
+ Return EgtMsg(MSG_GRIDVIEWPANEL + 1)
+ End Get
+ End Property
+
+ Public ReadOnly Property RenderingHLToolTip As String
+ Get
+ Return EgtMsg(MSG_GRIDVIEWPANEL + 2)
+ End Get
+ End Property
+
+ Public ReadOnly Property RenderingSHToolTip As String
+ Get
+ Return EgtMsg(MSG_GRIDVIEWPANEL + 3)
+ End Get
+ End Property
+
+ Public ReadOnly Property CurveDirToolTip As String
+ Get
+ Return EgtMsg(MSG_GRIDVIEWPANEL + 16)
+ End Get
+ End Property
+
+#End Region
+
+ Private m_bShowAll As Boolean = True
+ Friend Property bShowAll As Boolean
+ Get
+ Return m_bShowAll
+ End Get
+ Set(value As Boolean)
+ m_bShowAll = value
+ If m_bShowAll Then
+ m_ShowSolid_IsEnabled = False
+ m_ShowBuilding_IsEnabled = True
+ Else
+ m_ShowSolid_IsEnabled = True
+ m_ShowBuilding_IsEnabled = False
+ End If
+ NotifyPropertyChanged("ShowSolid_IsEnabled")
+ NotifyPropertyChanged("ShowBuilding_IsEnabled")
+ End Set
+ End Property
+
+ Private m_bShowSolid As Boolean
+ Public Property ShowSolid_IsChecked As Boolean
+ Get
+ Return m_bShowSolid
+ End Get
+ Set(value As Boolean)
+ m_bShowSolid = value
+ If Not IsNothing(Map.refProjectVM.BTLStructure) Then Map.refProjectVM.BTLStructure.ShowSolid()
+ End Set
+ End Property
+ Friend Sub SetShowSolid(bValue As Boolean)
+ m_bShowSolid = bValue
+ NotifyPropertyChanged("ShowSolid_IsChecked")
+ End Sub
+
+ Private m_bShowBuilding As Boolean
+ Public Property ShowBuilding_IsChecked As Boolean
+ Get
+ Return m_bShowBuilding
+ End Get
+ Set(value As Boolean)
+ m_bShowBuilding = value
+ If Not IsNothing(Map.refProjectVM.BTLStructure) Then Map.refProjectVM.BTLStructure.ShowBuilding()
+ End Set
+ End Property
+ Friend Sub SetShowBuilding(bValue As Boolean)
+ m_bShowBuilding = bValue
+ NotifyPropertyChanged("ShowBuilding_IsChecked")
+ End Sub
+
+ Private m_ShowSolid_IsEnabled As Boolean
+ Public Property ShowSolid_IsEnabled As Boolean
+ Get
+ Return m_ShowSolid_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_ShowSolid_IsEnabled = value
+ End Set
+ End Property
+
+ Private m_ShowBuilding_IsEnabled As Boolean
+ Public Property ShowBuilding_IsEnabled As Boolean
+ Get
+ Return m_ShowBuilding_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_ShowBuilding_IsEnabled = value
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdShowAll As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ 'Creo riferimento a questa classe in EgtBeamWALL
+ Map.SetRefShowBeamPanelVM(Me)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "ShowAll"
+
+ Public ReadOnly Property ShowAll_Command As ICommand
+ Get
+ If m_cmdShowAll Is Nothing Then
+ m_cmdShowAll = New Command(AddressOf ShowAll)
+ End If
+ Return m_cmdShowAll
+ End Get
+ End Property
+
+ Public Sub ShowAll()
+ If Not IsNothing(Map.refProjectVM.BTLStructure) Then
+ Map.refProjectVM.BTLStructure.ShowAll()
+ End If
+ End Sub
+
+#End Region ' ShowAll
+
+#End Region ' COMMANDS
+
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/ShowPanel/ShowPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/ShowPanel/ShowPanelV.xaml
new file mode 100644
index 00000000..4e4a1ea5
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ShowPanel/ShowPanelV.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ShowPanel/ShowPanelV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/ShowPanel/ShowPanelV.xaml.vb
new file mode 100644
index 00000000..98406775
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ShowPanel/ShowPanelV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class ShowPanelV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/StatusBar/MyStatusBarVM.vb b/EgtBEAMWALL.ViewerOptimizer/StatusBar/MyStatusBarVM.vb
new file mode 100644
index 00000000..fd4c557c
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/StatusBar/MyStatusBarVM.vb
@@ -0,0 +1,101 @@
+Imports System.Runtime.InteropServices
+Imports System.Threading
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class MyStatusBarVM
+ Inherits EgtWPFLib5.StatusBarVM
+
+ ' Funzioni di callback per output in interfaccia da LUA
+ Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
+ Private m_OutTextCallback As New OutTextCallback(AddressOf OutText)
+
+ Private m_bStopProgress As Boolean
+ Friend ReadOnly Property bStopProgress As Boolean
+ Get
+ Return m_bStopProgress
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdStopProgress As ICommand
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefStatusBarVM(Me)
+ ' Installo funzione gestione eventi per lua
+ EgtSetProcessEvents(m_ProcEventsCallback)
+ ' Installo funzione output testo su status per lua
+ EgtSetOutText(m_OutTextCallback)
+ End Sub
+
+ Friend Sub ResetStopProgress()
+ m_bStopProgress = False
+ End Sub
+
+ Public Function OutText(ByRef psText As IntPtr) As Boolean
+ ' Assegno stringa
+ OutputMessage = (Marshal.PtrToStringUni(psText))
+ ' Costringo ad aggiornare
+ UpdateUI()
+ Return True
+ End Function
+
+ Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
+ ' Se previsto, imposto progress
+ If nProg > 0 Then SetLoadingProgress(Math.Min(nProg, 100))
+ ' Costringo ad aggiornare
+ UpdateUI()
+ ' Eventuale attesa
+ Thread.Sleep(nPause)
+ ' Ritorno eventuale stop
+ If m_bStopProgress Then
+ m_bStopProgress = False
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
+
+ Friend Sub StartLoading(sMessage As String, bIsStop As Boolean)
+ Map.refMyStatusBarVM.SetLoadingProgress_Visibility(True)
+ Map.refMyStatusBarVM.SetStopProgress_IsActive(bIsStop)
+ Map.refMyStatusBarVM.SetStopProgress_IsEnabled(bIsStop)
+ Map.refMyStatusBarVM.SetOutputMessage(sMessage)
+ End Sub
+
+ Friend Sub EndLoading(sMessage As String, Optional nMessageTime As Integer = 3)
+ Map.refMyStatusBarVM.SetLoadingProgress_Visibility(False)
+ Map.refMyStatusBarVM.SetStopProgress_IsActive(False)
+ Map.refMyStatusBarVM.SetStopProgress_IsEnabled(False)
+ Map.refMyStatusBarVM.SetOutputMessage(sMessage, nMessageTime)
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "StopProgress"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property StopProgress_Command As ICommand
+ Get
+ If m_cmdStopProgress Is Nothing Then
+ m_cmdStopProgress = New Command(AddressOf StopProgress)
+ End If
+ Return m_cmdStopProgress
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub StopProgress(ByVal param As Object)
+ m_bStopProgress = True
+ End Sub
+
+#End Region ' StopProgress
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/StatusBar/StatusBarV.xaml b/EgtBEAMWALL.ViewerOptimizer/StatusBar/StatusBarV.xaml
new file mode 100644
index 00000000..20d97bc4
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/StatusBar/StatusBarV.xaml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/StatusBar/StatusBarV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/StatusBar/StatusBarV.xaml.vb
new file mode 100644
index 00000000..03d97984
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/StatusBar/StatusBarV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class StatusBarV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelV.xaml
new file mode 100644
index 00000000..dc95d7c0
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelV.xaml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelV.xaml.vb
new file mode 100644
index 00000000..566a3432
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class TopPanelV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelVM.vb
new file mode 100644
index 00000000..819f57b1
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelVM.vb
@@ -0,0 +1,181 @@
+Imports EgtUILib
+
+Public Class TopPanelVM
+
+#Region "FIELDS & PROPERTIES"
+
+ ' Definizione comandi
+ Private m_cmdRemoveRawPart As ICommand
+ Private m_cmdRemovePart As ICommand
+ Private m_cmdMoveUpPart As ICommand
+ Private m_cmdMoveDownPart As ICommand
+ Private m_cmdReOrderPart As ICommand
+
+#End Region 'FIELDS & PROPERTIES
+
+ Sub New()
+ ' imposto riferimento su mappa
+ 'Map.SetRefLeftPanelVM(Me)
+ End Sub
+
+#Region "METHODS"
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "RemoveRawPart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property RemoveRawPart_Command As ICommand
+ Get
+ If m_cmdRemoveRawPart Is Nothing Then
+ m_cmdRemoveRawPart = New Command(AddressOf RemoveRawPart)
+ End If
+ Return m_cmdRemoveRawPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub RemoveRawPart()
+ Dim SelMachGroup As Core.MyMachGroup = Map.refMachGroupPanelVM.SelectedMachGroup
+ If IsNothing(SelMachGroup) Then Return
+ SelMachGroup.DeleteMachGroup()
+ End Sub
+
+#End Region ' RemoveRawPart
+
+#Region "RemovePart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property RemovePart_Command As ICommand
+ Get
+ If m_cmdRemovePart Is Nothing Then
+ m_cmdRemovePart = New Command(AddressOf RemovePart)
+ End If
+ Return m_cmdRemovePart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub RemovePart()
+ Dim SelMachGroup As Core.MyMachGroup = Map.refMachGroupPanelVM.SelectedMachGroup
+ If IsNothing(SelMachGroup) Then Return
+ Dim SelPart As Core.Part = SelMachGroup.SelPart
+ If IsNothing(SelPart) Then Return
+ SelPart.DeletePart()
+ End Sub
+
+#End Region ' RemovePart
+
+#Region "MoveUpPart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property MoveUpPart_Command As ICommand
+ Get
+ If m_cmdMoveUpPart Is Nothing Then
+ m_cmdMoveUpPart = New Command(AddressOf MoveUpPart)
+ End If
+ Return m_cmdMoveUpPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub MoveUpPart()
+ Dim SelMachGroup As Core.MyMachGroup = Map.refMachGroupPanelVM.SelectedMachGroup
+ If IsNothing(SelMachGroup) Then Return
+ Dim SelPart As Core.Part = SelMachGroup.SelPart
+ If IsNothing(SelPart) Then Return
+ If SelMachGroup.nMachineType = MachineType.BEAM Then
+ Dim BeamMachGroup As BeamMachGroup = DirectCast(SelMachGroup, BeamMachGroup)
+ BeamMachGroup.MoveBeam(SelPart, MoveDirections.UP)
+ EgtDraw()
+ ' riseleziono trave
+ SelMachGroup.SelPart = SelPart
+ End If
+ End Sub
+
+#End Region ' MoveUpPart
+
+#Region "MoveDownPart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property MoveDownPart_Command As ICommand
+ Get
+ If m_cmdMoveDownPart Is Nothing Then
+ m_cmdMoveDownPart = New Command(AddressOf MoveDownPart)
+ End If
+ Return m_cmdMoveDownPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub MoveDownPart()
+ Dim SelMachGroup As Core.MyMachGroup = Map.refMachGroupPanelVM.SelectedMachGroup
+ If IsNothing(SelMachGroup) Then Return
+ Dim SelPart As Core.Part = SelMachGroup.SelPart
+ If IsNothing(SelPart) Then Return
+ If SelMachGroup.nMachineType = MachineType.BEAM Then
+ Dim BeamMachGroup As BeamMachGroup = DirectCast(SelMachGroup, BeamMachGroup)
+ BeamMachGroup.MoveBeam(SelPart, MoveDirections.DOWN)
+ EgtDraw()
+ ' riseleziono trave
+ SelMachGroup.SelPart = SelPart
+ End If
+ End Sub
+
+#End Region ' MoveDownPart
+
+#Region "ReOrderPart"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property ReOrderPart_Command As ICommand
+ Get
+ If m_cmdReOrderPart Is Nothing Then
+ m_cmdReOrderPart = New Command(AddressOf ReOrderPart)
+ End If
+ Return m_cmdReOrderPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub ReOrderPart()
+ Dim SelMachGroup As Core.MyMachGroup = Map.refMachGroupPanelVM.SelectedMachGroup
+ If IsNothing(SelMachGroup) Then Return
+ Dim SelPart As Core.Part = SelMachGroup.SelPart
+ If IsNothing(SelPart) Then Return
+ If SelMachGroup.nMachineType = MachineType.BEAM Then
+ Dim BeamMachGroup As BeamMachGroup = DirectCast(SelMachGroup, BeamMachGroup)
+ BeamMachGroup.ReorderBeam()
+ ' riseleziono trave
+ If Not IsNothing(SelPart) AndAlso (IsNothing(SelMachGroup.SelPart) OrElse SelPart.nPartId <> SelMachGroup.SelPart.nPartId) Then
+ SelMachGroup.SelPart = SelPart
+ End If
+ End If
+ End Sub
+
+#End Region ' ReOrderPart
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/BTLIniFile.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/BTLIniFile.vb
new file mode 100644
index 00000000..b6fdfe4c
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/BTLIniFile.vb
@@ -0,0 +1,173 @@
+'----------------------------------------------------------------------------
+' EgalTech 2017-2017
+'----------------------------------------------------------------------------
+' File : IniFile.vb Data : 08.04.17 Versione : 1.8d1
+' Contenuto : Modulo IniFile per gestione lettura/scrittura da file INI.
+'
+'
+'
+' Modifiche : 08.04.17 ES Creazione modulo.
+'
+'
+'----------------------------------------------------------------------------
+
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Module BTLIniFile
+
+ Public m_sBTLIniFile As String
+
+ Public Function GetBeamPrivateProfileProcessList(IpGRPType As GRPType, ByRef IpProcessList As ObservableCollection(Of Integer)) As Boolean
+ Dim PRCList As New ObservableCollection(Of Integer)
+ Dim sProcess As String = String.Empty
+ If EgtUILib.GetPrivateProfileString(PROCESSINGS, IpGRPType, String.Empty, sProcess, m_sBTLIniFile) > 0 Then
+ Dim sProcesses() As String = sProcess.Split(","c)
+ ' verifico ce ne sia almeno uno
+ If sProcesses.Count >= 0 Then
+ ' cancello spazi
+ For Index = 0 To sProcesses.Count - 1
+ sProcesses(Index) = sProcesses(Index).Trim()
+ Dim nProcess As Integer
+ Integer.TryParse(sProcesses(Index), nProcess)
+ PRCList.Add(nProcess)
+ Next
+ IpProcessList = PRCList
+ Return True
+ End If
+ End If
+ Return False
+ End Function
+
+ Public Function GetBeamPrivateProfileGRPList(IpGRP As Integer, IpPRC As Integer, ByRef IpGRPList As ObservableCollection(Of Integer)) As Boolean
+ IpGRPList.Clear()
+ ' ciclo sui tipi di gruppo
+ Dim sBTLGroup As String = String.Empty
+ If EgtUILib.GetPrivateProfileString(IpGRP & "." & IpPRC, BTL_FTR_GRP, String.Empty, sBTLGroup, m_sBTLIniFile) > 0 Then
+ Dim sBTLGroups() As String = sBTLGroup.Split(","c)
+ ' verifico numero minimo di parametri
+ If sBTLGroups.Count >= 0 Then
+ ' cancello spazi
+ For Index = 0 To sBTLGroups.Count - 1
+ sBTLGroups(Index) = sBTLGroups(Index).Trim()
+ Next
+ ' creo parametro
+ For Each Group In sBTLGroups
+ Dim nGroup As Integer = -1
+ Integer.TryParse(Group, nGroup)
+ If IpGRP = GRPType.L And (nGroup = 0 OrElse nGroup = 3 OrElse nGroup = 4) Then
+ IpGRPList.Add(nGroup)
+ ElseIf IpGRP = GRPType.T And (nGroup = 1 OrElse nGroup = 2) Then
+ IpGRPList.Add(nGroup)
+ End If
+ Next
+ End If
+ End If
+ Return IpGRPList.Count > 0
+ End Function
+
+ 'Public Function GetBeamPrivateProfileVerifyGRP(IpAppName As String, IpGPRtoVerify As String) As Boolean
+ ' ' ciclo sui tipi di gruppo
+ ' Dim sBTLGroup As String = String.Empty
+ ' If EgtUILib.GetPrivateProfileString(IpAppName, BTL_FTR_GRP, String.Empty, sBTLGroup, m_sBTLIniFile) > 0 Then
+ ' Dim sBTLGroups() As String = sBTLGroup.Split(","c)
+ ' ' verifico numero minimo di parametri
+ ' If sBTLGroups.Count >= 0 Then
+ ' ' cancello spazi
+ ' For Index = 0 To sBTLGroups.Count - 1
+ ' sBTLGroups(Index) = sBTLGroups(Index).Trim()
+ ' Next
+ ' End If
+ ' Return sBTLGroups.Contains(IpGPRtoVerify)
+ ' End If
+ ' Return False
+ 'End Function
+
+ Public Function CalcBeamPrivateProfileGRP(nGRP As Integer) As Integer
+ If nGRP = 1 Or nGRP = 2 Then
+ Return 1
+ ElseIf nGRP = 0 Or nGRP = 3 Or nGRP = 4 Then
+ Return 0
+ Else
+ Return nGRP
+ End If
+ End Function
+
+ Public Function GetBeamPrivateProfileName(IpGRP As Integer, IpPRC As Integer, ByRef IpBTLFeature As BTLFeature) As Boolean
+ Dim sBTLName As String = String.Empty
+ ' creo lista GRP e leggo nome
+ If EgtUILib.GetPrivateProfileString(CalcBeamPrivateProfileGRP(IpGRP) & "." & IpPRC, BTL_FTR_NAME, String.Empty, sBTLName, m_sBTLIniFile) > 0 Then
+ ' verifico numero minimo di parametri
+ If Not String.IsNullOrEmpty(sBTLName) Then
+ Dim nNameMsg As Integer
+ Integer.TryParse(sBTLName, nNameMsg)
+ IpBTLFeature.SetName(EgtMsg(nNameMsg))
+ Return True
+ End If
+ End If
+ Return False
+ End Function
+
+ Public Function GetBeamPrivateProfileName(IpGRP As Integer, IpPRC As Integer) As String
+ Dim sBTLName As String = String.Empty
+ ' creo lista GRP e leggo nome
+ If EgtUILib.GetPrivateProfileString(CalcBeamPrivateProfileGRP(IpGRP) & "." & IpPRC, BTL_FTR_NAME, String.Empty, sBTLName, m_sBTLIniFile) > 0 Then
+ ' verifico numero minimo di parametri
+ If Not String.IsNullOrEmpty(sBTLName) Then
+ Dim nNameMsg As Integer
+ Integer.TryParse(sBTLName, nNameMsg)
+ Return EgtMsg(nNameMsg)
+ Return True
+ End If
+ End If
+ Return ""
+ End Function
+
+ Public Function GetBeamPrivateProfileParam(IpGRP As Integer, IpPRC As Integer, IsP As Boolean, IpFeatureParamIndex As String, IpParentFeature As BTLFeature, ByRef IpBTLParam As BTLParam) As Boolean
+ Dim sBTLParam As String = String.Empty
+ If EgtUILib.GetPrivateProfileString(CalcBeamPrivateProfileGRP(IpGRP) & "." & IpPRC, If(IsP, "P", "Q") & IpFeatureParamIndex, String.Empty, sBTLParam, m_sBTLIniFile) > 0 Then
+ Dim sBTLParamParams() As String = sBTLParam.Split(","c)
+ ' verifico numero minimo di parametri
+ If sBTLParamParams.Count >= 6 Then
+ ' cancello spazi
+ For Index = 0 To sBTLParamParams.Count - 1
+ sBTLParamParams(Index) = sBTLParamParams(Index).Trim()
+ Next
+ ' creo parametro
+ If sBTLParamParams(0) = "d" OrElse sBTLParamParams(0) = "l" Then
+ Dim dMin As Double
+ Dim dMax As Double
+ Dim dDefault As Double
+ StringToDouble(sBTLParamParams(2), dMin)
+ StringToDouble(sBTLParamParams(3), dMax)
+ StringToDouble(sBTLParamParams(4), dDefault)
+ Dim ParamType As BTLParamType
+ If sBTLParamParams(0) = "d" Then
+ ParamType = BTLParamType.DOUBLE_
+ Else
+ ParamType = BTLParamType.LENGTH
+ End If
+ IpBTLParam = New BTLParam(IpParentFeature, IsP, ParamType, sBTLParamParams(1), dMin, dMax, dDefault, sBTLParamParams(5))
+ Return Not IsNothing(IpBTLParam)
+ ElseIf sBTLParamParams(0) = "s" Then
+ IpBTLParam = New BTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(5))
+ Return Not IsNothing(IpBTLParam)
+ ElseIf sBTLParamParams(0) = "c" Then
+ Dim nMin As Integer
+ Dim nMax As Integer
+ Dim nDefault As Integer
+ Integer.TryParse(sBTLParamParams(2), nMin)
+ Integer.TryParse(sBTLParamParams(3), nMax)
+ Integer.TryParse(sBTLParamParams(4), nDefault)
+ ' recupero lista valori
+ Dim ValueList As New List(Of String)
+ IpBTLParam = New BTLParam(IpParentFeature, IsP, BTLParamType.COMBO, sBTLParamParams(1), nMin, nMax, nDefault, sBTLParamParams(5), ValueList)
+ Return Not IsNothing(IpBTLParam)
+ End If
+ End If
+ End If
+ Return False
+ End Function
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/Command.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/Command.vb
new file mode 100644
index 00000000..476e71f6
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/Command.vb
@@ -0,0 +1,68 @@
+
+'''
+''' A command whose sole purpose is to
+''' relay its functionality to other
+''' objects by invoking delegates. The
+''' default return value for the CanExecute
+''' method is 'true'.
+'''
+Public Class Command
+ Implements ICommand
+
+#Region "Fields"
+
+ Private ReadOnly _execute As Action(Of Object)
+ Private ReadOnly _canExecute As Predicate(Of Object)
+
+#End Region ' Fields
+
+#Region "Constructors"
+
+ '''
+ ''' Creates a new command that can always execute.
+ '''
+ ''' The execution logic.
+ Public Sub New(ByVal execute As Action(Of Object))
+ Me.New(execute, Nothing)
+ End Sub
+
+ '''
+ ''' Creates a new command.
+ '''
+ ''' The execution logic.
+ ''' The execution status logic.
+ Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
+ If execute Is Nothing Then
+ Throw New ArgumentNullException("execute")
+ End If
+
+ _execute = execute
+ _canExecute = canExecute
+ End Sub
+
+#End Region ' Constructors
+
+#Region "ICommand Members"
+
+ _
+ Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
+ Return If(_canExecute Is Nothing, True, _canExecute(parameter))
+ End Function
+
+ Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
+ AddHandler(ByVal value As EventHandler)
+ AddHandler CommandManager.RequerySuggested, value
+ End AddHandler
+ RemoveHandler(ByVal value As EventHandler)
+ RemoveHandler CommandManager.RequerySuggested, value
+ End RemoveHandler
+ RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
+ End RaiseEvent
+ End Event
+
+ Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
+ _execute(parameter)
+ End Sub
+
+#End Region ' ICommand Members
+End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/CurrentMachine.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/CurrentMachine.vb
new file mode 100644
index 00000000..1cd54e6e
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/CurrentMachine.vb
@@ -0,0 +1,99 @@
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+
+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
+
+#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
+
+#End Region
+
+ 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)
+ ' Nome macchina corrente
+ m_sMachineName = sMachineName
+ ' Impostazione direttorio macchina
+ m_sMachDir = sMachinesRootDir & "\" & sMachineName
+ ' Impostazione path MachIni file
+ m_sMachIniFile = sMachinesRootDir & "\" & sMachineName & "\" & sMachineName & ".ini"
+ ' Impostazione path MachParamIni file
+ m_sMachParamIniFile = sMachinesRootDir & "\" & sMachineName & "\" & K_BEAM & "\" & MACH_INI_FILE_NAME
+
+ ' crea l'elenco dei parametri della macchina corrente
+ CreateMachParams()
+
+ 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
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/Dictionary.xaml b/EgtBEAMWALL.ViewerOptimizer/Utility/Dictionary.xaml
new file mode 100644
index 00000000..d36cabdd
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/Dictionary.xaml
@@ -0,0 +1,646 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/Dictionary.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/Dictionary.xaml.vb
new file mode 100644
index 00000000..fef4e3b7
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/Dictionary.xaml.vb
@@ -0,0 +1,30 @@
+Public Class OmagOFFICEDictionary
+
+ Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM"
+
+#Region "Colors"
+
+ Private m_Omag_Red As SolidColorBrush = Brushes.Red
+ Public ReadOnly Property Omag_Red As SolidColorBrush
+ Get
+ Return m_Omag_Red
+ End Get
+ End Property
+
+ Private Shared m_Button_Static_Background As SolidColorBrush = New BrushConverter().ConvertFrom("#FFDDDDDD")
+ Public Shared ReadOnly Property Button_Static_Background As SolidColorBrush
+ Get
+ Return m_Button_Static_Background
+ End Get
+ End Property
+
+ Private Shared m_TabControl_Header_Background As LinearGradientBrush = Application.Current.FindResource("TabItem.Static.Background")
+ Public Shared ReadOnly Property TabControl_Header_Background As LinearGradientBrush
+ Get
+ Return m_TabControl_Header_Background
+ End Get
+ End Property
+
+#End Region ' Colors
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb
new file mode 100644
index 00000000..e4de37d0
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb
@@ -0,0 +1,120 @@
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Module LuaExec
+
+ Friend Function ExecBeam(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean) As Boolean
+ EgtOutLog("-- Start ExecBeam --")
+ ' Recupero lo script da eseguire
+ Dim sExecPath As String = ""
+ Dim sExecName As String = ""
+ GetMainPrivateProfileString(S_BEAM, K_BEAMBWEEXEC, "", sExecName)
+ sExecPath = (Map.refMainWindowVM.MainWindowM.sBeamRoot & "\" & sExecName).TrimEnd({"\"c})
+ If Not My.Computer.FileSystem.FileExists(sExecPath) Then
+ EgtOutLog("Not found BeamExec script " & sExecPath)
+ Return False
+ End If
+ ' Assegno i dati
+ EgtLuaCreateGlobTable("BEAM")
+ EgtLuaSetGlobStringVar("BEAM.FILE", sFile)
+ EgtLuaSetGlobStringVar("BEAM.MACHINE", sMachine)
+ EgtLuaSetGlobIntVar("BEAM.FLAG", nFlag)
+ ' Eseguo lo script
+ Dim bOk As Boolean = False
+ If EgtLuaExecFile(sExecPath) Then
+ ' Recupero i risultati
+ Dim nErr As Integer = 999
+ EgtLuaGetGlobIntVar("BEAM.ERR", nErr)
+ bOk = (nErr <= 0)
+ If Not bOk Then EgtOutLog("BeamExec Err=" & nErr.ToString())
+ Else
+ EgtOutLog("Error executing Beam Exec script " & sExecPath)
+ Return False
+ End If
+ ' Cancello tavola globale
+ EgtLuaResetGlobVar("BEAM")
+ Return bOk
+ End Function
+
+ Friend Function ExecWall(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean) As Boolean
+ EgtOutLog("-- Start ExecWall --")
+ ' Recupero lo script da eseguire
+ Dim sExecPath As String = ""
+ Dim sExecName As String = ""
+ GetMainPrivateProfileString(S_WALL, K_WALLBWEEXEC, "", sExecName)
+ sExecPath = (Map.refMainWindowVM.MainWindowM.sWallRoot & "\" & sExecName).TrimEnd({"\"c})
+ If Not My.Computer.FileSystem.FileExists(sExecPath) Then
+ EgtOutLog("Not found WallExec script " & sExecPath)
+ Return False
+ End If
+ ' Assegno i dati
+ EgtLuaCreateGlobTable("WALL")
+ EgtLuaSetGlobStringVar("WALL.FILE", sFile)
+ EgtLuaSetGlobStringVar("WALL.MACHINE", sMachine)
+ EgtLuaSetGlobIntVar("WALL.FLAG", nFlag)
+ ' Eseguo lo script
+ Dim bOk As Boolean = False
+ If EgtLuaExecFile(sExecPath) Then
+ ' Recupero i risultati
+ Dim nErr As Integer = 999
+ EgtLuaGetGlobIntVar("WALL.ERR", nErr)
+ bOk = (nErr <= 0)
+ If Not bOk Then EgtOutLog("WallExec Err=" & nErr.ToString())
+ Else
+ bOk = False
+ EgtOutLog("Error executing Wall Exec script " & sExecPath)
+ End If
+ ' Cancello tavola globale
+ EgtLuaResetGlobVar("WALL")
+ Return bOk
+ End Function
+
+ Friend Function ExecNesting(sFile As String, sMachine As String, PartList As List(Of BTLPart), dLength As Double, dWidth As Double, dStartOffset As Double, dOffset As Double, dKerf As Double) As Boolean
+ EgtOutLog("-- Start ExecNest --")
+ ' Recupero lo script da eseguire
+ Dim sExecPath As String = ""
+ Dim sExecName As String = ""
+ GetMainPrivateProfileString(S_NEST, K_NESTEXEC, "", sExecName)
+ Dim sRoot As String = ""
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ sRoot = Map.refMainWindowVM.MainWindowM.sBeamRoot
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ sRoot = Map.refMainWindowVM.MainWindowM.sWallRoot
+ End If
+ sExecPath = (sRoot & "\" & sExecName).TrimEnd({"\"c})
+ If Not My.Computer.FileSystem.FileExists(sExecPath) Then
+ EgtOutLog("Not found NestExec script " & sExecPath)
+ Return False
+ End If
+ ' Assegno i dati
+ EgtLuaCreateGlobTable("NEST")
+ EgtLuaSetGlobStringVar("NEST.FILE", sFile)
+ EgtLuaSetGlobStringVar("NEST.MACHINE", sMachine)
+ EgtLuaSetGlobNumVar("NEST.LEN", dLength)
+ EgtLuaSetGlobNumVar("NEST.WIDTH", dWidth)
+ EgtLuaSetGlobNumVar("NEST.STARTOFFSET", dStartOffset)
+ EgtLuaSetGlobNumVar("NEST.OFFSET", dOffset)
+ EgtLuaSetGlobNumVar("NEST.KERF", dKerf)
+ EgtLuaCreateGlobTable("PART")
+ For PartIndex = 0 To PartList.Count - 1
+ EgtLuaSetGlobIntVar("PART." & PartList(PartIndex).nPartId.ToString(), PartList(PartIndex).nCNT)
+ Next
+ ' Eseguo lo script
+ Dim bOk As Boolean = False
+ If EgtLuaExecFile(sExecPath) Then
+ ' Recupero i risultati
+ Dim nErr As Integer = 999
+ EgtLuaGetGlobIntVar("NEST.ERR", nErr)
+ bOk = (nErr <= 0)
+ If Not bOk Then EgtOutLog("NestExec Err=" & nErr.ToString())
+ Else
+ bOk = False
+ EgtOutLog("Error executing Nest Exec script " & sExecPath)
+ End If
+ ' Cancello tavola globale
+ EgtLuaResetGlobVar("NEST")
+ EgtLuaResetGlobVar("PART")
+ Return bOk
+ End Function
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/MachParamIniFile.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/MachParamIniFile.vb
new file mode 100644
index 00000000..7ac45b9f
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/MachParamIniFile.vb
@@ -0,0 +1,64 @@
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Friend Module MachParamIniFile
+
+ Public Function GetMachPrivateProfileParam(IpParentTable As Integer, IpMachParamIndex As String, ByRef IpMachParam As MachParam) As Boolean
+ Dim sMachParam As String = String.Empty
+ If EgtUILib.GetPrivateProfileString(IpParentTable, IpMachParamIndex, String.Empty, sMachParam, sMachParamIniFile) > 0 Then
+ Dim sMachParamParams() As String = sMachParam.Split(","c)
+ ' verifico numero minimo di parametri
+ If sMachParamParams.Count >= 4 Then
+ ' cancello spazi
+ For Index = 0 To sMachParamParams.Count - 1
+ sMachParamParams(Index) = sMachParamParams(Index).Trim()
+ Next
+ ' creo parametro
+ If sMachParamParams(0) = "d" OrElse sMachParamParams(0) = "l" Then
+ Dim dDefault As Double
+ StringToDouble(sMachParamParams(2), dDefault)
+ Dim ParamType As MachParamType
+ If sMachParamParams(0) = "d" Then
+ ParamType = MachParamType.DOUBLE_
+ Else
+ ParamType = MachParamType.LENGTH
+ End If
+ IpMachParam = New MachParam(IpParentTable, IpMachParamIndex, ParamType, sMachParamParams(1), dDefault, sMachParamParams(3))
+ Return Not IsNothing(IpMachParam)
+ ElseIf sMachParamParams(0) = "s" Then
+ IpMachParam = New MachParam(IpParentTable, IpMachParamIndex, MachParamType.STRING_, sMachParamParams(1), sMachParamParams(3))
+ Return Not IsNothing(IpMachParam)
+ End If
+ End If
+ End If
+ Return False
+ End Function
+
+ Public Function GetMachPrivateProfileString(IpAppName As String, IpKeyName As String, IpDefault As String, ByRef IpString As String) As Integer
+ Return EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, sMachParamIniFile)
+ End Function
+
+ Public Function GetMachPrivateProfileParamValue(IpParentTable As Integer, IpMachParamIndex As String, ByRef IpMachParamValue As String) As Boolean
+ Dim sMachParam As String = String.Empty
+ If EgtUILib.GetPrivateProfileString(IpParentTable, IpMachParamIndex, String.Empty, sMachParam, sMachParamIniFile) > 0 Then
+ Dim sMachParamParams() As String = sMachParam.Split(","c)
+ ' verifico numero minimo di parametri
+ If sMachParamParams.Count >= 4 Then
+ ' cancello spazi
+ For Index = 0 To sMachParamParams.Count - 1
+ sMachParamParams(Index) = sMachParamParams(Index).Trim()
+ Next
+ 'restituisco il valore del parametro
+ IpMachParamValue = sMachParamParams(2)
+ Return Not IsNothing(IpMachParamValue)
+ End If
+ End If
+ Return False
+ End Function
+
+ Public Function WriteMachPrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean
+ Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, sMachParamIniFile)
+ End Function
+
+End Module
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb
new file mode 100644
index 00000000..2a07fa04
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb
@@ -0,0 +1,307 @@
+Imports EgtWPFLib5
+
+Module Map
+
+ Private m_refMainWindowVM As MainWindowVM
+ Private m_refMyStatusBarVM As MyStatusBarVM
+ Private m_refProjManagerVM As ProjManagerVM
+ Private m_refProdManagerVM As ProdManagerVM
+ Private m_refProjectVM As ProjectVM
+ Private m_refMainMenuVM As MainMenuVM
+ Private m_refMachinePanelVM As MachinePanelVM
+ Private m_refLeftPanelVM As LeftPanelVM
+ Private m_refBottomPanelVM As BottomPanelVM
+ Private m_refShowBeamPanelVM As ShowBeamPanelVM
+ Private m_refConfigurationPageVM As ConfigurationPageVM
+ Private m_refRawPartListVM As RawPartListVM
+ Private m_refWarehouseWndVM As WarehouseWndVM
+ 'Private m_refRawPartTabVM As RawPartTabVM
+ 'Private m_refNestingTabVM As NestingTabVM
+ 'Private m_refMachiningTabVM As MachiningTabVM
+ 'Private m_refSplitModeVM As SplitModeVM
+ 'Private m_refMoveRawModeVM As MoveRawModeVM
+ 'Private m_refSimulTabVM As SimulTabVM
+
+#Region "Get"
+
+ Public ReadOnly Property refMainWindowVM As MainWindowVM
+ Get
+ Return m_refMainWindowVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refMyStatusBarVM As MyStatusBarVM
+ Get
+ Return LibMap.refStatusBarVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refProjManagerVM As ProjManagerVM
+ Get
+ Return m_refProjManagerVM
+ End Get
+ End Property
+ Public ReadOnly Property refProdManagerVM As ProdManagerVM
+ Get
+ Return m_refProdManagerVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refProjectVM As ProjectVM
+ Get
+ Return m_refProjectVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refSceneHostVM As SceneHostVM
+ Get
+ Return LibMap.refSceneHostVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refShowPanelVM As ShowPanelVM
+ Get
+ Return LibMap.refShowPanelVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refMainMenuVM As MainMenuVM
+ Get
+ Return m_refMainMenuVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refMachinePanelVM As MachinePanelVM
+ Get
+ Return m_refMachinePanelVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refLeftPanelVM As LeftPanelVM
+ Get
+ Return m_refLeftPanelVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refMachGroupPanelVM As MyMachGroupPanelVM
+ Get
+ Return LibMap.refMachGroupPanelVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refBottomPanelVM As BottomPanelVM
+ Get
+ Return m_refBottomPanelVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refShowBeamPanelVM As ShowBeamPanelVM
+ Get
+ Return m_refShowBeamPanelVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refConfigurationPageVM As ConfigurationPageVM
+ Get
+ Return m_refConfigurationPageVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refRawPartListVM As RawPartListVM
+ Get
+ Return m_refRawPartListVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refWarehouseWndVM As WarehouseWndVM
+ Get
+ Return m_refWarehouseWndVM
+ End Get
+ End Property
+
+ 'Public ReadOnly Property refOptionPanelVM As OptionPanelVM
+ ' Get
+ ' Return m_refOptionPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refRawPartTabVM As RawPartTabVM
+ ' Get
+ ' Return m_refRawPartTabVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refNestingTabVM As NestingTabVM
+ ' Get
+ ' Return m_refNestingTabVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refMachiningTabVM As MachiningTabVM
+ ' Get
+ ' Return m_refMachiningTabVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refSplitModeVM As SplitModeVM
+ ' Get
+ ' Return m_refSplitModeVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refMoveRawModeVM As MoveRawModeVM
+ ' Get
+ ' Return m_refMoveRawModeVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refSimulTabVM As SimulTabVM
+ ' Get
+ ' Return m_refSimulTabVM
+ ' End Get
+ 'End Property
+
+#End Region ' Get
+
+#Region "Set"
+
+ Friend Function SetRefStatusBarVM(StatusBarVM As StatusBarVM) As Boolean
+ LibMap.SetRefStatusBarVM(StatusBarVM)
+ Return Not IsNothing(LibMap.refStatusBarVM)
+ End Function
+
+ Friend Function SetRefProjManagerVM(ProjManagerVM As ProjManagerVM) As Boolean
+ m_refProjManagerVM = ProjManagerVM
+ Return Not IsNothing(m_refProjManagerVM)
+ End Function
+
+ Friend Function SetRefProdManagerVM(ProdManagerVM As ProdManagerVM) As Boolean
+ m_refProdManagerVM = ProdManagerVM
+ Return Not IsNothing(m_refProdManagerVM)
+ End Function
+
+ Friend Function SetRefProjectVM(ProjectVM As ProjectVM) As Boolean
+ m_refProjectVM = ProjectVM
+ Return Not IsNothing(m_refProjectVM)
+ End Function
+
+ Friend Function SetRefMainMenuVM(MainMenuVM As MainMenuVM) As Boolean
+ m_refMainMenuVM = MainMenuVM
+ Return Not IsNothing(m_refMainMenuVM)
+ End Function
+
+ Friend Function SetRefSceneHostVM(SceneHostVM As SceneHostVM) As Boolean
+ LibMap.SetRefSceneHostVM(SceneHostVM)
+ Return Not IsNothing(LibMap.refSceneHostVM)
+ End Function
+
+ Friend Function SetRefShowPanelVM(ShowPanelVM As ShowPanelVM) As Boolean
+ LibMap.SetRefShowPanelVM(ShowPanelVM)
+ Return Not IsNothing(LibMap.refShowPanelVM)
+ End Function
+
+ Friend Function SetRefMachinePanelVM(MachinePanelVM As MachinePanelVM) As Boolean
+ m_refMachinePanelVM = MachinePanelVM
+ Return Not IsNothing(m_refMachinePanelVM)
+ End Function
+
+ Friend Function SetRefLeftPanelVM(LeftPanelVM As LeftPanelVM) As Boolean
+ m_refLeftPanelVM = LeftPanelVM
+ Return Not IsNothing(m_refLeftPanelVM)
+ End Function
+
+ Friend Function SetRefMachGroupPanelVM(MachGroupPanelVM As MyMachGroupPanelVM) As Boolean
+ LibMap.SetRefMachGroupPanelVM(MachGroupPanelVM)
+ Return Not IsNothing(LibMap.refMachGroupPanelVM)
+ End Function
+
+ Friend Function SetRefBottomPanelVM(BottomPanelVM As BottomPanelVM) As Boolean
+ m_refBottomPanelVM = BottomPanelVM
+ Return Not IsNothing(m_refBottomPanelVM)
+ End Function
+
+ Friend Function SetRefShowBeamPanelVM(ShowBeamPanelVM As ShowBeamPanelVM) As Boolean
+ m_refShowBeamPanelVM = ShowBeamPanelVM
+ Return Not IsNothing(m_refShowBeamPanelVM)
+ End Function
+
+ Friend Function SetRefConfigurationPageVM(ConfigurationPageVM As ConfigurationPageVM) As Boolean
+ m_refConfigurationPageVM = ConfigurationPageVM
+ Return Not IsNothing(m_refConfigurationPageVM)
+ End Function
+
+ Friend Function SetRefRawPartListVM(RawPartListVM As RawPartListVM) As Boolean
+ m_refRawPartListVM = RawPartListVM
+ Return Not IsNothing(m_refRawPartListVM)
+ End Function
+
+ Friend Function SetRefWarehouseWndVM(WarehouseWndVM As WarehouseWndVM) As Boolean
+ m_refWarehouseWndVM = WarehouseWndVM
+ Return Not IsNothing(m_refWarehouseWndVM)
+ End Function
+
+ 'Friend Function SetRefOptionPanelVM(OptionPanelVM As OptionPanelVM) As Boolean
+ ' m_refOptionPanelVM = OptionPanelVM
+ ' Return Not IsNothing(m_refOptionPanelVM)
+ 'End Function
+
+ 'Friend Function SetRefRawPartTabVM(RawPartTabVM As RawPartTabVM) As Boolean
+ ' m_refRawPartTabVM = RawPartTabVM
+ ' Return Not IsNothing(m_refRawPartTabVM)
+ 'End Function
+
+ 'Friend Function SetRefNestingTabVM(NestingTabVM As NestingTabVM) As Boolean
+ ' m_refNestingTabVM = NestingTabVM
+ ' Return Not IsNothing(m_refNestingTabVM)
+ 'End Function
+
+ 'Friend Function SetRefMachiningTabVM(MachiningTabVM As MachiningTabVM) As Boolean
+ ' m_refMachiningTabVM = MachiningTabVM
+ ' Return Not IsNothing(m_refMachiningTabVM)
+ 'End Function
+
+ 'Friend Function SetRefSplitModeVM(SplitModeVM As SplitModeVM) As Boolean
+ ' m_refSplitModeVM = SplitModeVM
+ ' Return Not IsNothing(m_refSplitModeVM)
+ 'End Function
+
+ 'Friend Function SetRefMoveRawModeVM(MoveRawModeVM As MoveRawModeVM) As Boolean
+ ' m_refMoveRawModeVM = MoveRawModeVM
+ ' Return Not IsNothing(m_refMoveRawModeVM)
+ 'End Function
+
+ 'Friend Function SetRefSimulTabVM(SimulTabVM As SimulTabVM) As Boolean
+ ' m_refSimulTabVM = SimulTabVM
+ ' Return Not IsNothing(m_refSimulTabVM)
+ 'End Function
+
+#End Region ' Set
+
+#Region "Init"
+
+ Friend Function BeginInit(MainWindowVM As MainWindowVM) As Boolean
+ m_refMainWindowVM = MainWindowVM
+ Return Not IsNothing(m_refMainWindowVM)
+ End Function
+ Friend Function EndInit() As Boolean
+ ' Verifico se tutti i pezzi necessari sono stati caricati
+ 'Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refProjectVM) AndAlso
+ ' Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refProjectManagerVM) AndAlso
+ ' Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
+ ' Not IsNothing(m_refVeinMatchPanelVM) AndAlso
+ ' Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refRawPartTabVM) AndAlso
+ ' Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso
+ ' Not IsNothing(m_refMachiningTabVM) AndAlso
+ ' LibMap.EndInit()
+ Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refMainMenuVM) AndAlso
+ Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refProjManagerVM) AndAlso
+ Not IsNothing(m_refProdManagerVM) AndAlso Not IsNothing(m_refConfigurationPageVM) AndAlso
+ Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
+ Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(LibMap.refMachGroupPanelVM) AndAlso
+ Not IsNothing(m_refRawPartListVM) AndAlso Not IsNothing(m_refWarehouseWndVM) AndAlso
+ Not IsNothing(m_refShowBeamPanelVM) AndAlso LibMap.EndInit()
+ End Function
+
+#End Region ' Init
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/RawPartConfiguration.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/RawPartConfiguration.vb
new file mode 100644
index 00000000..cad89875
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/RawPartConfiguration.vb
@@ -0,0 +1,17 @@
+Module RawPartConfiguration
+
+ Private m_dBeamDist As Double = 5.4
+ Public ReadOnly Property dBeamDist As Double
+ Get
+ Return m_dBeamDist
+ End Get
+ End Property
+
+ Private m_dWallDist As Double = 40
+ Public ReadOnly Property dWallDist As Double
+ Get
+ Return m_dWallDist
+ End Get
+ End Property
+
+End Module
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/VMBase.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/VMBase.vb
new file mode 100644
index 00000000..b2d5ce6c
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/VMBase.vb
@@ -0,0 +1,12 @@
+Imports System.ComponentModel
+
+Public Class VMBase
+ Implements INotifyPropertyChanged
+
+ Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
+
+ Public Sub NotifyPropertyChanged(propName As String)
+ RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ViewPage/ViewPageV.xaml b/EgtBEAMWALL.ViewerOptimizer/ViewPage/ViewPageV.xaml
new file mode 100644
index 00000000..4773cb7b
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ViewPage/ViewPageV.xaml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ViewPage/ViewPageV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/ViewPage/ViewPageV.xaml.vb
new file mode 100644
index 00000000..769e4aaf
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ViewPage/ViewPageV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class ViewPageV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ViewPage/ViewPageVM.vb b/EgtBEAMWALL.ViewerOptimizer/ViewPage/ViewPageVM.vb
new file mode 100644
index 00000000..f9d3a485
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ViewPage/ViewPageVM.vb
@@ -0,0 +1,16 @@
+Public Class ViewPageVM
+ Inherits VMBase
+
+ ' classe di gestione del progetto btl
+ Private m_BTLParameters As BTLParametersVM
+ Public Property BTLParameters As BTLParametersVM
+ Get
+ Return m_BTLParameters
+ End Get
+ Set(value As BTLParametersVM)
+ m_BTLParameters = value
+ End Set
+ End Property
+
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/ViewPanel/ViewPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/ViewPanel/ViewPanelV.xaml
new file mode 100644
index 00000000..0caf70a0
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ViewPanel/ViewPanelV.xaml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ViewPanel/ViewPanelV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/ViewPanel/ViewPanelV.xaml.vb
new file mode 100644
index 00000000..d9dd0b2c
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/ViewPanel/ViewPanelV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class ViewPanelV
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/WarehouseWnd/WarehouseWndV.xaml b/EgtBEAMWALL.ViewerOptimizer/WarehouseWnd/WarehouseWndV.xaml
new file mode 100644
index 00000000..374cccf8
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/WarehouseWnd/WarehouseWndV.xaml
@@ -0,0 +1,262 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/WarehouseWnd/WarehouseWndV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/WarehouseWnd/WarehouseWndV.xaml.vb
new file mode 100644
index 00000000..6b0b6d27
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/WarehouseWnd/WarehouseWndV.xaml.vb
@@ -0,0 +1,19 @@
+Public Class WarehouseWndV
+
+ Private WithEvents m_WarehouseWndVM As WarehouseWndVM
+
+ Sub New(Owner As Window, WarehouseWndVM As WarehouseWndVM)
+ MyBase.New(Owner)
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = WarehouseWndVM
+ Me.Tag = Map.refProjectVM.BTLStructure
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_WarehouseWndVM = WarehouseWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_WarehouseWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/WarehouseWnd/WarehouseWndVM.vb b/EgtBEAMWALL.ViewerOptimizer/WarehouseWnd/WarehouseWndVM.vb
new file mode 100644
index 00000000..8be6bef3
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/WarehouseWnd/WarehouseWndVM.vb
@@ -0,0 +1,1010 @@
+Imports EgtWPFLib5
+Imports EgtUILib
+Imports System.Collections.ObjectModel
+Imports System.Windows.Forms
+Imports EgtBEAMWALL.Core
+
+Public Class WarehouseWndVM
+ Inherits VMBase
+
+#Region "Messages"
+
+ Public ReadOnly Property CurrentS_Msg As String
+ Get
+ Select Case Map.refMachinePanelVM.SelectedMachine.nType
+ Case MachineType.BEAM
+ Return EgtMsg(61752)
+ Case MachineType.WALL
+ Return EgtMsg(61751)
+ End Select
+ Return Nothing
+ End Get
+ End Property
+
+ Public ReadOnly Property StartOffset_Msg As String
+ Get
+ Return EgtMsg(61753)
+ End Get
+ End Property
+
+ Public ReadOnly Property Kerf_Msg As String
+ Get
+ Return EgtMsg(61754)
+ End Get
+ End Property
+
+ Public ReadOnly Property Offset_Msg As String
+ Get
+ Return EgtMsg(61755)
+ End Get
+ End Property
+
+ Public ReadOnly Property SParams_Msg As String
+ Get
+ Select Case Map.refMachinePanelVM.SelectedMachine.nType
+ Case MachineType.BEAM
+ Return EgtMsg(61757)
+ Case MachineType.WALL
+ Return EgtMsg(61756)
+ End Select
+ Return Nothing
+ End Get
+ End Property
+
+ Public ReadOnly Property NewParam_Msg As String
+ Get
+ Return EgtMsg(61758)
+ End Get
+ End Property
+
+ Public ReadOnly Property W_Msg As String
+ Get
+ Return EgtMsg(61759)
+ End Get
+ End Property
+
+ Public ReadOnly Property L_Msg As String
+ Get
+ Return EgtMsg(61760)
+ End Get
+ End Property
+
+ Public ReadOnly Property OkAddParam_Msg As String
+ Get
+ Return EgtMsg(61761)
+ End Get
+ End Property
+
+ Public ReadOnly Property Save_Msg As String
+ Get
+ Return EgtMsg(61762)
+ End Get
+ End Property
+
+ Public ReadOnly Property Cancel_Msg As String
+ Get
+ Return EgtMsg(61763)
+ End Get
+ End Property
+
+ Public ReadOnly Property Error_Msg As String
+ Get
+ Return EgtMsg(61764)
+ End Get
+ End Property
+
+ Public ReadOnly Property ValueExists_Msg As String
+ Get
+ Return EgtMsg(61765)
+ End Get
+ End Property
+
+ Public ReadOnly Property IncorrectValue_Msg As String
+ Get
+ Return EgtMsg(61766)
+ End Get
+ End Property
+
+ Public ReadOnly Property ValuesExist_Msg As String
+ Get
+ Return EgtMsg(61767)
+ End Get
+ End Property
+
+ Public ReadOnly Property IncorrectValues_Msg As String
+ Get
+ Return EgtMsg(61768)
+ End Get
+ End Property
+
+ Public ReadOnly Property Attention_Msg As String
+ Get
+ Return EgtMsg(61769)
+ End Get
+ End Property
+
+ Public ReadOnly Property RemoveCurrent_Msg As String
+ Get
+ Return EgtMsg(61770)
+ End Get
+ End Property
+
+#End Region ' Messages
+
+#Region "FIELDS & PROPERTIES"
+
+ ' Contatore dei parametri L/S rimossi in finestra per successiva rimozione dal file INI
+ Private m_RemovedParamsCount As Integer = 0
+
+ Private m_WhType As WarehouseType
+ Public ReadOnly Property WhType As WarehouseType
+ Get
+ Return m_WhType
+ End Get
+ End Property
+
+ Private m_dStartOffset As Double
+ Public Property dStartOffset As Double
+ Get
+ Return m_dStartOffset
+ End Get
+ Set(value As Double)
+ m_dStartOffset = value
+ NotifyPropertyChanged("dStartOffset")
+ End Set
+ End Property
+
+ Private m_dKerf As Double
+ Public Property dKerf As Double
+ Get
+ Return m_dKerf
+ End Get
+ Set(value As Double)
+ m_dKerf = value
+ NotifyPropertyChanged("dKerf")
+ End Set
+ End Property
+
+ Private m_dOffset As Double
+ Public Property dOffset As Double
+ Get
+ Return m_dOffset
+ End Get
+ Set(value As Double)
+ m_dOffset = value
+ NotifyPropertyChanged("dOffset")
+ End Set
+ End Property
+
+ Private m_SelCurrentS As SParam
+ Public Property SelCurrentS As SParam
+ Get
+ Return m_SelCurrentS
+ End Get
+ Set(value As SParam)
+ m_SelCurrentS = value
+ End Set
+ End Property
+
+ Private m_SParamList As New ObservableCollection(Of SParam)
+ Public Property SParamList As ObservableCollection(Of SParam)
+ Get
+ Return m_SParamList
+ End Get
+ Set(value As ObservableCollection(Of SParam))
+ m_SParamList = value
+ End Set
+ End Property
+
+ Private m_SelSParam As SParam
+ Public Property SelSParam As SParam
+ Get
+ Return m_SelSParam
+ End Get
+ Set(value As SParam)
+ m_SelSParam = value
+ End Set
+ End Property
+
+ Private m_sNewW As String
+ Public Property sNewW As String
+ Get
+ Return m_sNewW
+ End Get
+ Set(value As String)
+ m_sNewW = value
+ NotifyPropertyChanged("sNewW")
+ End Set
+ End Property
+
+ Private m_sNewL As String
+ Public Property sNewL As String
+ Get
+ Return m_sNewL
+ End Get
+ Set(value As String)
+ m_sNewL = value
+ NotifyPropertyChanged("sNewL")
+ End Set
+ End Property
+
+ Private m_StartOffset_Visibility As Visibility = Visibility.Collapsed
+ Public Property StartOffset_Visibility As Visibility
+ Get
+ Return m_StartOffset_Visibility
+ End Get
+ Set(value As Visibility)
+ m_StartOffset_Visibility = value
+ NotifyPropertyChanged("StartOffset_Visibility")
+ End Set
+ End Property
+
+ Private m_Kerf_Visibility As Visibility = Visibility.Collapsed
+ Public Property Kerf_Visibility As Visibility
+ Get
+ Return m_Kerf_Visibility
+ End Get
+ Set(value As Visibility)
+ m_Kerf_Visibility = value
+ NotifyPropertyChanged("Kerf_Visibility")
+ End Set
+ End Property
+
+ Private m_Basic_Visibility As Visibility = Visibility.Collapsed
+ Public Property Basic_Visibility As Visibility
+ Get
+ Return m_Basic_Visibility
+ End Get
+ Set(value As Visibility)
+ m_Basic_Visibility = value
+ NotifyPropertyChanged("Basic_Visibility")
+ End Set
+ End Property
+
+ Private m_Medium_Visibility As Visibility = Visibility.Collapsed
+ Public Property Medium_Visibility As Visibility
+ Get
+ Return m_Medium_Visibility
+ End Get
+ Set(value As Visibility)
+ m_Medium_Visibility = value
+ NotifyPropertyChanged("Medium_Visibility")
+ End Set
+ End Property
+
+ Private m_AddRemoveBtns_Visibility As Visibility = Visibility.Collapsed
+ Public Property AddRemoveBtns_Visibility As Visibility
+ Get
+ Return m_AddRemoveBtns_Visibility
+ End Get
+ Set(value As Visibility)
+ m_AddRemoveBtns_Visibility = value
+ NotifyPropertyChanged("AddRemoveBtns_Visibility")
+ End Set
+ End Property
+
+ Private m_NewWallParam_Visibility As Visibility = Visibility.Collapsed
+ Public Property NewWallParam_Visibility As Visibility
+ Get
+ Return m_NewWallParam_Visibility
+ End Get
+ Set(value As Visibility)
+ m_NewWallParam_Visibility = value
+ NotifyPropertyChanged("NewWallParam_Visibility")
+ End Set
+ End Property
+
+ Private m_NewBeamParam_Visibility As Visibility = Visibility.Collapsed
+ Public Property NewBeamParam_Visibility As Visibility
+ Get
+ Return m_NewBeamParam_Visibility
+ End Get
+ Set(value As Visibility)
+ m_NewBeamParam_Visibility = value
+ NotifyPropertyChanged("NewBeamParam_Visibility")
+ End Set
+ End Property
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ ' Definizione comandi
+ Private m_cmdSave As ICommand
+ Private m_cmdCancel As ICommand
+ Private m_cmdAddParam As ICommand
+ Private m_cmdOkAddParam As ICommand
+ Private m_cmdCancelAddParam As ICommand
+ Private m_cmdRemoveParam As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefWarehouseWndVM(Me)
+
+ Dim sValue As String = String.Empty
+ Dim dValue As Double = 0
+ Dim ParamIndex As Integer = 1
+ m_WhType = GetMainPrivateProfileInt(S_GENERAL, K_WAREHOUSE, 1)
+
+ Select Case WhType
+ Case WarehouseType.BASIC
+
+ Basic_Visibility = Visibility.Visible
+ Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME
+
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ StartOffset_Visibility = Visibility.Visible
+
+ EgtUILib.GetPrivateProfileString(S_BEAM, K_STARTOFFSET, String.Empty, sValue, sWarehousePath)
+ StringToLen(sValue, dStartOffset)
+ EgtUILib.GetPrivateProfileString(S_BEAM, K_OFFSET, String.Empty, sValue, sWarehousePath)
+ StringToLen(sValue, dOffset)
+
+ SParamList = New ObservableCollection(Of SParam)
+ While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
+ StringToLen(sValue, dValue)
+ SParamList.Add(New SParam(dValue))
+ ParamIndex += 1
+ End While
+
+ EgtUILib.GetPrivateProfileString(S_BEAM, K_CURRENTL, String.Empty, sValue, sWarehousePath)
+ SelCurrentS = If(CInt(sValue) > 0 AndAlso CInt(sValue) <= SParamList.Count, SParamList(CInt(sValue) - 1), Nothing)
+
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ Kerf_Visibility = Visibility.Visible
+
+ EgtUILib.GetPrivateProfileString(S_WALL, K_KERF, String.Empty, sValue, sWarehousePath)
+ StringToLen(sValue, dKerf)
+ EgtUILib.GetPrivateProfileString(S_WALL, K_OFFSET, String.Empty, sValue, sWarehousePath)
+ StringToLen(sValue, dOffset)
+
+ SParamList = New ObservableCollection(Of SParam)
+ While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
+
+ Dim sParamValues() As String = sValue.Split(","c)
+ ' verifico numero minimo di parametri
+ If sParamValues.Count >= 2 Then
+ ' cancello spazi
+ For Index = 0 To sParamValues.Count - 1
+ sParamValues(Index) = sParamValues(Index).Trim()
+ Next
+ ' creo parametro
+ Dim dW As Double = 0
+ Dim dL As Double = 0
+ StringToLen(sParamValues(0), dW)
+ StringToLen(sParamValues(1), dL)
+ SParamList.Add(New SParam(dW, dL))
+ End If
+ ParamIndex += 1
+ End While
+
+ EgtUILib.GetPrivateProfileString(S_WALL, K_CURRENTS, String.Empty, sValue, sWarehousePath)
+ SelCurrentS = If(CInt(sValue) > 0 AndAlso CInt(sValue) <= SParamList.Count, SParamList(CInt(sValue) - 1), Nothing)
+
+ End If
+ AddRemoveBtns_Visibility = Visibility.Visible
+
+ Case WarehouseType.MEDIUM
+
+ Medium_Visibility = Visibility.Visible
+ Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
+
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ StartOffset_Visibility = Visibility.Visible
+
+ EgtUILib.GetPrivateProfileString(S_BEAM, K_STARTOFFSET, String.Empty, sValue, sWarehousePath)
+ StringToLen(sValue, dStartOffset)
+ EgtUILib.GetPrivateProfileString(S_BEAM, K_OFFSET, String.Empty, sValue, sWarehousePath)
+ StringToLen(sValue, dOffset)
+
+ SParamList = New ObservableCollection(Of SParam)
+ While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
+
+ Dim sParamValues() As String = sValue.Split(","c)
+ ' verifico numero minimo di parametri
+ If sParamValues.Count >= 4 Then
+ ' cancello spazi
+ For Index = 0 To sParamValues.Count - 1
+ sParamValues(Index) = sParamValues(Index).Trim()
+ Next
+ ' creo parametro
+ Dim dW As Double = 0
+ Dim dH As Double = 0
+ Dim dL As Double = 0
+ StringToLen(sParamValues(0), dW)
+ StringToLen(sParamValues(1), dH)
+ StringToLen(sParamValues(3), dL)
+ SParamList.Add(New SParam(New SectionXMaterial(dW, dH, dL, sParamValues(2)), dL))
+ End If
+ ParamIndex += 1
+ End While
+
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ Kerf_Visibility = Visibility.Visible
+
+ EgtUILib.GetPrivateProfileString(S_WALL, K_KERF, String.Empty, sValue, sWarehousePath)
+ StringToLen(sValue, dKerf)
+ EgtUILib.GetPrivateProfileString(S_WALL, K_OFFSET, String.Empty, sValue, sWarehousePath)
+ StringToLen(sValue, dOffset)
+
+ SParamList = New ObservableCollection(Of SParam)
+ While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
+
+ Dim sParamValues() As String = sValue.Split(","c)
+ ' verifico numero minimo di parametri
+ If sParamValues.Count >= 4 Then
+ ' cancello spazi
+ For Index = 0 To sParamValues.Count - 1
+ sParamValues(Index) = sParamValues(Index).Trim()
+ Next
+ ' creo parametro
+ Dim dH As Double = 0
+ Dim dW As Double = 0
+ Dim dL As Double = 0
+ StringToLen(sParamValues(0), dH)
+ StringToLen(sParamValues(2), dW)
+ StringToLen(sParamValues(3), dL)
+ Dim SPar = New SParam(New SectionXMaterial(dW, dH, dL, sParamValues(1)), dW, dL)
+ SPar.MediumW_Visibility = Visibility.Visible
+ SParamList.Add(SPar)
+ End If
+ ParamIndex += 1
+ End While
+
+ End If
+
+ Case WarehouseType.ADVANCED
+
+ ' CASO NON ANCORA PRESENTE
+
+ End Select
+
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "COMMANDS"
+
+#Region "Save"
+
+ Public ReadOnly Property Save_Command As ICommand
+ Get
+ If m_cmdSave Is Nothing Then
+ m_cmdSave = New Command(AddressOf Save)
+ End If
+ Return m_cmdSave
+ End Get
+ End Property
+
+ Public Sub Save()
+ ' Scrivo i valori nell'INI
+ Dim ParamIndex = 1
+ Select Case WhType
+ Case WarehouseType.BASIC
+
+ Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME
+
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ ' Verifico che i valori siano tutti > 0
+ If dStartOffset <= 0 OrElse dOffset <= 0 Then
+ MessageBox.Show(IncorrectValues_Msg, Error_Msg)
+ Return
+ End If
+ ' Se i valori sono tutti > 0 li scrivo nel file INI
+ WritePrivateProfileString(S_BEAM, K_CURRENTL, SParamList.IndexOf(SelCurrentS) + 1, sWarehousePath)
+ WritePrivateProfileString(S_BEAM, K_STARTOFFSET, LenToString(dStartOffset, 3), sWarehousePath)
+ WritePrivateProfileString(S_BEAM, K_OFFSET, LenToString(dOffset, 3), sWarehousePath)
+ For Each SPItem In SParamList
+ WritePrivateProfileString(S_BEAM, K_L & ParamIndex, SParamList(ParamIndex - 1).sValue, sWarehousePath)
+ ParamIndex += 1
+ Next
+ ' Se ci sono parametri da rimuovere li rimuovo
+ For Index = ParamIndex To ParamIndex + m_RemovedParamsCount
+ WritePrivateProfileString(S_BEAM, K_L & Index, Nothing, sWarehousePath)
+ Next
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ ' Verifico che i valori siano tutti > 0
+ If dKerf <= 0 OrElse dOffset <= 0 Then
+ MessageBox.Show(IncorrectValues_Msg, Error_Msg)
+ Return
+ End If
+ ' Se i valori sono tutti > 0 li scrivo nel file INI
+ WritePrivateProfileString(S_WALL, K_CURRENTS, SParamList.IndexOf(SelCurrentS) + 1, sWarehousePath)
+ WritePrivateProfileString(S_WALL, K_KERF, LenToString(dKerf, 3), sWarehousePath)
+ WritePrivateProfileString(S_WALL, K_OFFSET, LenToString(dOffset, 3), sWarehousePath)
+ For Each SPItem In SParamList
+ WritePrivateProfileString(S_WALL, K_S & ParamIndex, SParamList(ParamIndex - 1).sValue, sWarehousePath)
+ ParamIndex += 1
+ Next
+ ' Se ci sono parametri da rimuovere li rimuovo
+ For Index = ParamIndex To ParamIndex + m_RemovedParamsCount
+ WritePrivateProfileString(S_BEAM, K_S & Index, Nothing, sWarehousePath)
+ Next
+ End If
+ Case WarehouseType.MEDIUM
+
+ Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
+
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ ' Verifico che i valori siano tutti > 0
+ If dStartOffset <= 0 OrElse dOffset <= 0 Then
+ MessageBox.Show(IncorrectValues_Msg, Error_Msg)
+ Return
+ End If
+ For Each SPItem In SParamList
+ If SParamList(ParamIndex - 1).dL <= 0 Then
+ MessageBox.Show(IncorrectValues_Msg, Error_Msg)
+ Return
+ End If
+ ParamIndex += 1
+ Next
+ ' Se i valori sono tutti > 0 li scrivo nel file INI
+ WritePrivateProfileString(S_BEAM, K_STARTOFFSET, LenToString(dStartOffset, 3), sWarehousePath)
+ WritePrivateProfileString(S_BEAM, K_OFFSET, LenToString(dOffset, 3), sWarehousePath)
+ ParamIndex = 1
+ For Each SPItem In SParamList
+ Dim sL As String = String.Empty
+ sL = LenToString(SParamList(ParamIndex - 1).dL, 3)
+ WritePrivateProfileString(S_BEAM, K_L & ParamIndex, SParamList(ParamIndex - 1).sValue & "," & sL, sWarehousePath)
+ ParamIndex += 1
+ Next
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ ' Verifico che i valori siano tutti > 0
+ If dKerf <= 0 OrElse dOffset <= 0 Then
+ MessageBox.Show(IncorrectValues_Msg, Error_Msg)
+ Return
+ End If
+ For Each SPItem In SParamList
+ If SParamList(ParamIndex - 1).dW <= 0 OrElse SParamList(ParamIndex - 1).dL <= 0 Then
+ MessageBox.Show(IncorrectValues_Msg, Error_Msg)
+ Return
+ End If
+ ParamIndex += 1
+ Next
+ ' Se i valori sono tutti > 0 li scrivo nel file INI
+ WritePrivateProfileString(S_WALL, K_KERF, LenToString(dKerf, 3), sWarehousePath)
+ WritePrivateProfileString(S_WALL, K_OFFSET, LenToString(dOffset, 3), sWarehousePath)
+ ParamIndex = 1
+ For Each SPItem In SParamList
+ Dim sW As String = String.Empty
+ Dim sL As String = String.Empty
+ sW = LenToString(SParamList(ParamIndex - 1).dW, 3)
+ sL = LenToString(SParamList(ParamIndex - 1).dL, 3)
+ WritePrivateProfileString(S_WALL, K_S & ParamIndex, SParamList(ParamIndex - 1).sValue & "," & sW & "," & sL, sWarehousePath)
+ ParamIndex += 1
+ Next
+ End If
+
+ Case WarehouseType.ADVANCED
+
+ ' CASO NON ANCORA PRESENTE
+
+ End Select
+
+ RaiseEvent m_CloseWindow(True)
+ End Sub
+
+#End Region ' Save
+
+#Region "Cancel"
+
+ Public ReadOnly Property Cancel_Command As ICommand
+ Get
+ If m_cmdCancel Is Nothing Then
+ m_cmdCancel = New Command(AddressOf Cancel)
+ End If
+ Return m_cmdCancel
+ End Get
+ End Property
+
+ Public Sub Cancel()
+ RaiseEvent m_CloseWindow(True)
+ End Sub
+
+#End Region ' Cancel
+
+#Region "AddParam"
+
+ Public ReadOnly Property AddParam_Command As ICommand
+ Get
+ If m_cmdAddParam Is Nothing Then
+ m_cmdAddParam = New Command(AddressOf AddParam)
+ End If
+ Return m_cmdAddParam
+ End Get
+ End Property
+
+ Public Sub AddParam()
+ Select Case Map.refMachinePanelVM.SelectedMachine.nType
+ Case MachineType.BEAM
+ NewBeamParam_Visibility = Visibility.Visible
+ Case MachineType.WALL
+ NewWallParam_Visibility = Visibility.Visible
+ End Select
+ End Sub
+
+#End Region ' AddParam
+
+#Region "OkAddParam"
+
+ Public ReadOnly Property OkAddParam_Command As ICommand
+ Get
+ If m_cmdOkAddParam Is Nothing Then
+ m_cmdOkAddParam = New Command(AddressOf OkAddParam)
+ End If
+ Return m_cmdOkAddParam
+ End Get
+ End Property
+
+ Public Sub OkAddParam()
+ Dim dWValue As Double = 0
+ Dim dLValue As Double = 0
+ Select Case Map.refMachinePanelVM.SelectedMachine.nType
+ Case MachineType.BEAM
+ If Not IsNothing(sNewL) Then StringToLen(sNewL, dLValue)
+ If dLValue > 0 Then
+ ' controllo il valore immesso non sia già presente
+ Dim bExist As Boolean = False
+ For Each SPItem In SParamList
+ If SPItem.dL = dLValue Then
+ bExist = True
+ Exit For
+ End If
+ Next
+ If bExist Then
+ MessageBox.Show(ValueExists_Msg, Error_Msg)
+ Else
+ SParamList.Add(New SParam(dLValue))
+ sNewL = Nothing
+ NewBeamParam_Visibility = Visibility.Collapsed
+ End If
+ Else
+ MessageBox.Show(IncorrectValue_Msg, Error_Msg)
+ End If
+ Case MachineType.WALL
+ If Not IsNothing(sNewW) Then StringToLen(sNewW, dWValue)
+ If Not IsNothing(sNewL) Then StringToLen(sNewL, dLValue)
+ If dWValue > 0 AndAlso dLValue > 0 Then
+ ' controllo che la coppia di valori immessa non sia già presente
+ Dim bExist As Boolean = False
+ For Each SPItem In SParamList
+ If SPItem.dW = dWValue And SPItem.dL = dLValue Then
+ bExist = True
+ Exit For
+ End If
+ Next
+ If bExist Then
+ MessageBox.Show(ValuesExist_Msg, Error_Msg)
+ Else
+ SParamList.Add(New SParam(dWValue, dLValue))
+ sNewW = Nothing
+ sNewL = Nothing
+ NewWallParam_Visibility = Visibility.Collapsed
+ End If
+ Else
+ MessageBox.Show(IncorrectValues_Msg, Error_Msg)
+ End If
+ End Select
+ End Sub
+
+#End Region ' OkAddParam
+
+#Region "CancelAddParam"
+
+ Public ReadOnly Property CancelAddParam_Command As ICommand
+ Get
+ If m_cmdCancelAddParam Is Nothing Then
+ m_cmdCancelAddParam = New Command(AddressOf CancelAddParam)
+ End If
+ Return m_cmdCancelAddParam
+ End Get
+ End Property
+
+ Public Sub CancelAddParam()
+ sNewW = Nothing
+ sNewL = Nothing
+ NewBeamParam_Visibility = Visibility.Collapsed
+ NewWallParam_Visibility = Visibility.Collapsed
+ End Sub
+
+#End Region ' CancelAddParam
+
+#Region "RemoveParam"
+
+ Public ReadOnly Property RemoveParam_Command As ICommand
+ Get
+ If m_cmdRemoveParam Is Nothing Then
+ m_cmdRemoveParam = New Command(AddressOf RemoveParam)
+ End If
+ Return m_cmdRemoveParam
+ End Get
+ End Property
+
+ Public Sub RemoveParam()
+ If Not IsNothing(SelSParam) Then
+ If SelSParam.Equals(SelCurrentS) Then
+ If MessageBox.Show(RemoveCurrent_Msg, Attention_Msg, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
+ SParamList.Remove(SelSParam)
+ m_RemovedParamsCount += 1
+ If SParamList.Count > 0 Then
+ SelCurrentS = SParamList(0)
+ NotifyPropertyChanged("SelCurrentS")
+ End If
+ End If
+ Return
+ End If
+ SParamList.Remove(SelSParam)
+ m_RemovedParamsCount += 1
+ End If
+ End Sub
+
+#End Region ' RemoveParam
+
+#End Region ' COMMANDS
+
+#Region "METHODS"
+
+ Public Shared Sub CheckExistingSectionXMaterial()
+ Dim NewSectXMatList As New List(Of SectionXMaterial)
+ ' Ricavo la lista dei SectionXMaterial presenti in Warehouse
+ Dim WhSectXMatList As List(Of SectionXMaterial) = GetSectionXMaterialsFromWarehouse()
+ For Each SectionListItem In Map.refProjectVM.BTLStructure.SectionList
+ Dim Index As Integer = 0
+ Dim bEqual As Boolean = False
+ ' Confronto l'Item di SectionList con ciascuno di quelli presenti nella Warehouse
+ For Each SectXMatListItem In WhSectXMatList
+ If SectionListItem = WhSectXMatList(Index) Then
+ ' Se l'Item di SectionList equivale ad uno presente nella Warehouse setto bEqual a True ed esco dal For
+ bEqual = True
+ Exit For
+ End If
+ Index += 1
+ Next
+ ' Se l'Item di SectionList non equivale a nessuno di quelli della Warehouse lo aggiungo alla lista
+ If Not bEqual Then
+ NewSectXMatList.Add(SectionListItem)
+ End If
+ Next
+ ' Se nel BTL importato ci sono SectionXMaterial non presenti nell'INI della Warehouse mostro il dialog per la gestione di questi
+ If NewSectXMatList.Count > 0 Then
+ Dim AddSectionXMaterialWnd As New AddSectionXMaterialWndV(Application.Current.MainWindow, New AddSectionXMaterialWndVM(NewSectXMatList))
+ AddSectionXMaterialWnd.ShowDialog()
+ End If
+ End Sub
+
+ Public Shared Function GetSectionXMaterialsFromWarehouse() As List(Of SectionXMaterial)
+ Dim sValue As String = String.Empty
+ Dim dValue As Double = 0
+ Dim ParamIndex As Integer = 1
+ Dim SectXMatList As New List(Of SectionXMaterial)
+ Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
+
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
+ Dim sParamValues() As String = sValue.Split(","c)
+ ' verifico numero minimo di parametri
+ If sParamValues.Count >= 4 Then
+ ' cancello spazi
+ For Index = 0 To sParamValues.Count - 1
+ sParamValues(Index) = sParamValues(Index).Trim()
+ Next
+ ' creo parametro
+ Dim dW As Double = 0
+ Dim dH As Double = 0
+ Dim dL As Double = 0
+ StringToLen(sParamValues(0), dW)
+ StringToLen(sParamValues(1), dH)
+ StringToLen(sParamValues(3), dL)
+ SectXMatList.Add(New SectionXMaterial(dW, dH, dL, sParamValues(2)))
+ End If
+ ParamIndex += 1
+ End While
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
+ Dim sParamValues() As String = sValue.Split(","c)
+ ' verifico numero minimo di parametri
+ If sParamValues.Count >= 4 Then
+ ' cancello spazi
+ For Index = 0 To sParamValues.Count - 1
+ sParamValues(Index) = sParamValues(Index).Trim()
+ Next
+ ' creo parametro
+ Dim dH As Double = 0
+ Dim dW As Double = 0
+ Dim dL As Double = 0
+ StringToLen(sParamValues(0), dH)
+ StringToLen(sParamValues(2), dW)
+ StringToLen(sParamValues(3), dL)
+ SectXMatList.Add(New SectionXMaterial(dW, dH, dL, sParamValues(1)))
+ End If
+ ParamIndex += 1
+ End While
+ End If
+ Return SectXMatList
+ End Function
+
+ Public Shared Function GetSParamFromWarehouse(ParamIndex As Integer) As SParam
+ Dim nDefault As Integer = 1
+ Dim sValue As String = String.Empty
+ Dim dValue As Double = 0
+ Dim WhType As Integer = GetMainPrivateProfileInt(S_GENERAL, K_WAREHOUSE, nDefault)
+ Select Case WhType
+ Case WarehouseType.BASIC
+ Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ If EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath) Then
+ StringToLen(sValue, dValue)
+ Return New SParam(dValue)
+ ParamIndex += 1
+ End If
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ If EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath) Then
+ Dim sParamValues() As String = sValue.Split(","c)
+ ' verifico numero minimo di parametri
+ If sParamValues.Count >= 2 Then
+ ' cancello spazi
+ For Index = 0 To sParamValues.Count - 1
+ sParamValues(Index) = sParamValues(Index).Trim()
+ Next
+ ' creo parametro
+ Dim dW As Double = 0
+ Dim dL As Double = 0
+ StringToLen(sParamValues(0), dW)
+ StringToLen(sParamValues(1), dL)
+ Return New SParam(dW, dL)
+ End If
+ End If
+ End If
+ Case WarehouseType.MEDIUM
+ Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
+ If EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath) Then
+ Dim sParamValues() As String = sValue.Split(","c)
+ ' verifico numero minimo di parametri
+ If sParamValues.Count >= 4 Then
+ ' cancello spazi
+ For Index = 0 To sParamValues.Count - 1
+ sParamValues(Index) = sParamValues(Index).Trim()
+ Next
+ ' creo parametro
+ Dim dW As Double = 0
+ Dim dH As Double = 0
+ Dim dL As Double = 0
+ StringToLen(sParamValues(0), dW)
+ StringToLen(sParamValues(1), dH)
+ StringToLen(sParamValues(3), dL)
+ Return New SParam(New SectionXMaterial(dW, dH, dL, sParamValues(2)), dL)
+ End If
+ End If
+ ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
+ If EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath) Then
+ Dim sParamValues() As String = sValue.Split(","c)
+ ' verifico numero minimo di parametri
+ If sParamValues.Count >= 4 Then
+ ' cancello spazi
+ For Index = 0 To sParamValues.Count - 1
+ sParamValues(Index) = sParamValues(Index).Trim()
+ Next
+ ' creo parametro
+ Dim dH As Double = 0
+ Dim dW As Double = 0
+ Dim dL As Double = 0
+ StringToLen(sParamValues(0), dH)
+ StringToLen(sParamValues(2), dW)
+ StringToLen(sParamValues(3), dL)
+ Return New SParam(New SectionXMaterial(dW, dH, dL, sParamValues(1)), dW, dL)
+ End If
+ End If
+ End If
+ Case WarehouseType.ADVANCED
+ ' CASO NON ANCORA PRESENTE
+ End Select
+ Return Nothing
+ End Function
+
+#End Region ' METHODS
+
+End Class
+
+Public Class SParam
+
+ Public ReadOnly Property W_Msg As String
+ Get
+ Return EgtMsg(61759)
+ End Get
+ End Property
+
+ Public ReadOnly Property L_Msg As String
+ Get
+ Return EgtMsg(61760)
+ End Get
+ End Property
+
+ Private m_SectXMat As SectionXMaterial
+ Public Property SectXMat As SectionXMaterial
+ Get
+ Return m_SectXMat
+ End Get
+ Set(value As SectionXMaterial)
+ m_SectXMat = value
+ End Set
+ End Property
+
+ Private m_dW As Double
+ Public Property dW As Double
+ Get
+ Return m_dW
+ End Get
+ Set(value As Double)
+ m_dW = value
+ End Set
+ End Property
+
+ Private m_dL As Double
+ Public Property dL As Double
+ Get
+ Return m_dL
+ End Get
+ Set(value As Double)
+ m_dL = value
+ End Set
+ End Property
+
+ Public ReadOnly Property sValue As String
+ Get
+ Select Case Map.refWarehouseWndVM.WhType
+ Case WarehouseType.BASIC
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then Return LenToString(dL, 3)
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then Return LenToString(dW, 3) & "," & LenToString(dL, 3)
+ Case WarehouseType.MEDIUM
+ Dim sAlias As String = String.Empty
+ For Each sMatItem In SectXMat.sMaterial
+ sAlias &= sMatItem & ";"
+ Next
+ sAlias = sAlias.TrimEnd(";")
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then Return LenToString(SectXMat.dW, 3) & "," & LenToString(SectXMat.dH, 3) & "," & sAlias
+ If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then Return LenToString(SectXMat.dH, 3) & "," & sAlias
+ End Select
+ Return Nothing
+ End Get
+ End Property
+
+ Private m_MediumW_Visibility As Visibility = Visibility.Hidden
+ Public Property MediumW_Visibility As Visibility
+ Get
+ Return m_MediumW_Visibility
+ End Get
+ Set(value As Visibility)
+ m_MediumW_Visibility = value
+ End Set
+ End Property
+
+ Sub New(W As Double, L As Double)
+ m_dW = W
+ m_dL = L
+ End Sub
+
+ Sub New(L As Double)
+ m_dL = L
+ End Sub
+
+ Sub New(SxM As SectionXMaterial, W As Double, L As Double)
+ m_SectXMat = SxM
+ m_dW = W
+ m_dL = L
+ End Sub
+
+ Sub New(SxM As SectionXMaterial, L As Double)
+ m_SectXMat = SxM
+ m_dL = L
+ End Sub
+
+End Class
+
+Public Enum WarehouseType
+ BASIC = 1
+ MEDIUM = 2
+ ADVANCED = 3
+End Enum
diff --git a/EgtBEAMWALL.ViewerOptimizer/packages.config b/EgtBEAMWALL.ViewerOptimizer/packages.config
new file mode 100644
index 00000000..473d6ddf
--- /dev/null
+++ b/EgtBEAMWALL.ViewerOptimizer/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/EgtBEAMWALL.sln b/EgtBEAMWALL.sln
new file mode 100644
index 00000000..1465514f
--- /dev/null
+++ b/EgtBEAMWALL.sln
@@ -0,0 +1,79 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30114.105
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EgtBEAMWALL.ViewerOptimizer", "EgtBEAMWALL.ViewerOptimizer\EgtBEAMWALL.ViewerOptimizer.vbproj", "{57291955-F9C4-4466-8D53-476D43BA3659}"
+EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EgtBEAMWALL.Supervisor", "EgtBEAMWALL.Supervisor\EgtBEAMWALL.Supervisor.vbproj", "{B71DA327-38C8-4305-BBA1-34F3F3F32405}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgtBEAMWALL.DataLayer", "EgtBEAMWALL.DataLayer\EgtBEAMWALL.DataLayer.csproj", "{24D7760E-662A-47E4-B729-B70126C24A31}"
+EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EgtBEAMWALL.Core", "EgtBEAMWALL.Core\EgtBEAMWALL.Core.vbproj", "{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x64.ActiveCfg = Debug|x64
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x64.Build.0 = Debug|x64
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x86.ActiveCfg = Debug|x86
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x86.Build.0 = Debug|x86
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Release|Any CPU.Build.0 = Release|Any CPU
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Release|x64.ActiveCfg = Release|x64
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Release|x64.Build.0 = Release|x64
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Release|x86.ActiveCfg = Release|x86
+ {57291955-F9C4-4466-8D53-476D43BA3659}.Release|x86.Build.0 = Release|x86
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x64.ActiveCfg = Debug|x64
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x64.Build.0 = Debug|x64
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x86.ActiveCfg = Debug|x86
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x86.Build.0 = Debug|x86
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x64.ActiveCfg = Release|x64
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x64.Build.0 = Release|x64
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x86.ActiveCfg = Release|x86
+ {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x86.Build.0 = Release|x86
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x64.Build.0 = Debug|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x86.Build.0 = Debug|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Release|Any CPU.Build.0 = Release|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Release|x64.ActiveCfg = Release|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Release|x64.Build.0 = Release|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Release|x86.ActiveCfg = Release|Any CPU
+ {24D7760E-662A-47E4-B729-B70126C24A31}.Release|x86.Build.0 = Release|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x64.Build.0 = Debug|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x86.Build.0 = Debug|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x64.ActiveCfg = Release|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x64.Build.0 = Release|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x86.ActiveCfg = Release|Any CPU
+ {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {17B3925F-95AB-44F3-9E62-B3C8BD2CB52F}
+ EndGlobalSection
+EndGlobal