From a77211310788c0b08db3ad7bea7ebfc42344bedd Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Fri, 23 May 2025 14:55:26 +0200 Subject: [PATCH] =?UTF-8?q?-=20Correzioni=20varie=20per=20compatibilit?= =?UTF-8?q?=C3=A0=20con=20lettura=20file=20JSON=20di=20configurazione=20-?= =?UTF-8?q?=20In=20GetBestStrategy=20si=20fa=20copia=20della=20tabella=20c?= =?UTF-8?q?he=20prima=20era=20passata=20come=20riferimento?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/BeamExec.lua | 31 ++++++++++++++++++------- LuaLibs/BeamLib.lua | 2 +- LuaLibs/FeatureLib.lua | 2 +- Strategies/Standard/STR0007/STR0007.lua | 10 ++++---- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index e5505bd..d30cc71 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -550,13 +550,28 @@ local function GetStrategiesFromGlobalList( Proc) -- cerco tra le feature for i = 1, #STRATEGIES.FeatureList do -- se trovo la feature - if Proc.nPrc == STRATEGIES.FeatureList[i].nPrc and Proc.nGrp == STRATEGIES.FeatureList[i].nGrp then - -- cerco tra le topologie - for j = 1, #STRATEGIES.FeatureList[i].TopologyList do - -- se trovo la topologia - if Proc.Topology.sName == STRATEGIES.FeatureList[i].TopologyList[j].sName then - -- ritorno le strategie disponibili per la feature che sto analizzando - return STRATEGIES.FeatureList[i].TopologyList[j].StrategyList + if Proc.nPrc == STRATEGIES.FeatureList[i].nPrc then + local bGroupIsCompatible = false + -- nel JSON il gruppo è sempre 0/1, mente da BTL possono arrivare altri valori. + if STRATEGIES.FeatureList[i].nGrp == 0 then + if Proc.nGrp == 0 or Proc.nGrp == 3 or Proc.nGrp == 4 then + bGroupIsCompatible = true + end + elseif STRATEGIES.FeatureList[i].nGrp == 1 then + if Proc.nGrp == 1 or Proc.nGrp == 2 then + bGroupIsCompatible = true + end + end + + -- si controlla gruppo + if bGroupIsCompatible then + -- cerco tra le topologie + for j = 1, #STRATEGIES.FeatureList[i].TopologyList do + -- se trovo la topologia + if Proc.Topology.sName == STRATEGIES.FeatureList[i].TopologyList[j].sName then + -- ritorno le strategie disponibili per la feature che sto analizzando + return STRATEGIES.FeatureList[i].TopologyList[j].StrategyList + end end end end @@ -916,7 +931,7 @@ local function GetBestStrategy( vProcSingleRot) -- salvo sulla proc la migliore strategia end if nIndexBestStrategy ~= 0 then - Proc.ChosenStrategy = Proc.AvailableStrategies[nIndexBestStrategy] + Proc.ChosenStrategy = BeamLib.TableCopyDeep( Proc.AvailableStrategies[nIndexBestStrategy]) Proc.nIndexBestStrategy = nIndexBestStrategy end end diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index cd9df8a..76a6fc9 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -465,7 +465,7 @@ function BeamLib.LoadCustomParametersInStrategy( Proc, CustomParameters, Default end if DefaultStrategyParamList.ParameterList[i].sType == 'b' then - UpdatedParameters[DefaultStrategyParamList.ParameterList[i].sName] = xParameterValue == 'true' + UpdatedParameters[DefaultStrategyParamList.ParameterList[i].sName] = xParameterValue == 'true' or xParameterValue == '1' elseif DefaultStrategyParamList.ParameterList[i].sType == 'd' then if #DefaultStrategyParamList.ParameterList[i].sValue > 0 then UpdatedParameters[DefaultStrategyParamList.ParameterList[i].sName] = tonumber( xParameterValue) diff --git a/LuaLibs/FeatureLib.lua b/LuaLibs/FeatureLib.lua index 30a37a3..9c31555 100644 --- a/LuaLibs/FeatureLib.lua +++ b/LuaLibs/FeatureLib.lua @@ -255,7 +255,7 @@ function FeatureLib.GetTopologyFromFeature( Proc, Part) elseif ID.IsRidgeLap( Proc) then Topology.sName = 'RidgeLap-3-Through' else - Topology.sName = 'FEATURE' + Topology.sName = 'Feature' end return Topology end diff --git a/Strategies/Standard/STR0007/STR0007.lua b/Strategies/Standard/STR0007/STR0007.lua index 2ecf853..434d2e6 100644 --- a/Strategies/Standard/STR0007/STR0007.lua +++ b/Strategies/Standard/STR0007/STR0007.lua @@ -80,9 +80,9 @@ function GetMortiseStrategy( Proc, Part) end end - -- === ricerca utensile per lavorare tenone coda di rondine === + -- === ricerca utensile per lavorare mortasa coda di rondine === Machining.Milling.bIsApplicable = false - -- se tenone in testa oppure se di coda ma è possibile lavorare dopo separazione + -- se mortasa in testa oppure se di coda ma è possibile lavorare dopo separazione if not( Proc.AffectedFaces.bLeft) or Strategy.bCanMoveAfterSplit then ToolSearchParameters.dElevation = Proc.FeatureInfo.dMortiseDepth ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtMortiseN @@ -169,10 +169,10 @@ function GetMortiseMachiningResult( Proc, Result) TotalResult.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 50) TotalResult.dMRR = Result.Cutting.dMRR TotalResult.nQuality = FeatureLib.GetFeatureQuality( EgtIf( Strategy.Machining.bCuttingWithMill, 'Mill', 'Blade')) - TotalResult.sInfo = 'Tenon not completed' - -- strategia non applicabile, manca il taglio di lama sulla lunghezza del tenone + TotalResult.sInfo = 'Mortise not completed' + -- strategia non applicabile, manca il taglio di lama sulla lunghezza del Mortise else - TotalResult = FeatureLib.GetStrategyResultNotApplicable( 'Error on Tenon cutting') + TotalResult = FeatureLib.GetStrategyResultNotApplicable( 'Error on Mortise cutting') end return TotalResult end