From 4cd1bf526a596bf5318c3761359d0a73baa6cb23 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Thu, 8 May 2025 11:33:11 +0200 Subject: [PATCH] =?UTF-8?q?-=20Corretto=20STR0010=20in=20caso=20non=20abbi?= =?UTF-8?q?a=20trovato=20la=20lavorazione=20-=20Corretto=20calcolo=20step?= =?UTF-8?q?=20in=20FACEBYMILL=20-=20In=20BLADEKEEPWASTE=20corretto=20calco?= =?UTF-8?q?lo=20completamento=20nel=20caso=20in=20sui=20non=20c'=C3=A8=20i?= =?UTF-8?q?l=20peso=20sulla=20lavorazione?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BatchProcessNew.lua | 17 ++++++------ Process.lua | 17 ++++++------ Strategies/Standard/STR0010/STR0010.lua | 35 +++++++++++++------------ StrategyLibs/BLADEKEEPWASTE.lua | 2 +- StrategyLibs/FACEBYMILL.lua | 2 +- 5 files changed, 38 insertions(+), 35 deletions(-) diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 7a34d53..8a18c61 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -45,27 +45,28 @@ EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua') EgtOutLog( '*** Beam Process Start ***', 1) -- Carico le librerie +_G.package.loaded.BasicCustomerStrategies = nil _G.package.loaded.BeamExec = nil _G.package.loaded.BeamLib = nil -_G.package.loaded.BeamData = nil -_G.package.loaded.Identity = nil -_G.package.loaded.BasicCustomerStrategies = nil -_G.package.loaded.FeatureLib = nil -_G.package.loaded.FaceData = nil -_G.package.loaded.MachiningLib = nil _G.package.loaded.DiceCut = nil +_G.package.loaded.FaceData = nil +_G.package.loaded.FeatureLib = nil +_G.package.loaded.Identity = nil _G.package.loaded.Logs = nil +_G.package.loaded.MachiningLib = nil -- strategie di base sempre presenti _G.package.loaded['HEADCUT\\HEADCUT'] = nil _G.package.loaded['TAILCUT\\TAILCUT'] = nil +-- libreria macchina +_G.package.loaded.BeamData = nil -- TODO controllare se c'è un modo migliore per resettare librerie delle strategie caricate precedentemente -- Per ottimizzare potremmo anche ciclare solo fino al numero di strategie raggiunto per il momento. -- Infatti difficile ci siano 9999 strategie. -- reset strategie caricate come librerie for i = 1, 9999 do - local IdSTRTemp = EgtReplaceString( tostring( i/10000, 4), '0.', '') - local sLibraryToReload = "STR" .. IdSTRTemp .. "\\STR" .. IdSTRTemp + local idSTRTemp = EgtReplaceString( EgtNumToString( i/10000, -4), '0.', '') + local sLibraryToReload = "STR" .. idSTRTemp .. "\\STR" .. idSTRTemp if _G.package.loaded[sLibraryToReload] then _G.package.loaded[sLibraryToReload] = nil end diff --git a/Process.lua b/Process.lua index af3ba4a..58fc3ac 100644 --- a/Process.lua +++ b/Process.lua @@ -34,27 +34,28 @@ EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua') EgtOutLog( '*** Beam Process Start ***', 1) -- Carico le librerie +_G.package.loaded.BasicCustomerStrategies = nil _G.package.loaded.BeamExec = nil _G.package.loaded.BeamLib = nil -_G.package.loaded.BeamData = nil -_G.package.loaded.Identity = nil -_G.package.loaded.BasicCustomerStrategies = nil -_G.package.loaded.FeatureLib = nil -_G.package.loaded.FaceData = nil -_G.package.loaded.MachiningLib = nil _G.package.loaded.DiceCut = nil +_G.package.loaded.FaceData = nil +_G.package.loaded.FeatureLib = nil +_G.package.loaded.Identity = nil _G.package.loaded.Logs = nil +_G.package.loaded.MachiningLib = nil -- strategie di base sempre presenti _G.package.loaded['HEADCUT\\HEADCUT'] = nil _G.package.loaded['TAILCUT\\TAILCUT'] = nil +-- libreria macchina +_G.package.loaded.BeamData = nil -- TODO controllare se c'è un modo migliore per resettare librerie delle strategie caricate precedentemente -- Per ottimizzare potremmo anche ciclare solo fino al numero di strategie raggiunto per il momento. -- Infatti difficile ci siano 9999 strategie. -- reset strategie caricate come librerie for i = 1, 9999 do - local IdSTRTemp = EgtReplaceString( EgtNumToString( i/10000, -4), '0.', '') - local sLibraryToReload = "STR" .. IdSTRTemp .. "\\STR" .. IdSTRTemp + local idSTRTemp = EgtReplaceString( EgtNumToString( i/10000, -4), '0.', '') + local sLibraryToReload = "STR" .. idSTRTemp .. "\\STR" .. idSTRTemp if _G.package.loaded[sLibraryToReload] then _G.package.loaded[sLibraryToReload] = nil end diff --git a/Strategies/Standard/STR0010/STR0010.lua b/Strategies/Standard/STR0010/STR0010.lua index 7438929..79fa324 100644 --- a/Strategies/Standard/STR0010/STR0010.lua +++ b/Strategies/Standard/STR0010/STR0010.lua @@ -31,7 +31,7 @@ local function GetStrategyCompletionPercentage( Machinings) nWeightsCount = nWeightsCount + 1 end -- il peso deve essere settato in tutte le lavorazioni o in nessuna - if ( nWeightsCount ~= 0) and ( nWeightsCount ~= i) then + if nWeightsCount ~= 0 and nWeightsCount ~= i then error( 'GetWeightedCompletionPercentage : inconsistent weights') end local dWeightedCompletionPercentage = Machining.dCompletionPercentage / 100 * dWeight @@ -156,23 +156,23 @@ function STR0010.Make( bAddMachining, Proc, Part, CustomParameters) table.sort( BottomEdgesSorted, CompareEdges) -- lavorazione faccia bottom con fresa + local bAreAllMachiningsAdded = true local dDepthToMachine = BottomEdgesSorted[1].dElevation + 5 local OptionalParametersFaceByMill = { dDepthToMachine = dDepthToMachine, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail} -- primo lato local Milling = {} Milling = FaceByMill.Make( Proc, Part, Proc.MainFaces.BottomFaces[1], BottomEdgesSorted[1], OptionalParametersFaceByMill) - -- lavorazioni da applicare spostate in lista finale - table.insert( Strategy.Machinings, Milling) + if Milling.bIsApplicable then + -- lavorazioni da applicare spostate in lista finale + table.insert( Strategy.Machinings, Milling) - -- calcolo completamento, serve la lista di lavorazioni che comprende le non applicabili - Strategy.Result.dCompletionPercentage = GetStrategyCompletionPercentage( Strategy.Machinings) - Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage) + -- calcolo completamento, serve la lista di lavorazioni che comprende le non applicabili + Strategy.Result.dCompletionPercentage = GetStrategyCompletionPercentage( Strategy.Machinings) + Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage) - local MachiningResult = MachiningLib.GetSplitMachinings( Strategy.Machinings, FeatureSplittingPoints, Part) + local MachiningResult = MachiningLib.GetSplitMachinings( Strategy.Machinings, FeatureSplittingPoints, Part) - -- calcolo risultati - if Strategy.Machinings[1].bIsApplicable then Strategy.Result.nQuality = FeatureLib.GetStrategyQuality( MachiningResult) Strategy.Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( MachiningResult) Strategy.Result.dMRR = ( dFeatureVolume / Strategy.Result.dTimeToMachine) / pow( 10, 6) @@ -181,18 +181,19 @@ function STR0010.Make( bAddMachining, Proc, Part, CustomParameters) else Strategy.Result.sStatus = 'Not-Completed' end + + -- aggiunta lavorazioni + if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then + -- aggiunge lavorazione + for j = 1, #MachiningResult do + bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, MachiningResult[j]) + end + end + else Strategy.Result = FeatureLib.GetStrategyResultNotApplicable() end - local bAreAllMachiningsAdded = true - -- aggiunta lavorazioni - if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then - -- aggiunge lavorazione - for j = 1, #MachiningResult do - bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, MachiningResult[j]) - end - end return bAreAllMachiningsAdded, Strategy.Result end diff --git a/StrategyLibs/BLADEKEEPWASTE.lua b/StrategyLibs/BLADEKEEPWASTE.lua index 9d9b18d..7df2753 100644 --- a/StrategyLibs/BLADEKEEPWASTE.lua +++ b/StrategyLibs/BLADEKEEPWASTE.lua @@ -101,7 +101,7 @@ local function GetStrategyCompletionPercentage( Machinings) nWeightsCount = nWeightsCount + 1 end -- il peso deve essere settato in tutte le lavorazioni o in nessuna - if ( nWeightsCount == 0) or ( nWeightsCount ~= i) then + if nWeightsCount ~= 0 and nWeightsCount ~= i then error( 'GetWeightedCompletionPercentage : inconsistent weights') end local dWeightedCompletionPercentage = Machining.dCompletionPercentage / 100 * dWeight diff --git a/StrategyLibs/FACEBYMILL.lua b/StrategyLibs/FACEBYMILL.lua index c748a43..5c4a018 100644 --- a/StrategyLibs/FACEBYMILL.lua +++ b/StrategyLibs/FACEBYMILL.lua @@ -331,8 +331,8 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara Milling.dMaxElev = Milling.Steps.dStep * Milling.Steps.nCount - 10 * GEO.EPS_SMALL else Milling.Steps = {} - Milling.Steps.nCount = 1 Milling.Steps.dStep = TOOLS[Milling.nToolIndex].dStep + Milling.Steps.nCount = ceil( ( FaceToMachine.dElevation - 50 * GEO.EPS_SMALL) / Milling.Steps.dStep) Milling.Steps.nStepType = MCH_MILL_ST.ZIGZAG Milling.dMaxElev = FaceToMachine.dElevation end