Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 88b2e90ef7 | |||
| 53b2ef5e6a | |||
| 6832d1d95b | |||
| 9cb0a58005 | |||
| 765af0e268 | |||
| 3e74e7f1e2 | |||
| c56c5f4522 |
+93
-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,6 +980,10 @@ 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.sFamily = 'HeadCut'
|
||||
@@ -1131,64 +1131,100 @@ 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
|
||||
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
|
||||
-- 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 +1418,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
|
||||
|
||||
+14
-13
@@ -20,14 +20,7 @@ local function GetExtraAddLengthInclinedSides( Face, Edge)
|
||||
return 0, 0
|
||||
end
|
||||
|
||||
local nPreviousEdgeIndex = Edge.id + 1 - 1
|
||||
if nPreviousEdgeIndex < 1 then
|
||||
nPreviousEdgeIndex = #Face.Edges
|
||||
end
|
||||
local nNextEdgeIndex = Edge.id + 1 + 1
|
||||
if nNextEdgeIndex > #Face.Edges then
|
||||
nNextEdgeIndex = 1
|
||||
end
|
||||
local nPreviousEdgeIndex, nNextEdgeIndex = BeamLib.GetAdjacentIndices( Edge.id + 1, #Face.Edges)
|
||||
|
||||
local vtEdgePrevious = Face.Edges[nPreviousEdgeIndex].vtEdge
|
||||
local vtEdgeNext = Face.Edges[nNextEdgeIndex].vtEdge
|
||||
@@ -99,6 +92,14 @@ local function CalculateLeadInOutLength( ptToolCenter, vtNFace, b3Box, vtLeadInO
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetToolAddLength( dToolDiameter, dDepthToMachine)
|
||||
local dCheckDepth = min( dToolDiameter / 2, dDepthToMachine)
|
||||
local dToolAddLength = sqrt( dCheckDepth * dToolDiameter - dCheckDepth * dCheckDepth)
|
||||
|
||||
return dToolAddLength
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function LeadInOutLib.CalculateLeadInOut( sLeadInOutType, Parameters, OptionalParameters)
|
||||
|
||||
@@ -118,7 +119,7 @@ function LeadInOutLib.CalculateLeadInOut( sLeadInOutType, Parameters, OptionalPa
|
||||
local bIsEndClosed = not Edge.bIsEndOpen
|
||||
|
||||
-- accorciamento per lati chiusi
|
||||
LeadInOut.dToolMarkLength = sqrt( dDepthToMachine * Tool.dDiameter - dDepthToMachine * dDepthToMachine)
|
||||
LeadInOut.dToolAddLength = GetToolAddLength( Tool.dDiameter, dDepthToMachine)
|
||||
LeadInOut.dExtraAddLengthStart, LeadInOut.dExtraAddLengthEnd = GetExtraAddLengthInclinedSides( Face, Edge)
|
||||
-- allungamento per faccia singola (aperta in tutte le direzioni)
|
||||
LeadInOut.dAddedLengthOpenFace = BeamData.CUT_EXTRA
|
||||
@@ -140,14 +141,14 @@ function LeadInOutLib.CalculateLeadInOut( sLeadInOutType, Parameters, OptionalPa
|
||||
|
||||
-- calcolo allungamenti / accorciamenti
|
||||
if bIsStartClosed and bIsEndClosed then
|
||||
LeadIn.dStartAddLength = -LeadInOut.dToolMarkLength - LeadInOut.dExtraAddLengthStart
|
||||
LeadOut.dEndAddLength = -LeadInOut.dToolMarkLength - LeadInOut.dExtraAddLengthEnd
|
||||
LeadIn.dStartAddLength = -LeadInOut.dToolAddLength - LeadInOut.dExtraAddLengthStart
|
||||
LeadOut.dEndAddLength = -LeadInOut.dToolAddLength - LeadInOut.dExtraAddLengthEnd
|
||||
elseif bIsStartClosed then
|
||||
LeadIn.dStartAddLength = -LeadInOut.dToolMarkLength - LeadInOut.dExtraAddLengthStart
|
||||
LeadIn.dStartAddLength = -LeadInOut.dToolAddLength - LeadInOut.dExtraAddLengthStart
|
||||
-- eventuale correzione per accorciamento maggiore di larghezza tasca
|
||||
LeadOut.dEndAddLength = max( -LeadIn.dStartAddLength - Edge.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
|
||||
elseif bIsEndClosed then
|
||||
LeadOut.dEndAddLength = -LeadInOut.dToolMarkLength - LeadInOut.dExtraAddLengthEnd
|
||||
LeadOut.dEndAddLength = -LeadInOut.dToolAddLength - LeadInOut.dExtraAddLengthEnd
|
||||
-- eventuale correzione per accorciamento maggiore di larghezza tasca
|
||||
LeadIn.dStartAddLength = max( -LeadOut.dEndAddLength - Edge.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
|
||||
else
|
||||
|
||||
+32
-15
@@ -191,6 +191,19 @@ local Parts = {}
|
||||
-- ciclo su pezzi per aggiungerli al nesting
|
||||
local dTotLen = 0
|
||||
for nPartId, nCount in pairs( PARTLIST) do
|
||||
-- verifico se usa etichette
|
||||
local sTagList = EgtGetInfo( nPartId, 'LuxTagList')
|
||||
if sTagList and #sTagList then
|
||||
local TagTypeList = EgtSplitString( sTagList, ';')
|
||||
local UnusedTagList = EgtSplitString( TagTypeList[1], ',')
|
||||
if #UnusedTagList < nCount then
|
||||
NEST.ERR = 12
|
||||
NEST.MSG = 'Errore! Tentativo di nestare piu\' pezzi delle etichette disponibili!'
|
||||
WriteErrToLogFile( NEST.ERR, NEST.MSG)
|
||||
PostErrView( NEST.ERR, NEST.MSG)
|
||||
end
|
||||
end
|
||||
|
||||
-- recupero lunghezza pezzo
|
||||
local Len = EgtGetInfo( nPartId, "L", 'd')
|
||||
local DispLen = EgtIf( Len <= 1000, 2000, 0) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0)
|
||||
@@ -500,22 +513,26 @@ for nMachineIndex = 1, #NEST.MACHINELIST do
|
||||
end
|
||||
end
|
||||
local nAssignedTagIndex = #UnusedTagList
|
||||
local sAssignedTag = UnusedTagList[nAssignedTagIndex]
|
||||
-- creo stringa per info etichette aggiornata
|
||||
local sNewTagList = ''
|
||||
for nUnusedTagIndex = 1, nAssignedTagIndex - 1 do
|
||||
sNewTagList = sNewTagList .. UnusedTagList[nUnusedTagIndex] .. EgtIf( nUnusedTagIndex < nAssignedTagIndex - 1, ',', '')
|
||||
end
|
||||
sNewTagList = sNewTagList .. ';' .. UnusedTagList[nAssignedTagIndex] .. EgtIf( #UsedTagList > 0, ',', '')
|
||||
for nUsedTagIndex = 1, #UsedTagList do
|
||||
sNewTagList = sNewTagList .. UsedTagList[nUsedTagIndex] .. EgtIf( nUsedTagIndex < #UsedTagList, ',', '')
|
||||
end
|
||||
-- assegno etichetta a nuovo duplo
|
||||
EgtSetInfo( nPartDuploId, 'LuxTag', sAssignedTag)
|
||||
if #NEST.MACHINELIST == 1 then
|
||||
EgtSetInfo( CurrPart.PartId, 'LuxTagList', sNewTagList)
|
||||
if nAssignedTagIndex == 0 then
|
||||
EgtOutLog( 'Errore! Etichetta per pezzo non trovata dopo nesting!')
|
||||
else
|
||||
EgtSetInfo( CurrPart.PartId, 'LuxTagList' .. nMachineIndex, sNewTagList)
|
||||
local sAssignedTag = UnusedTagList[nAssignedTagIndex]
|
||||
-- creo stringa per info etichette aggiornata
|
||||
local sNewTagList = ''
|
||||
for nUnusedTagIndex = 1, nAssignedTagIndex - 1 do
|
||||
sNewTagList = sNewTagList .. UnusedTagList[nUnusedTagIndex] .. EgtIf( nUnusedTagIndex < nAssignedTagIndex - 1, ',', '')
|
||||
end
|
||||
sNewTagList = sNewTagList .. ';' .. UnusedTagList[nAssignedTagIndex] .. EgtIf( #UsedTagList > 0, ',', '')
|
||||
for nUsedTagIndex = 1, #UsedTagList do
|
||||
sNewTagList = sNewTagList .. UsedTagList[nUsedTagIndex] .. EgtIf( nUsedTagIndex < #UsedTagList, ',', '')
|
||||
end
|
||||
-- assegno etichetta a nuovo duplo
|
||||
EgtSetInfo( nPartDuploId, 'LuxTag', sAssignedTag)
|
||||
if #NEST.MACHINELIST == 1 then
|
||||
EgtSetInfo( CurrPart.PartId, 'LuxTagList', sNewTagList)
|
||||
else
|
||||
EgtSetInfo( CurrPart.PartId, 'LuxTagList' .. nMachineIndex, sNewTagList)
|
||||
end
|
||||
end
|
||||
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 and not Part.GeneralParameters.GEN_bGetAlternativesNesting2D 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
|
||||
@@ -80,7 +105,7 @@ 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
|
||||
if Strategy.Parameters.bExecutePreCut and not Part.GeneralParameters.GEN_bGetAlternativesNesting2D then
|
||||
bExecutePrecutOnly = Part.dHeadOverMaterial < 20
|
||||
|
||||
if Strategy.SplitStrategy and #Strategy.SplitStrategy > 0 then
|
||||
@@ -101,25 +126,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 +147,17 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
return nil, Strategy.Result
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -30,6 +30,7 @@ local function GetSCC( Machining)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- TODO l'utensile non viene scelto correttamente in base alla dimensione della geometria da lavorare!
|
||||
function GetMortiseStrategy( Proc, Part)
|
||||
local Machining = {}
|
||||
Machining.Milling = {}
|
||||
|
||||
@@ -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 = {}
|
||||
@@ -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
|
||||
@@ -119,7 +144,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 +165,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 +193,17 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
return nil, Strategy.Result
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -607,7 +607,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
end
|
||||
local bStartLeft = MachiningLib.StartsLeftSide( Cutting)
|
||||
local dAddLengthLeftSide = Cutting.LeadOut.dEndAddLength
|
||||
local dAddLengthToReduce = sqrt( Cutting.dDepthToMachine * TOOLS[Cutting.nToolIndex].dDiameter - Cutting.dDepthToMachine * Cutting.dDepthToMachine)
|
||||
local dToolAddLength = sqrt( Cutting.dDepthToMachine * TOOLS[Cutting.nToolIndex].dDiameter - Cutting.dDepthToMachine * Cutting.dDepthToMachine)
|
||||
if bStartLeft then
|
||||
dAddLengthLeftSide = Cutting.LeadIn.dStartAddLength
|
||||
end
|
||||
@@ -618,15 +618,15 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
else
|
||||
Cutting.bIsApplicable = false
|
||||
end
|
||||
elseif dAddLengthLeftSide + dAddLengthToReduce > dExtendAfterTail then
|
||||
elseif dAddLengthLeftSide + dToolAddLength > dExtendAfterTail then
|
||||
if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
|
||||
Cutting.sStage = 'AfterTail'
|
||||
Cutting.bMoveAfterSplit = true
|
||||
else
|
||||
if bStartLeft then
|
||||
Cutting.LeadIn.dStartAddLength = - dAddLengthToReduce + dExtendAfterTail
|
||||
Cutting.LeadIn.dStartAddLength = - dToolAddLength + dExtendAfterTail
|
||||
else
|
||||
Cutting.LeadOut.dEndAddLength = - dAddLengthToReduce + dExtendAfterTail
|
||||
Cutting.LeadOut.dEndAddLength = - dToolAddLength + dExtendAfterTail
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,8 +17,8 @@ local function CalculateLeadInOut( Machining, EdgeToMachine, sSideToMachine, dLe
|
||||
-- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom)
|
||||
|
||||
-- si determina l'eventuale riduzione da applicare in caso di inizio o fine chiusi
|
||||
local dAddLengthToReduce = 0
|
||||
dAddLengthToReduce = TOOLS[Machining.nToolIndex].dDiameter / 2
|
||||
local dToolAddLength = 0
|
||||
dToolAddLength = TOOLS[Machining.nToolIndex].dDiameter / 2
|
||||
|
||||
if Machining.bInvert then
|
||||
Machining.bIsStartClosed, Machining.bIsEndClosed = Machining.bIsEndClosed, Machining.bIsStartClosed
|
||||
@@ -29,16 +29,16 @@ local function CalculateLeadInOut( Machining, EdgeToMachine, sSideToMachine, dLe
|
||||
LeadIn.dStartAddLength = 0
|
||||
LeadOut.dEndAddLength = 0
|
||||
if sSideToMachine == 'End' then
|
||||
LeadIn.dStartAddLength = dAddLengthToReduce + dLengthToMachine + BeamData.CUT_EXTRA - EdgeToMachine.dLength
|
||||
LeadIn.dStartAddLength = dToolAddLength + dLengthToMachine + BeamData.CUT_EXTRA - EdgeToMachine.dLength
|
||||
elseif Machining.bIsStartClosed then
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
LeadIn.dStartAddLength = -dToolAddLength
|
||||
else
|
||||
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
|
||||
end
|
||||
if sSideToMachine == 'Start' then
|
||||
LeadOut.dEndAddLength = dAddLengthToReduce + dLengthToMachine + BeamData.CUT_EXTRA - EdgeToMachine.dLength
|
||||
LeadOut.dEndAddLength = dToolAddLength + dLengthToMachine + BeamData.CUT_EXTRA - EdgeToMachine.dLength
|
||||
elseif Machining.bIsEndClosed then
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce
|
||||
LeadOut.dEndAddLength = -dToolAddLength
|
||||
else
|
||||
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
|
||||
end
|
||||
|
||||
@@ -58,11 +58,19 @@ local function GetLeadInOutType( Machining)
|
||||
end
|
||||
|
||||
|
||||
local function GetToolAddLength( dToolDiameter, dDepthToMachine)
|
||||
local dCheckDepth = min( dToolDiameter / 2, dDepthToMachine)
|
||||
local dToolAddLength = sqrt( dCheckDepth * dToolDiameter - dCheckDepth * dCheckDepth)
|
||||
|
||||
return dToolAddLength
|
||||
end
|
||||
|
||||
|
||||
local function CalculateLeadInOut( Machining, EdgeToMachine, bIsSplitFeature)
|
||||
-- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom)
|
||||
|
||||
-- si determina l'eventuale riduzione da applicare in caso di inizio o fine chiusi
|
||||
local dAddLengthToReduce = sqrt( Machining.dDepthToMachine * TOOLS[Machining.nToolIndex].dDiameter - Machining.dDepthToMachine * Machining.dDepthToMachine)
|
||||
local dToolAddLength = GetToolAddLength( TOOLS[Machining.nToolIndex].dDiameter, Machining.dDepthToMachine)
|
||||
|
||||
if Machining.bInvert then
|
||||
Machining.bIsStartClosed, Machining.bIsEndClosed = Machining.bIsEndClosed, Machining.bIsStartClosed
|
||||
@@ -106,14 +114,14 @@ local function CalculateLeadInOut( Machining, EdgeToMachine, bIsSplitFeature)
|
||||
LeadIn.dCompLength = 0
|
||||
LeadOut.dCompLength = 0
|
||||
if Machining.bIsStartClosed and Machining.bIsEndClosed then
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce
|
||||
LeadIn.dStartAddLength = -dToolAddLength
|
||||
LeadOut.dEndAddLength = -dToolAddLength
|
||||
elseif Machining.bIsStartClosed then
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
LeadIn.dStartAddLength = -dToolAddLength
|
||||
-- eventuale correzione per accorciamento maggiore di larghezza tasca
|
||||
LeadOut.dEndAddLength = max( -LeadIn.dStartAddLength - EdgeToMachine.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
|
||||
elseif Machining.bIsEndClosed then
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce
|
||||
LeadOut.dEndAddLength = -dToolAddLength
|
||||
-- eventuale correzione per accorciamento maggiore di larghezza tasca
|
||||
LeadIn.dStartAddLength = max( -LeadOut.dEndAddLength - EdgeToMachine.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
|
||||
else
|
||||
@@ -421,7 +429,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara
|
||||
end
|
||||
local bStartLeft = MachiningLib.StartsLeftSide( Milling)
|
||||
local dAddLengthLeftSide = Milling.LeadOut.dEndAddLength
|
||||
local dAddLengthToReduce = sqrt( Milling.dDepthToMachine * TOOLS[Milling.nToolIndex].dDiameter - Milling.dDepthToMachine * Milling.dDepthToMachine)
|
||||
local dToolAddLength = sqrt( Milling.dDepthToMachine * TOOLS[Milling.nToolIndex].dDiameter - Milling.dDepthToMachine * Milling.dDepthToMachine)
|
||||
if bStartLeft then
|
||||
dAddLengthLeftSide = Milling.LeadIn.dStartAddLength
|
||||
end
|
||||
@@ -431,14 +439,14 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara
|
||||
else
|
||||
Milling.bIsApplicable = false
|
||||
end
|
||||
elseif dAddLengthLeftSide + dAddLengthToReduce > dExtendAfterTail then
|
||||
elseif dAddLengthLeftSide + dToolAddLength > dExtendAfterTail then
|
||||
if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
|
||||
Milling.sStage = 'AfterTail'
|
||||
else
|
||||
if bStartLeft then
|
||||
Milling.LeadIn.dStartAddLength = - dAddLengthToReduce + dExtendAfterTail
|
||||
Milling.LeadIn.dStartAddLength = - dToolAddLength + dExtendAfterTail
|
||||
else
|
||||
Milling.LeadOut.dEndAddLength = - dAddLengthToReduce + dExtendAfterTail
|
||||
Milling.LeadOut.dEndAddLength = - dToolAddLength + dExtendAfterTail
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user