diff --git a/BatchProcess.lua b/BatchProcess.lua index 468de84..99fdf3b 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -59,9 +59,23 @@ end local sLog = 'BatchProcess : ' .. BEAM.FILE .. ', ' .. BEAM.MACHINE .. ', ' .. sFlag EgtOutLog( sLog) --- Cancello file di log specifico local sLogFile = EgtChangePathExtension( BEAM.FILE, '.txt') -EgtEraseFile( sLogFile) +-- in caso sia richiesta generazione senza check, verifico prima che il file log specifico non contenga errori: se sì, forzo il check +if BEAM.FLAG == 0 then + local hLogFile = io.open( sLogFile, 'r') + if hLogFile then + for line in hLogFile:lines() do + if EgtStartsWith( line, 'ERR') and tonumber( EgtSplitString( line, '=')[2] or 0) > 0 then + BEAM.FLAG = 4 + break + end + end + hLogFile:close() + end +end + +-- Cancello file di log specifico +EgtEraseFile( sLogFile) -- Funzioni per scrittura su file di log specifico local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId) diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 282124b..94bfe77 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -45,9 +45,23 @@ end local sLog = 'BatchProcess : ' .. BEAM.FILE .. ', ' .. BEAM.MACHINE .. ', ' .. sFlag EgtOutLog( sLog) --- Cancello file di log specifico local sLogFile = EgtChangePathExtension( BEAM.FILE, '.txt') -EgtEraseFile( sLogFile) +-- in caso sia richiesta generazione senza check, verifico prima che il file log specifico non contenga errori: se sì, forzo il check +if BEAM.FLAG == 0 then + local hLogFile = io.open( sLogFile, 'r') + if hLogFile then + for line in hLogFile:lines() do + if EgtStartsWith( line, 'ERR') and tonumber( EgtSplitString( line, '=')[2] or 0) > 0 then + BEAM.FLAG = 4 + break + end + end + hLogFile:close() + end +end + +-- Cancello file di log specifico +EgtEraseFile( sLogFile) -- Funzioni per scrittura su file di log specifico local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 82812cc..ae0160f 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -29,6 +29,7 @@ -- 2024/02/22 Migliorato calcolo area non pinzabile in testa HCING e coda TCING -- 2024/03/27 In MakeTwo rimossa gestione calcolo differente su ultima passata in caso di macchina FAST -- 2024/06/18 In MakeOne in caso di inversione del percorso, si scambia anche accorciamento start con end +-- 2024/09/12 In MakeOne per settare il FaceUse si usa il versore nelle UserNotes -- Tabella per definizione modulo local FacesBySaw = {} @@ -232,8 +233,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5) local bDownUp = ( vtN:getZ() < dVzLimDwnUp) - -- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach) - local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT) + -- linea o bilinea di lavorazione + local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, vtOrthO, GDB_ID.ROOT) if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then local sWarn = 'Face ' .. string.format( '%d,%d', nSurfId, nFacet) .. ' skipped : too small' EgtOutLog( sWarn, 1) @@ -260,7 +261,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw nOrthoOpposite = nOrthoOppositeAlternative vtOrthO = vtOrthOAlternative -- avendo riassegnato la direzione di lavoro, i dati della linea vanno ricalcolati - ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT) + ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, vtOrthO, GDB_ID.ROOT) if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then local sWarn = 'Face ' .. string.format( '%d,%d', nSurfId, nFacet) .. ' skipped : too small' EgtOutLog( sWarn, 1) @@ -283,7 +284,10 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw if bInvert then ptP1, ptP2 = ptP2, ptP1 vtV1, vtV2 = vtV2, vtV1 - dAccStart, dAccEnd = dAccEnd, dAccStart + -- se l'inversione è forzata dall'esterno, anche gli accorciamenti che arrivano dall'esterno si prendono per buoni + if bForceInvert == nil then + dAccStart, dAccEnd = dAccEnd, dAccStart + end end local vtTg = ptP2 - ptP1 ; vtTg:normalize() local dAllStart = 0 @@ -422,14 +426,14 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local bLioTang local Ktp = 1.1 if BD.KIOTP then Ktp = BD.KIOTP end - if ( not bDownUp or abs( vtTg:getY()) > 0.5) and + if ( bForceTangentLeadInOut or ( not bDownUp or abs( vtTg:getY()) > 0.5) and ( not bDownHead or abs( vtTg:getZ()) < 0.51) and abs( vtTg:getX()) < 0.9848 and ( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or ( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450 and b3Box:getDimX() > BD.LEN_SHORT_PART) or ( abs( vtTg:getZ()) < 0.51 and ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo) or - ( BD.TURN == 2 and vtRef:getZ() < -0.1)) then + ( BD.TURN == 2 and vtRef:getZ() < -0.1))) then if BD.TURN == 2 then if vtTg:getY() < -0.1 then bLioTang = 1 @@ -512,6 +516,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw EgtSetMachiningGeometry( {{ nSurfId, nFacet}}) -- imposto uso faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) + local sNoteVtFaceUse = 'VtFaceUse=' .. EgtNumToString( vtOrthO:getX(),3) .. ',' .. EgtNumToString( vtOrthO:getY(),3) .. ',' .. EgtNumToString( vtOrthO:getZ(),3) .. ';' + EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteVtFaceUse) -- imposto posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto inversione e lato correzione diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 0aab253..1120525 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -254,7 +254,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione con testa da sopra -local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf) +local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, bForceTangentLeadInOut) -- ingombro del grezzo b3Raw = b3Raw or EgtGetRawPartBBox( nRawId) -- ingombro del pezzo @@ -581,7 +581,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b if ( i % 2 == 0) and ( Proc.Fct == 1) and bNoPerpCuts then vtOrthoOAlternative = - vtOrthoO end - local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, nil, vtOrthoOAlternative) + bForceTangentLeadInOut = bForceTangentLeadInOut and ( ( i % 2) ~= 0) + local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, bForceTangentLeadInOut, vtOrthoOAlternative) if not bOk then return bOk, sErr end end end @@ -821,7 +822,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione -function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf) +function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf, bForceTangentLeadInOut) -- sovramateriale di coda dOvmTail = dOvmTail or BD.OVM_MID -- ingombro del grezzo @@ -860,7 +861,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, local bNoDicing = false -- se taglio con testa da sopra if not bDownHead and not bDownTurn then - local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf) + local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, bForceTangentLeadInOut) bNoDicing = bNoDicing2 if not bOk then return false, sErr end -- altrimenti taglio con testa da sotto diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index fed7e24..ac27f68 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -23,6 +23,7 @@ -- 2024/03/13 Aggiunta gestione Predrill -- 2024/03/18 Per Predrill corretta direzione estrusione per fori con direzione verso il basso -- 2024/09/04 Gestione dipendenza foro-tasca in caso di fase con pezzo ribaltato +-- 2024/09/10 In GetData corretta gestione modifica diametro foro -- Tabella per definizione modulo local ProcessDrill = {} @@ -102,9 +103,10 @@ function ProcessDrill.GetData( Proc, b3Raw) local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') -- verifico se foro da adattare if EgtExistsInfo( Proc.Id, 'DiamUser') then - if AuxId then AuxId = AuxId + Proc.Id end - if AuxId and EgtGetType( AuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then - EgtModifyArcRadius( AuxId, BD.USER_HOLE_DIAM / 2) + local nNewAuxId + if AuxId then nNewAuxId = AuxId + Proc.Id end + if AuxId and EgtGetType( nNewAuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then + EgtModifyArcRadius( nNewAuxId, BD.USER_HOLE_DIAM / 2) end end -- recupero diametro e lunghezza diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index a805c87..96f20a7 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -177,7 +177,7 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw) for j = nVerticalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_FRONT local dVerticalCutOffset = dVerticalSliceHeight * -j - local bForceTangentLeadInOut = BD.PRESS_ROLLER + local bForceTangentLeadInOut = BD.PRESS_ROLLER and not BD.DOWN_HEAD bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, bForceTangentLeadInOut) if not bOk then return bOk, sErr end end @@ -252,7 +252,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut if not bOk then return false, sErr end end -- taglio verticale - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, '', b3Raw) + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, '', b3Raw, true) if not bOk then return bOk, sErr end end return true, sWarn @@ -290,7 +290,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut if i == 1 and HeadCutType.sType =='Precut' then dCutOffset = dStartOffset end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw) + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw, true) if not bOk then return false, sErr end end -- altrimenti necessari tagli da sopra e sotto con testa opportuna @@ -494,7 +494,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut end -- tagli aggiuntivi non necessari else - bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true) + local bForceTangentLeadInOut = false + if BD.PRESS_ROLLER then + bForceTangentLeadInOut = true + end + bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nil, bForceTangentLeadInOut) end return bOk, sErr end diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index c5dc662..ff3a78d 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -352,7 +352,7 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes) for j = nVerticalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_FRONT local dVerticalCutOffset = dVerticalSliceHeight * -j - local bForceTangentLeadInOut = BD.PRESS_ROLLER + local bForceTangentLeadInOut = BD.PRESS_ROLLER and not BD.DOWN_HEAD bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, bForceTangentLeadInOut) if not bOk then return bOk, sErr end end @@ -438,7 +438,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut if i == 1 and TailCutType.sType ~= 'Precut' then sInfo = 'Cut' end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, sInfo, b3Raw) + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, sInfo, b3Raw, true) if not bOk then return false, sErr end end return true, sWarn @@ -488,7 +488,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut if i == nCuts and TailCutType.bHorizCut and BD.C_SIMM and not BD.DOWN_HEAD then sNotes = EgtSetValInNotes( sNotes, 'StartZmax', 2) end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw) + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, true) if not bOk then return false, sErr end end -- altrimenti necessari tagli da sopra e sotto con testa opportuna @@ -766,7 +766,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt end -- tagli aggiuntivi non necessari else - bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT) + local bForceTangentLeadInOut = false + if BD.PRESS_ROLLER then + bForceTangentLeadInOut = true + end + bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nil, bForceTangentLeadInOut) end if sNotesFinal then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal) diff --git a/UpdateLog.txt b/UpdateLog.txt index 17457f9..ac998db 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,13 @@ ==== Beam Update Log ==== +Versione 2.6i2 (13/09/2024) +- Modif : in FacesBySaw si invertono gli accorciamenti solo se l'inversione del percorso non è forzata dall'esterno; adeguati HeadCut e Split +- Modif : in nesting correzione in lettura array per cambio dll di lettura +- Modif : in BatchProcess e New, in caso sia richiesta generazione senza check, verifico prima che il file log specifico non contenga errori: se sì, forzo il check +- Modif : in FacesBySaw per settare il FaceUse si usa il versore nelle UserNotes +- Modif : in HeadCut, Split modifiche ai tagli aggiuntivi orizzontali e verticali; disattivati attacchi tangenziali per tagli aggiuntivi verticali in PF1250 +- Fixed : in ProcessDrill In GetData corretta gestione modifica diametro foro + Versione 2.6i1 (09/09/2024) - Added : refactoring e modifiche a HeadCut e Split per introduzione pretagli a zero sul grezzo, per evitare problemi con pezzi non lunghi quanto ci si aspetta - Added : in Mark, gestita la lavorazione del testo diff --git a/Version.lua b/Version.lua index 3d09079..a28c10a 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.6i1' +VERSION = '2.6i2' MIN_EXE = '2.6e5'