Feature/MortiseCornerFinishing:
per mortasa implementata la finitura degli angoli con parametro P04=1, con apposito utensile
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
-- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge.
|
||||
-- 2022/06/25 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs prima in ProcessLapJpoint.
|
||||
-- 2022/07/12 A GetFaceHvRefDim aggiunta possibilità di confronto e limitazione dimensioni con grezzo/pezzo (conta solo la sezione).
|
||||
-- 2022/07/26 Aggiunta la funzione FindFaceBestOrientedAsAxis, precedentemente in ProcessLapJoint
|
||||
-- 2022/07/26 Alla funzione FindFaceBestOrientedAsAxis aggiunta la possibilità di escludere una faccia dalla ricerca
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local BeamLib = {}
|
||||
@@ -794,5 +796,23 @@ function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. La faccia di indice (0 based) fctExclude non viene considerata nella ricerca.
|
||||
function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
|
||||
local nFaceIndMax = 0
|
||||
local dMaxComp = 0
|
||||
fctExclude = fctExclude or -1
|
||||
for i = 1, Proc.Fct do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
local dComp = abs( vtN * vtAx)
|
||||
if dComp > dMaxComp and i ~= fctExclude + 1 then
|
||||
nFaceIndMax = i -1
|
||||
dMaxComp = dComp
|
||||
end
|
||||
end
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFaceIndMax, GDB_ID.ROOT)
|
||||
return nFaceIndMax, ptC, vtN
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return BeamLib
|
||||
|
||||
@@ -4338,23 +4338,6 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
return true, sMyWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa.
|
||||
local function FindFaceBestOrientedAsAxis( Proc, vtAx)
|
||||
local nFaceIndMax = 0
|
||||
local dMaxComp = 0 ;
|
||||
for i = 1, Proc.Fct do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
local dComp = abs( vtN * vtAx)
|
||||
if dComp > dMaxComp then
|
||||
nFaceIndMax = i -1
|
||||
dMaxComp = dComp
|
||||
end
|
||||
end
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFaceIndMax, GDB_ID.ROOT)
|
||||
return nFaceIndMax, ptC, vtN
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap)
|
||||
if not BD.MAXDIAM_POCK_CORNER then
|
||||
@@ -5137,7 +5120,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
local bOrthoFacesMaster = nil
|
||||
local bSetOpenBorders = nil
|
||||
-- trovo la faccia con normale più inclinata verso Y
|
||||
local nFacApproxY, ptCFacApproxY, vtNFacApproxY = FindFaceBestOrientedAsAxis( Proc, Y_AX())
|
||||
local nFacApproxY, ptCFacApproxY, vtNFacApproxY = BL.FindFaceBestOrientedAsAxis( Proc, Y_AX())
|
||||
-- se Q03 = 2 e
|
||||
-- 3 facce a L, oppure
|
||||
-- 3 facce non a L ma con una faccia favorevole a Y, oppure
|
||||
|
||||
@@ -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