- Completato strategia STR0014

- Migliorata gestione pezzo invertito
- Corretto problema scelta combinazione migliore
- In STR0001 corretto nome variabile
- In STR0011 (foro) cambiato messaggio warning in caso di lavorazione non completa
- In BLADETOWASTE se taglio troncante, si setta da fare dopo taglio coda
This commit is contained in:
andrea.villa
2025-09-05 13:14:50 +02:00
parent 3a4b29070e
commit 51dec026ec
11 changed files with 123 additions and 63 deletions
+28 -26
View File
@@ -304,7 +304,7 @@ function BeamExec.GetAvailableCombinations( PartInfo, bCalcBestPieceUnloadPositi
table.insert( CombinationList, Combination)
if nInvertIndex == 2 then
Combination.bPartIsInverted = true
Combination.bPartInCombiIsInverted = true
end
-- se posizionamento iniziale attivo
@@ -561,11 +561,11 @@ local function GetFeatureForcedStrategy( Proc)
end
-------------------------------------------------------------------------------------------------------------
local function AdjustPrcGrp( Proc, bPartIsInverted)
local function AdjustPrcGrp( Proc, bPartInCombiIsInverted)
local nNewPrc = { nPrc = Proc.nPrc, nGrp = Proc.nGrp}
-- se pezzo invertito
if bPartIsInverted then
if bPartInCombiIsInverted then
-- il taglio di testa diventa taglio di coda
if ID.IsHeadCut( Proc) then
_, nNewPrc.nPrc, nNewPrc.nGrp = ID.IsTailCut( Proc)
@@ -1269,21 +1269,23 @@ local function GetBestCombination( ListToCompare)
-- si sceglie soluzione con più feature complete
if ListToCompare[ListIndex].nComplete > ListToCompare[nIndexBestCombination].nComplete then
nIndexBestCombination = ListIndex
-- se stesso voto
elseif ListToCompare[nIndexBestCombination].dTotalRating == ListToCompare[ListIndex].dTotalRating then
-- TODO il voto dovrebbe essere considerato già pesando le rotazioni, con un coefficiente o un peso fisso aggiuntivo
-- scelgo soluzione con meno rotazioni
if ListToCompare[nIndexBestCombination].nRotations > ListToCompare[ListIndex].nRotations then
nIndexBestCombination = ListIndex
-- se anche le rotazioni sono le stesse, prendo la soluzione con più lavorazioni alla fine
elseif #ListToCompare[nIndexBestCombination].Rot0 < #ListToCompare[ListIndex].Rot0 then
nIndexBestCombination = ListIndex
end
-- se voto diverso
else
-- scelgo soluzione con voto più alto
if ListToCompare[nIndexBestCombination].dTotalRating < ListToCompare[ListIndex].dTotalRating then
nIndexBestCombination = ListIndex
elseif ListToCompare[ListIndex].nComplete == ListToCompare[nIndexBestCombination].nComplete then
-- se stesso voto
if ListToCompare[nIndexBestCombination].dTotalRating == ListToCompare[ListIndex].dTotalRating then
-- TODO il voto dovrebbe essere considerato già pesando le rotazioni, con un coefficiente o un peso fisso aggiuntivo
-- scelgo soluzione con meno rotazioni
if ListToCompare[nIndexBestCombination].nRotations > ListToCompare[ListIndex].nRotations then
nIndexBestCombination = ListIndex
-- se anche le rotazioni sono le stesse, prendo la soluzione con più lavorazioni alla fine
elseif #ListToCompare[nIndexBestCombination].Rot0 < #ListToCompare[ListIndex].Rot0 then
nIndexBestCombination = ListIndex
end
-- se voto diverso
else
-- scelgo soluzione con voto più alto
if ListToCompare[nIndexBestCombination].dTotalRating < ListToCompare[ListIndex].dTotalRating then
nIndexBestCombination = ListIndex
end
end
end
end
@@ -1391,7 +1393,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo)
SingleCombination.nNotExecute = 0
SingleCombination.sBitIndexCombination = PartInfo.CombinationList[i].sBitIndexCombination
-- TODO se pezzo invertito bisogna considerare le rotazioni nell'array dalla 5 alla 8
SingleCombination.bPartIsInverted = PartInfo.CombinationList[i].bPartIsInverted
SingleCombination.bPartInCombiIsInverted = PartInfo.CombinationList[i].bPartInCombiIsInverted
SingleCombination.nUnloadPos = nUnloadPos
-- creo liste dei proc suddivisi per rotazione
SingleCombination.Rot0 = {}
@@ -1411,7 +1413,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo)
else
-- ciclo sulle rotazioni
local nNextRot = nUnloadPos
local nOffsetIndex = EgtIf( SingleCombination.bPartIsInverted, 4, 0)
local nOffsetIndex = EgtIf( SingleCombination.bPartInCombiIsInverted, 4, 0)
local ResultsList = {}
for nRotation = 1, 3 do
-- se rotazione abilitata da combinazione
@@ -1553,7 +1555,7 @@ function BeamExec.ProcessMachinings( PARTS)
-- scelta delal migliore combinazione
local BestCombination = GetBestCombination( CombinationListFromMatrix)
PARTS[nPart].ChosenCombination = BestCombination.sBitIndexCombination
PARTS[nPart].bPartIsInverted = BestCombination.bPartIsInverted
PARTS[nPart].bPartInCombiIsInverted = BestCombination.bPartInCombiIsInverted
-- scrittura nel log delle combinazioni possibili
if EgtGetDebugLevel() >= 3 then
@@ -1581,7 +1583,7 @@ function BeamExec.ProcessMachinings( PARTS)
end
-- se combinazione prevede inversione, si gira il pezzo
if PARTS[nPart].bPartIsInverted then
if PARTS[nPart].bPartInCombiIsInverted then
BeamLib.InvertRawPart( PARTS[nPart], 2)
end
@@ -1590,7 +1592,7 @@ function BeamExec.ProcessMachinings( PARTS)
PrintFeatures( vProc, PARTS[nPart])
end
EgtOutLog( ' *** AddMachinings ***', 1)
-- se la posizione iniziale non è calcolata, significa che non ci sono feature da eseguire. Solo taglio testa/coda
if not MatrixResult.nInitialPosition then
MatrixResult.nInitialPosition = 1
@@ -1617,7 +1619,7 @@ function BeamExec.ProcessMachinings( PARTS)
-- salvo sul PART la posizione di partenza che è stata scelta
PARTS[nPart].nInitialPosition = MatrixResult.nInitialPosition
local nOffsetIndex = EgtIf( PARTS[nPart].bPartIsInverted, 4, 0)
local nOffsetIndex = EgtIf( PARTS[nPart].bPartInCombiIsInverted, 4, 0)
-- aggiunge tagli testa e coda in fasi opportune
local nRotHeadCut = MatrixResult.nInitialPosition + MACHININGS.Info.nHeadCutRotation - 1
if nRotHeadCut > 4 then
@@ -1721,7 +1723,7 @@ function BeamExec.ProcessMachinings( PARTS)
EgtSetInfo( idDisp, 'TYPE', 'MID')
end
-- se combinazione prevede inversione, si gira il pezzo
if PARTS[nPart].bPartIsInverted then
if PARTS[nPart].bPartInCombiIsInverted and not PARTS[nPart].bIsInverted then
BeamLib.InvertRawPart( PARTS[nPart], 2)
end
end
@@ -1746,7 +1748,7 @@ function BeamExec.ProcessMachinings( PARTS)
EgtSetInfo( idDisp, 'TYPE', 'MID')
end
-- se combinazione prevede inversione, si gira il pezzo
if PARTS[nPart].bPartIsInverted then
if PARTS[nPart].bPartInCombiIsInverted and not PARTS[nPart].bIsInverted then
BeamLib.InvertRawPart( PARTS[nPart], 2)
end
end