Merge branch 'develop' into STR0005_BladeToWaste
This commit is contained in:
@@ -1361,6 +1361,7 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
while not bIsCombinationMachinable do
|
||||
-- si calcola la combinazione di lavorazione migliore
|
||||
vProc, MatrixResult = GetBestResultFromCombinationsMatrix( PROCESSINGS[nPart], PARTS[nPart])
|
||||
|
||||
-- salvo sul PART la posizione di partenza che è stata scelta
|
||||
PARTS[nPart].nInitialPosition = MatrixResult.nInitialPosition
|
||||
|
||||
@@ -1376,6 +1377,12 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
-- esegue le strategie migliori che ha precedentemente scelto e salva le lavorazioni nella lista globale
|
||||
MACHININGS = CalculateMachinings( vProc, PARTS[nPart])
|
||||
|
||||
-- se la posizione iniziale non è calcolata, significa che non ci sono feature da eseguire. Solo taglio testa/coda
|
||||
if not MatrixResult.nInitialPosition then
|
||||
MatrixResult.nInitialPosition = 1
|
||||
MACHININGS.Info.nHeadCutRotation = 1
|
||||
MACHININGS.Info.nSplitCutRotation = 1
|
||||
end
|
||||
-- TODO applicare taglio testa e coda. DA COMPLETARE
|
||||
-- aggiunge tagli testa e coda in fasi opportune
|
||||
local nRotHeadCut = MatrixResult.nInitialPosition + MACHININGS.Info.nHeadCutRotation - 1
|
||||
@@ -1441,7 +1448,7 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
||||
end
|
||||
|
||||
-- se c'è almeno una lavorazione in posizionamento con trave ribaltata
|
||||
-- se c'è almeno una lavorazione in posizionamento con trave ruotata
|
||||
if MatrixResult.bSomeFeatureSide then
|
||||
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
||||
if MatrixResult.bSomeFeatureDown then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Strategia: STR0006
|
||||
-- Descrizione
|
||||
-- Lama + fresa CodaDiRondine per tenone
|
||||
-- Feature: 55,1
|
||||
-- Lama + fresa tenone
|
||||
-- Feature: 50,1
|
||||
|
||||
-- carico librerie
|
||||
local BeamLib = require( 'BeamLib')
|
||||
@@ -41,6 +41,139 @@ function AddMachiningAllSteps( Proc, Cutting, AuxiliaryData)
|
||||
return bMachiningAdded
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function GetTenonStrategy( Proc, Part)
|
||||
local Machining = {}
|
||||
Machining.Milling = {}
|
||||
Machining.Cutting = {}
|
||||
local Result = {}
|
||||
Result.Milling = {}
|
||||
Result.Cutting = {}
|
||||
local ToolSearchParameters = {}
|
||||
|
||||
-- scelta automatica lavorazione. Non viene mai scelta la motosega
|
||||
if Strategy.Parameters.sCuttingStrategy == 'AUTO' then
|
||||
-- creo piano di taglio sulla testa del tenone
|
||||
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
|
||||
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
|
||||
}
|
||||
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idTenonCutPlane, Part, OptionalParameters)
|
||||
-- se presente almeno una lavorazione e completo, il taglio è applicabile
|
||||
if #Machining.Cutting > 0 and Result.Cutting and Result.Cutting.sStatus == 'Completed' then
|
||||
Machining.Cutting.bIsApplicable = true
|
||||
end
|
||||
-- se non possibile di lama si prova con fresa
|
||||
if not Machining.Cutting or Result.Cutting.sStatus ~= 'Completed' then
|
||||
Machining.bCuttingWithMill = true
|
||||
end
|
||||
-- lavorazione forzata con utensile lama
|
||||
elseif Strategy.Parameters.sCuttingStrategy == 'BLADE_FORCED' then
|
||||
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
|
||||
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
|
||||
}
|
||||
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idTenonCutPlane, Part, OptionalParameters)
|
||||
-- se presente almeno una lavorazione e completo, il taglio è applicabile
|
||||
if #Machining.Cutting > 0 and Result.Cutting.sStatus == 'Completed' then
|
||||
Machining.Cutting.bIsApplicable = true
|
||||
end
|
||||
-- lavorazione forzata con utensile fresa
|
||||
elseif Strategy.Parameters.sCuttingStrategy == 'MILL_FORCED' then
|
||||
Machining.bCuttingWithMill = true
|
||||
-- lavorazione forzata con utensile motosega
|
||||
elseif Strategy.Parameters.sCuttingStrategy == 'CHAINSAW_FORCED' then
|
||||
-- DA FARE!!
|
||||
end
|
||||
|
||||
-- === ricerca utensile per lavorare tenone ===
|
||||
Machining.Milling.bIsApplicable = false
|
||||
-- se tenone in testa oppure se di coda ma è possibile lavorare dopo separazione
|
||||
if not( Proc.AffectedFaces.bLeft) or Strategy.bCanMoveAfterSplit then
|
||||
ToolSearchParameters.dElevation = Proc.FeatureInfo.dTenonLength
|
||||
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
||||
ToolSearchParameters.sMillShape = 'STANDARD'
|
||||
Machining.Milling.ToolInfo = {}
|
||||
Machining.Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
if Machining.Milling.ToolInfo.nToolIndex then
|
||||
Machining.Milling.bIsApplicable = true
|
||||
-- calcolo passate necessarie
|
||||
Machining.nMillingPathsNeeded = ceil( Proc.FeatureInfo.dTenonMaxDist / TOOLS[Machining.Milling.ToolInfo.nToolIndex].dSideStep)
|
||||
local ParametersMRR = {}
|
||||
ParametersMRR.nToolIndex = Machining.Milling.ToolInfo.nToolIndex
|
||||
Result.Milling.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
|
||||
if Machining.Milling.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
Result.Milling.sStatus = 'Completed'
|
||||
else
|
||||
Result.Milling.sStatus = 'Not-Completed'
|
||||
Result.Milling.sInfo = 'Tenon not complete, left ' .. ceil( Machining.Milling.ToolInfo.dResidualDepth) .. 'mm'
|
||||
end
|
||||
end
|
||||
|
||||
-- se cutting da fare come svuotatura, copio i dati dell'utensile scelto per lavorare il tenone
|
||||
if Machining.bCuttingWithMill and Machining.Milling.bIsApplicable then
|
||||
Machining.Cutting.bIsApplicable = true
|
||||
Machining.Cutting.ToolInfo = Machining.Milling.ToolInfo
|
||||
Result.Cutting.dMRR = Result.Milling.dMRR
|
||||
end
|
||||
end
|
||||
return Machining, Result
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function GetFeatureRotationIndex( Proc)
|
||||
local nVoteIndex
|
||||
|
||||
-- se fatto con testa sopra
|
||||
if TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].SetupInfo.HeadType.bTop then
|
||||
if Proc.FeatureInfo.vtTenonN:getZ() < 0 then
|
||||
nVoteIndex = 2
|
||||
elseif Proc.FeatureInfo.vtTenonN:getZ() > abs( Proc.FeatureInfo.vtTenonN:getY()) then
|
||||
nVoteIndex = 4
|
||||
else
|
||||
nVoteIndex = 3
|
||||
end
|
||||
-- se fatto con testa sotto
|
||||
elseif TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].SetupInfo.HeadType.bBottom then
|
||||
if Proc.FeatureInfo.vtTenonN:getZ() > 0 then
|
||||
nVoteIndex = 2
|
||||
elseif Proc.FeatureInfo.vtTenonN:getZ() < - abs( Proc.FeatureInfo.vtTenonN:getY()) then
|
||||
nVoteIndex = 4
|
||||
else
|
||||
nVoteIndex = 3
|
||||
end
|
||||
end
|
||||
|
||||
return nVoteIndex
|
||||
end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function GetTenonMachiningResult( Proc, Result)
|
||||
local TotalResult = {}
|
||||
-- setto il risultato in base agli utensili trovati
|
||||
-- lavorazione completa
|
||||
if Strategy.Machining.Milling.bIsApplicable and Strategy.Machining.Cutting.bIsApplicable then
|
||||
TotalResult.sStatus = Result.Milling.sStatus
|
||||
TotalResult.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100)
|
||||
TotalResult.dMRR = ( Result.Milling.dMRR + Result.Cutting.dMRR) / 2
|
||||
TotalResult.nQuality = FeatureLib.GetFeatureQuality( EgtIf( Strategy.Machining.bCuttingWithMill, 'Mill,Mill', 'Mill,Blade'))
|
||||
TotalResult.nFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
||||
TotalResult.sInfo = ''
|
||||
-- lavorazione incompleta
|
||||
elseif Strategy.Machining.Cutting.bIsApplicable then
|
||||
TotalResult.sStatus = 'Not-Completed'
|
||||
TotalResult.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 50)
|
||||
TotalResult.dMRR = Result.Cutting.dMRR
|
||||
TotalResult.nQuality = FeatureLib.GetFeatureQuality( EgtIf( Strategy.Machining.bCuttingWithMill, 'Mill', 'Blade'))
|
||||
TotalResult.sInfo = 'Tenon not completed'
|
||||
-- strategia non applicabile, manca il taglio di lama sulla lunghezza del tenone
|
||||
else
|
||||
TotalResult.sStatus = 'Not-Applicable'
|
||||
TotalResult.nCompletionIndex = 0
|
||||
TotalResult.dMRR = 0
|
||||
TotalResult.nQuality = 0
|
||||
TotalResult.sInfo = 'Error on Tenon cutting'
|
||||
end
|
||||
return TotalResult
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function STR0006.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- carico parametri de default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
||||
@@ -51,212 +184,127 @@ function STR0006.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
|
||||
Strategy.Machining = {}
|
||||
Strategy.Result = {}
|
||||
local Results = {}
|
||||
|
||||
|
||||
local bAreAllMachiningsAdded = true
|
||||
local ToolSearchParameters = {}
|
||||
local Milling = {}
|
||||
local Cutting = {}
|
||||
local bCuttingWithMill = false
|
||||
local nMillingPathsNeeded = 0
|
||||
local dCompletionPercentage
|
||||
|
||||
-- controllo conformità offset tenone
|
||||
Strategy.Parameters.dOverMatOnRadius = EgtClamp( Strategy.Parameters.dOverMatOnRadius, -5, 5)
|
||||
Strategy.Parameters.dOverMatOnLength = EgtClamp( Strategy.Parameters.dOverMatOnRadius, -5, 5)
|
||||
|
||||
-- calcolo se la lavorazione del tenone può essere spostata dopo taglio di coda
|
||||
local dLengthOnX = Proc.b3Box:getDimX()
|
||||
local bCanMoveAfterSplit = MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part)
|
||||
Strategy.bCanMoveAfterSplit = MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part)
|
||||
|
||||
-- aggiunta superficie di taglio sulla lunghezza del tenone
|
||||
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
|
||||
local idTenonCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, Proc.FeatureInfo.ptTenonCenter, Proc.FeatureInfo.vtTenonN, Part.b3Part, GDB_RT.GLOB)
|
||||
local ptCenterAddSurf = Proc.FeatureInfo.ptTenonCenter + ( Proc.FeatureInfo.vtTenonN * Strategy.Parameters.dOverMatOnLength)
|
||||
Strategy.idTenonCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, ptCenterAddSurf, Proc.FeatureInfo.vtTenonN, Part.b3Part, GDB_RT.GLOB)
|
||||
|
||||
-- scelta automatica lavorazione. Non viene mai scelta la motosega
|
||||
if Strategy.Parameters.sCuttingStrategy == 'AUTO' then
|
||||
-- creo piano di taglio sulla testa del tenone
|
||||
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
|
||||
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
|
||||
}
|
||||
Cutting.Result, dCompletionPercentage = BladeToWaste.Make( idTenonCutPlane, Part, OptionalParameters)
|
||||
-- se presente almeno una lavorazione e completo, il taglio è applicabile
|
||||
if #Cutting.Result > 0 and dCompletionPercentage == 100 then
|
||||
Cutting.bIsApplicable = true
|
||||
end
|
||||
-- se non possibile di lama si prova con fresa
|
||||
if not Cutting.Result or #Cutting.Result == 0 then
|
||||
bCuttingWithMill = true
|
||||
end
|
||||
-- lavorazione forzata con utensile lama
|
||||
elseif Strategy.Parameters.sCuttingStrategy == 'BLADE_FORCED' then
|
||||
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
|
||||
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
|
||||
}
|
||||
Cutting.Result, dCompletionPercentage = BladeToWaste.Make( idTenonCutPlane, Part, OptionalParameters)
|
||||
-- se presente almeno una lavorazione e completo, il taglio è applicabile
|
||||
if #Cutting.Result > 0 and dCompletionPercentage == 100 then
|
||||
Cutting.bIsApplicable = true
|
||||
end
|
||||
-- lavorazione forzata con utensile fresa
|
||||
elseif Strategy.Parameters.sCuttingStrategy == 'MILL_FORCED' then
|
||||
bCuttingWithMill = true
|
||||
-- lavorazione forzata con utensile motosega
|
||||
elseif Strategy.Parameters.sCuttingStrategy == 'CHAINSAW_FORCED' then
|
||||
-- DA FARE!!
|
||||
end
|
||||
Strategy.Machining, Results = GetTenonStrategy( Proc, Part)
|
||||
|
||||
-- TODO = Verificare se il taglio può essere fatto prima (con pezzo a caduta). Deve dagliare in un colpo, altrimenti a cubetti non si può fare prima di separare.
|
||||
|
||||
if Cutting.bIsApplicable then
|
||||
local ParametersMRR = {}
|
||||
ParametersMRR.nToolIndex = Cutting.Result.nToolIndex
|
||||
Cutting.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
|
||||
end
|
||||
|
||||
-- === ricerca utensile per lavorare tenone ===
|
||||
Milling.bIsApplicable = false
|
||||
-- se tenone in testa oppure se di coda ma è possibile lavorare dopo separazione
|
||||
if not( Proc.AffectedFaces.bLeft) or bCanMoveAfterSplit then
|
||||
ToolSearchParameters.dElevation = Proc.FeatureInfo.dTenonLength
|
||||
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
||||
Milling.ToolInfo = {}
|
||||
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill')
|
||||
if Milling.ToolInfo.nToolIndex then
|
||||
Milling.bIsApplicable = true
|
||||
-- calcolo passate necessarie
|
||||
nMillingPathsNeeded = ceil( Proc.FeatureInfo.dTenonMaxDist / TOOLS[Milling.ToolInfo.nToolIndex].dSideStep)
|
||||
local ParametersMRR = {}
|
||||
ParametersMRR.nToolIndex = Milling.ToolInfo.nToolIndex
|
||||
Milling.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
|
||||
end
|
||||
|
||||
-- se cutting da fare come svuotatura, copio i dati dell'utensile scelto per lavorare il tenone
|
||||
if bCuttingWithMill and Milling.bIsApplicable then
|
||||
Cutting.bIsApplicable = true
|
||||
Cutting.ToolInfo = Milling.ToolInfo
|
||||
Cutting.dMRR = Milling.dMRR
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- setto il risultato in base agli utensili trovati
|
||||
-- lavorazione completa
|
||||
if Milling.bIsApplicable and Cutting.bIsApplicable then
|
||||
Strategy.Result.sStatus = 'Completed'
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100)
|
||||
Strategy.Result.dMRR = ( Milling.dMRR + Cutting.dMRR) / 2
|
||||
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( EgtIf( bCuttingWithMill, 'Mill,Mill', 'Mill,Blade'))
|
||||
Strategy.Result.sInfo = ''
|
||||
-- lavorazione incompleta
|
||||
elseif Cutting.bIsApplicable then
|
||||
Strategy.Result.sStatus = 'Not-Completed'
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 50)
|
||||
Strategy.Result.dMRR = ( Milling.dMRR + Cutting.dMRR) / 2
|
||||
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( EgtIf( bCuttingWithMill, 'Mill', 'Blade'))
|
||||
Strategy.Result.sInfo = 'Tenon not completed'
|
||||
-- strategia non applicabile, manca il taglio di lama sulla lunghezza del tenone
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
Strategy.Result.nCompletionIndex = 0
|
||||
Strategy.Result.dMRR = 0
|
||||
Strategy.Result.nQuality = 0
|
||||
Strategy.Result.sInfo = 'Error on Tenon cutting'
|
||||
end
|
||||
Strategy.Result = GetTenonMachiningResult( Proc, Results)
|
||||
|
||||
-- applicazione delle lavorazioni
|
||||
if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then
|
||||
-- taglio in lunghezza sul tenone
|
||||
if Cutting.bIsApplicable then
|
||||
if Strategy.Machining.Cutting.bIsApplicable then
|
||||
OptionalParameters = {}
|
||||
local AuxiliaryData = {}
|
||||
|
||||
-- se cutting da fare come svuotatura
|
||||
if bCuttingWithMill then
|
||||
Cutting.Steps = {}
|
||||
Cutting.LeadIn = {}
|
||||
Cutting.nType = MCH_OY.POCKETING
|
||||
Cutting.nSubType = MCH_POCK_SUB.SPIRALIN
|
||||
Cutting.LeadIn.nType = MCH_POCK_LI.ZIGZAG
|
||||
Cutting.Steps.dStep = TOOLS[Cutting.ToolInfo.nToolIndex].dStep
|
||||
Cutting.Steps.dSideStep = TOOLS[Cutting.ToolInfo.nToolIndex].dSideStep
|
||||
Cutting.nToolIndex = Cutting.ToolInfo.nToolIndex
|
||||
Cutting.LeadIn.dTangentDistance = TOOLS[Cutting.ToolInfo.nToolIndex].dDiameter/2
|
||||
Cutting.LeadIn.dElevation = TOOLS[Cutting.ToolInfo.nToolIndex].dDiameter/2
|
||||
Cutting.sDepth = 0
|
||||
Cutting.Geometry = {{ idTenonCutPlane, 0}}
|
||||
Cutting.vtToolDirection = Proc.vtTNormal
|
||||
if Proc.AffectedFaces.bLeft and bCanMoveAfterSplit then
|
||||
Cutting.sStage = 'AfterTail'
|
||||
if Strategy.Machining.bCuttingWithMill then
|
||||
Strategy.Machining.Cutting.Steps = {}
|
||||
Strategy.Machining.Cutting.LeadIn = {}
|
||||
Strategy.Machining.Cutting.nType = MCH_OY.POCKETING
|
||||
Strategy.Machining.Cutting.nSubType = MCH_POCK_SUB.SPIRALIN
|
||||
Strategy.Machining.Cutting.LeadIn.nType = MCH_POCK_LI.ZIGZAG
|
||||
Strategy.Machining.Cutting.Steps.dStep = TOOLS[Strategy.Machining.Cutting.ToolInfo.nToolIndex].dStep
|
||||
Strategy.Machining.Cutting.Steps.dSideStep = TOOLS[Strategy.Machining.Cutting.ToolInfo.nToolIndex].dSideStep
|
||||
Strategy.Machining.Cutting.nToolIndex = Strategy.Machining.Cutting.ToolInfo.nToolIndex
|
||||
Strategy.Machining.Cutting.LeadIn.dTangentDistance = TOOLS[Strategy.Machining.Cutting.ToolInfo.nToolIndex].dDiameter/2
|
||||
Strategy.Machining.Cutting.LeadIn.dElevation = TOOLS[Strategy.Machining.Cutting.ToolInfo.nToolIndex].dDiameter/2
|
||||
Strategy.Machining.Cutting.sDepth = 0
|
||||
Strategy.Machining.Cutting.Geometry = {{ Strategy.idTenonCutPlane, 0}}
|
||||
Strategy.Machining.Cutting.vtToolDirection = Proc.vtTNormal
|
||||
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
|
||||
Strategy.Machining.Cutting.sStage = 'AfterTail'
|
||||
end
|
||||
bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Cutting)
|
||||
bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Strategy.Machining.Cutting)
|
||||
|
||||
-- taglio di lama
|
||||
else
|
||||
|
||||
for i = 1, #Cutting.Result do
|
||||
if Cutting.Result[i].bIsApplicable then
|
||||
if Proc.AffectedFaces.bLeft and bCanMoveAfterSplit then
|
||||
Cutting.Result[i].sStage = 'AfterTail'
|
||||
for i = 1, #Strategy.Machining.Cutting do
|
||||
if Strategy.Machining.Cutting.bIsApplicable then
|
||||
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
|
||||
Strategy.Machining.Cutting[i].sStage = 'AfterTail'
|
||||
end
|
||||
local bIsMachiningAdded = AddMachiningAllSteps( Proc, Cutting.Result[i])
|
||||
local bIsMachiningAdded = AddMachiningAllSteps( Proc, Strategy.Machining.Cutting[i])
|
||||
if not bIsMachiningAdded then
|
||||
bAreAllMachiningsAdded = false
|
||||
end
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Cutting.Result[i].sMessage
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- passaggio sul profilo
|
||||
if Milling.bIsApplicable then
|
||||
if Strategy.Machining.Milling.bIsApplicable then
|
||||
local AuxiliaryData = {}
|
||||
-- se molti passaggi richiesti, si fa svuotatura
|
||||
if nMillingPathsNeeded > Strategy.Parameters.nMaxMillingPaths then
|
||||
-- TODO in attesa delle svuotature, si fanno passaggi senza limiti sul numero massimo. Poi togliere il FALSE nella condizione.
|
||||
if false and Strategy.Machining.nMillingPathsNeeded > Strategy.Parameters.nMaxMillingPaths then
|
||||
-- TODO. SERVONO NUOVE SVUOTATURE!!!!
|
||||
else
|
||||
-- aggiungo geometria
|
||||
Milling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, -1}}
|
||||
Milling.nToolIndex = Milling.ToolInfo.nToolIndex
|
||||
Milling.nType = MCH_MY.MILLING
|
||||
Milling.vtToolDirection = Proc.vtTNormal
|
||||
Milling.sDepth = 0
|
||||
Strategy.Machining.Milling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, -1}}
|
||||
Strategy.Machining.Milling.nToolIndex = Strategy.Machining.Milling.ToolInfo.nToolIndex
|
||||
Strategy.Machining.Milling.nType = MCH_MY.MILLING
|
||||
Strategy.Machining.Milling.vtToolDirection = Proc.vtTNormal
|
||||
Strategy.Machining.Milling.sDepth = min( -Strategy.Machining.Milling.ToolInfo.dResidualDepth, 0)
|
||||
|
||||
-- LeadIn / LeadOut
|
||||
Milling.LeadIn = {}
|
||||
Milling.LeadOut = {}
|
||||
Milling.LeadIn.nType = MCH_MILL_LI.TANGENT
|
||||
Milling.LeadOut.nType = MCH_MILL_LI.TANGENT
|
||||
Milling.LeadIn.dTangentDistance = TOOLS[Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
||||
Milling.LeadIn.dPerpDistance = TOOLS[Milling.ToolInfo.nToolIndex].dSideStep
|
||||
Milling.LeadOut.dTangentDistance = TOOLS[Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
||||
Milling.LeadOut.dPerpDistance = TOOLS[Milling.ToolInfo.nToolIndex].dSideStep
|
||||
Strategy.Machining.Milling.LeadIn = {}
|
||||
Strategy.Machining.Milling.LeadOut = {}
|
||||
Strategy.Machining.Milling.LeadIn.nType = MCH_MILL_LI.TANGENT
|
||||
Strategy.Machining.Milling.LeadOut.nType = MCH_MILL_LI.TANGENT
|
||||
Strategy.Machining.Milling.LeadIn.dTangentDistance = TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
||||
Strategy.Machining.Milling.LeadIn.dPerpDistance = TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].dSideStep
|
||||
Strategy.Machining.Milling.LeadOut.dTangentDistance = TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
||||
Strategy.Machining.Milling.LeadOut.dPerpDistance = TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].dSideStep
|
||||
|
||||
if Proc.AffectedFaces.bLeft and bCanMoveAfterSplit then
|
||||
Milling.sStage = 'AfterTail'
|
||||
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
|
||||
Strategy.Machining.Milling.sStage = 'AfterTail'
|
||||
end
|
||||
|
||||
-- sistemo il lato e la direzione di lavoro
|
||||
Milling.bInvert = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, false, true)
|
||||
Milling.nWorkside = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
|
||||
Strategy.Machining.Milling.bInvert = EgtIf( TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].bIsCCW, false, true)
|
||||
Strategy.Machining.Milling.nWorkside = EgtIf( TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
|
||||
|
||||
Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.FeatureInfo.dTenonLength, 1)) .. ';'
|
||||
Strategy.Machining.Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.FeatureInfo.dTenonLength, 1)) .. ';'
|
||||
|
||||
-- TODO calcolare SCC
|
||||
|
||||
-- passate con sovramateriale
|
||||
AuxiliaryData.Clones = {}
|
||||
for i = nMillingPathsNeeded, 1, -1 do
|
||||
for i = Strategy.Machining.nMillingPathsNeeded, 1, -1 do
|
||||
-- il primo è il passaggio più esterno
|
||||
local nIndexClones = nMillingPathsNeeded - i + 1
|
||||
local nIndexClones = Strategy.Machining.nMillingPathsNeeded - i + 1
|
||||
-- suddivido step in base al numero passate da fare
|
||||
local dRealSideStep = floor( Proc.FeatureInfo.dTenonMaxDist / nMillingPathsNeeded)
|
||||
local dRealSideStep = floor( Proc.FeatureInfo.dTenonMaxDist / Strategy.Machining.nMillingPathsNeeded)
|
||||
-- cambia solo sovrmateriale radiale
|
||||
AuxiliaryData.Clones[nIndexClones] = {}
|
||||
AuxiliaryData.Clones[nIndexClones].dRadialOffset = ( i - 1) * dRealSideStep
|
||||
-- ultima passata con sovramateriale impostato
|
||||
if i == 1 then
|
||||
AuxiliaryData.Clones[nIndexClones].dRadialOffset = Strategy.Parameters.dOverMatOnRadius
|
||||
else
|
||||
AuxiliaryData.Clones[nIndexClones].dRadialOffset = ( i - 1) * dRealSideStep
|
||||
end
|
||||
end
|
||||
|
||||
-- aggiunge lavorazione
|
||||
bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Milling, AuxiliaryData)
|
||||
bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Strategy.Machining.Milling, AuxiliaryData)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user