48b7a8f325
- copia dei file di un progetto nel direttorio della macchina (configurabili nel file da OptionPage); - salvataggio delle modifiche dei parametri delle componenti già esistenti (RunAs=0);
132 lines
5.6 KiB
VB.net
132 lines
5.6 KiB
VB.net
Imports EgtUILib
|
|
Imports System.IO
|
|
|
|
Module CompoMatch
|
|
|
|
Friend Function CalcCompoMatching(sCompoDir As String, DoorNumber As Integer, sTemplate As String, ByRef sFrameTemplate As String) As Boolean
|
|
' Path del lua da utilizzare
|
|
Dim sLuaPath As String = sCompoDir & "\Matching.lua"
|
|
' Verifico esistenza file Matching nel direttorio passato
|
|
If Not File.Exists(sLuaPath) Then
|
|
EgtOutLog("Matching error: missing file (" & sLuaPath & ")")
|
|
Return False
|
|
End If
|
|
' Parsing
|
|
EgtLuaExecFile(sLuaPath)
|
|
' Assegno valori ai parametri per lua
|
|
EgtLuaSetGlobIntVar("STU.DoorNumber", DoorNumber)
|
|
EgtLuaSetGlobStringVar("STU.CompoPath", sCompoDir)
|
|
EgtLuaSetGlobStringVar("STU.Template", sTemplate)
|
|
|
|
' Chiamo funzione di Matching tra componente di anta e componente di telaio
|
|
If Not EgtLuaCallFunction("STU.Matching") Then
|
|
EgtOutLog("Matching error: STU.Matching")
|
|
Return False
|
|
End If
|
|
|
|
' Recupero il componente di telaio
|
|
EgtLuaGetGlobStringVar("STU.OutTemplate", sFrameTemplate)
|
|
EgtLuaResetGlobVar("STU")
|
|
Return True
|
|
End Function
|
|
|
|
Friend Function LoadCompoParam(CurrCompo As Compo) As Boolean
|
|
' Path del lua da utilizzare
|
|
Dim sLuaPath As String = CurrCompo.CompoType.Path & "\Matching.lua"
|
|
' Verifico esistenza file Matching nel direttorio passato
|
|
If Not File.Exists(sLuaPath) Then
|
|
EgtOutLog("Matching error: missing file (" & sLuaPath & ")")
|
|
Return False
|
|
End If
|
|
' Parsing
|
|
EgtLuaExecFile(sLuaPath)
|
|
' Assegno valori ai parametri per lua
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyPageVM.CurrAssembly
|
|
Dim nDoorNbr As Integer = 1
|
|
Int32.TryParse(CurrAssembly.DoorNumber, nDoorNbr)
|
|
EgtLuaSetGlobIntVar("STU.DoorNumber", nDoorNbr)
|
|
EgtLuaSetGlobStringVar("STU.CompoPath", CurrCompo.CompoType.Path)
|
|
EgtLuaSetGlobStringVar("STU.Template", CurrCompo.refJambCompo.TemplateSelItem)
|
|
Dim bExterior As Boolean = CurrAssembly.Exterior
|
|
EgtLuaSetGlobBoolVar("STU.Exterior", bExterior)
|
|
Dim dLightUp As Double
|
|
StringToDouble(CurrAssembly.LightUp, dLightUp)
|
|
EgtLuaSetGlobNumVar("STU.LightUp", dLightUp)
|
|
Dim dLightBottom As Double
|
|
StringToDouble(CurrAssembly.LightBottom, dLightBottom)
|
|
EgtLuaSetGlobNumVar("STU.LightBottom", dLightBottom)
|
|
Dim dLightHinge As Double
|
|
StringToDouble(CurrAssembly.LightHinge, dLightHinge)
|
|
EgtLuaSetGlobNumVar("STU.LightHinge", dLightHinge)
|
|
Dim dLightLock As Double
|
|
StringToDouble(CurrAssembly.LightLock, dLightLock)
|
|
EgtLuaSetGlobNumVar("STU.LightLock", dLightLock)
|
|
Dim dOverlapHinge As Double
|
|
StringToDouble(CurrAssembly.OverlapHinge, dOverlapHinge)
|
|
EgtLuaSetGlobNumVar("STU.OverlapHinge", dOverlapHinge)
|
|
Dim dOverlapLock As Double
|
|
StringToDouble(CurrAssembly.OverlapLock, dOverlapLock)
|
|
EgtLuaSetGlobNumVar("STU.OverlapLock", dOverlapLock)
|
|
Dim dOverlapTop As Double
|
|
StringToDouble(CurrAssembly.OverlapTop, dOverlapTop)
|
|
EgtLuaSetGlobNumVar("STU.OverlapTop", dOverlapTop)
|
|
Dim dThicknessHead As Double
|
|
StringToDouble(CurrAssembly.ThicknessHead, dThicknessHead)
|
|
EgtLuaSetGlobNumVar("STU.ThicknessHead", dThicknessHead)
|
|
Dim dThicknessJamb As Double
|
|
StringToDouble(CurrAssembly.Thickness, dThicknessJamb)
|
|
EgtLuaSetGlobNumVar("STU.ThicknessJamb", dThicknessJamb)
|
|
Dim dDeltaT As Double
|
|
StringToDouble(CurrAssembly.DeltaThickness, dDeltaT)
|
|
EgtLuaSetGlobNumVar("STU.DeltaThickness", dDeltaT)
|
|
Dim dThicknessDoor As Double
|
|
If Not IsNothing(Map.refPartPageVM.CurrPart) Then
|
|
StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThicknessDoor)
|
|
ElseIf CurrAssembly.ArrayPartDoor.Count > 0 Then
|
|
StringToDouble(CurrAssembly.GetArrayPartDoor(0).Door.Thickness, dThicknessDoor)
|
|
End If
|
|
EgtLuaSetGlobNumVar("STU.ThicknessDoor", dThicknessDoor)
|
|
Return True
|
|
End Function
|
|
|
|
Friend Function CalcCompoParamValue(sInParamName As String, sInParamValue As String, ByRef sOutParamValue As String, ByRef IsEnable As Boolean) As Boolean
|
|
' Assegno dati parametro
|
|
EgtLuaSetGlobStringVar("STU.InParamName", sInParamName)
|
|
Dim dInParamValue As Double
|
|
StringToDouble(sInParamValue, dInParamValue)
|
|
EgtLuaSetGlobNumVar("STU.InParamValue", dInParamValue)
|
|
' Calcolo equivalente parametro in telaio
|
|
If Not EgtLuaCallFunction("STU.CalcParam") Then
|
|
EgtOutLog("Error in STU.CalcParam")
|
|
Return False
|
|
End If
|
|
' Recupero nuovo valore
|
|
Dim dVal As Double
|
|
EgtLuaGetGlobNumVar("STU.OutParamValue", dVal)
|
|
sOutParamValue = DoubleToString(dVal, 4)
|
|
' Recupero stato di visualizzazione
|
|
EgtLuaGetGlobBoolVar("STU.IsEnable", IsEnable)
|
|
Return True
|
|
End Function
|
|
|
|
Friend Function CalcCompoParamVisibility(sInParamName As String, ByRef IsEnable As Boolean) As Boolean
|
|
' Assegno dati parametro
|
|
EgtLuaSetGlobStringVar("STU.InParamName", sInParamName)
|
|
' Calcolo equivalente parametro in telaio
|
|
If Not EgtLuaCallFunction("STU.VisibilityParam") Then
|
|
EgtOutLog("Error in STU.VisibilityParam")
|
|
Return False
|
|
End If
|
|
' Recupero stato di visualizzazione
|
|
EgtLuaGetGlobBoolVar("STU.IsEnable", IsEnable)
|
|
Return True
|
|
End Function
|
|
|
|
Friend Function ResetCompoParam() As Boolean
|
|
EgtLuaResetGlobVar("STU")
|
|
Return True
|
|
End Function
|
|
|
|
End Module
|
|
|