diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index 3651fcf..8871dff 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -25,6 +25,17 @@ local function GetStrategies_Egalware( Proc) --------------------------------------------------------------------- -- Feature : Cut if ID.IsHeadCut( Proc) then + if Proc.Topology.Name == 'FEATURE' then + Strategy_Egalware = { + StrategyID = 'STR0010', + Parameters = { + { Value = '15', Name = 'Step', Type = 'd'}, + { Value = 'false', Name = 'AntiSplint', Type = 'b'} + } + } + table.insert( Strategies_Egalware, Strategy_Egalware) + Strategy_Egalware = {} + end --------------------------------------------------------------------- -- Feature : Cut elseif ID.IsSplitCut( Proc) then @@ -176,7 +187,7 @@ local function GetStrategies_Egalware( Proc) -- Feature : Variant elseif ID.IsVariant( Proc) then end - + return Strategies_Egalware end @@ -192,18 +203,12 @@ local function GetStrategies_Essetre( Proc) --------------------------------------------------------------------- -- Feature : Cut if ID.IsHeadCut( Proc) then - --------------------------------------------------------------------- - -- Feature : Cut - elseif ID.IsSplitCut( Proc) then if Proc.Topology.Name == 'FEATURE' then Strategy_Essetre = { StrategyID = 'STR0010', Parameters = { - { { Value = '15', Name = 'Step', Type = 'd'}, - { Value = '2', Name = 'Depth', Type = 'd'}, { Value = 'false', Name = 'AntiSplint', Type = 'b'} - } } } table.insert( Strategies_Essetre, Strategy_Essetre) @@ -211,21 +216,10 @@ local function GetStrategies_Essetre( Proc) end --------------------------------------------------------------------- -- Feature : Cut + elseif ID.IsSplitCut( Proc) then + --------------------------------------------------------------------- + -- Feature : Cut elseif ID.IsCut( Proc) then - if Proc.Topology.Name == 'FEATURE' then - Strategy_Essetre = { - StrategyID = 'STR0001', - Parameters = { - { - { Value = '15', Name = 'Step', Type = 'd'}, - { Value = '2', Name = 'Depth', Type = 'd'}, - { Value = 'false', Name = 'AntiSplint', Type = 'b'} - } - } - } - table.insert( Strategies_Essetre, Strategy_Essetre) - Strategy_Essetre = {} - end --------------------------------------------------------------------- -- Feature : Longitudinal Cut elseif ID.IsLongitudinalCut( Proc) then diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index f01e37f..59bd832 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -422,12 +422,18 @@ local function GetFeatureForcedStrategy( Proc) -- se è presente la strategia forzata if sStrategyID then - local StrategyData = require( sStrategyID .. '\\' .. sStrategyID .. 'Config.lua') + -- eseguo file config con i parametri di default + local StrategyData = require( sStrategyID .. '\\' .. sStrategyID .. 'Config') + -- se ID strategia letto in NGE è differente da quello letto nella strategia, esco subito if StrategyData.StrategyID ~= sStrategyID then return nil end - + + -- salvo che questa strategia è stata forzata, e che quindi ho già letto il file config con i parametri di default + -- quando si calcolerà la lavorazione non servirà riverificare i dati + StrategyData.ForcedStrategy = true + -- cerco e aggiorno i parametri come sono settati nel processing - for i = 1, #StrategyData do + for i = 1, #StrategyData.Parameters do local sParameterToRead = StrategyData.StrategyID .. '_' .. StrategyData.Parameters[i].Name ForcedParameterForProc = EgtGetInfo( Proc.Id, sParameterToRead, 's') -- se ho trovato il valore, lo sovrascrivo al default @@ -500,7 +506,7 @@ local function CollectFeatures( PartId, b3Raw) -- se topologia feature riconosciuta, oppure da non calcolare perchè il riconoscimento topologico è basato sulla feature stessa if Proc.Topology.Name ~= 'NOT_IMPLEMENTED' then -- TODO Funzione 'GetMainFaces' da scrivere - Proc.MainFaces = FaceData.GetMainFaces( Proc) + -- Proc.MainFaces = FaceData.GetMainFaces( Proc) -- se la processing ha una strategia forzata, riporto tutto nella proc local vForcedStrategy = GetFeatureForcedStrategy( Proc) if vForcedStrategy then diff --git a/Process.lua b/Process.lua index 422ac4f..723d60a 100644 --- a/Process.lua +++ b/Process.lua @@ -12,7 +12,7 @@ EgtEnableDebug( true) -- Imposto direttorio libreria specializzata per Travi EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') -- Imposto direttorio strategie. N.B. Le strategie dovranno essere caricate con il nome del direttorio padre -EgtAddToPackagePath( BEAM.BASEDIR .. '\\Strategies') +EgtAddToPackagePath( BEAM.BASEDIR .. '\\Strategies\\?') -- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi local sMachDir = EgtGetCurrMachineDir() @@ -41,6 +41,21 @@ _G.package.loaded.BasicCustomerStrategies = nil _G.package.loaded.FeatureData = nil _G.package.loaded.FaceData = nil +-- TODO controlare se c'è un modo migliore per resettare librerie caricate precedentemente +-- reset strategie caricate come librerie +for i = 1, 9999 do + local IdSTRTemp = EgtReplaceString( tostring( i/10000, 4), '0.', '') + local sLibraryToReload = "STR" .. IdSTRTemp .. "\\STR" .. IdSTRTemp .. "Config" + local sLibraryConfigToReload = sLibraryToReload .. "Config" + if _G.package.loaded[sLibraryToReload] then + _G.package.loaded[sLibraryToReload] = nil + end + if _G.package.loaded[sLibraryConfigToReload] then + _G.package.loaded[sLibraryConfigToReload] = nil + end +end + + local BeamExec = require( 'BeamExec') -- Carico i dati globali diff --git a/Strategies/STR0001/STR0001Config.lua b/Strategies/STR0001/STR0001Config.lua index 27e090f..dfc5782 100644 --- a/Strategies/STR0001/STR0001Config.lua +++ b/Strategies/STR0001/STR0001Config.lua @@ -1,15 +1,11 @@ -- Parametri configurabili da cliente per strategia: STR0001 local STR0001Data = { - { - StrategyID = 'STR0001', - Parameters = { - { - { Value = '15', Name = 'Step', Description = 'Questo è lo step di lavorazione', Type = 'd'}, - { Value = '2', Name = 'Depth', Description = 'Affondamento lavorazione', Type = 'd'}, - { Value = 'false', Name = 'AntiSplint', Description = 'Antischeggia', Type = 'b'} - } - } + StrategyID = 'STR0001', + Parameters = { + { Value = '15', Name = 'Step', Description = 'Questo è lo step di lavorazione', Type = 'd'}, + { Value = '2', Name = 'Depth', Description = 'Affondamento lavorazione', Type = 'd'}, + { Value = 'false', Name = 'AntiSplint', Description = 'Antischeggia', Type = 'b'} } }