3f4b917f92
- modifica nel caricamento della lista di properties, - aggiunto un controllo sulla configurazione in lettura, - gestione del cambio numero di ante nel progetto corrente, - configurabilità della lista degli swing.
192 lines
8.9 KiB
VB.net
192 lines
8.9 KiB
VB.net
Imports EgtUILib
|
|
Imports System.IO
|
|
|
|
Module CompoMatch
|
|
|
|
' restituisce il nome dell'assegnazione eseguito nel file Matching.lua e resetta l'assegnazione
|
|
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", If(IsNothing(sTemplate), "", 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, già nello script lua verifico che il nome del file esista, altrimenti restituisco una stringa vuota
|
|
EgtLuaGetGlobStringVar("STU.OutTemplate", sFrameTemplate)
|
|
EgtLuaResetGlobVar("STU")
|
|
Return True
|
|
End Function
|
|
|
|
' richiamo lo script Matching.lua e lo carico con tutte le variabili necessaerie al calcolo del posizionamento delle componenti
|
|
Friend Function LoadCompoParam(CurrCompo As Compo, sDoor As String) 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)
|
|
' indica se è la prima o la seconda anta selezionata
|
|
EgtLuaSetGlobStringVar("STU.Door", sDoor)
|
|
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
|
|
EgtLuaSetGlobStringVar("STU.SelDoor", Map.refPartPageVM.CurrPart.TypePart)
|
|
StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThicknessDoor)
|
|
ElseIf CurrAssembly.ListPartDoorOfDoor.Count > 0 Then
|
|
StringToDouble(CurrAssembly.ListPartDoorOfDoor(0).Door.Thickness, dThicknessDoor)
|
|
End If
|
|
EgtLuaSetGlobNumVar("STU.ThicknessDoor", dThicknessDoor)
|
|
Dim dDoor1Width As Double = 0.0
|
|
'StringToDouble(CurrAssembly.GetArrayPartDoor(0).Door.Width, dDoor1Width)
|
|
If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")) Then
|
|
StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.Width, dDoor1Width)
|
|
EgtLuaSetGlobStringVar("STU.Swing", Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SwingAlias.Name)
|
|
End If
|
|
EgtLuaSetGlobNumVar("STU.Door1Width", dDoor1Width)
|
|
Dim dDoor2Width As Double = 0.0
|
|
'StringToDouble(CurrAssembly.GetArrayPartDoor(1).Door.Width, dDoor2Width)
|
|
If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_2")) Then
|
|
StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.Width, dDoor2Width)
|
|
End If
|
|
EgtLuaSetGlobNumVar("STU.Door2Width", dDoor2Width)
|
|
Return True
|
|
End Function
|
|
|
|
' asseganto un parametro restituisce il valore da associare allo stesso parametro sul jamb
|
|
Friend Function CalcCompoParamValue(sInParamName As String, sInParamValue As String, ByRef sOutParamValue As String, ByRef IsEnable As Boolean, ByRef sSelDoor As String, Optional ByRef sConfigurationCompo As String = "Graphic parameters1") As Boolean
|
|
' Assegno dati parametro
|
|
EgtLuaSetGlobStringVar("STU.InParamName", sInParamName)
|
|
EgtLuaSetGlobStringVar("STU.SelDoor", sSelDoor)
|
|
EgtLuaSetGlobStringVar("STU.ConfigDefault", sConfigurationCompo)
|
|
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
|
|
|
|
' restituisce una variabile boolena (utilizzata nella prorpietà ReadOnly)
|
|
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 ResetSTU() As Boolean
|
|
EgtLuaResetGlobVar("STU")
|
|
Return True
|
|
End Function
|
|
|
|
#Region "HARDWAREMANAGER"
|
|
' carico il file Tabella.lua per la ricerca dei nomi delle geometrie
|
|
Friend Function LoadTableGeometry() As Boolean
|
|
EgtLuaCreateGlobTable("HMD")
|
|
Dim sLuaPath As String = IniFile.m_CompoDir & "\TabellaLua.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
|
|
If Not EgtLuaExecFile(sLuaPath) Then
|
|
EgtOutLog("Matching error: executing file (" & sLuaPath & ")")
|
|
Return False
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
' utilizzato nell'HardwareManger per l'assegnazoine del nome della geometria
|
|
Friend Function ReserchInTable(sNameHardware As String, sNameParamLua As String, ByRef sNameGeometry As String) As Boolean
|
|
' Assegno dati parametro
|
|
EgtLuaSetGlobStringVar("HMD.HardwareName", sNameHardware)
|
|
EgtLuaSetGlobStringVar("HMD.Parameter", sNameParamLua)
|
|
If Not EgtLuaCallFunction("HMD.RicercaNellaTabella") Then
|
|
EgtOutLog("Error in HMD.RicercaNellaTabella")
|
|
Return False
|
|
End If
|
|
' Recupero stato di visualizzazione
|
|
EgtLuaGetGlobStringVar("HMD.GeometryName", sNameGeometry)
|
|
Return True
|
|
End Function
|
|
|
|
' pulisce l'elenco dei parametri caricati nello script
|
|
Friend Function ResetCompoParam() As Boolean
|
|
EgtLuaResetGlobVar("HMD")
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' HardwareManager
|
|
|
|
End Module
|
|
|