diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index 7677a98..ec8ecf8 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -1,4 +1,4 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2019/10/08 +-- ProcessTenon.lua by Egaltech s.r.l. 2019/11/27 -- Gestione calcolo tenone a coda di rondine per Travi -- Tabella per definizione modulo @@ -129,10 +129,37 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if AddId then EgtRelocate( AddId, nAddGrpId) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) - -- applico lavorazione - local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg} - local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0) - if not bOk then return bOk, sErr end + -- se pezzo piccolo, in coda e piano inclinato attorno a Z applico svuotatura + if b3Solid:getDimX() < 1000 and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then + local sPocketing = ML.FindPocketing( 'OpenPocket') + -- inserisco la lavorazione di svuotatura + local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchFId = EgtAddMachining( sName, sPocketing) + if not nMchFId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AddId, -1}}) + -- imposto uso faccia + EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) + -- imposto posizione braccio porta testa + local nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- eseguo + if not EgtApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr + end + -- altrimenti applico taglio di lama + else + local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg} + local bFromBottom = ( b3Solid:getDimX() < 1000 and vtExtr:getZ() > 0.25) + local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0, bFromBottom) + if not bOk then return bOk, sErr end + end end end -- recupero la lavorazione @@ -190,6 +217,12 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local dOffs = ( i - 1) * dStep EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDtTenH, 1) .. ';') + -- imposto posizione braccio porta testa + local nSCC = MCH_SCC.ADIR_YM + if abs( vtExtr:getY()) > 0.088 then + nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) + end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index e02f4da..a0fe291 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -1,4 +1,4 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2019/11/26 +-- ProcessTenon.lua by Egaltech s.r.l. 2019/11/27 -- Gestione calcolo tenone per Travi -- Tabella per definizione modulo @@ -136,11 +136,37 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if AddId then EgtRelocate( AddId, nAddGrpId) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) - -- applico lavorazione - local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail} - local bFromBottom = ( b3Solid:getDimX() < 1000 and vtExtr:getZ() > 0.25) - local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0, bFromBottom) - if not bOk then return bOk, sErr end + -- se pezzo piccolo, in coda e piano inclinato attorno a Z applico svuotatura + if b3Solid:getDimX() < 1000 and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then + local sPocketing = ML.FindPocketing( 'OpenPocket') + -- inserisco la lavorazione di svuotatura + local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchFId = EgtAddMachining( sName, sPocketing) + if not nMchFId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AddId, -1}}) + -- imposto uso faccia + EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) + -- imposto posizione braccio porta testa + local nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- eseguo + if not EgtApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr + end + -- altrimenti applico taglio di lama + else + local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail} + local bFromBottom = ( b3Solid:getDimX() < 1000 and vtExtr:getZ() > 0.25) + local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0, bFromBottom) + if not bOk then return bOk, sErr end + end end end -- recupero la lavorazione @@ -196,6 +222,12 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dMillDiam) EgtSetMachiningParam( MCH_MP.LOPERP, 0) end + -- imposto posizione braccio porta testa + local nSCC = MCH_SCC.ADIR_YM + if abs( vtExtr:getY()) > 0.088 then + nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) + end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError()