Merge branch 'Feature/T010LongCutsFinishWithChainSaw' into develop
This commit is contained in:
+127
-7
@@ -15,6 +15,7 @@
|
||||
-- 2022/11/04 Aggiunto passaggio parametro bDownHead (Testa da Sotto) nelle chiamate a MakeSideFace.
|
||||
-- 2022/11/28 Correzioni varie per attacco, pulizia spigoli, utilizzo H3
|
||||
-- 2022/11/30 Modifiche su SCC per TURN.
|
||||
-- 2022/01/18 Aggiunta, se richiesta, una lavorazione ulteriore con sega a catena nei casi in cui la doppia lama non sia sufficiente.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLongCut = {}
|
||||
@@ -337,6 +338,88 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- lavorazione faccia laterale con sega a catena
|
||||
local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal)
|
||||
-- Recupero i dati dell'utensile
|
||||
local sSawing = ML.FindSawing( 'Sawing')
|
||||
local dMaxMat = 0
|
||||
local dSawCornerRad = 0
|
||||
local dSawThick = 0
|
||||
-- se non trova una lavorazione di sawing esco
|
||||
if not sSawing then
|
||||
local sErr = 'Error : Sawing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
if EgtMdbSetCurrMachining( sSawing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
|
||||
dSawCornerRad = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or dSawCornerRad
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di sawing
|
||||
local sName = 'Csaw_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_1'
|
||||
local nMchFId = EgtAddMachining( sName, sSawing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nSurfId, 0}})
|
||||
-- imposto faceuse
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
|
||||
local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT)
|
||||
local vtOrtho = BL.GetVersRef( nFaceUse)
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
-- imposto eventuale sovramateriale
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
-- imposto allungamento percorso iniziale e finale
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||
-- imposto il lato di lavorazione
|
||||
local nWorkSide = MCH_MILL_WS.RIGHT
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide)
|
||||
-- verifico se devo ridurre l'affondamento
|
||||
if dMaxMat >= dDepth then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
|
||||
sWarn = 'Warning : chainsaw elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
if EgtGetOutstrokeInfo() then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
-- impostazione alternativa angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
if EgtIsMachiningEmpty() then
|
||||
_, sWarn = EgtGetMachMgrWarning( 0)
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sWarn
|
||||
end
|
||||
--end
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCustForceUseBladeOnNCF)
|
||||
@@ -393,7 +476,13 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
-- fino al punto più vicino della faccia terminale (prima l'arretramento era sempre del raggio utensile).
|
||||
-- Questo viene fatto se Q07=1 o fresa da sotto
|
||||
----------------------------------------------------------------------------------------------------------------------------------------
|
||||
local nUseBlade = EgtIf( bCustUseBlade, 1, EgtGetInfo( Proc.Id, 'Q05', 'i') or 0)
|
||||
local nUseBlade = 0
|
||||
if bCustUseBlade and bCustUseBlade == 1 then
|
||||
nUseBlade = 1
|
||||
-- leggo il parametro Q05 solo se è una vera longcut L010
|
||||
elseif ProcessLongCut.Identify( Proc) then
|
||||
nUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i') or 0
|
||||
end
|
||||
local bForceUseBladeOnNotThruFace
|
||||
if nCustForceUseBladeOnNCF then
|
||||
bForceUseBladeOnNotThruFace = nCustForceUseBladeOnNCF > 2
|
||||
@@ -642,7 +731,14 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
nC = nCDn
|
||||
dC = dCDn
|
||||
end
|
||||
|
||||
|
||||
-- nei casi in cui la doppia lama non sia sufficiente, se richiesto, attivo un'ulteriore lavorazione con sega a catena
|
||||
-- solo per T010
|
||||
local bFinishWithChainSaw = false
|
||||
if ( Proc.Prc == 10 and not ProcessLongCut.Identify( Proc)) and bLarghAsFace and abs( nSide) == 2 and ( bCanUseBlade and bCanUseUnderBlade) and Proc.Fct == 1 then
|
||||
bFinishWithChainSaw = EgtIf ( EgtGetInfo( Proc.Id, 'Q05', 'i') or 0 == 1, true, false)
|
||||
end
|
||||
|
||||
local nFaceUse
|
||||
local nFaceUse2
|
||||
-- se ho solo lama da sotto
|
||||
@@ -657,14 +753,20 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
end
|
||||
-- si percorrono i lati alto e basso della faccia
|
||||
-- calcolo quanto è l'affondamento del taglio
|
||||
local dOffset = ( dWidth + dDimStrip) / 2
|
||||
local dOffsetTopBlade = ( dWidth + dDimStrip) / 2
|
||||
local dOffsetDownBlade = ( dWidth + dDimStrip) / 2
|
||||
-- se lama da sotto verifico se la componente Y della profondità di taglio supera la capacità della lama
|
||||
if ( nSide == -1 or abs(nSide) == 2) and bCanUseUnderBlade then
|
||||
if (( dWidth - dDimStrip) / 2) > dMaxDepthDn then
|
||||
if ( nSide == -1 or abs(nSide) == 2) and bCanUseUnderBlade and (( dWidth - dDimStrip) / 2) > dMaxDepthDn then
|
||||
if bFinishWithChainSaw then
|
||||
dOffsetTopBlade = max( dWidth - dMaxDepth + ( BD.DECR_VERT_CUT or 0), dOffsetTopBlade)
|
||||
dOffsetDownBlade = max( dWidth - dMaxDepthDn, dOffsetDownBlade)
|
||||
else
|
||||
local sErr = 'Error : side depth is bigger than underneath blade cut depth'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
else
|
||||
bFinishWithChainSaw = false
|
||||
end
|
||||
local nM = 0
|
||||
-- se abilitata la lavorazione di lama su faccia chiusa, aggiungo le eventuali lavorazioni di antischeggia
|
||||
@@ -729,6 +831,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- inserisco tagli di lama
|
||||
for i = 1, nC do
|
||||
-- Posizione braccio portatesta
|
||||
@@ -737,7 +840,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
local dLioTang = 0
|
||||
|
||||
for k = 1, 2 do
|
||||
local dLioPerp = ( dWidth - dDimStrip) / 2 + BD.CUT_SIC ;
|
||||
local dLioPerp = ( dWidth - dDimStrip) / 2 + BD.CUT_SIC
|
||||
local bAddOpposite = true
|
||||
local dAddExtraPerp = 0
|
||||
-- se faccia da sotto e angolo inferiore ai 12° o faccia di fianco e angolo inferiore a 15° (al di sotto di questo angolo
|
||||
@@ -829,6 +932,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||
-- imposto offset radiale
|
||||
local dOffset = EgtIf( k == 1, dOffsetTopBlade, dOffsetDownBlade)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( nSide == -1, -dOffset, dOffset))
|
||||
-- imposto attacco/uscita
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, dLioTang)
|
||||
@@ -854,7 +958,23 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- se richiesto aggiungo la lavorazione con sega a catena
|
||||
if bFinishWithChainSaw then
|
||||
local dChainSawOverMaterial = 3
|
||||
local dChainSawDepth = dOffsetDownBlade - dDimStrip
|
||||
dEndDist = dEndDistUp
|
||||
dEndAccDist = dEndAccDistUp
|
||||
dStartDist = dStartDistUp
|
||||
dStartAccDist = dStartAccDistUp
|
||||
for i = nC, 1, -1 do
|
||||
local dSal = EgtIf( i == nC, -dEndDist, - dEndAccDist - ( nC - i - 1) * dC)
|
||||
local dEal = EgtIf( i == 1, -dStartDist, - dStartAccDist - ( i - 2) * dC)
|
||||
local bChainSawOk, sErr = MakeSideFaceByChainSaw( Proc.Id, dChainSawDepth, dChainSawOverMaterial, dSal, dEal)
|
||||
if not bChainSawOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
|
||||
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
|
||||
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
|
||||
-- determino la massima elevazione
|
||||
|
||||
Reference in New Issue
Block a user