From dd21a0ec167d2b292fb4323bdf3e9b07fac7464a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 27 Mar 2023 13:02:31 +0200 Subject: [PATCH] - in ProcessTenon e ProcessDtTenon migliorate e unificate condizioni scelta pretaglio con lama o fresa --- LuaLibs/ProcessDtTenon.lua | 53 ++++++++++---------------------------- LuaLibs/ProcessTenon.lua | 8 +++--- 2 files changed, 18 insertions(+), 43 deletions(-) diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index 6ee6d8d..0d974d3 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -3,6 +3,7 @@ -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF. -- 2023/02/08 Aumentato il range per cui i tenoni vengono lavorati in sottosquadro. +-- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessTenon. -- Tabella per definizione modulo local ProcessDtTenon = {} @@ -10,6 +11,7 @@ local ProcessDtTenon = {} -- Include require( 'EgtBase') local BL = require( 'BeamLib') +local Fbp = require( 'FaceByPocket') local Cut = require( 'ProcessCut') EgtOutLog( ' ProcessTenon started', 1) @@ -167,6 +169,9 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- ne determino l'asse local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB) vtAx:normalize() + -- abilitazione lavorazione da sotto + local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) + local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) -- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or ( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and @@ -183,44 +188,17 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if AddId then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) - -- se pezzo piccolo, in coda e piano inclinato attorno a Z applico svuotatura - if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then - local sPocketing = ML.FindPocketing( 'OpenPocket') - local dMaxDepth = 100 - local dStep = 30 - local nSurfStep - -- acquisisco i dati necessari dall'utensile - if EgtMdbSetCurrMachining( sPocketing) then - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep - if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then - dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth - end - end - -- acquisisco elevazione - local dElev = BL.GetFaceElevation( AddId, 0, nPartId) - nSurfStep = ceil( dElev / dMaxDepth) - dSurfStep = dElev / nSurfStep - local bOk = true - local sErr - -- copio superfice al passo superfice e ci applico la lavorazione - for i = nSurfStep, 2, -1 do - local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptC+((dSurfStep*(i-1))*vtN), vtN, b3Solid, GDB_RT.GLOB) - if nAddIdTmp then - EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id)) - EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId) - -- aggiungo lavorazione - bOk, sErr = ApplyPocket( Proc, sPocketing, i, (dSurfStep + 0), nAddIdTmp, vtExtr) - if not bOk then - break - end - end - end - if not bOk then + -- solo per macchine tipo PF e simili: se pezzo piccolo, in coda, piano inclinato attorno a Z e inclinato verso il basso applico svuotatura + if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 and vtExtr:getZ() < -0.1 and BD.C_SIMM then + -- recupero la lavorazione + local sPocketing = ML.FindPocketing( 'OpenPocket', nil, nil, nil, not bMillDown, bMillDown) + if not sPocketing then + local sErr = 'Error : pocketing '..sPockType..' not found in library' + EgtOutLog( sErr) return false, sErr end - -- faccio ultima superfice - bOk, sErr = ApplyPocket( Proc, sPocketing, 1, EgtIf( nSurfStep > 1, ( dSurfStep + 0), 0), AddId, vtExtr) + -- eseguo le svuotature necessarie + local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid) if not bOk then return false, sErr end @@ -234,9 +212,6 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end end end - -- abilitazione lavorazione da sotto - local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) - local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) -- recupero la lavorazione local sMillType = 'DtTenon' local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown) diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index 437b9e7..f029305 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -9,6 +9,7 @@ -- 2022/12/12 Su macchine con rulli pressori e pinze separate si riduce di meno l'ingombro con tenoni inclinati. -- 2022/12/20 Aggiunta gestione smusso. Migliorata scelta tra sopra e sotto per il punto di inizio. In VerifyOrientation aggiunta trave medio alta. -- 2023/01/20 Modificata scelta lato di attacco per pezzo piccolo su macchine con pinza speciale (pinza 5). +-- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessDtTenon. -- Tabella per definizione modulo local ProcessTenon = {} @@ -180,11 +181,10 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if AddId then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) - -- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura - if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then + -- solo per macchine tipo PF e simili: se pezzo piccolo, in coda, piano inclinato attorno a Z e inclinato verso il basso applico svuotatura + if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 and vtExtr:getZ() < -0.1 and BD.C_SIMM then -- recupero la lavorazione - local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket') - local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown) + local sPocketing = ML.FindPocketing( 'OpenPocket', nil, nil, nil, not bMillDown, bMillDown) if not sPocketing then local sErr = 'Error : pocketing '..sPockType..' not found in library' EgtOutLog( sErr)