From b28cdf488d4e2eaf2d78a638feba18d86070baff Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 13 Jul 2026 14:52:00 +0200 Subject: [PATCH] - in BeamExec se feature ignombra pinzaggio in qualche rotazione attiva si fa in ultima fase --- LuaLibs/BeamExec.lua | 51 ++++++++++++++++++++++----------- StrategyLibs/BLADEKEEPWASTE.lua | 2 ++ 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index f3a62e7..c21c5c2 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1698,17 +1698,17 @@ end ------------------------------------------------------------------------------------------------------------- -- funzione che calcola le combinazioni di rotazione per lavorare la trave e sceglie la migliore -local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bReProcessEmptyChosenStrategy, BitCombinationListToReprocess) +local function GetCombinationListFromMatrix( ProcessingsOnPart, Part, bReProcessEmptyChosenStrategy, BitCombinationListToReprocess) local CombinationsList = { dAllCombinationsTotalTime = 0} -- calcolo per tutte le combinazioni disponibili precedentemente verificate - for i = 1, #PartInfo.CombinationList do + for i = 1, #Part.CombinationList do local bToProcess = false -- controllo se debbano essere ricalcolate solo alcune soluzioni if BitCombinationListToReprocess and #BitCombinationListToReprocess > 0 then for c = 1, #BitCombinationListToReprocess do - if PartInfo.CombinationList[i].sBitIndexCombination == BitCombinationListToReprocess[c].sBitIndexCombination and - PartInfo.CombinationList[i].bPartInCombiIsInverted == BitCombinationListToReprocess[c].bPartInCombiIsInverted then + if Part.CombinationList[i].sBitIndexCombination == BitCombinationListToReprocess[c].sBitIndexCombination and + Part.CombinationList[i].bPartInCombiIsInverted == BitCombinationListToReprocess[c].bPartInCombiIsInverted then bToProcess = true end end @@ -1719,7 +1719,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro if bToProcess then local bRot90, bRot180 local SingleCombination = {} - local nUnloadPos = PartInfo.CombinationList[i].nUnloadPos + local nUnloadPos = Part.CombinationList[i].nUnloadPos SingleCombination.nRotations = 0 SingleCombination.dTotalTimeToMachine = 0 SingleCombination.dTotalQuality = 0 @@ -1727,9 +1727,9 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro SingleCombination.nComplete = 0 SingleCombination.nNotComplete = 0 SingleCombination.nNotExecute = 0 - SingleCombination.sBitIndexCombination = PartInfo.CombinationList[i].sBitIndexCombination + SingleCombination.sBitIndexCombination = Part.CombinationList[i].sBitIndexCombination -- TODO se pezzo invertito bisogna considerare le rotazioni nell'array dalla 5 alla 8 - SingleCombination.bPartInCombiIsInverted = PartInfo.CombinationList[i].bPartInCombiIsInverted + SingleCombination.bPartInCombiIsInverted = Part.CombinationList[i].bPartInCombiIsInverted SingleCombination.nUnloadPos = nUnloadPos -- creo liste dei proc suddivisi per rotazione SingleCombination.Rot0 = {} @@ -1750,19 +1750,38 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro else if not ( ( ID.IsHeadCut( ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc]) and ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc].bIsOriginalHeadcut) or ( ID.IsTailCut( ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc]) and ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc].bIsOriginalTailcut)) then + -- primo ciclo sulle rotazioni per vedere se la feature interferisce con il pinzaggio, in una qualunque rotazione + local dMaxNotClampableLengthHead = 0 + local dMaxNotClampableLengthTail = 0 + local dMaxNotClampableLength = 0 + for nRotation = 1, 4 do + -- si considera solo rotazione attiva + if string.sub( Part.CombinationList[i].sBitIndexCombination, nRotation, nRotation) == '1' then + dMaxNotClampableLengthHead = max( ProcessingsOnPart.Rotation[nRotation+nOffsetIndex][nProc].NotClampableLength.dNotClampableLengthHead, dMaxNotClampableLengthHead) + dMaxNotClampableLengthTail = max( ProcessingsOnPart.Rotation[nRotation+nOffsetIndex][nProc].NotClampableLength.dNotClampableLengthTail, dMaxNotClampableLengthTail) + end + end + dMaxNotClampableLength = max( dMaxNotClampableLengthHead, dMaxNotClampableLengthTail) -- ciclo sulle rotazioni local nNextRot = nUnloadPos local ResultsList = {} + local bExecInLastRotation = false for nRotation = 1, 3 do -- se rotazione abilitata da combinazione - if string.sub( PartInfo.CombinationList[i].sBitIndexCombination, nNextRot, nNextRot) == '1' then + if string.sub( Part.CombinationList[i].sBitIndexCombination, nNextRot, nNextRot) == '1' then local CurrProc = ProcessingsOnPart.Rotation[nNextRot+nOffsetIndex][nProc] - -- se è ultima rotazione oppure se feature non impatta su misura laser, allora è valida e può essere effettivamente considerata - if nNextRot == nUnloadPos or not( CurrProc.bHindersLaserMeasure) then - -- se non è settata la ChosenStrtegy, provo a cercare comunque tra quelle disponibili - if not CurrProc.ChosenStrategy and bReProcessEmptyChosenStrategy then - CurrProc = GetFeatureBestStrategy( CurrProc, PartInfo) - end + -- se non è settata la ChosenStrategy, provo a cercare comunque tra quelle disponibili + if not CurrProc.ChosenStrategy and bReProcessEmptyChosenStrategy then + CurrProc = GetFeatureBestStrategy( CurrProc, Part) + end + -- si verifica se la feature compromette il pinzaggio + local bIgnoreNotClampableLength = false + if CurrProc.ChosenStrategy then + bIgnoreNotClampableLength = CurrProc.ChosenStrategy.Result.bIgnoreNotClampableLength + end + bExecInLastRotation = ( not bIgnoreNotClampableLength) and FeatureLib.IsMachiningLong( dMaxNotClampableLength, Part) + -- se la feature impatta sulla lettura laser o compromette il pinzaggio è valida solo se fatta in ultima rotazione; negli altri casi è sempre valida + if nNextRot == nUnloadPos or not( CurrProc.bHindersLaserMeasure) or not( bExecInLastRotation) then -- controllo se è stata scelta una strategia if CurrProc.ChosenStrategy then local Proc = {} @@ -1782,7 +1801,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro SingleCombination.nIndexTailCutInVProc = nProc else if #ResultsList > 0 then - local Proc, Data = GetProcBestMachRotationFromList( ResultsList, PartInfo) + local Proc, Data = GetProcBestMachRotationFromList( ResultsList, Part) Proc.nIndexRotation = Data.nIndexRotation -- inserisco la Proc nell'apposita lista if Data.nIndexRotation == nUnloadPos then @@ -1833,7 +1852,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro end -- si calsola il total rating - CombinationsList = FeatureLib.CalculateCombinationsCompositeRating( CombinationsList, PartInfo.GeneralParameters.GEN_sMachiningStrategy) + CombinationsList = FeatureLib.CalculateCombinationsCompositeRating( CombinationsList, Part.GeneralParameters.GEN_sMachiningStrategy) return CombinationsList end diff --git a/StrategyLibs/BLADEKEEPWASTE.lua b/StrategyLibs/BLADEKEEPWASTE.lua index 0ad5564..9d48af2 100644 --- a/StrategyLibs/BLADEKEEPWASTE.lua +++ b/StrategyLibs/BLADEKEEPWASTE.lua @@ -478,6 +478,8 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) Result.dQuality = FeatureLib.GetStrategyQuality( Machinings) Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Machinings) Result.dMRR = ( dFeatureVolume / Result.dTimeToMachine) / pow( 10, 6) + -- il codolo non compromette mai il pinzaggio + Result.bIgnoreNotClampableLength = true if Result.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then Result.sStatus = 'Completed' if bForced then