- Lettura parametri globali PROJECT e BTL
- Possibilità di leggere più file BTLInfo - Creata funzione GetPieceGeneralParameters (DA FARE) per aggiornamento parametri su pezzo
This commit is contained in:
+47
-65
@@ -460,25 +460,28 @@ end
|
||||
|
||||
-- TODO bisogna recuperare il nome del parametro NGE, perchè in questo caso è forzato
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetPieceGeneralParameters( Part, sParameterName)
|
||||
local sValue = nil
|
||||
-- si caricano i parametri generali riferiti al pezzo
|
||||
sValue = EgtGetInfo( Part.id, sParameterName, 's')
|
||||
return sValue
|
||||
function BeamLib.GetPieceGeneralParameters( idPart, idBTLInfo, StrategiesParameterList, DefaultGeneralParamList)
|
||||
local GeneralParameters = {}
|
||||
|
||||
-- TODO DA FARE!!!
|
||||
-- da JSON leggere i parametri di default
|
||||
-- vedere se sono settati ome nota su pezzo
|
||||
-- vedere se sono settate nel BTLInfo del pezzo
|
||||
-- vedere se sono settate nel PROJECT
|
||||
|
||||
return GeneralParameters
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetInheritedParameter( Part, sSourceParamName)
|
||||
local sValue = nil
|
||||
if sSourceParamName and #sSourceParamName > 0 then
|
||||
-- se il parametro è già stato letto
|
||||
if Part.GeneralParameters[sSourceParamName] then
|
||||
sValue = Part.GeneralParameters[sSourceParamName]
|
||||
-- altrimenti lo recupero
|
||||
else
|
||||
Part.GeneralParameters[sSourceParamName] = BeamLib.GetPieceGeneralParameters( Part, sSourceParamName)
|
||||
sValue = Part.GeneralParameters[sSourceParamName] or
|
||||
GENERAL_PARAMETERS.PIECE[sSourceParamName] or GENERAL_PARAMETERS.BTL[sSourceParamName] or GENERAL_PARAMETERS.PROJECT[sSourceParamName] or nil
|
||||
elseif GENERAL_PARAMETERS.BTL and GENERAL_PARAMETERS.BTL[Part.sBTLInfo] and GENERAL_PARAMETERS.BTL[Part.sBTLInfo][sSourceParamName] then
|
||||
sValue = GENERAL_PARAMETERS.BTL[Part.sBTLInfo][sSourceParamName]
|
||||
elseif GENERAL_PARAMETERS.PROJECT[sSourceParamName] then
|
||||
sValue = GENERAL_PARAMETERS.PROJECT[sSourceParamName]
|
||||
end
|
||||
end
|
||||
return sValue
|
||||
@@ -543,7 +546,7 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- si traduce la tabella dei parametri con tutte le informazioni in una lista contenente i parametri utilizzabili con accesso diretto
|
||||
function BeamLib.LoadGeneralParametersInList( DefaultGeneralParamList)
|
||||
local UpdatedParameters = { PROJECT = {}, BTL = {}, PIECE = {}}
|
||||
local UpdatedParameters = { PROJECT = {}, BTL = {}}
|
||||
-- aggiornamento parametri PROJECT
|
||||
if DefaultGeneralParamList and DefaultGeneralParamList.PROJECT then
|
||||
local idProjectInfo = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'ProjectInfo') or GDB_ID.NULL
|
||||
@@ -566,53 +569,32 @@ function BeamLib.LoadGeneralParametersInList( DefaultGeneralParamList)
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO GESTIRE IL CASO IN CUI IN UN PROGETTO CI SIANO PIU' DI UN BTL
|
||||
-- aggiornamento parametri BTL
|
||||
if DefaultGeneralParamList and DefaultGeneralParamList.BTL then
|
||||
local idBTLInfo = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
|
||||
for i = 1, #DefaultGeneralParamList.BTL do
|
||||
if DefaultGeneralParamList.BTL[i].sType == 'inherited' then
|
||||
UpdatedParameters.BTL[DefaultGeneralParamList.BTL[i].sName] = UpdatedParameters.PROJECT[DefaultGeneralParamList.BTL[i].sName]
|
||||
else
|
||||
local sParamNameNGE = DefaultGeneralParamList.BTL[i].sNameNge
|
||||
|
||||
local xParameterValue = EgtGetInfo( idBTLInfo, sParamNameNGE, 's') or DefaultGeneralParamList.BTL[i].sValue
|
||||
-- salvataggio dato su lista con accesso diretto
|
||||
if DefaultGeneralParamList.BTL[i].sType == 'b' then
|
||||
UpdatedParameters.BTL[DefaultGeneralParamList.BTL[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
|
||||
elseif DefaultGeneralParamList.BTL[i].sType == 'd' then
|
||||
if #DefaultGeneralParamList.BTL[i].sValue > 0 then
|
||||
UpdatedParameters.BTL[DefaultGeneralParamList.BTL[i].sName] = tonumber( xParameterValue)
|
||||
-- stringa vuota equivale a non passare alcun valore (deciderà la strategia)
|
||||
else
|
||||
UpdatedParameters.BTL[DefaultGeneralParamList.BTL[i].sName] = nil
|
||||
-- TODO verificare perchè sembra non funzionare, mentre la EgtGetFirstNameInGroup restituiva l'ID
|
||||
local BTLInfo = EgtGetNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
|
||||
for j = 1, #BTLInfo do
|
||||
local BTLName = EgtGetInfo( BTLInfo[j], 'PROJ', 's')
|
||||
for i = 1, #DefaultGeneralParamList.BTL do
|
||||
if DefaultGeneralParamList.BTL[i].sType == 'inherited' then
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = UpdatedParameters.PROJECT[DefaultGeneralParamList.BTL[i].sName]
|
||||
else
|
||||
local sParamNameNGE = DefaultGeneralParamList.BTL[i].sNameNge
|
||||
|
||||
local xParameterValue = EgtGetInfo( BTLInfo[j], sParamNameNGE, 's') or DefaultGeneralParamList.BTL[i].sValue
|
||||
-- salvataggio dato su lista con accesso diretto
|
||||
if DefaultGeneralParamList.BTL[i].sType == 'b' then
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
|
||||
elseif DefaultGeneralParamList.BTL[i].sType == 'd' then
|
||||
if #DefaultGeneralParamList.BTL[i].sValue > 0 then
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = tonumber( xParameterValue)
|
||||
-- stringa vuota equivale a non passare alcun valore (deciderà la strategia)
|
||||
else
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = nil
|
||||
end
|
||||
else --DefaultGeneralParamList[i].sType == 's' or DefaultGeneralParamList[i].sType == 'combo'
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = xParameterValue
|
||||
end
|
||||
else --DefaultGeneralParamList[i].sType == 's' or DefaultGeneralParamList[i].sType == 'combo'
|
||||
UpdatedParameters.BTL[DefaultGeneralParamList.BTL[i].sName] = xParameterValue
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- aggiornamento parametri PIECE (in questo momento si salva solo il default, poi lo si aggiorna pezzo per pezzo)
|
||||
if DefaultGeneralParamList and DefaultGeneralParamList.PIECE then
|
||||
for i = 1, #DefaultGeneralParamList.PIECE do
|
||||
if DefaultGeneralParamList.PIECE[i].sType == 'inherited' then
|
||||
UpdatedParameters.PIECE[DefaultGeneralParamList.PIECE[i].sName] = UpdatedParameters.BTL[DefaultGeneralParamList.PIECE[i].sName] or UpdatedParameters.PROJECT[DefaultGeneralParamList.PIECE[i].sName]
|
||||
else
|
||||
local xParameterValue = DefaultGeneralParamList.PIECE[i].sValue or nil
|
||||
-- salvataggio dato su lista con accesso diretto
|
||||
if DefaultGeneralParamList.PIECE[i].sType == 'b' then
|
||||
UpdatedParameters.PIECE[DefaultGeneralParamList.PIECE[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
|
||||
elseif DefaultGeneralParamList.PIECE[i].sType == 'd' then
|
||||
if #DefaultGeneralParamList.PIECE[i].sValue > 0 then
|
||||
UpdatedParameters.PIECE[DefaultGeneralParamList.PIECE[i].sName] = tonumber( xParameterValue)
|
||||
-- stringa vuota equivale a non passare alcun valore (deciderà la strategia)
|
||||
else
|
||||
UpdatedParameters.PIECE[DefaultGeneralParamList.PIECE[i].sName] = nil
|
||||
end
|
||||
else --DefaultGeneralParamList[i].sType == 's' or DefaultGeneralParamList[i].sType == 'combo'
|
||||
UpdatedParameters.PIECE[DefaultGeneralParamList.PIECE[i].sName] = xParameterValue
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -835,16 +817,16 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetStrategiesFromList( Proc, StrategyList)
|
||||
-- cerco tra le feature
|
||||
for i = 1, #StrategyList.FeatureList do
|
||||
for i = 1, #StrategyList.FEATURE do
|
||||
-- se trovo la feature
|
||||
if Proc.nPrc == StrategyList.FeatureList[i].nPrc then
|
||||
if Proc.nPrc == StrategyList.FEATURE[i].nPrc then
|
||||
local bGroupIsCompatible = false
|
||||
-- nel JSON il gruppo è sempre 0/1, mente da BTL possono arrivare altri valori.
|
||||
if StrategyList.FeatureList[i].nGrp == 0 then
|
||||
if StrategyList.FEATURE[i].nGrp == 0 then
|
||||
if Proc.nGrp == 0 or Proc.nGrp == 3 or Proc.nGrp == 4 then
|
||||
bGroupIsCompatible = true
|
||||
end
|
||||
elseif StrategyList.FeatureList[i].nGrp == 1 then
|
||||
elseif StrategyList.FEATURE[i].nGrp == 1 then
|
||||
if Proc.nGrp == 1 or Proc.nGrp == 2 then
|
||||
bGroupIsCompatible = true
|
||||
end
|
||||
@@ -852,15 +834,15 @@ function BeamLib.GetStrategiesFromList( Proc, StrategyList)
|
||||
|
||||
-- si controlla gruppo
|
||||
if bGroupIsCompatible then
|
||||
if #StrategyList.FeatureList[i].TopologyList == 1 and StrategyList.FeatureList[i].TopologyList[1].sName == 'Feature' then
|
||||
return BeamLib.TableCopyDeep( StrategyList.FeatureList[i].TopologyList[1].StrategyList)
|
||||
if #StrategyList.FEATURE[i].TopologyList == 1 and StrategyList.FEATURE[i].TopologyList[1].sName == 'Feature' then
|
||||
return BeamLib.TableCopyDeep( StrategyList.FEATURE[i].TopologyList[1].StrategyList)
|
||||
else
|
||||
-- cerco tra le topologie
|
||||
for j = 1, #StrategyList.FeatureList[i].TopologyList do
|
||||
for j = 1, #StrategyList.FEATURE[i].TopologyList do
|
||||
-- se trovo la topologia
|
||||
if Proc.Topology.sName == StrategyList.FeatureList[i].TopologyList[j].sName then
|
||||
if Proc.Topology.sName == StrategyList.FEATURE[i].TopologyList[j].sName then
|
||||
-- ritorno le strategie disponibili per la feature che sto analizzando
|
||||
return BeamLib.TableCopyDeep( StrategyList.FeatureList[i].TopologyList[j].StrategyList)
|
||||
return BeamLib.TableCopyDeep( StrategyList.FEATURE[i].TopologyList[j].StrategyList)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user