911113e853
- 'dTimeToMachine' ora obbligatorio nei Result (da sistemare tutte le strategie) - Piccola modifica ai nomi delle variabili, qualità e completamento diventano double e non più interi - Riduzione numero scelte in parametri generici
436 lines
22 KiB
Lua
436 lines
22 KiB
Lua
-- Strategia: STR0001
|
|
-- Descrizione
|
|
-- Lama + fresa CodaDiRondine per tenone
|
|
-- Feature: 55,1
|
|
|
|
-- carico librerie
|
|
local BeamLib = require( 'BeamLib')
|
|
local BeamData = require( 'BeamData')
|
|
local MachiningLib = require( 'MachiningLib')
|
|
local FeatureLib = require( 'FeatureLib')
|
|
-- strategie di base
|
|
local BladeToWaste = require('BLADETOWASTE')
|
|
|
|
-- Tabella per definizione modulo
|
|
local STR0001 = {}
|
|
local Strategy = {}
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
local function GetSCC( Machining)
|
|
local nSCC
|
|
|
|
if Machining.vtToolDirection:getX() > 0 then
|
|
nSCC = MCH_SCC.ADIR_XP
|
|
else
|
|
nSCC = MCH_SCC.ADIR_XM
|
|
end
|
|
|
|
return nSCC
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
local function GetTenonStrategy( Proc, Part)
|
|
local Machining = {}
|
|
Machining.Milling = MachiningLib.InitMachiningParameters( MCH_MY.MILLING)
|
|
Machining.Cutting = MachiningLib.InitMachiningParameters( MCH_MY.MILLING)
|
|
Machining.Pocketing = MachiningLib.InitMachiningParameters( MCH_MY.POCKETING)
|
|
local Result = {}
|
|
Result.Milling = {}
|
|
Result.Cutting = {}
|
|
Result.Pocketing = {}
|
|
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,
|
|
bReduceBladePath = Strategy.Parameters.bReduceBladePath
|
|
}
|
|
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,
|
|
bReduceBladePath = Strategy.Parameters.bReduceBladePath
|
|
}
|
|
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
|
|
else
|
|
Machining.Cutting.bIsApplicable = false
|
|
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 svuotare taglio iniziale, se taglio non possibile ===
|
|
if Machining.bCuttingWithMill and ( not( Proc.AffectedFaces.bLeft) or Strategy.bCanMoveAfterSplit) then
|
|
ToolSearchParameters = {}
|
|
|
|
-- TODO SISTEMARE!!! qui la svuotatura non deve limitare l'elevazione se aperta da tutti i lati. In futuro si deve passare 0 come elevazione
|
|
ToolSearchParameters.dElevation = EgtSurfTmFacetElevationInBBox( Strategy.idTenonCutPlane, 0, Part.b3Part, true, GDB_ID.ROOT)
|
|
|
|
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
|
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sPocketingList, 'Pocketing')
|
|
Machining.Cutting.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
|
|
-- TODO anche il test sul ResidualDepth va tolto
|
|
if Machining.Cutting.ToolInfo.nToolIndex and ( Machining.Cutting.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL) then
|
|
Machining.Cutting.bIsApplicable = true
|
|
local ParametersMRR = {}
|
|
ParametersMRR.nToolIndex = Machining.Cutting.ToolInfo.nToolIndex
|
|
Result.Cutting.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
|
|
Machining.Cutting.sStatus = 'Completed'
|
|
Machining.Cutting.Steps = {}
|
|
Machining.Cutting.LeadIn = {}
|
|
Machining.Cutting.nType = MCH_MY.POCKETING
|
|
Machining.Cutting.nSubType = MCH_POCK_SUB.SPIRALIN
|
|
Machining.Cutting.LeadIn.nType = MCH_POCK_LI.ZIGZAG
|
|
Machining.Cutting.Steps.dStep = TOOLS[Machining.Cutting.ToolInfo.nToolIndex].dStep
|
|
Machining.Cutting.Steps.dSideStep = TOOLS[Machining.Cutting.ToolInfo.nToolIndex].dSideStep
|
|
Machining.Cutting.nToolIndex = Machining.Cutting.ToolInfo.nToolIndex
|
|
Machining.Cutting.LeadIn.dTangentDistance = TOOLS[Machining.Cutting.ToolInfo.nToolIndex].dDiameter/2
|
|
Machining.Cutting.LeadIn.dElevation = TOOLS[Machining.Cutting.ToolInfo.nToolIndex].dDiameter/2
|
|
Machining.Cutting.sDepth = 0
|
|
Machining.Cutting.Geometry = {{ Strategy.idTenonCutPlane, 0}}
|
|
Machining.Cutting.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
|
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
|
|
Machining.Cutting.sStage = 'AfterTail'
|
|
end
|
|
-- tempo di svuotatura
|
|
Result.Cutting.dTimeToMachine = MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machining.Cutting, Part)
|
|
end
|
|
end
|
|
|
|
-- === ricerca utensile per lavorare tenone coda di rondine ===
|
|
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 = 'DOVETAIL'
|
|
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, 'Milling')
|
|
Machining.Milling.ToolInfo = {}
|
|
Machining.Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
if Machining.Milling.ToolInfo.nToolIndex then
|
|
Machining.Milling.bIsApplicable = true
|
|
local ParametersMRR = {}
|
|
ParametersMRR.nToolIndex = Machining.Milling.ToolInfo.nToolIndex
|
|
Result.Milling.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
|
|
-- l'utensile a coda di rondine deve per forza riuscire a lavorare tutto, altrimenti errore
|
|
if Machining.Milling.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
|
|
Result.Milling.sStatus = 'Completed'
|
|
-- aggiungo geometria e imposto tutti i dati
|
|
Machining.Milling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, -1}}
|
|
Machining.Milling.nToolIndex = Machining.Milling.ToolInfo.nToolIndex
|
|
Machining.Milling.nType = MCH_MY.MILLING
|
|
Machining.Milling.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
|
Machining.Milling.sDepth = min( -Machining.Milling.ToolInfo.dResidualDepth, 0)
|
|
|
|
-- LeadIn / LeadOut
|
|
Machining.Milling.LeadIn = {}
|
|
Machining.Milling.LeadOut = {}
|
|
Machining.Milling.LeadIn.nType = MCH_MILL_LI.TANGENT
|
|
Machining.Milling.LeadOut.nType = MCH_MILL_LI.TANGENT
|
|
Machining.Milling.LeadIn.dTangentDistance = TOOLS[Machining.Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
|
Machining.Milling.LeadIn.dPerpDistance = TOOLS[Machining.Milling.ToolInfo.nToolIndex].dSideStep
|
|
Machining.Milling.LeadOut.dTangentDistance = TOOLS[Machining.Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
|
Machining.Milling.LeadOut.dPerpDistance = TOOLS[Machining.Milling.ToolInfo.nToolIndex].dSideStep
|
|
Machining.Milling.dLengthToMachine = Proc.FeatureInfo.dTenonPathLength
|
|
|
|
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
|
|
Machining.Milling.sStage = 'AfterTail'
|
|
end
|
|
|
|
-- sistemo il lato e la direzione di lavoro
|
|
Machining.Milling.bInvert = EgtIf( TOOLS[Machining.Milling.ToolInfo.nToolIndex].bIsCCW, false, true)
|
|
Machining.Milling.nWorkside = EgtIf( TOOLS[Machining.Milling.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
|
|
|
|
Machining.Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.FeatureInfo.dTenonLength, 1)) .. ';'
|
|
|
|
Machining.Milling.nSCC = GetSCC( Machining.Milling)
|
|
|
|
-- passate con sovramateriale
|
|
Machining.nMillingPathsNeeded = ceil( Proc.FeatureInfo.dTenonMaxDist / TOOLS[Machining.Milling.ToolInfo.nToolIndex].dSideStep)
|
|
Machining.Milling.AuxiliaryData = {}
|
|
Machining.Milling.AuxiliaryData.Clones = {}
|
|
for i = Machining.nMillingPathsNeeded, 1, -1 do
|
|
-- il primo è il passaggio più esterno
|
|
local nIndexClones = Machining.nMillingPathsNeeded - i + 1
|
|
-- suddivido step in base al numero passate da fare
|
|
local dRealSideStep = floor( Proc.FeatureInfo.dTenonMaxDist / Machining.nMillingPathsNeeded)
|
|
-- cambia solo sovrmateriale radiale
|
|
Machining.Milling.AuxiliaryData.Clones[nIndexClones] = {}
|
|
-- ultima passata con sovramateriale impostato
|
|
if i == 1 then
|
|
Machining.Milling.AuxiliaryData.Clones[nIndexClones].dRadialOffset = Strategy.Parameters.dOverMatOnRadius
|
|
else
|
|
Machining.Milling.AuxiliaryData.Clones[nIndexClones].dRadialOffset = ( i - 1) * dRealSideStep
|
|
end
|
|
end
|
|
-- tempo di svuotatura
|
|
Result.Milling.dTimeToMachine = MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machining.Milling, Part)
|
|
else
|
|
Machining.Milling.bIsApplicable = false
|
|
end
|
|
end
|
|
end
|
|
|
|
-- === ricerca utensile di svuotatura (se richiesto e se è andata a buon fine la coda di rondine) ===
|
|
if Machining.Milling.bIsApplicable then
|
|
if Machining.nMillingPathsNeeded <= Strategy.Parameters.nMaxMillingPaths then
|
|
Machining.Pocketing.bNotNeeded = true
|
|
Machining.Pocketing.dMRR = Machining.Milling.dMRR
|
|
-- serve svuotatura
|
|
else
|
|
-- se ammessa svuotatura con utensile DoveTail, copio i dati
|
|
if Strategy.Parameters.bUseDTToolOnPocketing then
|
|
Machining.Pocketing.bIsApplicable = true
|
|
Machining.Pocketing.ToolInfo = Machining.Milling.ToolInfo
|
|
Machining.Pocketing.dMRR = Machining.Milling.dMRR
|
|
-- altrimenti serve cercarne un altro
|
|
else
|
|
ToolSearchParameters = {}
|
|
ToolSearchParameters.dElevation = Proc.FeatureInfo.dTenonLength
|
|
ToolSearchParameters.vtToolDirection = Proc.vtTenonN
|
|
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, 'Milling')
|
|
Machining.Pocketing.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
if Machining.Pocketing.ToolInfo.nToolIndex then
|
|
Machining.Pocketing.bIsApplicable = true
|
|
local ParametersMRR = {}
|
|
ParametersMRR.nToolIndex = Machining.Pocketing.ToolInfo.nToolIndex
|
|
Result.Pocketing.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
|
|
if Machining.Pocketing.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
|
|
Result.Pocketing.sStatus = 'Completed'
|
|
Result.Pocketing.dCompletionPercentage = 100
|
|
else
|
|
Result.Pocketing.sStatus = 'Not-Completed'
|
|
Result.Pocketing.sInfo = 'Tenon not complete, left ' .. ceil( Machining.Pocketing.ToolInfo.dResidualDepth) .. 'mm'
|
|
Result.Pocketing.dCompletionPercentage = ( 1 - Machining.Pocketing.ToolInfo.dResidualDepth / Proc.dDTLength) * 100
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return Machining, Result
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
local 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
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
-- TODO vedere se leggere direttamente la quality dell'utensile e mediarle nel caso di utensile doppio
|
|
local 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.dCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100)
|
|
TotalResult.dMRR = ( Result.Milling.dMRR + Result.Cutting.dMRR) / 2
|
|
if Strategy.Machining.nMillingPathsNeeded > Strategy.Parameters.nMaxMillingPaths then
|
|
TotalResult.dQuality = FeatureLib.GetStrategyQuality( 'STD')
|
|
else
|
|
TotalResult.dQuality = FeatureLib.GetStrategyQuality( 'FINE')
|
|
end
|
|
TotalResult.nFeatureRotationIndex = GetFeatureRotationIndex( Proc)
|
|
TotalResult.dTimeToMachine = Result.Milling.dTimeToMachine + Result.Cutting.dTimeToMachine
|
|
TotalResult.sInfo = ''
|
|
-- lavorazione incompleta
|
|
elseif Strategy.Machining.Cutting.bIsApplicable then
|
|
TotalResult.sStatus = 'Not-Completed'
|
|
TotalResult.dCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 50)
|
|
TotalResult.dMRR = Result.Cutting.dMRR
|
|
TotalResult.dQuality = FeatureLib.GetStrategyQuality( 'FINE')
|
|
TotalResult.sInfo = 'Tenon not completed'
|
|
TotalResult.dTimeToMachine = Result.Cutting.dTimeToMachine
|
|
-- strategia non applicabile, manca il taglio di lama sulla lunghezza del tenone
|
|
else
|
|
TotalResult = FeatureLib.GetStrategyResultNotApplicable( 'Error on Tenon cutting')
|
|
end
|
|
return TotalResult
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
function STR0001.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
-- carico parametri de default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
|
local StrategyLib = {}
|
|
StrategyLib.Config = STRATEGIES_CONFIG[CustomParameters.sStrategyId]
|
|
Strategy.sName = StrategyLib.Config.sStrategyId
|
|
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( Proc, Part, CustomParameters, StrategyLib.Config)
|
|
Strategy.Machining = {}
|
|
Strategy.Result = {}
|
|
Strategy.Result.dTimeToMachine = 0
|
|
|
|
local bAreAllMachiningsAdded = true
|
|
local Results = {}
|
|
|
|
-- 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()
|
|
Strategy.bCanMoveAfterSplit = MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part)
|
|
|
|
-- aggiunta superficie di taglio sulla lunghezza del tenone
|
|
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
|
|
local ptCenterAddSurf = Proc.FeatureInfo.ptTenonCenter + ( Proc.FeatureInfo.vtTenonN * Strategy.Parameters.dOverMatOnLength)
|
|
Strategy.idTenonCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, ptCenterAddSurf, Proc.FeatureInfo.vtTenonN, Part.b3Part, GDB_RT.GLOB)
|
|
|
|
Strategy.Machining, Results = GetTenonStrategy( Proc, Part)
|
|
|
|
Strategy.Result = GetTenonMachiningResult( Proc, Results)
|
|
|
|
|
|
-- applicazione delle lavorazioni
|
|
if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then
|
|
-- taglio in lunghezza sul tenone
|
|
if Strategy.Machining.Cutting.bIsApplicable then
|
|
-- se cutting da fare come svuotatura
|
|
if Strategy.Machining.bCuttingWithMill then
|
|
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machining.Cutting)
|
|
|
|
-- taglio di lama
|
|
else
|
|
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 = MachiningLib.AddMachinings( Proc, Strategy.Machining.Cutting[i])
|
|
if not bIsMachiningAdded then
|
|
bAreAllMachiningsAdded = false
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- passaggio sul profilo
|
|
if Strategy.Machining.Milling.bIsApplicable then
|
|
-- se molti passaggi richiesti, si fa svuotatura
|
|
-- 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
|
|
-- aggiunge lavorazione
|
|
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machining.Milling, Strategy.Machining.Milling.AuxiliaryData)
|
|
end
|
|
|
|
-- si controllano le ultime 5 facce della feature
|
|
local nIndFace = -1
|
|
for i = 1, 5 do
|
|
if abs( Proc.FeatureInfo.vtTenonN * EgtSurfTmFacetNormVersor( Proc.id, Proc.nFct-i, GDB_ID.ROOT)) < GEO.EPS_ANG_SMALL then
|
|
nIndFace = Proc.nFct-i
|
|
end
|
|
end
|
|
-- controllo se serve passaggio di finitura in caso il tenone non cominci dal bordo della trave (P14 > 0)
|
|
if nIndFace > 0 then
|
|
-- verifico che entrambi i punti iniziale e finale della curva no giacciano in uno dei piani limite del pezzo, quindi se è un lato aperto
|
|
local ptIni = EgtSP( Proc.FeatureInfo.idAddAuxGeom, GDB_RT.GLOB)
|
|
local ptFin = EgtEP( Proc.FeatureInfo.idAddAuxGeom, GDB_RT.GLOB)
|
|
-- se entrambi i punti non sono sul limite pezzo
|
|
if not( BeamLib.IsPointOnBoxLimit( ptIni, Part.b3Part) or BeamLib.IsPointOnBoxLimit( ptFin, Part.b3Part)) then
|
|
-- cerco utensile
|
|
local ToolSearchParameters = {}
|
|
local FinishMach = {}
|
|
ToolSearchParameters.dElevation = Proc.FeatureInfo.dTenonLength
|
|
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
|
ToolSearchParameters.sMillShape = 'STANDARD'
|
|
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, 'MillingFinish')
|
|
FinishMach.ToolInfo = {}
|
|
FinishMach.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
if FinishMach.ToolInfo.nToolIndex then
|
|
|
|
-- aggiungo geometria e imposto tutti i dati
|
|
FinishMach.Geometry = {{ Proc.id, Proc.nFct-1}}
|
|
FinishMach.nToolIndex = FinishMach.ToolInfo.nToolIndex
|
|
FinishMach.nType = MCH_MY.MILLING
|
|
FinishMach.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
|
FinishMach.sDepth = 'TH'
|
|
|
|
-- LeadIn / LeadOut
|
|
FinishMach.LeadIn = {}
|
|
FinishMach.LeadOut = {}
|
|
FinishMach.LeadIn.nType = MCH_MILL_LI.TANGENT
|
|
FinishMach.LeadOut.nType = MCH_MILL_LI.TANGENT
|
|
FinishMach.LeadIn.dTangentDistance = TOOLS[FinishMach.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
|
FinishMach.LeadIn.dPerpDistance = TOOLS[FinishMach.ToolInfo.nToolIndex].dSideStep
|
|
FinishMach.LeadOut.dTangentDistance = TOOLS[FinishMach.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
|
FinishMach.LeadOut.dPerpDistance = TOOLS[FinishMach.ToolInfo.nToolIndex].dSideStep
|
|
|
|
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
|
|
FinishMach.sStage = 'AfterTail'
|
|
end
|
|
|
|
-- sistemo il lato e la direzione di lavoro
|
|
FinishMach.bInvert = EgtIf( TOOLS[FinishMach.ToolInfo.nToolIndex].bIsCCW, false, true)
|
|
FinishMach.nWorkside = EgtIf( TOOLS[FinishMach.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
|
|
|
|
FinishMach.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.FeatureInfo.dTenonLength, 1)) .. ';'
|
|
|
|
FinishMach.nSCC = GetSCC( FinishMach)
|
|
|
|
-- imposto utilizzo faccia (--TODO verificare se serve riconoscere il lato specifico)
|
|
local nFaceUse
|
|
if Proc.FeatureInfo.vtTenonN:getX() > -GEO.EPS_SMALL then
|
|
nFaceUse = MCH_MILL_FU.PARAL_LEFT
|
|
else
|
|
nFaceUse = MCH_MILL_FU.PARAL_RIGHT
|
|
end
|
|
FinishMach.nFaceuse = nFaceUse
|
|
|
|
-- aggiunge lavorazione
|
|
bAreAllMachiningsAdded = bAreAllMachiningsAdded and MachiningLib.AddMachinings( Proc, FinishMach)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return bAreAllMachiningsAdded, Strategy.Result
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
return STR0001 |