Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a871ea134 | |||
| 06d27a1df7 | |||
| aa4968787a | |||
| 88b2e90ef7 | |||
| 53b2ef5e6a | |||
| 6832d1d95b |
+101
-57
@@ -966,10 +966,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,10 +980,16 @@ 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)
|
||||
@@ -1131,64 +1133,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 +1426,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
|
||||
|
||||
@@ -955,7 +955,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
|
||||
|
||||
+15
-3
@@ -392,7 +392,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 +406,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 +529,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 +628,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 +640,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 +666,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,8 +106,8 @@ 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 Strategy.Parameters.bExecutePreCut
|
||||
|
||||
if Strategy.SplitStrategy and #Strategy.SplitStrategy > 0 then
|
||||
for i = 1, #Strategy.SplitStrategy do
|
||||
@@ -101,25 +127,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 +148,9 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
else
|
||||
return nil, Strategy.Result
|
||||
end
|
||||
|
||||
return nil, Strategy.Result
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user