Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 88b2e90ef7 | |||
| 53b2ef5e6a | |||
| 6832d1d95b |
+93
-57
@@ -966,10 +966,6 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part, bIsFlipRot)
|
|||||||
end
|
end
|
||||||
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
|
-- si tiene via il riferimento alla Proc Head/Tail originale in caso si dovesse rimpiazzare
|
||||||
HeadProcOriginal.bIsOriginalHeadcut = true
|
HeadProcOriginal.bIsOriginalHeadcut = true
|
||||||
TailProcOriginal.bIsOriginalTailcut = true
|
TailProcOriginal.bIsOriginalTailcut = true
|
||||||
@@ -984,6 +980,10 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part, bIsFlipRot)
|
|||||||
TailProc.TailProcOriginal = TailProcOriginal
|
TailProc.TailProcOriginal = TailProcOriginal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not Part.GeneralParameters.GEN_bGetAlternativesNesting2D then
|
||||||
|
return vProcSingleRot
|
||||||
|
end
|
||||||
|
|
||||||
HeadProc.Topology = {}
|
HeadProc.Topology = {}
|
||||||
TailProc.Topology = {}
|
TailProc.Topology = {}
|
||||||
HeadProc.Topology.sFamily = 'HeadCut'
|
HeadProc.Topology.sFamily = 'HeadCut'
|
||||||
@@ -1131,64 +1131,100 @@ end
|
|||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- funzione che processa tutte le feature del pezzo
|
-- funzione che processa tutte le feature del pezzo
|
||||||
local function CalculateStrategies( vProcSingleRot, Part)
|
local function CalculateStrategies( vProcSingleRot, Part)
|
||||||
-- per ogni feature
|
local nCounter = 0
|
||||||
for i = 1, #vProcSingleRot do
|
repeat
|
||||||
-- processo tutte le feature attive
|
nCounter = nCounter + 1
|
||||||
local Proc = vProcSingleRot[i]
|
local bToReprocess = false
|
||||||
if Proc.nFlg ~= 0 then
|
-- per ogni feature
|
||||||
-- controllo se ci sono strategie disponibili
|
for i = 1, #vProcSingleRot do
|
||||||
if Proc.AvailableStrategies and #Proc.AvailableStrategies > 0 then
|
-- processo tutte le feature attive
|
||||||
-- se le strategie disponibili sono le basic, non si possono customizzare valori di default da interfaccia
|
local Proc = vProcSingleRot[i]
|
||||||
-- si leggono allora eventuali parametri di default scritti come info sulla feature
|
if Proc.nFlg ~= 0 then
|
||||||
if Proc.AvailableStrategies.bIsBasicStrategy then
|
-- controllo se ci sono strategie disponibili
|
||||||
-- si recuperano eventuali parametri custom
|
if Proc.AvailableStrategies and #Proc.AvailableStrategies > 0 then
|
||||||
for j = 1, #Proc.AvailableStrategies do
|
-- se le strategie disponibili sono le basic, non si possono customizzare valori di default da interfaccia
|
||||||
-- essendo una strategia basic, la lista dei parametri custom dovrebbe essere sempre vuota. Si leggono ora
|
-- si leggono allora eventuali parametri di default scritti come info sulla feature
|
||||||
if not Proc.AvailableStrategies[j].ParameterList then
|
if Proc.AvailableStrategies.bIsBasicStrategy then
|
||||||
Proc.AvailableStrategies[j].ParameterList = BCS.GetParametersFromBasicCustomerStrategies( Proc, Proc.AvailableStrategies[j].sStrategyId)
|
-- 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
|
||||||
|
Proc.HeadProcOriginal.nFlg = 1
|
||||||
|
Proc.HeadProcOriginal.nIndexMasterProc = nil
|
||||||
|
Proc.Topology = FeatureLib.ClassifyTopology( Proc, Part)
|
||||||
|
-- TODO è corretto? se era già un taglio a zero non lo devo più fare
|
||||||
|
if Proc.Topology.sName == 'HeadCut' then
|
||||||
|
Proc.nFlg = 0
|
||||||
|
end
|
||||||
|
Proc.SlaveProcIndexes = nil
|
||||||
|
bToReprocess = true
|
||||||
|
break
|
||||||
|
elseif ID.IsTailCut( Proc) and not Proc.bIsOriginalTailcut then
|
||||||
|
Proc.TailProcOriginal.nFlg = 1
|
||||||
|
Proc.TailProcOriginal.nIndexMasterProc = nil
|
||||||
|
Proc.Topology = FeatureLib.ClassifyTopology( Proc, Part)
|
||||||
|
-- TODO è corretto? se era già un taglio a zero non lo devo più fare
|
||||||
|
if Proc.Topology.sName == 'TailCut' then
|
||||||
|
Proc.nFlg = 0
|
||||||
|
end
|
||||||
|
Proc.SlaveProcIndexes = nil
|
||||||
|
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
|
||||||
end
|
end
|
||||||
-- si riprocessano le strategie dopo che sono stati letti i parametri
|
if bToReprocess then
|
||||||
Proc.AvailableStrategies = BCS.UpdateStrategies( Proc.AvailableStrategies)
|
break
|
||||||
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'
|
|
||||||
end
|
end
|
||||||
|
-- si calcola il composite rating delle strategie
|
||||||
|
Proc.AvailableStrategies = FeatureLib.CalculateStrategiesCompositeRating( Proc.AvailableStrategies, Part.GeneralParameters.GEN_sMachiningStrategy)
|
||||||
end
|
end
|
||||||
-- si calcola il composite rating delle strategie
|
|
||||||
Proc.AvailableStrategies = FeatureLib.CalculateStrategiesCompositeRating( Proc.AvailableStrategies, Part.GeneralParameters.GEN_sMachiningStrategy)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
until ( not bToReprocess) or ( nCounter > 5)
|
||||||
|
|
||||||
return vProcSingleRot
|
return vProcSingleRot
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1382,7 +1418,7 @@ local function CalculateMachinings( vProc, Part, nInitialRotation)
|
|||||||
-- eseguo la strategia e si applicano le lavorazioni. Si passa la Proc e i parametri personalizzati
|
-- 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)
|
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
|
-- 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
|
Proc.ChosenStrategy.Result = Result
|
||||||
end
|
end
|
||||||
-- se tutte le strategie disponibili non sono applicabili
|
-- se tutte le strategie disponibili non sono applicabili
|
||||||
|
|||||||
@@ -955,7 +955,7 @@ function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
|
|||||||
local dNotClampableLengthTail = 0
|
local dNotClampableLengthTail = 0
|
||||||
|
|
||||||
-- se il grezzo non è definito, prendo il box del pezzo
|
-- 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
|
if not Part.b3Raw then
|
||||||
Part.b3Raw = Part.b3Part
|
Part.b3Raw = Part.b3Part
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,6 +22,31 @@ local function MakeChamfer()
|
|||||||
-- TODO funzionalità da aggiungere
|
-- TODO funzionalità da aggiungere
|
||||||
end
|
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)
|
function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||||
local StrategyLib = {}
|
local StrategyLib = {}
|
||||||
@@ -47,7 +72,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
-- 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
|
||||||
Strategy.SplitStrategy, Strategy.Result = SPLITCUT.GetMachining( Proc, Part, OptionalParameters)
|
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
|
-- 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
|
-- if not Strategy.SplitStrategy or #Strategy.SplitStrategy == 0 then
|
||||||
@@ -80,7 +105,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
|||||||
local MachiningsToAdd = {}
|
local MachiningsToAdd = {}
|
||||||
local bExecutePrecutOnly = false
|
local bExecutePrecutOnly = false
|
||||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
-- 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
|
||||||
bExecutePrecutOnly = Part.dHeadOverMaterial < 20
|
bExecutePrecutOnly = Part.dHeadOverMaterial < 20
|
||||||
|
|
||||||
if Strategy.SplitStrategy and #Strategy.SplitStrategy > 0 then
|
if Strategy.SplitStrategy and #Strategy.SplitStrategy > 0 then
|
||||||
@@ -101,25 +126,8 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
|||||||
|
|
||||||
if not bExecutePrecutOnly then
|
if not bExecutePrecutOnly then
|
||||||
|
|
||||||
-- si recuperano gli estremi del box del materiale di testa da togliere
|
Strategy.Machining = CalculateHeadCut( Proc, Part)
|
||||||
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
|
|
||||||
|
|
||||||
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
|
if Strategy.Machining and #Strategy.Machining > 0 then
|
||||||
for i = 1, #Strategy.Machining do
|
for i = 1, #Strategy.Machining do
|
||||||
local TempList = {}
|
local TempList = {}
|
||||||
@@ -139,9 +147,17 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return bAreAllMachiningsAdded, Strategy.Result
|
return bAreAllMachiningsAdded, Strategy.Result
|
||||||
else
|
|
||||||
return nil, Strategy.Result
|
elseif not Proc.bIsOriginalHeadcut then
|
||||||
|
|
||||||
|
Strategy.Machining = CalculateHeadCut( Proc, Part)
|
||||||
|
|
||||||
|
if not Strategy.Machining or #Strategy.Machining == 0 then
|
||||||
|
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( 'Head machining not possible')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return nil, Strategy.Result
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -22,6 +22,31 @@ local function MakeChamfer()
|
|||||||
-- TODO funzionalità da aggiungere
|
-- TODO funzionalità da aggiungere
|
||||||
end
|
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)
|
function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||||
local StrategyLib = {}
|
local StrategyLib = {}
|
||||||
@@ -64,7 +89,7 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
|||||||
-- se devo rimuovere tutto il restante
|
-- se devo rimuovere tutto il restante
|
||||||
else
|
else
|
||||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
-- 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
|
if Part.dRestLength < 20 then
|
||||||
bExecutePrecutOnly = true
|
bExecutePrecutOnly = true
|
||||||
OptionalParameters.dOffset = 0
|
OptionalParameters.dOffset = 0
|
||||||
@@ -119,7 +144,7 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
|||||||
-- se devo rimuovere tutto il restante
|
-- se devo rimuovere tutto il restante
|
||||||
else
|
else
|
||||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
-- 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
|
if Strategy.SplitStrategy and #Strategy.SplitStrategy > 0 then
|
||||||
for i = 1, #Strategy.SplitStrategy do
|
for i = 1, #Strategy.SplitStrategy do
|
||||||
local TempList = {}
|
local TempList = {}
|
||||||
@@ -140,25 +165,8 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
|||||||
|
|
||||||
if not bExecutePrecutOnly then
|
if not bExecutePrecutOnly then
|
||||||
|
|
||||||
-- si recuperano gli estremi del box del materiale di coda da rimuovere
|
Strategy.Machining = CalculateTailCut( Proc, Part)
|
||||||
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
|
|
||||||
|
|
||||||
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
|
if Strategy.Machining and #Strategy.Machining > 0 then
|
||||||
for i = 1, #Strategy.Machining do
|
for i = 1, #Strategy.Machining do
|
||||||
local TempList = {}
|
local TempList = {}
|
||||||
@@ -185,9 +193,17 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return bAreAllMachiningsAdded, Strategy.Result
|
return bAreAllMachiningsAdded, Strategy.Result
|
||||||
else
|
|
||||||
return nil, Strategy.Result
|
elseif not Proc.bIsOriginalTailcut then
|
||||||
|
|
||||||
|
Strategy.Machining = CalculateTailCut( Proc, Part)
|
||||||
|
|
||||||
|
if not Strategy.Machining or #Strategy.Machining == 0 then
|
||||||
|
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( 'Tail machining not possible')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return nil, Strategy.Result
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user