Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a2868c4a8 | |||
| eb6d2a1a1e | |||
| 5c6d6951c9 | |||
| 14bb688e26 | |||
| d86e1c1c56 | |||
| 2a8b7d37f6 | |||
| 86bda3d3af | |||
| 60d8387485 | |||
| 60166eb995 | |||
| 3f0654c655 | |||
| 9706f218a8 | |||
| c114794d0b | |||
| 4ef7e0cc0e | |||
| 6eff65e4ac | |||
| 236d9a43b0 | |||
| e4ab69f749 | |||
| 2d72146ae0 | |||
| 4552235383 | |||
| 8aab3e9cbc | |||
| d2e0402a07 | |||
| 5a871ea134 | |||
| 06d27a1df7 | |||
| aa4968787a | |||
| 88b2e90ef7 | |||
| 53b2ef5e6a | |||
| 6832d1d95b |
+208
-136
@@ -822,7 +822,33 @@ local function AreDrillingsMirrored( Proc, ProcMirror, Part)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetFeatureInfoAndDependency( vProcSingleRot, Part, bIsFlipRot)
|
||||
local function GetHeadTailInfoForNesting( HeadProc, TailProc, Part)
|
||||
-- per nesting, si settano come info gli offset X degli estremi dei tagli
|
||||
local HeadcutInfo = {}
|
||||
local PtSortedHead = BeamLib.GetSortedVertices( HeadProc)
|
||||
if PtSortedHead then
|
||||
HeadcutInfo.OffsetX = {}
|
||||
for i = 1, #PtSortedHead do
|
||||
table.insert( HeadcutInfo.OffsetX, Part.b3Part:getMax():getX() - PtSortedHead[i]:getX())
|
||||
end
|
||||
end
|
||||
local TailcutInfo = {}
|
||||
local PtSortedTail = BeamLib.GetSortedVertices( TailProc)
|
||||
if PtSortedTail then
|
||||
TailcutInfo.OffsetX = {}
|
||||
for i = 1, #PtSortedTail do
|
||||
table.insert( TailcutInfo.OffsetX, Part.b3Part:getMin():getX() - PtSortedTail[i]:getX())
|
||||
end
|
||||
end
|
||||
-- per nesting, si settano come info le normali delle facce di taglio
|
||||
HeadcutInfo.vtN = Vector3d( HeadProc.Faces[1].vtN)
|
||||
TailcutInfo.vtN = Vector3d( TailProc.Faces[1].vtN)
|
||||
|
||||
return HeadcutInfo, TailcutInfo
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
||||
-- gruppo per geometrie temporanee
|
||||
local idTempGroup = BeamLib.GetTempGroup()
|
||||
|
||||
@@ -966,10 +992,6 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part, bIsFlipRot)
|
||||
end
|
||||
end
|
||||
|
||||
if not Part.GeneralParameters.GEN_bGetAlternativesNesting2D then
|
||||
return vProcSingleRot
|
||||
end
|
||||
|
||||
-- si tiene via il riferimento alla Proc Head/Tail originale in caso si dovesse rimpiazzare
|
||||
HeadProcOriginal.bIsOriginalHeadcut = true
|
||||
TailProcOriginal.bIsOriginalTailcut = true
|
||||
@@ -984,36 +1006,22 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part, bIsFlipRot)
|
||||
TailProc.TailProcOriginal = TailProcOriginal
|
||||
end
|
||||
|
||||
if not Part.GeneralParameters.GEN_bGetAlternativesNesting2D then
|
||||
return vProcSingleRot
|
||||
end
|
||||
|
||||
HeadProc.Topology = {}
|
||||
TailProc.Topology = {}
|
||||
HeadProc.Topology.bIsThrough = true
|
||||
HeadProc.Topology.sFamily = 'HeadCut'
|
||||
HeadProc.Topology.sName = 'HeadCut'
|
||||
TailProc.Topology.bIsThrough = true
|
||||
TailProc.Topology.sFamily = 'TailCut'
|
||||
TailProc.Topology.sName = 'TailCut'
|
||||
HeadProc.AvailableStrategies = GetStrategies( HeadProc, Part.sAISetupConfig)
|
||||
TailProc.AvailableStrategies = GetStrategies( TailProc, Part.sAISetupConfig)
|
||||
-- per nesting, si settano come info gli offset X degli estremi dei tagli
|
||||
local HeadcutInfo = {}
|
||||
local PtSortedHead = BeamLib.GetSortedVertices( HeadProc)
|
||||
if PtSortedHead then
|
||||
HeadcutInfo.OffsetX = {}
|
||||
for i = 1, #PtSortedHead do
|
||||
table.insert( HeadcutInfo.OffsetX, Part.b3Part:getMax():getX() - PtSortedHead[i]:getX())
|
||||
end
|
||||
end
|
||||
local TailcutInfo = {}
|
||||
local PtSortedTail = BeamLib.GetSortedVertices( TailProc)
|
||||
if PtSortedTail then
|
||||
TailcutInfo.OffsetX = {}
|
||||
for i = 1, #PtSortedTail do
|
||||
table.insert( TailcutInfo.OffsetX, Part.b3Part:getMin():getX() - PtSortedTail[i]:getX())
|
||||
end
|
||||
end
|
||||
-- per nesting, si settano come info le normali delle facce di taglio
|
||||
HeadcutInfo.vtN = HeadProc.Faces[1].vtN
|
||||
TailcutInfo.vtN = TailProc.Faces[1].vtN
|
||||
|
||||
return vProcSingleRot, HeadcutInfo, TailcutInfo
|
||||
return vProcSingleRot
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -1131,64 +1139,106 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione che processa tutte le feature del pezzo
|
||||
local function CalculateStrategies( vProcSingleRot, Part)
|
||||
-- per ogni feature
|
||||
for i = 1, #vProcSingleRot do
|
||||
-- processo tutte le feature attive
|
||||
local Proc = vProcSingleRot[i]
|
||||
if Proc.nFlg ~= 0 then
|
||||
-- controllo se ci sono strategie disponibili
|
||||
if Proc.AvailableStrategies and #Proc.AvailableStrategies > 0 then
|
||||
-- se le strategie disponibili sono le basic, non si possono customizzare valori di default da interfaccia
|
||||
-- si leggono allora eventuali parametri di default scritti come info sulla feature
|
||||
if Proc.AvailableStrategies.bIsBasicStrategy then
|
||||
-- si recuperano eventuali parametri custom
|
||||
for j = 1, #Proc.AvailableStrategies do
|
||||
-- essendo una strategia basic, la lista dei parametri custom dovrebbe essere sempre vuota. Si leggono ora
|
||||
if not Proc.AvailableStrategies[j].ParameterList then
|
||||
Proc.AvailableStrategies[j].ParameterList = BCS.GetParametersFromBasicCustomerStrategies( Proc, Proc.AvailableStrategies[j].sStrategyId)
|
||||
local nCounter = 0
|
||||
repeat
|
||||
nCounter = nCounter + 1
|
||||
local bToReprocess = false
|
||||
-- per ogni feature
|
||||
for i = 1, #vProcSingleRot do
|
||||
-- processo tutte le feature attive
|
||||
local Proc = vProcSingleRot[i]
|
||||
if Proc.nFlg ~= 0 then
|
||||
-- controllo se ci sono strategie disponibili
|
||||
if Proc.AvailableStrategies and #Proc.AvailableStrategies > 0 then
|
||||
-- se le strategie disponibili sono le basic, non si possono customizzare valori di default da interfaccia
|
||||
-- si leggono allora eventuali parametri di default scritti come info sulla feature
|
||||
if Proc.AvailableStrategies.bIsBasicStrategy then
|
||||
-- si recuperano eventuali parametri custom
|
||||
for j = 1, #Proc.AvailableStrategies do
|
||||
-- essendo una strategia basic, la lista dei parametri custom dovrebbe essere sempre vuota. Si leggono ora
|
||||
if not Proc.AvailableStrategies[j].ParameterList then
|
||||
Proc.AvailableStrategies[j].ParameterList = BCS.GetParametersFromBasicCustomerStrategies( Proc, Proc.AvailableStrategies[j].sStrategyId)
|
||||
end
|
||||
end
|
||||
-- si riprocessano le strategie dopo che sono stati letti i parametri
|
||||
Proc.AvailableStrategies = BCS.UpdateStrategies( Proc.AvailableStrategies)
|
||||
end
|
||||
|
||||
-- ciclo tutte le strategie della feature
|
||||
for nIndexCurrentStrategy = 1, #Proc.AvailableStrategies do
|
||||
-- eseguo file config con i parametri di default
|
||||
local CurrentStrategy = {}
|
||||
CurrentStrategy = RunStrategyLibraries( Proc.AvailableStrategies[nIndexCurrentStrategy].sStrategyId)
|
||||
-- controllo che le librerie siano state effettivamente caricate
|
||||
if CurrentStrategy.Config and CurrentStrategy.Script then
|
||||
-- eseguo la strategia solo come calcolo fattibilità e voto. Non si applicano le lavorazioni. Si passa la Proc e i parametri personalizzati
|
||||
_, Proc.AvailableStrategies[nIndexCurrentStrategy].Result = CurrentStrategy.Script.Make( false, Proc, Part, Proc.AvailableStrategies[nIndexCurrentStrategy])
|
||||
|
||||
-- se taglio di testa o coda sostitutivo non applicabile si ripristina l'originale
|
||||
if Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus ~= 'Completed' then
|
||||
if ID.IsHeadCut( Proc) and not Proc.bIsOriginalHeadcut then
|
||||
-- si riabilita taglio di testa originale
|
||||
Proc.HeadProcOriginal.nFlg = 1
|
||||
Proc.HeadProcOriginal.nIndexMasterProc = nil
|
||||
-- il taglio attuale va riportato alla sua topologia originale
|
||||
Proc.Topology = FeatureLib.ClassifyTopology( Proc, Part)
|
||||
Proc.AvailableStrategies = GetStrategies( Proc, Part.sAISetupConfig)
|
||||
for j = #Proc.SlaveProcIndexes, 1, -1 do
|
||||
if Proc.SlaveProcIndexes[j] == Proc.HeadProcOriginal.nIndexInVProc then
|
||||
table.remove( Proc.SlaveProcIndexes, j)
|
||||
end
|
||||
end
|
||||
bToReprocess = true
|
||||
break
|
||||
elseif ID.IsTailCut( Proc) and not Proc.bIsOriginalTailcut then
|
||||
-- si riabilita il taglio di coda originale
|
||||
Proc.TailProcOriginal.nFlg = 1
|
||||
Proc.TailProcOriginal.nIndexMasterProc = nil
|
||||
-- il taglio attuale va riportato alla sua topologia originale
|
||||
Proc.Topology = FeatureLib.ClassifyTopology( Proc, Part)
|
||||
Proc.AvailableStrategies = GetStrategies( Proc, Part.sAISetupConfig)
|
||||
for j = #Proc.SlaveProcIndexes, 1, -1 do
|
||||
if Proc.SlaveProcIndexes[j] == Proc.TailProcOriginal.nIndexInVProc then
|
||||
table.remove( Proc.SlaveProcIndexes, j)
|
||||
end
|
||||
end
|
||||
bToReprocess = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO da capire se dare un tempo molto alto oppure se dare errore perchè non deve mai capitare. Per ora si setta tempo alto
|
||||
-- se tempo non calcolato, si setta un tempo molto alto, 99 minuti
|
||||
if not Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine or Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine == 0 then
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine = 99
|
||||
end
|
||||
|
||||
if not Proc.AvailableStrategies.dAllStrategiesTotalTime then
|
||||
Proc.AvailableStrategies.dAllStrategiesTotalTime = 0
|
||||
end
|
||||
Proc.AvailableStrategies.dAllStrategiesTotalTime = Proc.AvailableStrategies.dAllStrategiesTotalTime + Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine
|
||||
-- se scelta strategia in modalità base o standard, esco subito alla prima che trovo completa
|
||||
if Part.GeneralParameters.GEN_sMachiningStrategy == 'FIRST_IN_LIST' and Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus == 'Completed' then
|
||||
break
|
||||
end
|
||||
|
||||
-- se non trovo i file della strategia (Script e Config), scrivo che non è più disponibile
|
||||
else
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result = {}
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sInfo = 'Strategy not found'
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus = 'Not-Applicable'
|
||||
end
|
||||
end
|
||||
-- si riprocessano le strategie dopo che sono stati letti i parametri
|
||||
Proc.AvailableStrategies = BCS.UpdateStrategies( Proc.AvailableStrategies)
|
||||
end
|
||||
|
||||
-- ciclo tutte le strategie della feature
|
||||
for nIndexCurrentStrategy = 1, #Proc.AvailableStrategies do
|
||||
-- eseguo file config con i parametri di default
|
||||
local CurrentStrategy = {}
|
||||
CurrentStrategy = RunStrategyLibraries( Proc.AvailableStrategies[nIndexCurrentStrategy].sStrategyId)
|
||||
-- controllo che le librerie siano state effettivamente caricate
|
||||
if CurrentStrategy.Config and CurrentStrategy.Script then
|
||||
-- eseguo la strategia solo come calcolo fattibilità e voto. Non si applicano le lavorazioni. Si passa la Proc e i parametri personalizzati
|
||||
_, Proc.AvailableStrategies[nIndexCurrentStrategy].Result = CurrentStrategy.Script.Make( false, Proc, Part, Proc.AvailableStrategies[nIndexCurrentStrategy])
|
||||
|
||||
-- TODO da capire se dare un tempo molto alto oppure se dare errore perchè non deve mai capitare. Per ora si setta tempo alto
|
||||
-- se tempo non calcolato, si setta un tempo molto alto, 99 minuti
|
||||
if not Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine or Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine == 0 then
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine = 99
|
||||
end
|
||||
|
||||
if not Proc.AvailableStrategies.dAllStrategiesTotalTime then
|
||||
Proc.AvailableStrategies.dAllStrategiesTotalTime = 0
|
||||
end
|
||||
Proc.AvailableStrategies.dAllStrategiesTotalTime = Proc.AvailableStrategies.dAllStrategiesTotalTime + Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine
|
||||
-- se scelta strategia in modalità base o standard, esco subito alla prima che trovo completa
|
||||
if Part.GeneralParameters.GEN_sMachiningStrategy == 'FIRST_IN_LIST' and Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus == 'Completed' then
|
||||
break
|
||||
end
|
||||
|
||||
-- se non trovo i file della strategia (Script e Config), scrivo che non è più disponibile
|
||||
else
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result = {}
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sInfo = 'Strategy not found'
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus = 'Not-Applicable'
|
||||
if bToReprocess then
|
||||
break
|
||||
end
|
||||
-- si calcola il composite rating delle strategie
|
||||
Proc.AvailableStrategies = FeatureLib.CalculateStrategiesCompositeRating( Proc.AvailableStrategies, Part.GeneralParameters.GEN_sMachiningStrategy)
|
||||
end
|
||||
-- si calcola il composite rating delle strategie
|
||||
Proc.AvailableStrategies = FeatureLib.CalculateStrategiesCompositeRating( Proc.AvailableStrategies, Part.GeneralParameters.GEN_sMachiningStrategy)
|
||||
end
|
||||
end
|
||||
end
|
||||
until ( not bToReprocess) or ( nCounter > 5)
|
||||
|
||||
return vProcSingleRot
|
||||
end
|
||||
|
||||
@@ -1382,7 +1432,7 @@ local function CalculateMachinings( vProc, Part, nInitialRotation)
|
||||
-- eseguo la strategia e si applicano le lavorazioni. Si passa la Proc e i parametri personalizzati
|
||||
local _, Result = StrategyScript.Make( true, Proc, Part, Proc.ChosenStrategy)
|
||||
-- per i tagli di testa e coda, che non hanno girato nel CalculateStrategies, si devono settare i risultati
|
||||
if ID.IsHeadCut( Proc) or ID.IsTailCut( Proc) then
|
||||
if ( ID.IsHeadCut( Proc) or ID.IsTailCut( Proc)) and not Proc.ChosenStrategy.Result then
|
||||
Proc.ChosenStrategy.Result = Result
|
||||
end
|
||||
-- se tutte le strategie disponibili non sono applicabili
|
||||
@@ -1436,8 +1486,6 @@ function BeamExec.GetProcessings( PARTS, bIsFlipRot)
|
||||
-- se è prerotazione, oltre al ciclo normale, si devono verificare anche invertiti
|
||||
local bCalcInverted = bIsFlipRot and PARTS[nPart].GeneralParameters.GEN_bAllowPieceInversion
|
||||
local nCycles = EgtIf( bCalcInverted, 2, 1)
|
||||
PARTS[nPart].HeadcutInfo = {}
|
||||
PARTS[nPart].TailcutInfo = {}
|
||||
-- per ogni inversione
|
||||
for nInvertIndex = 1, nCycles do
|
||||
-- per ogni rotazione
|
||||
@@ -1453,23 +1501,11 @@ function BeamExec.GetProcessings( PARTS, bIsFlipRot)
|
||||
|
||||
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
|
||||
-- TODO le dipendenze cambiano in base alla rotazione del pezzo? probabilmente no
|
||||
vProcRot[nIndex], HeadcutInfo, TailcutInfo = GetFeatureInfoAndDependency( vProcRot[nIndex], PARTS[nPart], bIsFlipRot)
|
||||
vProcRot[nIndex] = GetFeatureInfoAndDependency( vProcRot[nIndex], PARTS[nPart])
|
||||
else
|
||||
-- inserisco una tabella vuota
|
||||
table.insert( vProcRot, {})
|
||||
end
|
||||
if HeadcutInfo then
|
||||
PARTS[nPart].HeadcutInfo[nIndex] = {
|
||||
OffsetX = HeadcutInfo.OffsetX,
|
||||
vtN = HeadcutInfo.vtN
|
||||
}
|
||||
end
|
||||
if TailcutInfo then
|
||||
PARTS[nPart].TailcutInfo[nIndex] = {
|
||||
OffsetX = TailcutInfo.OffsetX,
|
||||
vtN = TailcutInfo.vtN
|
||||
}
|
||||
end
|
||||
-- rotazione pezzo di 90° per volta
|
||||
BeamLib.RotateRawPart( PARTS[nPart], 1)
|
||||
-- aggiorno info pezzo
|
||||
@@ -1681,6 +1717,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
||||
SingleCombination.nRotations = 0
|
||||
SingleCombination.dTotalTimeToMachine = 0
|
||||
SingleCombination.dTotalQuality = 0
|
||||
SingleCombination.dFeatureRotationIndex = 0
|
||||
SingleCombination.dTotalCompletionIndex = 0
|
||||
SingleCombination.nComplete = 0
|
||||
SingleCombination.nNotComplete = 0
|
||||
@@ -1697,17 +1734,17 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
||||
-- ciclo su tutte le feature, ad eccezione dei tagli testa/coda che dipendono dal risultato delle altre
|
||||
-- tagli testa e coda vengono aggiunti sempre alla fine
|
||||
for nProc = 1, #ProcessingsOnPart.Rotation[1] do
|
||||
-- Si controlla sempre la rotazione 1 perchè la dipendenza di una feature da un'altra non dipende dalla rotazione
|
||||
-- Si controlla sempre la rotazione 1 perchè la dipendenza di una feature da un'altra non dipende dalla rotazione (ma dall'inversione sì!)
|
||||
-- se feature disattivata perchè eseguita da master a lei associata dichiaro comunque eseguita
|
||||
local ProcOnFirstRotation = ProcessingsOnPart.Rotation[1][nProc]
|
||||
local nOffsetIndex = EgtIf( SingleCombination.bPartInCombiIsInverted, 4, 0)
|
||||
local ProcOnFirstRotation = ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc]
|
||||
if ProcOnFirstRotation.nFlg == 0 and ProcOnFirstRotation.nIndexMasterProc then
|
||||
ProcOnFirstRotation.nIndexRotation = nUnloadPos
|
||||
table.insert( SingleCombination.Rot0, ProcOnFirstRotation)
|
||||
SingleCombination.nComplete = SingleCombination.nComplete + 1
|
||||
else
|
||||
local nOffsetIndex = EgtIf( SingleCombination.bPartInCombiIsInverted, 4, 0)
|
||||
if not ( ( ID.IsHeadCut( ProcOnFirstRotation) and ProcOnFirstRotation.bIsOriginalHeadcut)
|
||||
or ( ID.IsTailCut( ProcOnFirstRotation) and ProcOnFirstRotation.bIsOriginalTailcut)) then
|
||||
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
|
||||
-- ciclo sulle rotazioni
|
||||
local nNextRot = nUnloadPos
|
||||
local ResultsList = {}
|
||||
@@ -1756,6 +1793,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
||||
SingleCombination.dTotalTimeToMachine = SingleCombination.dTotalTimeToMachine + Data.dTimeToMachine
|
||||
SingleCombination.dTotalQuality = SingleCombination.dTotalQuality + Data.dQuality
|
||||
SingleCombination.dTotalCompletionIndex = SingleCombination.dTotalCompletionIndex + Data.dCompletionIndex
|
||||
SingleCombination.dFeatureRotationIndex = SingleCombination.dFeatureRotationIndex + ( Data.dFeatureRotationIndex or 3)
|
||||
SingleCombination.nComplete = SingleCombination.nComplete + EgtIf( Data.bComplete, 1, 0)
|
||||
SingleCombination.nNotComplete = SingleCombination.nNotComplete + EgtIf( Data.bNotComplete, 1, 0)
|
||||
SingleCombination.nNotExecute = SingleCombination.nNotExecute + EgtIf( Data.bNotApplicable, 1, 0)
|
||||
@@ -1938,30 +1976,34 @@ function BeamExec.ProcessMachinings( PARTS, bIsFlipRot)
|
||||
if nRotSplitCut > 4 then
|
||||
nRotSplitCut = nRotSplitCut - 4
|
||||
end
|
||||
|
||||
local HeadCut = PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc]
|
||||
local TailCut = PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc]
|
||||
|
||||
-- setto nella Proc l'indice rotazione nella quale deve essere lavorata
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].nIndexRotation = nRotHeadCut
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].nIndexRotation = nRotSplitCut
|
||||
HeadCut.nIndexRotation = nRotHeadCut
|
||||
TailCut.nIndexRotation = nRotSplitCut
|
||||
|
||||
-- si imposta flag rotazione per taglio di testa
|
||||
if MACHININGS.Info.nHeadCutRotation == 2 then
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bSide = true
|
||||
HeadCut.bSide = true
|
||||
elseif MACHININGS.Info.nHeadCutRotation == 3 then
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bDown = true
|
||||
HeadCut.bDown = true
|
||||
else
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bStd = true
|
||||
HeadCut.bStd = true
|
||||
end
|
||||
-- si imposta flag rotazione per taglio di coda
|
||||
if MACHININGS.Info.nSplitCutRotation == 2 then
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bSide = true
|
||||
TailCut.bSide = true
|
||||
elseif MACHININGS.Info.nSplitCutRotation == 3 then
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bDown = true
|
||||
TailCut.bDown = true
|
||||
else
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bStd = true
|
||||
TailCut.bStd = true
|
||||
end
|
||||
|
||||
local vProcHeadTail = {}
|
||||
table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc])
|
||||
table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc])
|
||||
table.insert( vProcHeadTail, HeadCut)
|
||||
table.insert( vProcHeadTail, TailCut)
|
||||
|
||||
MACHININGS = CalculateMachinings( vProcHeadTail, PARTS[nPart], MatrixResult.nInitialPosition)
|
||||
|
||||
@@ -2267,6 +2309,10 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
end
|
||||
end
|
||||
|
||||
-- informazioni tagli di testa e coda da passare a nesting
|
||||
PARTS[nPart].HeadcutInfo = {}
|
||||
PARTS[nPart].TailcutInfo = {}
|
||||
|
||||
-- fino a che ci sono soluzioni da testare
|
||||
for z = 1, #TotalCombiToTest do
|
||||
-- si svuota il machgroup e si resettano le variabili
|
||||
@@ -2341,42 +2387,69 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
if nRotSplitCut > 4 then
|
||||
nRotSplitCut = nRotSplitCut - 4
|
||||
end
|
||||
|
||||
local HeadCut = PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc]
|
||||
local TailCut = PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc]
|
||||
|
||||
-- setto nella Proc l'indice rotazione nella quale deve essere lavorata
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].nIndexRotation = nRotHeadCut
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].nIndexRotation = nRotSplitCut
|
||||
HeadCut.nIndexRotation = nRotHeadCut
|
||||
TailCut.nIndexRotation = nRotSplitCut
|
||||
|
||||
-- si imposta flag rotazione per taglio di testa
|
||||
if MACHININGS.Info.nHeadCutRotation == 2 then
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bDown = nil
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bSide = true
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bStd = nil
|
||||
HeadCut.bDown = nil
|
||||
HeadCut.bSide = true
|
||||
HeadCut.bStd = nil
|
||||
elseif MACHININGS.Info.nHeadCutRotation == 3 then
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bDown = true
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bSide = nil
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bStd = nil
|
||||
HeadCut.bDown = true
|
||||
HeadCut.bSide = nil
|
||||
HeadCut.bStd = nil
|
||||
else
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bDown = nil
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bSide = nil
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bStd = true
|
||||
HeadCut.bDown = nil
|
||||
HeadCut.bSide = nil
|
||||
HeadCut.bStd = true
|
||||
end
|
||||
-- si imposta flag rotazione per taglio di coda
|
||||
if MACHININGS.Info.nSplitCutRotation == 2 then
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bDown = nil
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bSide = true
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bStd = nil
|
||||
TailCut.bDown = nil
|
||||
TailCut.bSide = true
|
||||
TailCut.bStd = nil
|
||||
elseif MACHININGS.Info.nSplitCutRotation == 3 then
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bDown = true
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bSide = nil
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bStd = nil
|
||||
TailCut.bDown = true
|
||||
TailCut.bSide = nil
|
||||
TailCut.bStd = nil
|
||||
else
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bDown = nil
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bSide = nil
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bStd = true
|
||||
TailCut.bDown = nil
|
||||
TailCut.bSide = nil
|
||||
TailCut.bStd = true
|
||||
end
|
||||
|
||||
local vProcHeadTail = {}
|
||||
table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc])
|
||||
table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc])
|
||||
table.insert( vProcHeadTail, HeadCut)
|
||||
table.insert( vProcHeadTail, TailCut)
|
||||
|
||||
-- aggiornamento info testa/coda per Nesting
|
||||
local nRotation = BeamLib.ConvertBitIndexToRotationIndex( BestCombination.sBitIndexCombination)
|
||||
local sBitIndexCombinationWithInvert = BestCombination.sBitIndexCombination .. EgtIf( BestCombination.bPartInCombiIsInverted, '_INV', '')
|
||||
local HeadcutInfo, TailcutInfo = GetHeadTailInfoForNesting( HeadCut, TailCut, PARTS[nPart])
|
||||
if HeadcutInfo then
|
||||
-- offset e vettori vanno adeguati alla rotazione attuale (inversione è già corretta)
|
||||
BeamLib.RotateTableFromIndexInPlace( HeadcutInfo.OffsetX, nRotation)
|
||||
HeadcutInfo.vtN:rotate( X_AX(), ( nRotation - 1) * 90)
|
||||
PARTS[nPart].HeadcutInfo[sBitIndexCombinationWithInvert] = {
|
||||
OffsetX = HeadcutInfo.OffsetX,
|
||||
vtN = HeadcutInfo.vtN
|
||||
}
|
||||
end
|
||||
if TailcutInfo then
|
||||
-- offset e vettori vanno adeguati alla rotazione attuale (inversione è già corretta)
|
||||
BeamLib.RotateTableFromIndexInPlace( TailcutInfo.OffsetX, nRotation)
|
||||
TailcutInfo.vtN:rotate( X_AX(), ( nRotation - 1) * 90)
|
||||
PARTS[nPart].TailcutInfo[sBitIndexCombinationWithInvert] = {
|
||||
OffsetX = TailcutInfo.OffsetX,
|
||||
vtN = TailcutInfo.vtN
|
||||
}
|
||||
end
|
||||
|
||||
MACHININGS = CalculateMachinings( vProcHeadTail, PARTS[nPart], MatrixResult.nInitialPosition)
|
||||
|
||||
@@ -2533,15 +2606,14 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
BEAM.INFONGEPART = {}
|
||||
table.insert( BEAM.INFONGEPART, 'INITIALPOSITION=' .. PARTS[nPart].nInitialPosition)
|
||||
for i = 1, #AlternativesNest2D do
|
||||
local sRotation = BeamLib.ConvertBitIndexToRotationIndex( AlternativesNest2D[i])
|
||||
if PARTS[nPart].HeadcutInfo then
|
||||
local sOffsetX = table.concat( PARTS[nPart].HeadcutInfo[sRotation].OffsetX, ',')
|
||||
local sVtN = ( tostring( PARTS[nPart].HeadcutInfo[sRotation].vtN)):gsub("^%(", ""):gsub("%)$", "")
|
||||
local sOffsetX = table.concat( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].OffsetX, ',')
|
||||
local sVtN = ( tostring( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].vtN)):gsub("^%(", ""):gsub("%)$", "")
|
||||
table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i].. '_H' .. '=' .. sOffsetX .. ';' .. sVtN )
|
||||
end
|
||||
if PARTS[nPart].TailcutInfo then
|
||||
local sOffsetX = table.concat( PARTS[nPart].TailcutInfo[sRotation].OffsetX, ',')
|
||||
local sVtN = ( tostring( PARTS[nPart].TailcutInfo[sRotation].vtN)):gsub("^%(", ""):gsub("%)$", "")
|
||||
local sOffsetX = table.concat( PARTS[nPart].TailcutInfo[AlternativesNest2D[i]].OffsetX, ',')
|
||||
local sVtN = ( tostring( PARTS[nPart].TailcutInfo[AlternativesNest2D[i]].vtN)):gsub("^%(", ""):gsub("%)$", "")
|
||||
table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i] .. '_T' .. '=' .. sOffsetX .. ';' .. sVtN)
|
||||
end
|
||||
end
|
||||
|
||||
+26
-6
@@ -961,16 +961,36 @@ function BeamLib.ConvertBitIndexToRotationIndex( sBitIndexCombination)
|
||||
return nRotationIndex
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- inverte la porzione tra nStartIndex e nEndIndex della tabella passata
|
||||
local function ReverseTablePortionInPlace( Table, nStartIndex, nEndIndex)
|
||||
while nStartIndex < nEndIndex do
|
||||
Table[nStartIndex], Table[nEndIndex] = Table[nEndIndex], Table[nStartIndex]
|
||||
nStartIndex = nStartIndex + 1
|
||||
nEndIndex = nEndIndex - 1
|
||||
end
|
||||
|
||||
return Table
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- reindicizza una tabella passata ripartendo dall'indice nStartIndex e mantenendo l'ordine
|
||||
function BeamLib.RotateTableFromIndex( Table, nStartIndex)
|
||||
local RotatedTable = {}
|
||||
function BeamLib.RotateTableFromIndexInPlace( Table, nStartIndex)
|
||||
local dLen = #Table
|
||||
|
||||
for i = 1, #Table do
|
||||
RotatedTable[#RotatedTable + 1] = Table[((RotatedTable + i - 2) % #Table) + 1]
|
||||
end
|
||||
-- Nessuna rotazione necessaria se la tabella è vuota, ha 1 solo elemento, o la rotazione è dall'indice 1
|
||||
if dLen <= 1 or nStartIndex <= 1 or nStartIndex > dLen then
|
||||
return Table
|
||||
end
|
||||
|
||||
return RotatedTable
|
||||
local k = nStartIndex - 1
|
||||
|
||||
ReverseTablePortionInPlace( Table, 1, k) -- 1. Inverte la parte inziale
|
||||
ReverseTablePortionInPlace( Table, k + 1, dLen) -- 2. Inverte la parte finale
|
||||
ReverseTablePortionInPlace( Table, 1, dLen) -- 3. Inverte tutto
|
||||
|
||||
return Table
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -788,15 +788,17 @@ function FeatureLib.CalculateCombinationsCompositeRating( CombinationsList, sMac
|
||||
local dIndexWeightTimeToMachine = 5 - ( 4 * ( EgtClamp( CombinationsList[n].dTotalTimeToMachine / CombinationsList.dAllCombinationsTotalTime, 0, 1)))
|
||||
|
||||
-- si calcolano gli indici pesati in base alla configurazione utente. Possibili parametri di configurazione:
|
||||
local dQuality, dCompletion, dTime, dCoeffQuality, dCoeffCompletion, dCoeffTime
|
||||
local dQuality, dCompletion, dTime, dFeatureRotationIndex, dCoeffQuality, dCoeffCompletion, dCoeffTime
|
||||
dCoeffQuality, dCoeffCompletion, dCoeffTime = GetMachiningStrategyCoefficients( sMachiningStrategy)
|
||||
|
||||
|
||||
dQuality = CombinationsList[n].dTotalQuality * dCoeffQuality
|
||||
dCompletion = CombinationsList[n].dTotalCompletionIndex * dCoeffCompletion
|
||||
dTime = dIndexWeightTimeToMachine * dCoeffTime
|
||||
dFeatureRotationIndex = CombinationsList[n].dFeatureRotationIndex
|
||||
|
||||
CombinationsList[n].dTotalRating = dQuality + dCompletion + dTime -- TODO da verificare se meglio sommare o moltiplicare gli indici
|
||||
-- TODO da verificare se meglio sommare o moltiplicare gli indici
|
||||
CombinationsList[n].dTotalRating = dQuality + dCompletion + dTime + dFeatureRotationIndex
|
||||
else
|
||||
CombinationsList[n].dTotalRating = 0
|
||||
end
|
||||
@@ -955,7 +957,7 @@ function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
|
||||
local dNotClampableLengthTail = 0
|
||||
|
||||
-- se il grezzo non è definito, prendo il box del pezzo
|
||||
-- TODO 1- si sta passando b3part per riferimento, 2- non dovrebbe essre sempre definito?
|
||||
-- TODO 1- si sta passando b3part per riferimento, è giusto? 2- non dovrebbe essre sempre definito?
|
||||
if not Part.b3Raw then
|
||||
Part.b3Raw = Part.b3Part
|
||||
end
|
||||
|
||||
@@ -209,6 +209,9 @@ function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part)
|
||||
Machinings[nCurrentMachiningIndex].nFeatureSegment = j
|
||||
Machinings[nCurrentMachiningIndex].dLengthToMachine = Machinings[nCurrentMachiningIndex].dEdgeLength + Machinings[nCurrentMachiningIndex].LeadIn.dStartAddLength + Machinings[nCurrentMachiningIndex].LeadOut.dEndAddLength
|
||||
Machinings[nCurrentMachiningIndex].dTimeToMachine = MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machinings[nCurrentMachiningIndex], Part)
|
||||
Machinings[nCurrentMachiningIndex].bIsFirstSegment = ( j == 1)
|
||||
Machinings[nCurrentMachiningIndex].bIsLastSegment = ( j == nParts)
|
||||
Machinings[nCurrentMachiningIndex].bIsMachiningSplitted = true
|
||||
end
|
||||
-- anche le lavorazioni non splittate necessitano del segmento assegnato
|
||||
else
|
||||
|
||||
@@ -319,4 +319,6 @@
|
||||
1000316=Autocam will apply a machining on the theoretical zero, to avoid collision if the theoretical piece length doesn't correspond to the real length
|
||||
1000317=Finish with mill
|
||||
1000318=Use a mill to finish the surface if split with chain saw
|
||||
1000319=Allow multiple short strips
|
||||
1000320=Allow multiple short strips
|
||||
// ----- End -----
|
||||
|
||||
@@ -319,4 +319,6 @@
|
||||
1000316=Autocam applicherà una lavorazione sullo zero teorico per evitare collisioni se la lunghezza teorica del pezzo non corrisponde alla lunghezza reale
|
||||
1000317=Finisci con la fresa
|
||||
1000318=Utilizza una fresa per rifinire la superficie se tagliata con la sega a catena
|
||||
1000319=Permettere codoli multipli
|
||||
1000320=Permettere codoli multipli
|
||||
// ----- End -----
|
||||
|
||||
@@ -319,4 +319,6 @@
|
||||
1000316=Autocam past een bewerking toe op het theoretische nulpunt om botsingen te voorkomen als de theoretische lengte niet overeenkomt met de werkelijke lengte
|
||||
1000317=Afwerken met frees
|
||||
1000318=Gebruik een frees om het oppervlak na te bewerken als dit met de kettingzaag is gespleten
|
||||
1000319=Sta meerdere korte verbindingsstrips toe
|
||||
1000320=Sta meerdere korte verbindingsstrips toe
|
||||
// ----- End -----
|
||||
+17
-4
@@ -223,7 +223,8 @@ function PartTemplates:AddPart( id)
|
||||
end
|
||||
|
||||
-- info eventuali rotazioni / inversioni custom e forzature manuali
|
||||
local bIsManualFlipRot = ( ( EgtGetInfo( id, 'MANUALROT', 'i') or 0) == 1) or ( ( EgtGetInfo( id, 'MANUALFLIP', 'i') or 0) == 1)
|
||||
-- TODO ignorare gli stati calcolati porta a problemi, valutare se eliminare del tutto la dipendenza da bIsManualFlipRot
|
||||
--local bIsManualFlipRot = ( ( EgtGetInfo( id, 'MANUALROT', 'i') or 0) == 1) or ( ( EgtGetInfo( id, 'MANUALFLIP', 'i') or 0) == 1)
|
||||
|
||||
if not bIsManualFlipRot then
|
||||
|
||||
@@ -392,7 +393,8 @@ local function CalculateMove( Beam, dPartLength, sState, State)
|
||||
end
|
||||
|
||||
-- Bonus Shared Cut: se le normali sono opposte, si risparmia un taglio/posizionamento
|
||||
if AreOppositeVectorApprox( Beam.LastVtN, State.Tail.vtN) then
|
||||
local bSharedCut = AreOppositeVectorApprox( Beam.LastVtN, State.Tail.vtN)
|
||||
if bSharedCut then
|
||||
dScore = dScore + CONFIG.BONUS_SHARED_CUT
|
||||
end
|
||||
|
||||
@@ -405,7 +407,8 @@ local function CalculateMove( Beam, dPartLength, sState, State)
|
||||
sState = sState,
|
||||
dScore = dScore,
|
||||
dSafeOverlap = dSafeOverlap,
|
||||
dFutureResidualLength = dFutureResidualLength
|
||||
dFutureResidualLength = dFutureResidualLength,
|
||||
bSharedCut = bSharedCut
|
||||
}
|
||||
return Move
|
||||
end
|
||||
@@ -527,7 +530,8 @@ local function CommitBestMove( BestMove)
|
||||
sState = BestMove.sState,
|
||||
dSafeOverlap = BestMove.dSafeOverlap,
|
||||
dLength = Template.dLength,
|
||||
dPosX = BestMove.dFutureResidualLength
|
||||
dPosX = BestMove.dFutureResidualLength,
|
||||
bSharedCut = BestMove.bSharedCut
|
||||
})
|
||||
|
||||
-- chiusura job
|
||||
@@ -625,6 +629,8 @@ for i = 1, #RawInventory.ActiveBeams do
|
||||
|
||||
-- Spostamento pezzi verso la testa della barra e aggiunta duplo
|
||||
local nIndex = 1
|
||||
local bSkipNextHeadCut = false
|
||||
|
||||
for j = #Beam.NestedParts, 1, -1 do
|
||||
local Part = Beam.NestedParts[j]
|
||||
local nInitialPosition = EgtGetInfo( Part.id, 'INITIALPOSITION', 'i')
|
||||
@@ -635,6 +641,11 @@ for i = 1, #RawInventory.ActiveBeams do
|
||||
-- copia del pezzo (aggiunta duplo)
|
||||
local idDuplo = EgtDuploNew( Part.id)
|
||||
|
||||
-- pezzo già intestato dal Tailcut precedente: si segnala all'automatismo che si può saltare Headcut
|
||||
if bSkipNextHeadCut then
|
||||
EgtSetInfo( idDuplo, "SKIP_HEADCUT", 1)
|
||||
end
|
||||
|
||||
-- eventuale rotazione
|
||||
if ( EgtStartsWith( Part.sState, '0010') and nInitialPosition == 1)
|
||||
or ( EgtStartsWith( Part.sState, '1000') and nInitialPosition == 3) then
|
||||
@@ -656,6 +667,8 @@ for i = 1, #RawInventory.ActiveBeams do
|
||||
EgtSetInfo( idMachGroup, "PART" .. nIndex, idDuplo .. "," .. dPosX)
|
||||
|
||||
nIndex = nIndex + 1
|
||||
|
||||
bSkipNextHeadCut = Part.bSharedCut
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,6 +22,31 @@ local function MakeChamfer()
|
||||
-- TODO funzionalità da aggiungere
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CalculateHeadCut( Proc, Part)
|
||||
-- si recuperano gli estremi del box del materiale di testa da togliere
|
||||
local b3PartWithHead = BeamLib.GetPartBoxWithHeadTail( Part, 'Head')
|
||||
local ptStartRestLength = Point3d( Part.b3Part:getMax():getX() - 1, Part.b3Part:getMax():getY(), Part.b3Part:getMax():getZ())
|
||||
local ptEndRestLength = Point3d( b3PartWithHead:getMax():getX(), Part.b3Part:getMin():getY(), Part.b3Part:getMin():getZ())
|
||||
|
||||
local OptionalParametersBladeToWaste = {}
|
||||
OptionalParametersBladeToWaste.b3BoxDicing = BBox3d( ptStartRestLength, ptEndRestLength)
|
||||
OptionalParametersBladeToWaste.dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume
|
||||
OptionalParametersBladeToWaste.dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
|
||||
OptionalParametersBladeToWaste.bReduceBladePath = Strategy.Parameters.bReduceBladePath
|
||||
OptionalParametersBladeToWaste.sRestLengthSideForPreSimulation = 'Head'
|
||||
OptionalParametersBladeToWaste.bCannotSplitRestLength = true
|
||||
|
||||
local Machinings = BladeToWaste.Make( Proc, Part, OptionalParametersBladeToWaste)
|
||||
-- se taglio non riuscito, si riprova con il riduci percorso forzato (collisione possibile in separazione pezzi alti)
|
||||
if ( not Machinings) or ( #Machinings == 0) then
|
||||
OptionalParametersBladeToWaste.bReduceBladePath = true
|
||||
Machinings = BladeToWaste.Make( Proc, Part, OptionalParametersBladeToWaste)
|
||||
end
|
||||
|
||||
return Machinings
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
local StrategyLib = {}
|
||||
@@ -47,7 +72,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
|
||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
||||
if Strategy.Parameters.bExecutePreCut then
|
||||
if Strategy.Parameters.bExecutePreCut or not Proc.bIsOriginalHeadcut then
|
||||
Strategy.SplitStrategy, Strategy.Result = SPLITCUT.GetMachining( Proc, Part, OptionalParameters)
|
||||
-- se non faccio tagli PRECUT, imposto tabella Result direttamente. Non serve verificare che riesca a rimuovere il materiale extra
|
||||
-- if not Strategy.SplitStrategy or #Strategy.SplitStrategy == 0 then
|
||||
@@ -65,8 +90,9 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- TODO di quale utensile si deve impostare la qualità qui?
|
||||
Strategy.Result.dQuality = FeatureLib.GetStrategyQuality( 'SAWBLADE')
|
||||
|
||||
-- se coincide con inizio grezzo, non va fatto
|
||||
if abs( Proc.b3Box:getCenter():getX() - Part.b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then
|
||||
-- se settato da saltare o coincide con inizio grezzo, non va fatto
|
||||
--local bSkipHeadCut = ( EgtGetInfo( Part.id, "SKIP_HEADCUT", 'i') or 0) == 1
|
||||
if bSkipHeadCut or ( abs( Proc.b3Box:getCenter():getX() - Part.b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL) then
|
||||
return true, Strategy.Result
|
||||
end
|
||||
|
||||
@@ -80,16 +106,14 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
local MachiningsToAdd = {}
|
||||
local bExecutePrecutOnly = false
|
||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
||||
if Strategy.Parameters.bExecutePreCut then
|
||||
bExecutePrecutOnly = Part.dHeadOverMaterial < 20
|
||||
if Strategy.Parameters.bExecutePreCut or not Proc.bIsOriginalHeadcut then
|
||||
bExecutePrecutOnly = ( Part.dHeadOverMaterial < 20) or not Proc.bIsOriginalHeadcut
|
||||
|
||||
if Strategy.SplitStrategy and #Strategy.SplitStrategy > 0 then
|
||||
for i = 1, #Strategy.SplitStrategy do
|
||||
local TempList = {}
|
||||
TempList = Strategy.SplitStrategy[i]
|
||||
if bExecutePrecutOnly then
|
||||
TempList.dLongitudinalOffset = 0
|
||||
else
|
||||
if not bExecutePrecutOnly then
|
||||
TempList.bIsPreCut = true
|
||||
TempList.dLongitudinalOffset = Part.dHeadOverMaterial
|
||||
end
|
||||
@@ -101,25 +125,8 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
if not bExecutePrecutOnly then
|
||||
|
||||
-- si recuperano gli estremi del box del materiale di testa da togliere
|
||||
local b3PartWithHead = BeamLib.GetPartBoxWithHeadTail( Part, 'Head')
|
||||
local ptStartRestLength = Point3d( Part.b3Part:getMax():getX() - 1, Part.b3Part:getMax():getY(), Part.b3Part:getMax():getZ())
|
||||
local ptEndRestLength = Point3d( b3PartWithHead:getMax():getX(), Part.b3Part:getMin():getY(), Part.b3Part:getMin():getZ())
|
||||
Strategy.Machining = CalculateHeadCut( Proc, Part)
|
||||
|
||||
local OptionalParametersBladeToWaste = {}
|
||||
OptionalParametersBladeToWaste.b3BoxDicing = BBox3d( ptStartRestLength, ptEndRestLength)
|
||||
OptionalParametersBladeToWaste.dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume
|
||||
OptionalParametersBladeToWaste.dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
|
||||
OptionalParametersBladeToWaste.bReduceBladePath = Strategy.Parameters.bReduceBladePath
|
||||
OptionalParametersBladeToWaste.sRestLengthSideForPreSimulation = 'Head'
|
||||
OptionalParametersBladeToWaste.bCannotSplitRestLength = true
|
||||
|
||||
Strategy.Machining, _ = BladeToWaste.Make( Proc, Part, OptionalParametersBladeToWaste)
|
||||
-- se taglio non riuscito, si riprova con il riduci percorso forzato (collisione possibile in separazione pezzi alti)
|
||||
if ( not Strategy.Machining) or ( #Strategy.Machining == 0) then
|
||||
OptionalParametersBladeToWaste.bReduceBladePath = true
|
||||
Strategy.Machining, _ = BladeToWaste.Make( Proc, Part, OptionalParametersBladeToWaste)
|
||||
end
|
||||
if Strategy.Machining and #Strategy.Machining > 0 then
|
||||
for i = 1, #Strategy.Machining do
|
||||
local TempList = {}
|
||||
@@ -139,9 +146,9 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
else
|
||||
return nil, Strategy.Result
|
||||
end
|
||||
|
||||
return nil, Strategy.Result
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -292,7 +292,7 @@ local function GetTenonMachiningResult( Proc, Result)
|
||||
else
|
||||
TotalResult.dQuality = FeatureLib.GetStrategyQuality( 'FINE')
|
||||
end
|
||||
TotalResult.nFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
TotalResult.dFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
TotalResult.dTimeToMachine = Result.Milling.dTimeToMachine + Result.Cutting.dTimeToMachine
|
||||
TotalResult.sInfo = ''
|
||||
-- lavorazione incompleta
|
||||
|
||||
@@ -136,6 +136,18 @@
|
||||
"sMessageId": " ",
|
||||
"sMinUserLevel": "1"
|
||||
},
|
||||
{
|
||||
"sName": "bAllowPerpendicularStrip",
|
||||
"sNameNge": "ALLOW_PERPENDICULAR_STRIP",
|
||||
"sValue": "false",
|
||||
"sDescriptionShort": "Allow multiple short strips",
|
||||
"sDescriptionLong": "Allow multiple short strips",
|
||||
"idDescriptionShortMsg": 1000319,
|
||||
"idDescriptionLongMsg": 1000320,
|
||||
"sType": "b",
|
||||
"sMessageId": " ",
|
||||
"sMinUserLevel": "1"
|
||||
},
|
||||
{
|
||||
"sName": "bFinishWithMill",
|
||||
"sNameNge": "ALLOW_FINISH_MILL",
|
||||
|
||||
@@ -46,6 +46,20 @@ local function IsTwoFacesCommonEdgeTooLong( Proc, Part)
|
||||
return bIsTwoFacesCommonEdgeTooLong
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- si cerca di tenere la feature rivolta verso il fronte o sopra, cioè dal lato opposto la battuta
|
||||
local function GetFeatureRotationIndex( Proc)
|
||||
local nVoteIndex
|
||||
|
||||
if Proc.MainFaces.BottomFaces[1].vtN:getY() < 0 or Proc.MainFaces.BottomFaces[1].vtN:getZ() < 0 then
|
||||
nVoteIndex = 2
|
||||
else
|
||||
nVoteIndex = 3
|
||||
end
|
||||
|
||||
return nVoteIndex
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
||||
@@ -112,7 +126,12 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
or bKeepWasteAttached then
|
||||
|
||||
local BladeKeepWasteResult
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dStripWidth = Strategy.Parameters.dStripWidth, bForced = bKeepWasteAttached}
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail,
|
||||
dStripWidth = Strategy.Parameters.dStripWidth,
|
||||
bAllowPerpendicularStrip = Strategy.Parameters.bAllowPerpendicularStrip,
|
||||
bFinishWithMill = Strategy.Parameters.bFinishWithMill,
|
||||
bForced = bKeepWasteAttached
|
||||
}
|
||||
AuxiliaryData.bIgnoreNotClampableLength = true
|
||||
Blade.Result, BladeKeepWasteResult = BladeKeepWaste.Make( Proc, Part, OptionalParameters)
|
||||
dTimeToMachine = BladeKeepWasteResult.dTimeToMachine
|
||||
@@ -120,6 +139,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
dCompletionPercentage = BladeKeepWasteResult.dCompletionPercentage
|
||||
dQuality = BladeKeepWasteResult.dQuality
|
||||
Strategy.Result.sInfo = BladeKeepWasteResult.sInfo or ''
|
||||
Strategy.Result.dFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
end
|
||||
|
||||
-- lavorazione a cubetti / taglio singolo
|
||||
@@ -157,6 +177,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
dMRRBlade = BladeKeepWasteResult.dMRR
|
||||
dCompletionPercentage = BladeKeepWasteResult.dCompletionPercentage
|
||||
dQuality = BladeKeepWasteResult.dQuality
|
||||
Strategy.Result.dFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
end
|
||||
|
||||
-- lavorazione eventuale terza faccia tipo RidgeLap
|
||||
|
||||
@@ -247,7 +247,7 @@ local function GetTenonMachiningResult( Proc, Result)
|
||||
TotalResult.dCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100)
|
||||
TotalResult.dMRR = ( Result.Milling.dMRR + Result.Cutting.dMRR) / 2
|
||||
TotalResult.dQuality = FeatureLib.GetStrategyQuality( EgtIf( Strategy.Machining.bCuttingWithMill, 'STD', 'FINE'))
|
||||
TotalResult.nFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
TotalResult.dFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
TotalResult.dTimeToMachine = Result.Milling.dTimeToMachine + Result.Cutting.dTimeToMachine
|
||||
TotalResult.sInfo = ''
|
||||
-- lavorazione incompleta
|
||||
|
||||
@@ -249,7 +249,7 @@ function GetMortiseMachiningResult( Proc, Result)
|
||||
sQuality = 'STD'
|
||||
end
|
||||
TotalResult.dQuality = FeatureLib.GetStrategyQuality( sQuality)
|
||||
TotalResult.nFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
TotalResult.dFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
TotalResult.sInfo = ''
|
||||
-- lavorazione mortasa completa
|
||||
elseif Strategy.Machining.Milling.bIsApplicable and not( Proc.FeatureInfo.bIsFrontMortise) then
|
||||
@@ -258,7 +258,7 @@ function GetMortiseMachiningResult( Proc, Result)
|
||||
TotalResult.dMRR = Result.Milling.dMRR
|
||||
local sQuality = EgtIf( Strategy.Machining.AntiSplint.bIsApplicable, 'BEST', 'STD')
|
||||
TotalResult.dQuality = FeatureLib.GetStrategyQuality( sQuality)
|
||||
TotalResult.nFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
TotalResult.dFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
TotalResult.sInfo = ''
|
||||
-- lavorazione incompleta
|
||||
elseif Strategy.Machining.Cutting.bIsApplicable then
|
||||
|
||||
@@ -14,6 +14,43 @@
|
||||
"sMessageId": " ",
|
||||
"sMinUserLevel": "1"
|
||||
},
|
||||
{
|
||||
"sName": "sCuttingStrategy",
|
||||
"sNameNge": "CUTTING_STRATEGY",
|
||||
"sValue": "AUTO",
|
||||
"sDescriptionShort": "Cutting strategy",
|
||||
"sDescriptionLong": "",
|
||||
"idDescriptionShortMsg": 1000117,
|
||||
"idDescriptionLongMsg": 1000118,
|
||||
"sType": "combo",
|
||||
"sMinUserLevel": "1",
|
||||
"Choices": [
|
||||
{
|
||||
"sValue": "AUTO",
|
||||
"sDescriptionShort": "Automatic",
|
||||
"sDescriptionLong": "",
|
||||
"idDescriptionShortMsg": 1000119,
|
||||
"idDescriptionLongMsg": 1000120,
|
||||
"sMessageId": ""
|
||||
},
|
||||
{
|
||||
"sValue": "DROP_WASTE",
|
||||
"sDescriptionShort": "Drop waste",
|
||||
"sDescriptionLong": "",
|
||||
"idDescriptionShortMsg": 1000121,
|
||||
"idDescriptionLongMsg": 1000122,
|
||||
"sMessageId": ""
|
||||
},
|
||||
{
|
||||
"sValue": "KEEP_WASTE_ATTACHED",
|
||||
"sDescriptionShort": "Keep waste attached",
|
||||
"sDescriptionLong": "",
|
||||
"idDescriptionShortMsg": 1000123,
|
||||
"idDescriptionLongMsg": 1000124,
|
||||
"sMessageId": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"sName": "sCanDamageNextPiece",
|
||||
"sNameNge": "DAMAGE_NEXT_PIECE",
|
||||
@@ -88,6 +125,30 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"sName": "dStripWidth",
|
||||
"sNameNge": "STRIP_WIDTH",
|
||||
"sValue": "5",
|
||||
"sDescriptionShort": "Strip width",
|
||||
"sDescriptionLong": "In case the waste is still kept attached, this is the wigth dimension of the strip",
|
||||
"idDescriptionShortMsg": 1000129,
|
||||
"idDescriptionLongMsg": 1000130,
|
||||
"sType": "d",
|
||||
"sMessageId": " ",
|
||||
"sMinUserLevel": "1"
|
||||
},
|
||||
{
|
||||
"sName": "bAllowPerpendicularStrip",
|
||||
"sNameNge": "ALLOW_PERPENDICULAR_STRIP",
|
||||
"sValue": "false",
|
||||
"sDescriptionShort": "Allow multiple short strips",
|
||||
"sDescriptionLong": "Allow multiple short strips",
|
||||
"idDescriptionShortMsg": 1000319,
|
||||
"idDescriptionLongMsg": 1000320,
|
||||
"sType": "b",
|
||||
"sMessageId": " ",
|
||||
"sMinUserLevel": "1"
|
||||
},
|
||||
{
|
||||
"sName": "dMaxWasteLength",
|
||||
"sSource": "GEN_dMaxWasteLength",
|
||||
|
||||
@@ -18,6 +18,20 @@ local Strategy = {}
|
||||
local RidgeLap = {}
|
||||
RidgeLap.Result = {}
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- si cerca di tenere la feature rivolta verso il fronte o sopra, cioè dal lato opposto la battuta
|
||||
local function GetFeatureRotationIndex( Proc)
|
||||
local nVoteIndex
|
||||
|
||||
if Proc.MainFaces.BottomFaces[1].vtN:getY() < 0 or Proc.MainFaces.BottomFaces[1].vtN:getZ() < 0 then
|
||||
nVoteIndex = 2
|
||||
else
|
||||
nVoteIndex = 3
|
||||
end
|
||||
|
||||
return nVoteIndex
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- TODO risolvere problemi calcolo volume nullo se facce rimosse
|
||||
-- TODO gestire lavorazione con svuotatura
|
||||
@@ -94,29 +108,32 @@ function STR0012.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- considerazioni necessarie a determinare se lavorare con codolo oppure no
|
||||
local bKeepWasteAttached = ( Strategy.Parameters.sCuttingStrategy == 'KEEP_WASTE_ATTACHED')
|
||||
local bDropWaste = ( Strategy.Parameters.sCuttingStrategy == 'DROP_WASTE')
|
||||
local bFeatureHindersClamping = MachiningLib.IsFeatureHinderingClamping( Proc, Part)
|
||||
local bFeatureHindersClamping = MachiningLib.IsFeatureHinderingClamping( NewProc, Part)
|
||||
|
||||
-- lavorazione con codolo
|
||||
if ( bFeatureHindersClamping and not bDropWaste)
|
||||
or bKeepWasteAttached then
|
||||
|
||||
local BladeKeepWasteResult
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dStripWidth = 5, bFinishWithMill = false}
|
||||
local OptionalParameters = { bAllowPerpendicularStrip = Strategy.Parameters.bAllowPerpendicularStrip,
|
||||
dStripWidth = Strategy.Parameters.dStripWidth,
|
||||
dExtendAfterTail = dExtendAfterTail, bFinishWithMill = false}
|
||||
AuxiliaryData.bIgnoreNotClampableLength = true
|
||||
TwoFaces.Result, BladeKeepWasteResult = BladeKeepWaste.Make( NewProc, Part, OptionalParameters)
|
||||
dTimeToMachine = BladeKeepWasteResult.dTimeToMachine
|
||||
dMRRBlade = BladeKeepWasteResult.dMRR
|
||||
dCompletionPercentage = BladeKeepWasteResult.dCompletionPercentage
|
||||
dQuality = BladeKeepWasteResult.dQuality
|
||||
Strategy.Result.dFeatureRotationIndex = GetFeatureRotationIndex( NewProc)
|
||||
|
||||
-- lavorazione a cubetti facce concave
|
||||
else
|
||||
local BladeToWasteResult
|
||||
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
|
||||
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
|
||||
bSaveAddedGeometries = bAddMachining,
|
||||
dExtendAfterTail = dExtendAfterTail,
|
||||
bReduceBladePath = Strategy.Parameters.bReduceBladePath
|
||||
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
|
||||
bSaveAddedGeometries = bAddMachining,
|
||||
dExtendAfterTail = dExtendAfterTail,
|
||||
bReduceBladePath = Strategy.Parameters.bReduceBladePath
|
||||
}
|
||||
AuxiliaryData.bIgnoreNotClampableLength = false
|
||||
TwoFaces.Result, BladeToWasteResult = BladeToWaste.Make( NewProc, Part, OptionalParameters)
|
||||
|
||||
@@ -22,6 +22,31 @@ local function MakeChamfer()
|
||||
-- TODO funzionalità da aggiungere
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CalculateTailCut( Proc, Part)
|
||||
-- si recuperano gli estremi del box del materiale di coda da rimuovere
|
||||
local b3PartWithTail = BeamLib.GetPartBoxWithHeadTail( Part, 'Tail')
|
||||
local ptStartRestLength = Point3d( Part.b3Part:getMin():getX() + 1, Part.b3Part:getMax():getY(), Part.b3Part:getMax():getZ())
|
||||
local ptEndRestLength = Point3d( b3PartWithTail:getMin():getX(), Part.b3Part:getMin():getY(), Part.b3Part:getMin():getZ())
|
||||
|
||||
local OptionalParametersBladeToWaste = {}
|
||||
OptionalParametersBladeToWaste.b3BoxDicing = BBox3d( ptStartRestLength, ptEndRestLength)
|
||||
OptionalParametersBladeToWaste.dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume
|
||||
OptionalParametersBladeToWaste.dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
|
||||
OptionalParametersBladeToWaste.bReduceBladePath = Strategy.Parameters.bReduceBladePath
|
||||
OptionalParametersBladeToWaste.sRestLengthSideForPreSimulation = 'Tail'
|
||||
OptionalParametersBladeToWaste.bCannotSplitRestLength = true
|
||||
|
||||
local Machinings = BladeToWaste.Make( Proc, Part, OptionalParametersBladeToWaste)
|
||||
-- se taglio non riuscito, si riprova con il riduci percorso forzato (collisione possibile in separazione pezzi alti)
|
||||
if ( not Machinings) or ( #Machinings == 0) then
|
||||
OptionalParametersBladeToWaste.bReduceBladePath = true
|
||||
Machinings = BladeToWaste.Make( Proc, Part, OptionalParametersBladeToWaste)
|
||||
end
|
||||
|
||||
return Machinings
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
local StrategyLib = {}
|
||||
@@ -51,7 +76,7 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.bSplit = not( Part.bIsLastPart) or Part.dRestLength >= BeamData.dMinRaw
|
||||
|
||||
-- se devo fare split perchè c'è un grezzo da scaricare o un altro pezzo
|
||||
if Strategy.bSplit then
|
||||
if Strategy.bSplit or not Proc.bIsOriginalTailcut then
|
||||
OptionalParameters.dOffset = 0
|
||||
OptionalParameters.bDisableDicing = true
|
||||
Strategy.SplitStrategy, Strategy.Result = SPLITCUT.GetMachining( Proc, Part, OptionalParameters)
|
||||
@@ -64,7 +89,7 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- se devo rimuovere tutto il restante
|
||||
else
|
||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
||||
if Strategy.Parameters.bExecutePreCut then
|
||||
if Strategy.Parameters.bExecutePreCut and not Part.GeneralParameters.GEN_bGetAlternativesNesting2D then
|
||||
if Part.dRestLength < 20 then
|
||||
bExecutePrecutOnly = true
|
||||
OptionalParameters.dOffset = 0
|
||||
@@ -101,16 +126,22 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
local MachiningsToAdd = {}
|
||||
-- se devo fare split perchè c'è un grezzo da scaricare o un altro pezzo
|
||||
if Strategy.bSplit then
|
||||
if Strategy.bSplit or not Proc.bIsOriginalTailcut then
|
||||
if Strategy.SplitStrategy and #Strategy.SplitStrategy > 0 then
|
||||
for i = 1, #Strategy.SplitStrategy do
|
||||
local TempList = {}
|
||||
TempList.Splitting = Strategy.SplitStrategy[i]
|
||||
local sNoteFinalCut = 'Split;'
|
||||
local sNoteOtherCuts = 'Presplit;'
|
||||
if not Strategy.bSplit then
|
||||
sNoteFinalCut = 'Cut;'
|
||||
sNoteOtherCuts = 'Precut;'
|
||||
end
|
||||
if i == #Strategy.SplitStrategy then
|
||||
TempList.Splitting.sUserNotes = 'Split;'
|
||||
TempList.Splitting.sUserNotes = sNoteFinalCut
|
||||
TempList.AuxiliaryData = { bIsSplitOrCut = true}
|
||||
else
|
||||
TempList.Splitting.sUserNotes = 'Presplit;'
|
||||
TempList.Splitting.sUserNotes = sNoteOtherCuts
|
||||
end
|
||||
table.insert( MachiningsToAdd, TempList)
|
||||
end
|
||||
@@ -119,7 +150,7 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- se devo rimuovere tutto il restante
|
||||
else
|
||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
||||
if Strategy.Parameters.bExecutePreCut then
|
||||
if Strategy.Parameters.bExecutePreCut and not Part.GeneralParameters.GEN_bGetAlternativesNesting2D then
|
||||
if Strategy.SplitStrategy and #Strategy.SplitStrategy > 0 then
|
||||
for i = 1, #Strategy.SplitStrategy do
|
||||
local TempList = {}
|
||||
@@ -140,25 +171,8 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
if not bExecutePrecutOnly then
|
||||
|
||||
-- si recuperano gli estremi del box del materiale di coda da rimuovere
|
||||
local b3PartWithTail = BeamLib.GetPartBoxWithHeadTail( Part, 'Tail')
|
||||
local ptStartRestLength = Point3d( Part.b3Part:getMin():getX() + 1, Part.b3Part:getMax():getY(), Part.b3Part:getMax():getZ())
|
||||
local ptEndRestLength = Point3d( b3PartWithTail:getMin():getX(), Part.b3Part:getMin():getY(), Part.b3Part:getMin():getZ())
|
||||
Strategy.Machining = CalculateTailCut( Proc, Part)
|
||||
|
||||
local OptionalParametersBladeToWaste = {}
|
||||
OptionalParametersBladeToWaste.b3BoxDicing = BBox3d( ptStartRestLength, ptEndRestLength)
|
||||
OptionalParametersBladeToWaste.dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume
|
||||
OptionalParametersBladeToWaste.dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
|
||||
OptionalParametersBladeToWaste.bReduceBladePath = Strategy.Parameters.bReduceBladePath
|
||||
OptionalParametersBladeToWaste.sRestLengthSideForPreSimulation = 'Tail'
|
||||
OptionalParametersBladeToWaste.bCannotSplitRestLength = true
|
||||
|
||||
Strategy.Machining, _ = BladeToWaste.Make( Proc, Part, OptionalParametersBladeToWaste)
|
||||
-- se taglio non riuscito, si riprova con il riduci percorso forzato (collisione possibile in separazione pezzi alti)
|
||||
if ( not Strategy.Machining) or ( #Strategy.Machining == 0) then
|
||||
OptionalParametersBladeToWaste.bReduceBladePath = true
|
||||
Strategy.Machining, _ = BladeToWaste.Make( Proc, Part, OptionalParametersBladeToWaste)
|
||||
end
|
||||
if Strategy.Machining and #Strategy.Machining > 0 then
|
||||
for i = 1, #Strategy.Machining do
|
||||
local TempList = {}
|
||||
@@ -185,9 +199,9 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
else
|
||||
return nil, Strategy.Result
|
||||
end
|
||||
|
||||
return nil, Strategy.Result
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -146,10 +146,12 @@ local function MakeBottomFace( Proc, Part, BottomFace, EdgeToMachine, Parameters
|
||||
local dExtendAfterTail = Parameters.dExtendAfterTail
|
||||
local nToolIndex = Parameters.nToolIndex
|
||||
local dStripWidth = Parameters.dStripWidth
|
||||
local bAllowPerpendicularStrip = Parameters.bAllowPerpendicularStrip
|
||||
local OtherBottomFace = Parameters.OtherBottomFace
|
||||
|
||||
local dDepthToMachine = EdgeToMachine.dElevation / 2 - dStripWidth / 2
|
||||
local OptionalParametersFaceByBlade1 = { dDepthToMachine = dDepthToMachine, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail, nToolIndex = nToolIndex}
|
||||
local OptionalParametersFaceByBlade1 = { dDepthToMachine = dDepthToMachine, bIsSplitFeature = bIsSplitFeature,
|
||||
dExtendAfterTail = dExtendAfterTail, nToolIndex = nToolIndex}
|
||||
local EdgeToMachineOpposite = BeamLib.FindEdgeBestOrientedAsDirection( BottomFace.Edges, -EdgeToMachine.vtN)
|
||||
|
||||
-- primo lato
|
||||
@@ -175,8 +177,15 @@ local function MakeBottomFace( Proc, Part, BottomFace, EdgeToMachine, Parameters
|
||||
if OtherBottomFace and ( EdgeToMachine.idAdjacentFace == OtherBottomFace.id) then
|
||||
dStripWidth = TOOLS[Cutting2.nToolIndex].dThickness + 2 * dStripWidth
|
||||
end
|
||||
dDepthToMachine = min( TOOLS[Cutting2.nToolIndex].dMaxMaterial, EdgeToMachine.dElevation - dStripWidth)
|
||||
-- se richiesto, si calcola il codolo verticale
|
||||
if bAllowPerpendicularStrip and FeatureLib.IsMachiningLong( Cutting1.dEdgeLength, Part) then
|
||||
dDepthToMachine = TOOLS[Cutting2.nToolIndex].dMaxMaterial - 10
|
||||
else
|
||||
dDepthToMachine = min( TOOLS[Cutting2.nToolIndex].dMaxMaterial, EdgeToMachine.dElevation - dStripWidth)
|
||||
end
|
||||
|
||||
OptionalParametersFaceByBlade2.dDepthToMachine = dDepthToMachine
|
||||
OptionalParametersFaceByBlade2.bAllowPerpendicularStrip = bAllowPerpendicularStrip
|
||||
|
||||
Cutting2 = FaceByBlade.Make( Proc, Part, BottomFace, EdgeToMachine, OptionalParametersFaceByBlade2)
|
||||
Cutting2.nInternalSortingPriority = 2
|
||||
@@ -189,8 +198,15 @@ local function MakeBottomFace( Proc, Part, BottomFace, EdgeToMachine, Parameters
|
||||
if OtherBottomFace and ( EdgeToMachine.idAdjacentFace == OtherBottomFace.id) then
|
||||
dStripWidth = TOOLS[Cutting1.nToolIndex].dThickness + 2 * dStripWidth
|
||||
end
|
||||
dDepthToMachine = min( TOOLS[Cutting1.nToolIndex].dMaxMaterial, EdgeToMachine.dElevation - dStripWidth)
|
||||
-- se richiesto, si calcola il codolo verticale
|
||||
if bAllowPerpendicularStrip and FeatureLib.IsMachiningLong( Cutting2.dEdgeLength, Part) then
|
||||
dDepthToMachine = TOOLS[Cutting1.nToolIndex].dMaxMaterial - 10
|
||||
else
|
||||
dDepthToMachine = min( TOOLS[Cutting1.nToolIndex].dMaxMaterial, EdgeToMachine.dElevation - dStripWidth)
|
||||
end
|
||||
|
||||
OptionalParametersFaceByBlade1.dDepthToMachine = dDepthToMachine
|
||||
OptionalParametersFaceByBlade1.bAllowPerpendicularStrip = bAllowPerpendicularStrip
|
||||
|
||||
Cutting1 = FaceByBlade.Make( Proc, Part, BottomFace, EdgeToMachine, OptionalParametersFaceByBlade1)
|
||||
Cutting1.nInternalSortingPriority = 2
|
||||
@@ -250,6 +266,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
local bFinishWithMill = ( OptionalParameters.bFinishWithMill ~= false)
|
||||
local dMillingOffsetFromSide = OptionalParameters.dMillingOffsetFromSide or 1
|
||||
local dStripWidth = OptionalParameters.dStripWidth or 5
|
||||
local bAllowPerpendicularStrip = OptionalParameters.bAllowPerpendicularStrip or false
|
||||
local bForced = OptionalParameters.bForced or false
|
||||
|
||||
-- volume della feature
|
||||
@@ -296,6 +313,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
dExtendAfterTail = dExtendAfterTail,
|
||||
nToolIndex = nToolIndex,
|
||||
dStripWidth = dStripWidth,
|
||||
bAllowPerpendicularStrip = bAllowPerpendicularStrip,
|
||||
OtherBottomFace = BottomFace2
|
||||
}
|
||||
local Cuttings1 = MakeBottomFace( Proc, Part, BottomFace1, BottomEdgeToMachine1, Parameters1)
|
||||
@@ -427,6 +445,37 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
Machinings = MachiningLib.GetSplitMachinings( Machinings, FeatureSplittingPoints, Part)
|
||||
end
|
||||
|
||||
-- se codoli perpendicolari, si accorciano LeadIn/LeadOut
|
||||
if bAllowPerpendicularStrip then
|
||||
for j = 1, #Machinings do
|
||||
if Machinings[j].bIsMachiningSplitted then
|
||||
-- se primo spezzone
|
||||
if Machinings[j].bIsFirstSegment then
|
||||
if MachiningLib.StartsLeftSide( Machinings[j]) then
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - dStripWidth
|
||||
else
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - dStripWidth
|
||||
end
|
||||
-- se ultimo spezzone
|
||||
elseif Machinings[j].bIsLastSegment then
|
||||
if MachiningLib.StartsLeftSide( Machinings[j]) then
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - dStripWidth
|
||||
else
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - dStripWidth
|
||||
end
|
||||
-- se spezzoni centrali
|
||||
else
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ordinamento
|
||||
table.sort( Machinings, SortMachiningsBySegment)
|
||||
|
||||
|
||||
@@ -845,8 +845,12 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
local bReduceDiceDepth = Parameters.bReduceDiceDepth
|
||||
|
||||
-- trimesh con RestLength
|
||||
local b3CheckCollision = BeamLib.GetPartBoxWithHeadTail( Part, sRestLengthSideForPreSimulation)
|
||||
local idCheckCollisionTm = EgtSurfTmBBox( Part.idTempGroup, b3CheckCollision, false, GDB_RT.GLOB)
|
||||
local idCheckCollisionTm = EgtCopyGlob( Part.idBoxTm, Part.idTempGroup)
|
||||
-- se testa o coda attaccate, si considerano nella superficie di collisione
|
||||
if bCannotSplitRestLength then
|
||||
local b3CheckCollision = BeamLib.GetPartBoxWithHeadTail( Part, sRestLengthSideForPreSimulation)
|
||||
idCheckCollisionTm = EgtSurfTmBBox( Part.idTempGroup, b3CheckCollision, false, GDB_RT.GLOB)
|
||||
end
|
||||
|
||||
-- eventuale inversione tagli ortogonali e aggiunta informazioni alla geometria
|
||||
local bAreOrthogonalCutsInverted = false
|
||||
|
||||
Reference in New Issue
Block a user