Feature/MortiseCornerFinishing:
per mortasa implementata la finitura degli angoli con parametro P04=1, con apposito utensile
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
-- Gestione calcolo mortase per Travi
|
||||
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
|
||||
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
|
||||
-- 2022/07/26 Aggiunta gestione del parametro P04=1 per la pulizia degli angoli con mortasatrice (sega a catena) specifica
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessMortise = {}
|
||||
@@ -79,6 +80,62 @@ function ProcessMortise.GetCutPlane( Proc)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Pulizia angoli nel caso sia settato il parametro P04=1
|
||||
local function CleanCorners( Proc, dMorH, vtN, bOpenBtm)
|
||||
-- verifico se è attiva la pulizia
|
||||
local bCleanCorners = ( EgtGetInfo( Proc.Id, 'P04', 'i') == 1 and Proc.Prc ~= 51)
|
||||
-- cerco la lavorazione adatta
|
||||
local sMortisingCleanCorners = ML.FindSawing( 'Mortising')
|
||||
if bCleanCorners and sMortisingCleanCorners then
|
||||
local dSawWidth = 50
|
||||
local dSawThick = 12
|
||||
local dMaxDepth = 200
|
||||
-- se non trova la lavorazione non faccio nulla
|
||||
if not sMortisingCleanCorners then
|
||||
local sWarn = 'Warning: mortising tool not found, square tenon finishing skipped'
|
||||
EgtOutLog( sWarn)
|
||||
return true, sWarn
|
||||
else
|
||||
-- recupero i dati dell'utensile
|
||||
if EgtMdbSetCurrMachining( sMortisingCleanCorners) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dSawWidth = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawWidth
|
||||
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- al momento se l'utensile non arriva salto la lavorazione
|
||||
local dFullMorH = EgtIf( bOpenBtm, dMorH * 2, dMorH)
|
||||
if dFullMorH > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||
local sErr = 'Error in Mortise : elevation (' .. EgtNumToString( dFullMorH, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_CleanCorners'
|
||||
nMchFId = EgtAddMachining( sName, sMortisingCleanCorners)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMortisingCleanCorners
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
sName = EgtGetOperationName( nMchFId)
|
||||
-- aggiungo geometria
|
||||
local nWorkFaceInd, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ X_AX())
|
||||
local nWorkFaceInd2, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ X_AX(), nWorkFaceInd)
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, nWorkFaceInd}, { Proc.Id, nWorkFaceInd2}})
|
||||
local nFaceUse = BL.GetNearestParalOpposite( vtN)
|
||||
-- imposto uso del lato faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- applico il parametro plunge, che setta la lavorazione per affondare solamente, senza lavorare tutto il contorno; 1: solo lato iniziale, 2: solo lato finale, 3: entrambi
|
||||
local sNotes = 'Plunge=3;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
return true, sWarn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- ingombro del pezzo
|
||||
@@ -326,6 +383,12 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico se necessaria la pulizia degli angoli ( tenone ad angoli non raggiati) e applico nel caso
|
||||
local _, sWarn2 = CleanCorners( Proc, dMorH, vtN, bOpenBtm)
|
||||
if sWarn2 then
|
||||
if not sWarn then sWarn = '' end
|
||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||
end
|
||||
-- Se non c'è il fondo e la lavorazione non ha lavorato tutta la superficie per limite altezza utensile
|
||||
-- inserisco una ulteriore lavorazione contraria
|
||||
if bOpenBtm and not bForceOneSide and nDepthMin and abs(nDepthMin) > 0 then
|
||||
|
||||
Reference in New Issue
Block a user