diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index bd43572..beb6eb0 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,6 +1,7 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2021/04/14 +-- ProcessDrill.lua by Egaltech s.r.l. 2021/05/03 -- Gestione calcolo forature per Travi -- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile. +-- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto. -- Tabella per definizione modulo local ProcessDrill = {} @@ -110,8 +111,6 @@ function ProcessDrill.Split( Proc, b3Raw) if not bTrySplit then return false end - -- abilitazione foratura da sotto - local bDrillDown = ( BD.DOWN_HEAD and ( Proc.Down or vtExtr:getZ() < 0.1 or EgtExistsInfo( Proc.Id, 'MAIN')) and not EgtExistsInfo( Proc.Id, 'DOU')) -- recupero la lavorazione local sDrilling, _, dMaxMat = ML.FindDrilling( dDiam, 0, bDrillDown) if not sDrilling then dMaxMat = 0 end @@ -119,7 +118,7 @@ function ProcessDrill.Split( Proc, b3Raw) local bHoriz = ( abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and ( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6)) local bSlant = ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX) - return ( bOpen and ( bHoriz or BD.ROT90) and not bSlant) + return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD) and not bSlant) end --------------------------------------------------------------------- @@ -137,7 +136,7 @@ function ProcessDrill.Classify( Proc, b3Raw) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local ptCen = EgtCP( AuxId, GDB_RT.GLOB) -- se lavorato in doppio, devo considerare il lato più sfavorevole - if Proc.Flg == -2 or ( BD.ROT90 and Proc.Flg == 2) then + if Proc.Flg == -2 or (( BD.ROT90 or BD.DOWN_HEAD) and Proc.Flg == 2) then if vtExtr:getZ() > 0 then vtExtr = - vtExtr ptCen = ptCen + vtExtr * dLen @@ -148,13 +147,13 @@ function ProcessDrill.Classify( Proc, b3Raw) return false, false, false end local bOpen = ( Proc.Fce ~= 0) - local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or ( BD.ROT90 and ( Proc.Flg == 2 or Proc.Flg == -2)))) + local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD) and ( Proc.Flg == 2 or Proc.Flg == -2)))) -- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then if not bOpen then return true, true, false else - return true, not BD.ROT90, BD.ROT90 + return true, not ( BD.ROT90 or BD.DOWN_HEAD), ( BD.ROT90 or BD.DOWN_HEAD) end else return true, false, false diff --git a/LuaLibs/ProcessMark.lua b/LuaLibs/ProcessMark.lua index 48d2fed..aec2e5c 100644 --- a/LuaLibs/ProcessMark.lua +++ b/LuaLibs/ProcessMark.lua @@ -1,6 +1,7 @@ --- ProcessMark.lua by Egaltech s.r.l. 2020/05/28 +-- ProcessMark.lua by Egaltech s.r.l. 2021/05/03 -- Gestione calcolo marcatura per Travi --- 2020/05/28 Tipo di lavorazione passato da Mark a Text +-- 2020/05/28 Tipo di lavorazione passato da Mark a Text. +-- 2021/05/03 Aggiunta gestione testa da sotto. -- Tabella per definizione modulo local ProcessMark = {} @@ -59,13 +60,21 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) return false, sErr end -- verifico che la marcatura non sia orientata verso il basso (-5 deg) - if vtExtr:getZ() < - 0.1 then + if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible' EgtOutLog( sErr) return false, sErr 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 sMilling = ML.FindMilling( 'Text') + local sMillType = 'Text' + local sMchExt = EgtIf( bMillDown, '_H2', '') + local sMilling = ML.FindMilling( sMillType..sMchExt) + if not sMilling and bMillUp then + sMilling = ML.FindMilling( sMillType) + end if not sMilling then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index d0660dd..554d829 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -1,5 +1,6 @@ --- ProcessProfCamb.lua by Egaltech s.r.l. 2021/03/28 +-- ProcessProfCamb.lua by Egaltech s.r.l. 2021/05/03 -- Gestione calcolo profilo caudato per Travi +-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- Tabella per definizione modulo local ProcessProfCamb = {} @@ -155,28 +156,36 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly if abs( vtExtr:getZ()) > 0.1 then if not bMakeVertCham then if nChamfer == 2 then -- se devo fare solo smusso, genero errore - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' not horizontale chamfer' + local sErr = 'Error : not horizontal chamfer' EgtOutLog( sErr) return -1, dDepth, sErr else - local sWarn = 'Warning on process ' .. tostring( Proc.Id) .. ' skipped not horizontale chamfer' + local sWarn = 'Warning : skipped not horizontal chamfer' EgtOutLog( sWarn) return 0, dDepth end end end -- recupero la lavorazione - local sMilling + local sMilling, sMilling2 if nChamfer > 0 then sMilling = ML.FindMilling( 'Mark') if not sMilling then - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' chamfer not found in library' + local sErr = 'Error : chamfer not found in library' EgtOutLog( sErr) return -1, 0, sErr end + if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.99 then + sMilling2 = ML.FindMilling( 'Mark_H2') + if not sMilling2 then + local sErr = 'Error : chamfer2 not found in library' + EgtOutLog( sErr) + return -1, 0, sErr + end + end end - return nChamfer, dDepth, sMilling + return nChamfer, dDepth, sMilling, sMilling2 end --------------------------------------------------------------------- @@ -227,7 +236,8 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- verifico se sono presenti i parametri Q per la profondità smusso e -- per eseguire in esclusiva solo lo smusso - local nChamfer, dDepthCham, sChamfer = VerifyCham( Proc, AuxId, nRawId, false, sDepthChamferMill, sPreemptiveChamfer) + local bMakeVertCham = BD.DOWN_HEAD + local nChamfer, dDepthCham, sChamfer, sChamfer2 = VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDepthChamferMill, sPreemptiveChamfer) -- se non posso lavorare la feature perché condizionata dall'esecuzione del solo chamfer -- genero errore e non faccio nulla if nChamfer < 0 then @@ -331,6 +341,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- altrimenti lavorazione dal davanti o dal dietro else + bDoubleCham = BD.DOWN_HEAD -- se fresa verso il basso, la porto verso l'alto if vtExtr:getZ() < 0 then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) @@ -365,9 +376,10 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bDoubleCham then -- inserisco la lavorazione local sName = 'ChamB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtAddMachining( sName, sChamfer) + local sMachining2 = EgtIf( BD.DOWN_HEAD and sChamfer2, sChamfer2, sChamfer) + local nMchId = EgtAddMachining( sName, sMachining2) if not nMchId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sChamfer + local sErr = 'Error adding machining ' .. sName .. '-' .. sMachining2 EgtOutLog( sErr) return false, sErr end diff --git a/LuaLibs/ProcessText.lua b/LuaLibs/ProcessText.lua index 861c3b9..040e3ac 100644 --- a/LuaLibs/ProcessText.lua +++ b/LuaLibs/ProcessText.lua @@ -1,5 +1,6 @@ --- ProcessText.lua by Egaltech s.r.l. 2018/04/17 +-- ProcessText.lua by Egaltech s.r.l. 2021/05/03 -- Gestione calcolo testi per Travi +-- 2021/05/03 Aggiunta gestione testa da sotto. -- Tabella per definizione modulo local ProcessText = {} @@ -45,13 +46,21 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId) return false, sErr end -- verifico che il testo non sia orientato verso il basso (-5 deg) - if vtN:getZ() < - 0.1 then + if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text from bottom impossible' EgtOutLog( sErr) return false, sErr end + -- abilitazione lavorazione da sotto + local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259) + local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174) -- recupero la lavorazione - local sMilling = ML.FindMilling( 'Text') + local sMillType = 'Text' + local sMchExt = EgtIf( bMillDown, '_H2', '') + local sMilling = ML.FindMilling( sMillType..sMchExt) + if not sMilling and bMillUp then + sMilling = ML.FindMilling( sMillType) + end if not sMilling then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' EgtOutLog( sErr)