Merge branch 'Improvement/BetterMortiseToolSelection' into develop
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
-- 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
|
||||
-- 2022/07/29 Nella pulitura angoli aggiunto il check dimensioni tasca vs utensile. Corretta direzione utensile per mortasa frontale.
|
||||
-- 2022/09/27 Migliorata la scelta utensile. Se c'è almeno una lavorazione 'mortise' si cerca di usare quelle, riducendo l'elevazione se necessario.
|
||||
-- Se non c'è nemmeno una lavorazione 'mortise' si passa alle pocket.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessMortise = {}
|
||||
@@ -229,6 +231,35 @@ local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen, sType, bPocketDown)
|
||||
-- ricerca della svuotatura
|
||||
local sPocketing
|
||||
if dDepth then
|
||||
sPocketing = ML.FindPocketing( sType, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||
ML.FindPocketing( sType, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||
ML.FindPocketing( sType, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||
ML.FindPocketing( sType, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||
ML.FindPocketing( sType, dDiam, 0, dMaxTotLen)
|
||||
else
|
||||
sPocketing = ML.FindPocketing( sType, dDiam, 0, dMaxTotLen)
|
||||
end
|
||||
if not sPocketing then
|
||||
return false
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dMaxDepth = 0
|
||||
local dToolDiam = 0
|
||||
if EgtMdbSetCurrMachining( sPocketing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
return sPocketing, dMaxDepth, dToolDiam
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
@@ -309,8 +340,10 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se il percorso ausiliario è esterno al grezzo, lo riavvicino
|
||||
if abs( dMove) > GEO.EPS_SMALL then
|
||||
AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup( nPartId))
|
||||
EgtMove( AuxId, Vector3d(0,0,-dMove))
|
||||
EgtMove( nFlat, Vector3d(0,0,-dMove))
|
||||
local vtMove = Vector3d(0,0,dMove)
|
||||
vtMove:toGlob(frMor)
|
||||
EgtMove( AuxId, vtMove, GDB_RT.GLOB)
|
||||
EgtMove( nFlat, vtMove, GDB_RT.GLOB)
|
||||
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
|
||||
ptC = frMor:getOrigin()
|
||||
vtN = frMor:getVersZ()
|
||||
@@ -387,16 +420,16 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
local sPocketing
|
||||
if Proc.Prc ~= 53 then
|
||||
sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown)
|
||||
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown)
|
||||
if not sPocketing and bPockUp then
|
||||
sPocketing = ML.FindPocketing( sPockType, dW)
|
||||
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt)
|
||||
end
|
||||
end
|
||||
if not sPocketing then
|
||||
sPockType = 'Pocket'
|
||||
sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown)
|
||||
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown)
|
||||
if not sPocketing and bPockUp then
|
||||
sPocketing = ML.FindPocketing( sPockType, dW)
|
||||
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt)
|
||||
end
|
||||
end
|
||||
if not sPocketing then
|
||||
|
||||
Reference in New Issue
Block a user