From 3d80ec94287c61c60d505060ecaeebbc821160c9 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 30 Sep 2022 12:50:34 +0200 Subject: [PATCH 01/11] BugFix/SideGrooveMaxElevation: - In LapJoint MakeSideGrooveByMill sistemato il calcolo del massimo sottosquadro lavorabile dell'utensile. --- LuaLibs/WProcessLapJoint.lua | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 3fbc615..9f542fc 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -9,6 +9,7 @@ -- 2022/01/17 ES Migliorata scelta fresa per lavorazione di fianco sotto. -- 2022/02/03 DS Gorge larga come gambo più sicurezza. -- 2022/02/04 DS In svuotatura aggiunta gestione WD.MAXDIAM_POCK_CORNER in presenza di almeno un angolo interno. +-- 2022/09/30 In MakeSideGrooveByMill sistemato il calcolo del massimo sottosquadro dell'utensile per determinare la fattibilità della tasca. -- Tabella per definizione modulo local WPL = {} @@ -1400,13 +1401,19 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d local dMillLen = 10 local dMillTotLen = 30 local dMaxMat = 0 - local dMillDiamTh = 0 + local dMillDiamTh = 999 + local dMillDiamThStem = 0 + local dMillLenTh = 0 if EgtMdbSetCurrMachining( sMilling) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMillLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dMillLen dMillTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dMillTotLen + -- di default uso il diametro "alto" del portautensile come diametro del gambo + dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh + dMillDiamThStem = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or dMillDiamThStem + dMillLenTh = EgtTdbGetCurrToolThLength() or dMillLenTh if ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0 then dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dMaxMat if not dMaxDepthOnSide or dMaxDepthOnSide < 0.1 then @@ -1418,13 +1425,21 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') end end - dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh + local dGrooveMinZ = max( b3Raw:getMin():getZ(), Proc.Box:getMin():getZ()) + local dRawMaxZ = b3Raw:getMax():getZ() + -- se riesco a lavorare il sottosquadro senza arrivare alla parte larga del portautensile uso la sidedepth o il diametro stretto del portautensile come diametro del gambo + if ( dMillTotLen - dMillLenTh) > ( abs( dRawMaxZ - dGrooveMinZ) + 1) then + if dMaxDepthOnSide and dMaxDepthOnSide > 0 then + dMillDiamTh = dMillDiam - dMaxDepthOnSide * 2 + elseif dMillDiamThStem > 0 then + dMillDiamTh = dMillDiamThStem + end + end end end - local dMaxSideElev = EgtIf( dMaxDepthOnSide and dMaxDepthOnSide > 0, dMaxDepthOnSide, dMillDiam / 2 - 30) - -- se profondità ribasso è maggiore della capacità dichiarata nelle note o di quella netta al gambo utensile - if ( not bEnablePreMill and bMachFromDn) and ( dElev > dMaxSideElev or dElev >= ( 0.5 * ( dMillDiam - dMillDiamTh))) then - local sErr = 'Error : Side Elevation too big' + -- se profondità ribasso è maggiore della capacità di sottosquadro dell'utensile + if ( not bEnablePreMill and bMachFromDn) and ( dElev >= ( 0.5 * ( dMillDiam - dMillDiamTh))) then + local sErr = 'Error : Side Elevation (' .. dElev .. ') bigger than max tool side depth (' .. ( 0.5 * ( dMillDiam - dMillDiamTh)) ..')' EgtOutLog( sErr) return false, sErr end From 6ccbc4f0cda70684d56f1b9772e8225a096f5479 Mon Sep 17 00:00:00 2001 From: SaraP Date: Wed, 30 Nov 2022 15:00:44 +0100 Subject: [PATCH 02/11] DataWall : - nel nesting corretta la rimozione dei parametri Q. --- NestProcess.lua | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/NestProcess.lua b/NestProcess.lua index d88443d..975215b 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -2177,21 +2177,33 @@ if bNestingOk then end end -- se è lap joint dall'alto - if nFaceInd ~= -1 and nFaceDownInd == -1 then + if nFaceInd ~= -1 and nFaceDownInd == -1 then + local bResetQ = false local ptCen = EgtSurfTmFacetCenter( Proc.Id, nFaceInd, GDB_ID.ROOT) - -- se all'interno rimuovo info Q + -- se all'interno rimuovo info Q if EnclosesPointXY( b3Raw, ptCen) then + bResetQ = true + elseif Proc.Fct == 2 then + -- se non è interno ma ha 2 facce non ortogonali rimuovo info Q + local vtN1 = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) + local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) + if abs( vtN1 * vtN2) > GEO.EPS_SMALL then + bResetQ = true + end + end + + if bResetQ then -- resetto parametro Q if Proc.Prc == 30 then EgtRemoveInfo( Proc.Id, "Q08") - EgtRemoveInfo( Proc.Id, "Q08A") + EgtRemoveInfo( Proc.Id, "Q08A") else EgtRemoveInfo( Proc.Id, "Q03") - EgtRemoveInfo( Proc.Id, "Q03A") - end - end + EgtRemoveInfo( Proc.Id, "Q03A") + end + end end - + elseif DoubleCut.Identify( Proc) then -- verifico se due facce e rivolto verso l'alto if Proc.Fct == 2 then From d37e4bdf8d2400a945457b1faf7c5969a845e473 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 1 Dec 2022 11:46:50 +0100 Subject: [PATCH 03/11] =?UTF-8?q?Improvement/SideMillGreater90:=20-=20in?= =?UTF-8?q?=20lapjoint,=20per=202=20facce=20con=20angolo=20>=2090=C2=B0,?= =?UTF-8?q?=20implementata=20lavorazione=20principale=20verticale;=20per?= =?UTF-8?q?=20quelle=20dall'alto=20si=20fa=20anche=20finitura=20del=20lato?= =?UTF-8?q?=20inclinato?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/WProcessLapJoint.lua | 243 +++++++++++++++++++---------------- 1 file changed, 133 insertions(+), 110 deletions(-) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 5d8208c..3a26fa3 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -11,6 +11,7 @@ -- 2022/02/04 DS In svuotatura aggiunta gestione WD.MAXDIAM_POCK_CORNER in presenza di almeno un angolo interno. -- 2022/09/30 In MakeSideGrooveByMill sistemato il calcolo del massimo sottosquadro dell'utensile per determinare la fattibilità della tasca. -- 2022/11/15 DS Con lama massima inclinazione 60deg. +-- 2022/12/01 Per 2 facce con angolo > 90° implementata lavorazione principale verticale. Se da sopra, aggiunta ripresa del lato inclinato. -- Tabella per definizione modulo local WPL = {} @@ -114,7 +115,7 @@ function WPL.Classify( Proc, b3Raw) vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) -- verifico se è lavorabile da sopra o di fianco - return ( vtN[1]:getZ() >= - 0.01 or vtN[2]:getZ() >= - 0.01) + return ( vtN[1]:getZ() >= - 0.015 or vtN[2]:getZ() >= - 0.015) -- se più di 2 facce else local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) @@ -1375,10 +1376,17 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist) end --------------------------------------------------------------------- -local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, dMaxDepthOnSide, bEnablePreMill, bMachFromDn, dAng, bAsEnablePreMill, nSinglePass) - -- dati della faccia +local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, dMaxDepthOnSide, bEnablePreMill, bMachFromDn, dAng, bAsEnablePreMill, nSinglePass, bExcludeFinishing) + -- dati della faccia principale (la più verticale) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT) local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId) + -- dati della faccia più orizzontale + local nOtherFacet = abs( nFacet - 1) + local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFacet, GDB_ID.ROOT) + local dElevOtherFacet = WL.GetFaceElevation( Proc.Id, nOtherFacet, nRawId) + -- se lap joint 2 facce dal basso e angolo più di 90° + local bExcludeSideMill = Proc.Fct == 2 and dAng and dAng > -90 + 10 * GEO.EPS_SMALL and vtN2:getZ() < -0.99 and vtN2:getZ() > -1.01 + -- dimensioni della faccia principale local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) local dThick = min( dH, dV) local frFace = Frame3d( ptC, vtN) @@ -1793,121 +1801,126 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d end end end - -- inserisco la lavorazione di ribasso o gola - local sName = EgtIf( bEnablePreMill ~= nil, 'SideMill_', 'Mill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchFId = EgtAddMachining( sName, sMilling) - if not nMchFId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - end - EgtSetInfo( nMchFId, 'Part', Proc.PartId) - -- se ho abilitato la lavorazione di lama per garantire passaggio utensile, setto la nota per spostare la fresatura dopo i tagli di lama - if bEnablePreMill or bAsEnablePreMill then - EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) - end - -- aggiungo geometria - EgtSetMachiningGeometry( {{ Proc.Id, nFacet}}) - -- imposto posizione braccio porta testa - --local nSCC = MCH_SCC.ADIR_ZP - --if abs( vtN:getZ()) < GEO.EPS_SMALL then - -- nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP) - --end - local nSCC = MCH_SCC.ADIR_NEAR - EgtSetMachiningParam( MCH_MP.SCC, nSCC) - -- imposto modo di lavorare la faccia - local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN) - EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) - -- imposto elevazione e step - local dStep = EgtGetMachiningParam( MCH_MP.STEP) - if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end - local nStep = ceil( ( dThick - dMaxMat) / dStep) - dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0) - local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0) - if nSinglePass and nSinglePass > 0 then - dStep = 0 - if nSinglePass == 1 then - EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat) + + local dStepOri + if not bExcludeSideMill then + -- inserisco la lavorazione di ribasso o gola + local sName = EgtIf( bEnablePreMill ~= nil, 'SideMill_', 'Mill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchFId = EgtAddMachining( sName, sMilling) + if not nMchFId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr end - end - EgtSetMachiningParam( MCH_MP.STEP, dStep) - EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 3) .. ';') - -- setto il lato di lavoro standard - EgtSetMachiningParam( MCH_MP.INVERT, true) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) - -- modifico ingressi e uscita - -- se ho inserito il pretaglio modifico - if bEnablePreMill or bAsEnablePreMill then - if nModifyLeadInOut > 0 then - -- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita - if dElev > ( 0.5 * dMillDiam) then - if nModifyLeadInOut == 1 then - -- setto il tipo di passo a una via - EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY) - -- modifico il tipo di uscita - EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) + EgtSetInfo( nMchFId, 'Part', Proc.PartId) + -- se ho abilitato la lavorazione di lama per garantire passaggio utensile, setto la nota per spostare la fresatura dopo i tagli di lama + if bEnablePreMill or bAsEnablePreMill then + EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ Proc.Id, nFacet}}) + -- imposto posizione braccio porta testa + --local nSCC = MCH_SCC.ADIR_ZP + --if abs( vtN:getZ()) < GEO.EPS_SMALL then + -- nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP) + --end + local nSCC = MCH_SCC.ADIR_NEAR + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- imposto modo di lavorare la faccia + local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN) + EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) + -- imposto elevazione e step + local dStep = EgtGetMachiningParam( MCH_MP.STEP) + dStepOri = dStep + if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end + local nStep = ceil( ( dThick - dMaxMat) / dStep) + dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0) + local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0) + if nSinglePass and nSinglePass > 0 then + dStep = 0 + if nSinglePass == 1 then + EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat) + end + end + EgtSetMachiningParam( MCH_MP.STEP, dStep) + EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 3) .. ';') + -- setto il lato di lavoro standard + EgtSetMachiningParam( MCH_MP.INVERT, true) + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + -- modifico ingressi e uscita + -- se ho inserito il pretaglio modifico + if bEnablePreMill or bAsEnablePreMill then + if nModifyLeadInOut > 0 then + -- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita + if dElev > ( 0.5 * dMillDiam) then + if nModifyLeadInOut == 1 then + -- setto il tipo di passo a una via + EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY) + -- modifico il tipo di uscita + EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) + EgtSetMachiningParam( MCH_MP.LIPERP, 0) + -- modifico dati supplementari uscita + EgtSetMachiningParam( MCH_MP.LOPERP, 0.5) + EgtSetMachiningParam( MCH_MP.LOTANG, -( dLongGorge + dExtraLongIni + dExtraLongEnd)) + else + EgtSetMachiningParam( MCH_MP.LIPERP, dElev) + EgtSetMachiningParam( MCH_MP.LOPERP, dElev) + end + end + -- setto allungamenti iniziali e finali + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd) + if bInvertMach then + -- setto il lato di lavoro invertito + EgtSetMachiningParam( MCH_MP.INVERT, false) + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + end + else + -- setto allungamenti iniziali e finali + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd) + -- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita + if dElev > ( 0.5 * dMillDiam) then + -- setto allungamenti perpendicolari EgtSetMachiningParam( MCH_MP.LIPERP, 0) - -- modifico dati supplementari uscita - EgtSetMachiningParam( MCH_MP.LOPERP, 0.5) - EgtSetMachiningParam( MCH_MP.LOTANG, -( dLongGorge + dExtraLongIni + dExtraLongEnd)) - else - EgtSetMachiningParam( MCH_MP.LIPERP, dElev) - EgtSetMachiningParam( MCH_MP.LOPERP, dElev) + EgtSetMachiningParam( MCH_MP.LOPERP, 0) + end + end + -- se richiesto, setto la nota per spostare la lavorazione alla fine + if not WD.SIDEMILL_BEFORE then + EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + end + else + if nModifyLeadInOut > 0 then + -- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita + if dElev > ( 0.5 * dMillDiam) then + -- setto il tipo di passo a una via + EgtSetMachiningParam( MCH_MP.STEPTYPE, 1) + end + if bInvertMach then + -- setto il lato di lavoro invertito + EgtSetMachiningParam( MCH_MP.INVERT, false) + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) end end -- setto allungamenti iniziali e finali EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd) - if bInvertMach then - -- setto il lato di lavoro invertito - EgtSetMachiningParam( MCH_MP.INVERT, false) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) - end - else - -- setto allungamenti iniziali e finali - EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd) - -- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita - if dElev > ( 0.5 * dMillDiam) then - -- setto allungamenti perpendicolari - EgtSetMachiningParam( MCH_MP.LIPERP, 0) - EgtSetMachiningParam( MCH_MP.LOPERP, 0) + -- se richiesto, setto la nota per spostare la lavorazione alla fine + if not WD.SIDEMILL_BEFORE then + EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) end end - -- se richiesto, setto la nota per spostare la lavorazione alla fine - if not WD.SIDEMILL_BEFORE then - EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) - end - else - if nModifyLeadInOut > 0 then - -- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita - if dElev > ( 0.5 * dMillDiam) then - -- setto il tipo di passo a una via - EgtSetMachiningParam( MCH_MP.STEPTYPE, 1) - end - if bInvertMach then - -- setto il lato di lavoro invertito - EgtSetMachiningParam( MCH_MP.INVERT, false) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) - end - end - -- setto allungamenti iniziali e finali - EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd) - -- se richiesto, setto la nota per spostare la lavorazione alla fine - if not WD.SIDEMILL_BEFORE then - EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + -- eseguo + if not EgtApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr end end - -- eseguo - if not EgtApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchFId, false) - return false, sErr - end + -- verifico se devo lavorare anche la seconda faccia basandomi sul valore dell'angolo interno - if dAng and dAng > -90 + 10 * GEO.EPS_SMALL then - local nOtherFacet = abs( nFacet - 1) + if dAng and dAng > -90 + 10 * GEO.EPS_SMALL and not bExcludeFinishing then -- inserisco la lavorazione di contornatura local sName = 'Mill_Oth_Fac_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchFId = EgtAddMachining( sName, sMilling) @@ -1920,7 +1933,6 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, nOtherFacet}}) -- imposto posizione braccio porta testa - local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFacet, GDB_ID.ROOT) local nSCC = MCH_SCC.ADIR_ZP if AreSameOrOppositeVectorApprox( vtN2, Z_AX()) then nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP) @@ -1928,8 +1940,15 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto modo di lavorare la faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFace2ndFace) - EgtSetMachiningParam( MCH_MP.STEP, 0) local dMaxElev = dMaxMat + local dStepOtherFace = dStepOri or EgtGetMachiningParam( MCH_MP.STEP) + if dStepOtherFace < GEO.EPS_SMALL then dStepOtherFace = 0.75 * dMaxMat end + if Proc.Fct == 2 and vtN2:getZ() < -0.99 and vtN2:getZ() > -1.01 then + local nStepOtherFace = ceil( ( dElevOtherFacet - dMaxMat) / dStepOtherFace) + dStepOtherFace = max( ( dElevOtherFacet - dMaxMat) / max( nStepOtherFace, 1), 0) + dMaxElev = max( ( nStepOtherFace + 1) * dStepOtherFace - GEO.EPS_SMALL, 0) + end + EgtSetMachiningParam( MCH_MP.STEP, dStepOtherFace) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 3) .. ';') if bMachFromDn then EgtSetMachiningParam( MCH_MP.INVERT, true) @@ -2374,8 +2393,12 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) if bEnableMillOnSide and dMaxDepthOnSide > 0 then bLikeAsMakeFirstGroove = false return MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove) - elseif MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw, dSideDist) then - return true + else + local bOk, sErr = MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw, dSideDist) + if dAng and dAng > -90 + 10 * GEO.EPS_SMALL then + local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true) + end + return bOk end elseif bEnableMillOnSide and dMaxDepthOnSide > 0 then bLikeAsMakeFirstGroove = true From 5023887f2e07468faf06a7c3d8f7daa35bab16e0 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 1 Dec 2022 16:08:15 +0100 Subject: [PATCH 04/11] Improvement/SideMillGreater90: - aggiunto warning per lapjoint da sotto con angolo ottuso non completata --- LuaLibs/WProcessLapJoint.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 3a26fa3..13d764b 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1377,6 +1377,7 @@ end --------------------------------------------------------------------- local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, dMaxDepthOnSide, bEnablePreMill, bMachFromDn, dAng, bAsEnablePreMill, nSinglePass, bExcludeFinishing) + local sWarn -- dati della faccia principale (la più verticale) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT) local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId) @@ -1917,6 +1918,9 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d EgtSetOperationMode( nMchFId, false) return false, sErr end + else + sWarn = 'Warning in LapJoint : upside down groove with obtuse angle not completed' + EgtOutLog( sWarn) end -- verifico se devo lavorare anche la seconda faccia basandomi sul valore dell'angolo interno @@ -2034,7 +2038,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d end end - return true + return true, sWarn end --------------------------------------------------------------------- From b2f1645322b15603d052f99e3977032a8d4d26c2 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 2 Dec 2022 15:38:04 +0100 Subject: [PATCH 05/11] Improvement/SideMillGreater90: - aggiunto ripasso lato inclinato anche per svuotatura --- LuaLibs/WMachiningLib.lua | 2 +- LuaLibs/WProcessLapJoint.lua | 37 ++++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/LuaLibs/WMachiningLib.lua b/LuaLibs/WMachiningLib.lua index ae106bc..e3b857c 100644 --- a/LuaLibs/WMachiningLib.lua +++ b/LuaLibs/WMachiningLib.lua @@ -56,7 +56,7 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, d local Milling = Millings[i] if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) - local sMyTuuid = EgtGetMachiningParam( MCH_MP.TUUID) + local sMyTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, dTMaxMat, EgtTdbGetCurrToolMaxDepth()) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 13d764b..35c8ef8 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1945,9 +1945,10 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d -- imposto modo di lavorare la faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFace2ndFace) local dMaxElev = dMaxMat - local dStepOtherFace = dStepOri or EgtGetMachiningParam( MCH_MP.STEP) - if dStepOtherFace < GEO.EPS_SMALL then dStepOtherFace = 0.75 * dMaxMat end + local dStepOtherFace = 0 if Proc.Fct == 2 and vtN2:getZ() < -0.99 and vtN2:getZ() > -1.01 then + dStepOtherFace = dStepOri or EgtGetMachiningParam( MCH_MP.STEP) + if dStepOtherFace < GEO.EPS_SMALL then dStepOtherFace = 0.75 * dMaxMat end local nStepOtherFace = ceil( ( dElevOtherFacet - dMaxMat) / dStepOtherFace) dStepOtherFace = max( ( dElevOtherFacet - dMaxMat) / max( nStepOtherFace, 1), 0) dMaxElev = max( ( nStepOtherFace + 1) * dStepOtherFace - GEO.EPS_SMALL, 0) @@ -2002,7 +2003,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d end end -- se richiesto, setto la nota per spostare la lavorazione alla fine - if not WD.SIDEMILL_BEFORE then + if bEnablePreMill or bAsEnablePreMill or not WD.SIDEMILL_BEFORE then EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) end else @@ -2095,8 +2096,9 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar) local dMillDiam = 20 local dMaxDepth = 0 local dThDiam = 100 + local sTuuid if EgtMdbSetCurrMachining( sPocketing) then - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth()) or dMaxDepth @@ -2163,7 +2165,7 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar) else EgtErase( nNewProc) end - return true, sWarn + return true, sWarn, sTuuid end --------------------------------------------------------------------- @@ -2399,10 +2401,11 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) return MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove) else local bOk, sErr = MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw, dSideDist) - if dAng and dAng > -90 + 10 * GEO.EPS_SMALL then + -- se angolo ottuso riprendo il lato quasi verticale + if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true) end - return bOk + return bOk, sErr end elseif bEnableMillOnSide and dMaxDepthOnSide > 0 then bLikeAsMakeFirstGroove = true @@ -2412,7 +2415,25 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) -- se non inclinate o capacità di taglio non sufficiente o non molto grandi (80mm), provo con contornatura o svuotatura if vtN:getZ() > 0.866 or vtNV:getZ() > 0.866 or not sCutting or dSawMaxDepth < dDimY[1] + WD.CUT_SIC or dSawMaxDepth < dDimY[2] + WD.CUT_SIC or dDimY[1] < 80 or dDimY[2] < 80 then -- eseguo la svuotatura - return MakeByPocketing( Proc, nFacet, nRawId, b3Raw) + local bOk, sErr, sTuuid = MakeByPocketing( Proc, nFacet, nRawId, b3Raw) + -- se angolo ottuso riprendo il lato quasi verticale + if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then + local _, dHVert, dVVert = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacetVert, GDB_ID.ROOT) + local dDepth = min( dHVert, dVVert) + local _, dHHor, dVHor = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) + local dDiam = 2 * min( dHHor, dVHor) + local sMillObtuseAngle = WM.FindMilling( 'FreeContour', dDepth, sTuuid, nil, dDiam, nil, nil, nil) + if not sMillObtuseAngle then + sMillObtuseAngle = WM.FindMilling( 'FreeContour', dDepth, nil, nil, dDiam, nil, nil, nil) + end + if not sMillObtuseAngle then + local sErrMillNotFound = 'Error : Processing to finish obtuse angle not found in library' + EgtOutLog( sErrMillNotFound) + return true, sErrMillNotFound + end + local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, sMillObtuseAngle, dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true) + end + return bOk, sErr end -- se una delle due facce rivolta verso il basso elseif vtN[1]:getZ() < -0.001 or vtN[2]:getZ() < -0.001 then From ade9d3ffe9fd853ce8dbfc6a7b0b34b81e2db362 Mon Sep 17 00:00:00 2001 From: SaraP Date: Fri, 2 Dec 2022 17:58:39 +0100 Subject: [PATCH 06/11] DataWall : - nel nesting aggiunto controllo sul diametro dei fori - in FlipAndRot corretto controllo sulle rotazioni. --- NestFlipAndRotate.lua | 11 ++-- NestProcess.lua | 132 ++++++++++++++++++++++-------------------- 2 files changed, 74 insertions(+), 69 deletions(-) diff --git a/NestFlipAndRotate.lua b/NestFlipAndRotate.lua index 4571168..a19c747 100644 --- a/NestFlipAndRotate.lua +++ b/NestFlipAndRotate.lua @@ -349,16 +349,17 @@ if not bManualRot then local nRotateOpt = 0 if #RotateFeatureStates > 0 then -- calcolo lato con punteggio minore o molteplicita' piu' alta - local nRotMax = 0 - local nScoreMax = 0 - local nScoreCnt = 0 - for nInd = 1, #MinList do + local nRotMax = MinList[1].Rot + local nScoreMax = MinList[1].Score + local nScoreCnt = MinList[1].ScoreCnt + for nInd = 2, #MinList do if MinList[nInd].Score > nScoreMax then nRotMax = MinList[nInd].Rot nScoreMax = MinList[nInd].Score nScoreCnt = MinList[nInd].ScoreCnt elseif MinList[nInd].Score == nScoreMax then - if MinList[nInd].ScoreCnt > nScoreCnt then + -- se punteggio > 0 conservo quello con molteplicità più alta, se punteggio = 0 conservo quello con molteplicità più bassa + if ( nScoreMax ~= 0 and MinList[nInd].ScoreCnt > nScoreCnt) or ( nScoreMax == 0 and MinList[nInd].ScoreCnt < nScoreCnt) then nRotMax = MinList[nInd].Rot nScoreMax = MinList[nInd].Score nScoreCnt = MinList[nInd].ScoreCnt diff --git a/NestProcess.lua b/NestProcess.lua index 975215b..02c904b 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -509,80 +509,84 @@ local function ClassifyDrillsOnLateralFaces( nPartId, dMinSheetWidth) local vPartProc = WE.CollectFeatures( nPartId) for nInd = 1, #vPartProc do repeat - if Drill.Identify( vPartProc[nInd]) then + if Drill.Identify( vPartProc[nInd]) then -- identifico su quali facce si trova il foro local bOpen = ( vPartProc[nInd].Fcs ~= 0 and vPartProc[nInd].Fce ~= 0) local AuxId = EgtGetInfo( vPartProc[nInd].Id, 'AUXID', 'i') or 0 if AuxId then AuxId = AuxId + vPartProc[nInd].Id end - if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then break end - local ptDrill = EgtCP( AuxId, GDB_RT.GLOB) - local dLen = abs( EgtCurveThickness( AuxId)) - local bLong = dLen > WD.HOR_DRILL_LEN - 1 - local bOnlyOnRef = dLen + dDeltaRaw > WD.HOR_DRILL_LEN - GEO.EPS_SMALL and not bLong - - -- faccia Front - local dTol = GEO.EPS_SMALL - if ( abs( ptDrill:getY() - ptPartMin:getY()) < dTol) then - DrillOnFaces.F.nbr = DrillOnFaces.F.nbr + 1 - if bOnlyOnRef then DrillOnFaces.F.OnlyOnRef = true end - if bOpen then - DrillOnFaces.B.nbr = DrillOnFaces.B.nbr + 1 - if bOnlyOnRef then DrillOnFaces.B.OnlyOnRef = true end - else - DrillOnFaces.F.closed = true - - end - if bLong then - DrillOnFaces.F.long = true - if bOpen then DrillOnFaces.B.long = true end - end + if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then break end + -- verifico se diametro compatibile con la punta + local dDiam = 2 * EgtArcRadius( AuxId) + if abs( dDiam - WD.HOR_DRILL_DIAM) < WD.DRILL_TOL + GEO.EPS_SMALL then + local ptDrill = EgtCP( AuxId, GDB_RT.GLOB) + local dLen = abs( EgtCurveThickness( AuxId)) + local bLong = dLen > WD.HOR_DRILL_LEN - 1 + local bOnlyOnRef = dLen + dDeltaRaw > WD.HOR_DRILL_LEN - GEO.EPS_SMALL and not bLong - -- faccia Back - elseif ( abs( ptDrill:getY() - ptPartMax:getY()) < dTol) then - DrillOnFaces.B.nbr = DrillOnFaces.B.nbr + 1 - if bOnlyOnRef then DrillOnFaces.B.OnlyOnRef = true end - if bOpen then + -- faccia Front + local dTol = GEO.EPS_SMALL + if ( abs( ptDrill:getY() - ptPartMin:getY()) < dTol) then DrillOnFaces.F.nbr = DrillOnFaces.F.nbr + 1 - if bOnlyOnRef then DrillOnFaces.F.OnlyOnRef = true end - else - DrillOnFaces.B.closed = true - end - if bLong then - DrillOnFaces.B.long = true - if bOpen then DrillOnFaces.F.long = true end - end - - -- faccia Left - elseif ( abs( ptDrill:getX() - ptPartMin:getX()) < dTol) then - DrillOnFaces.L.nbr = DrillOnFaces.L.nbr + 1 - if bOnlyOnRef then DrillOnFaces.L.OnlyOnRef = true end - if bOpen then - DrillOnFaces.R.nbr = DrillOnFaces.R.nbr + 1 - if bOnlyOnRef then DrillOnFaces.R.OnlyOnRef = true end - else - DrillOnFaces.L.closed = true - end + if bOnlyOnRef then DrillOnFaces.F.OnlyOnRef = true end + if bOpen then + DrillOnFaces.B.nbr = DrillOnFaces.B.nbr + 1 + if bOnlyOnRef then DrillOnFaces.B.OnlyOnRef = true end + else + DrillOnFaces.F.closed = true + + end + if bLong then + DrillOnFaces.F.long = true + if bOpen then DrillOnFaces.B.long = true end + end + + -- faccia Back + elseif ( abs( ptDrill:getY() - ptPartMax:getY()) < dTol) then + DrillOnFaces.B.nbr = DrillOnFaces.B.nbr + 1 + if bOnlyOnRef then DrillOnFaces.B.OnlyOnRef = true end + if bOpen then + DrillOnFaces.F.nbr = DrillOnFaces.F.nbr + 1 + if bOnlyOnRef then DrillOnFaces.F.OnlyOnRef = true end + else + DrillOnFaces.B.closed = true + end if bLong then - DrillOnFaces.L.long = true - if bOpen then DrillOnFaces.R.long = true end - end - - -- faccia Right - elseif ( abs( ptDrill:getX() - ptPartMax:getX()) < dTol) then - DrillOnFaces.R.nbr = DrillOnFaces.R.nbr + 1 - if bOnlyOnRef then DrillOnFaces.R.OnlyOnRef = true end - if bOpen then - DrillOnFaces.L.nbr = DrillOnFaces.L.nbr + 1 + DrillOnFaces.B.long = true + if bOpen then DrillOnFaces.F.long = true end + end + + -- faccia Left + elseif ( abs( ptDrill:getX() - ptPartMin:getX()) < dTol) then + DrillOnFaces.L.nbr = DrillOnFaces.L.nbr + 1 if bOnlyOnRef then DrillOnFaces.L.OnlyOnRef = true end - else - DrillOnFaces.R.closed = true - end - if bLong then - DrillOnFaces.R.long = true - if bOpen then DrillOnFaces.L.long = true end + if bOpen then + DrillOnFaces.R.nbr = DrillOnFaces.R.nbr + 1 + if bOnlyOnRef then DrillOnFaces.R.OnlyOnRef = true end + else + DrillOnFaces.L.closed = true + end + if bLong then + DrillOnFaces.L.long = true + if bOpen then DrillOnFaces.R.long = true end + end + + -- faccia Right + elseif ( abs( ptDrill:getX() - ptPartMax:getX()) < dTol) then + DrillOnFaces.R.nbr = DrillOnFaces.R.nbr + 1 + if bOnlyOnRef then DrillOnFaces.R.OnlyOnRef = true end + if bOpen then + DrillOnFaces.L.nbr = DrillOnFaces.L.nbr + 1 + if bOnlyOnRef then DrillOnFaces.L.OnlyOnRef = true end + else + DrillOnFaces.R.closed = true + end + if bLong then + DrillOnFaces.R.long = true + if bOpen then DrillOnFaces.L.long = true end + end end - end + end end until true From b62b694112562735006ccb4bfdaf2d03714d895d Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 2 Dec 2022 18:10:17 +0100 Subject: [PATCH 07/11] =?UTF-8?q?Improvement/SideMillGreater90:=20-=20Corr?= =?UTF-8?q?etto=20calcolo=20profondit=C3=A0=20per=20lavorazione=20vertical?= =?UTF-8?q?e=20con=20angolo=20ottuso?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/WProcessLapJoint.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 35c8ef8..c2d86d0 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -115,7 +115,7 @@ function WPL.Classify( Proc, b3Raw) vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) -- verifico se è lavorabile da sopra o di fianco - return ( vtN[1]:getZ() >= - 0.015 or vtN[2]:getZ() >= - 0.015) + return ( vtN[1]:getZ() >= - 0.028 or vtN[2]:getZ() >= - 0.028) -- se più di 2 facce else local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) @@ -1946,18 +1946,20 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d EgtSetMachiningParam( MCH_MP.FACEUSE, nFace2ndFace) local dMaxElev = dMaxMat local dStepOtherFace = 0 + local dDepthOtherFace = dMaxMat if Proc.Fct == 2 and vtN2:getZ() < -0.99 and vtN2:getZ() > -1.01 then dStepOtherFace = dStepOri or EgtGetMachiningParam( MCH_MP.STEP) if dStepOtherFace < GEO.EPS_SMALL then dStepOtherFace = 0.75 * dMaxMat end local nStepOtherFace = ceil( ( dElevOtherFacet - dMaxMat) / dStepOtherFace) dStepOtherFace = max( ( dElevOtherFacet - dMaxMat) / max( nStepOtherFace, 1), 0) dMaxElev = max( ( nStepOtherFace + 1) * dStepOtherFace - GEO.EPS_SMALL, 0) + dDepthOtherFace = dElevOtherFacet end EgtSetMachiningParam( MCH_MP.STEP, dStepOtherFace) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 3) .. ';') if bMachFromDn then EgtSetMachiningParam( MCH_MP.INVERT, true) - EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat) + EgtSetMachiningParam( MCH_MP.DEPTH, dDepthOtherFace) else EgtSetMachiningParam( MCH_MP.INVERT, false) end From d236b19d6a03617b40a457e730c7ddf4aa553428 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 2 Dec 2022 18:35:46 +0100 Subject: [PATCH 08/11] Improvement/SideMillGreater90: - piccola correzione --- LuaLibs/WProcessLapJoint.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index c2d86d0..8889c17 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1947,7 +1947,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d local dMaxElev = dMaxMat local dStepOtherFace = 0 local dDepthOtherFace = dMaxMat - if Proc.Fct == 2 and vtN2:getZ() < -0.99 and vtN2:getZ() > -1.01 then + if Proc.Fct == 2 and abs( vtN2:getZ()) > 0.99 and abs( vtN2:getZ()) < 1.01 then dStepOtherFace = dStepOri or EgtGetMachiningParam( MCH_MP.STEP) if dStepOtherFace < GEO.EPS_SMALL then dStepOtherFace = 0.75 * dMaxMat end local nStepOtherFace = ceil( ( dElevOtherFacet - dMaxMat) / dStepOtherFace) From 3bf3ba3b43669203b1e916a62682d9ee0fda82cd Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 6 Dec 2022 12:41:47 +0100 Subject: [PATCH 09/11] Improvement/SideMillGreater90: - piccole correzioni e miglioramenti --- LuaLibs/WProcessLapJoint.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 8889c17..a8936ab 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1385,8 +1385,8 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d local nOtherFacet = abs( nFacet - 1) local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFacet, GDB_ID.ROOT) local dElevOtherFacet = WL.GetFaceElevation( Proc.Id, nOtherFacet, nRawId) - -- se lap joint 2 facce dal basso e angolo più di 90° - local bExcludeSideMill = Proc.Fct == 2 and dAng and dAng > -90 + 10 * GEO.EPS_SMALL and vtN2:getZ() < -0.99 and vtN2:getZ() > -1.01 + -- se lap joint 2 facce dal basso e angolo negativo + local bExcludeSideMill = Proc.Fct == 2 and vtN:getZ() < -0.01 and vtN2:getZ() < -0.01 -- dimensioni della faccia principale local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) local dThick = min( dH, dV) @@ -2039,8 +2039,11 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d EgtSetOperationMode( nMchFId, false) return false, sErr end + elseif bExcludeSideMill then + local sErr = 'Feature not machinable by orientation' + EgtOutLog( sErr) + return false, sErr end - return true, sWarn end @@ -2345,11 +2348,12 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) EgtOutLog( sErr) return false, sErr end - local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) + local vtNTemp = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) local dSideDist local ptMid = ( ptP1 + ptP2) / 2 -- faccia orizzontale - local nFacet = EgtIf( vtN:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2) + local nFacet = EgtIf( vtNTemp:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2) + local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacet, GDB_ID.ROOT) -- faccia verticale local nFacetVert = EgtIf( nFacet == nFacInd, nFacInd2, nFacInd) local vtNV = EgtSurfTmFacetNormVersor( Proc.Id, nFacetVert, GDB_ID.ROOT) @@ -2593,7 +2597,6 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw) local sErr = 'Side milling not possible' EgtOutLog( sErr) return true, sErr - end -- fessura verticale elseif Proc.Stype == 3 then From 3b46a5b28569753d78ae0257b8802b4aa14a6766 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 13 Dec 2022 09:48:53 +0100 Subject: [PATCH 10/11] BugFix/Approx3EdgesFaces: - in freeContour aggiunta la funzione Is3EdgesApprox per riconoscere come 3 lati anche facce con lati aggiuntivi molto corti (<15 mm) --- LuaLibs/WProcessFreeContour.lua | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 2411020..503cdc7 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -12,6 +12,7 @@ -- 2022/04/26 Migliorata gestione caso pocketing. -- 2022/08/05 Aggiunta segnalazione aree vietate non gestite. -- 2022/08/29 Corretta gestione tipo Pocket senza fondo (sono lavorabili da entrambe le parti con fresatura). +-- 2022/12/13 Aggiunta la funzione Is3EdgesApprox per riconoscere come 3 lati anche facce con lati aggiuntivi molto corti (<15 mm) -- Tabella per definizione modulo local WPF = {} @@ -1233,6 +1234,33 @@ local function GetMaxDepth( vtNz, dMillDiam, dDiamTh, dMaxDepth, dFreeLen) end end +--------------------------------------------------------------------- +-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce +local function Is3EdgesApprox( Proc, nFacet, nAddGrpId) + local bResult = false + local nContourId = EgtExtractSurfTmFacetLoops( Proc.Id, nFacet, nAddGrpId) + EgtMergeCurvesInCurveCompo( nContourId) + -- recupero il numero effettivo di lati + local _, nEntityCount = EgtCurveDomain( nContourId) + local nEdges = nEntityCount + if nContourId then + if nEntityCount and nEntityCount == 3 then + bResult = true + -- rimuovo i lati molto corti dal conteggio totale + elseif nEntityCount then + for i = 1, nEntityCount do + local dLength = EgtCurveCompoLength( nContourId, i - 1) + if dLength < 15 then nEdges = nEdges - 1 end + end + end + if nEdges == 3 then bResult = true end + end + if bResult == true then + EgtOutLog( 'FreeContour : Face with ' .. tointeger( nEntityCount) .. ' edges skipped (approx 3 edges)') + end + return bResult +end + --------------------------------------------------------------------- local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAddGrpId) -- flag per fresature non passanti @@ -1358,8 +1386,10 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd return 0, sErr end end + -- verifico se la faccia ha alcuni lati molto corti e può essere approssimata ad una 3 lati + local bIs3EdgesApprox = Is3EdgesApprox( Proc, vFace[i].Fac, nAddGrpId) -- se tutta la faccia o la sua fine senza taglio, inserisco una fresatura - if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and vFace[i].Edges > 3) then + if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not bIs3EdgesApprox)) then -- inserisco la lavorazione local sName = 'Free_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) local nMchId = EgtAddMachining( sName, sMilling) From a0bd97e7aa0e7e466a073d254b5bc16e0a797885 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 14 Dec 2022 12:02:54 +0100 Subject: [PATCH 11/11] BugFix/FreeContourBladeUpsideDownAdjFace: - Aggiunto l'accorciamento della lama in caso di facce vicine orientate verso il basso - in Lapjoint piccola modifica al modo di oridinare le facce --- LuaLibs/WProcessFreeContour.lua | 51 +++++++++++++++++++++++++-------- LuaLibs/WProcessLapJoint.lua | 4 ++- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 503cdc7..d0731b2 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -13,6 +13,7 @@ -- 2022/08/05 Aggiunta segnalazione aree vietate non gestite. -- 2022/08/29 Corretta gestione tipo Pocket senza fondo (sono lavorabili da entrambe le parti con fresatura). -- 2022/12/13 Aggiunta la funzione Is3EdgesApprox per riconoscere come 3 lati anche facce con lati aggiuntivi molto corti (<15 mm) +-- 2022/12/14 Aggiunto l'accorciamento della lama in caso di facce vicine orientate verso il basso -- Tabella per definizione modulo local WPF = {} @@ -1281,13 +1282,19 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd dMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), dFreeLen) or dMaxDepth end end + -- verifico se la facce hanno alcuni lati molto corti e possono quindi essere approssimate a 3 lati + for currentFace = 1, #vFace do + if Is3EdgesApprox( Proc, vFace[currentFace].Fac, nAddGrpId) then + vFace[currentFace].Is3EdgesApprox = true + end + end -- verifico se ciclo chiuso local bClosed = ( abs( vFace[1].PrevAng) > 0.1) -- ciclo di inserimento delle fresate sulle facce del contorno in esame local i = 1 -- se faccia finale con fine non lavorato, forzo partenza da prima faccia non tutta saltata (tipo 4) - if bClosed and ( ( vFace[#vFace].Type == 4 and vFace[#vFace].Edges > 3) or ( vFace[#vFace].Type & 2) ~= 0) then - while i <= #vFace and vFace[i].Type == 4 and vFace[i].Edges > 3 and abs( vFace[i].SideAng) < 0.1 do + if bClosed and ( ( vFace[#vFace].Type == 4 and ( vFace[#vFace].Edges > 3 and not vFace[#vFace].Is3EdgesApprox)) or ( vFace[#vFace].Type & 2) ~= 0) then + while i <= #vFace and vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not vFace[i].Is3EdgesApprox) and abs( vFace[i].SideAng) < 0.1 do i = i + 1 end end @@ -1350,6 +1357,10 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd end end local dEal = vFace[i].Whisk - vFace[i].Len + -- se faccia precedente inclinata verso il basso prolungo il finale per adeguarmi all percorso della lama + if j and vFace[j].Norm:getZ() < -0.017 then + dEal = dEal - vFace[j].Width * vFace[j].Norm:getZ() + end -- se angolo interno prima e faccia precedente inclinata verso l'alto oltre 16.1deg if vFace[i].PrevAng < -30 and j and vFace[j].Norm:getZ() < 0.96078 and vFace[j].Norm:getZ() > 0 then dEal = dEal + vFace[j].Width * vFace[j].Norm:getZ() @@ -1386,10 +1397,8 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd return 0, sErr end end - -- verifico se la faccia ha alcuni lati molto corti e può essere approssimata ad una 3 lati - local bIs3EdgesApprox = Is3EdgesApprox( Proc, vFace[i].Fac, nAddGrpId) -- se tutta la faccia o la sua fine senza taglio, inserisco una fresatura - if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not bIs3EdgesApprox)) then + if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not vFace[i].Is3EdgesApprox)) then -- inserisco la lavorazione local sName = 'Free_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) local nMchId = EgtAddMachining( sName, sMilling) @@ -1430,7 +1439,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd local LastJ i = i + 1 local j = EgtIf( i <= #vFace, i, EgtIf( bAllType4 or not bClosed, nil, 1)) - while j and ( ( vFace[j].Type & 1) ~= 0 or ( vFace[j].Type == 4 and vFace[j].Edges > 3)) and abs( vFace[j].SideAng) < 0.1 and abs( vFace[OrigI].SideAng) < 0.1 do + while j and ( ( vFace[j].Type & 1) ~= 0 or ( vFace[j].Type == 4 and ( vFace[j].Edges > 3 and not vFace[j].Is3EdgesApprox))) and abs( vFace[j].SideAng) < 0.1 and abs( vFace[OrigI].SideAng) < 0.1 do table.insert( vGeom, { Proc.Id, vFace[j].Fac}) LastJ = j dEal = EgtIf( ( vFace[j].Type & 1) ~= 0, vFace[j].Whisk - vFace[j].Len, 0) @@ -1441,13 +1450,13 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd j = EgtIf( j + 1 <= #vFace, j + 1, EgtIf( bAllType4 or not bClosed, nil, 1)) end -- se faccia singola è da fare tutta senza oltrepassare estremi - if #vFace == 1 and vFace[OrigI].Type == 4 and vFace[OrigI].Edges > 3 then + if #vFace == 1 and vFace[OrigI].Type == 4 and ( vFace[OrigI].Edges > 3 and not vFace[OrigI].Is3EdgesApprox) then dSal = -dMillDiam / 2 dEal = -dMillDiam / 2 -- altrimenti va verificato else -- se lavorazione completa su faccia iniziale - if vFace[OrigI].Type == 4 and vFace[OrigI].Edges > 3 then + if vFace[OrigI].Type == 4 and ( vFace[OrigI].Edges > 3 and not vFace[OrigI].Is3EdgesApprox) then -- se angolo interno prima if vFace[OrigI].PrevAng < -30 then local dSinA = -sin( vFace[OrigI].PlPrevAng + 90) @@ -1468,7 +1477,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd -- se lavorazione completa o finale su faccia finale local LastFace = ( LastJ or OrigI) local OrigK = EgtIf( LastFace < #vFace, LastFace + 1, EgtIf( bClosed, 1, nil)) - if ( vFace[LastFace].Type == 4 and vFace[LastFace].Edges > 3) or ( LastFace == OrigI and ( vFace[LastFace].Type & 2) ~= 0) then + if ( vFace[LastFace].Type == 4 and ( vFace[LastFace].Edges > 3 and not vFace[LastFace].Is3EdgesApprox)) or ( LastFace == OrigI and ( vFace[LastFace].Type & 2) ~= 0) then -- se angolo interno dopo if OrigK and vFace[OrigK].PrevAng < -30 then local dSinA = -sin( vFace[OrigK].PlPrevAng + 90) @@ -1730,7 +1739,7 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw) end end -- se fine faccia non tagliato completamente o faccia non tagliata completamente e abbastanza lunga, inserisco un ripasso con sega a catena - if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and vFace[i].Edges > 3 and vFace[i].Len > dSawDiam + 1) then + if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not vFace[i].Is3EdgesApprox) and vFace[i].Len > dSawDiam + 1) then -- inserisco la lavorazione local sName = 'Free_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) local nMchId = EgtAddMachining( sName, sSawing) @@ -1791,6 +1800,8 @@ end --------------------------------------------------------------------- local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick) + -- verifico se ciclo chiuso + local bClosed = ( abs( vFace[1].PrevAng) > 0.1) -- ciclo di inserimento dei tagli sulle facce del contorno in esame for i = 1, #vFace do -- verifico se faccia da saltare, perchè macchina travi e faccia su bordo longitudinale esterno già finito @@ -1799,6 +1810,8 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick) if not bToSkip and vFace[i].Type ~= 4 then -- indice del successivo local j = EgtIf( i < #vFace, i + 1, 1) + -- indice del precedente + local h = EgtIf( i > 1, i - 1, EgtIf( bClosed, #vFace, nil)) -- inserisco la lavorazione local sName = 'Cut_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) .. '_' .. tostring( i) local nMchId = EgtAddMachining( sName, sCutting) @@ -1842,7 +1855,14 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick) EgtSetMachiningParam( MCH_MP.LEADINTYPE, nLeadIn) local dSal = 0 if ( not bInvert and vFace[i].PrevAng < -0.1) or ( bInvert and vFace[j].PrevAng < -0.1) then - dSal = -WHISK_SAFE + -- se faccia precedente inclinata verso il basso + if not bInvert and h and vFace[h].Norm:getZ() < -0.017 then + dSal = vFace[h].Width * vFace[h].Norm:getZ() - WHISK_SAFE + elseif bInvert and j and vFace[j].Norm:getZ() < -0.017 then + dSal = vFace[j].Width * vFace[j].Norm:getZ() - WHISK_SAFE + else + dSal = -WHISK_SAFE + end end EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) -- assegno i dati di uscita (sicurezza solo se angolo interno) @@ -1853,7 +1873,14 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, nLeadOut) local dEal = 0 if ( not bInvert and vFace[j].PrevAng < -0.1) or ( bInvert and vFace[i].PrevAng < -0.1) then - dEal = -WHISK_SAFE + -- se faccia precedente inclinata verso il basso + if not bInvert and j and vFace[j].Norm:getZ() < -0.017 then + dEal = vFace[j].Width * vFace[j].Norm:getZ() - WHISK_SAFE + elseif bInvert and h and vFace[h].Norm:getZ() < -0.017 then + dEal = vFace[h].Width * vFace[h].Norm:getZ() - WHISK_SAFE + else + dEal = -WHISK_SAFE + end end EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) -- posizione braccio porta testa diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index a8936ab..b89f729 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -12,6 +12,7 @@ -- 2022/09/30 In MakeSideGrooveByMill sistemato il calcolo del massimo sottosquadro dell'utensile per determinare la fattibilità della tasca. -- 2022/11/15 DS Con lama massima inclinazione 60deg. -- 2022/12/01 Per 2 facce con angolo > 90° implementata lavorazione principale verticale. Se da sopra, aggiunta ripresa del lato inclinato. +-- 2022/12/14 Nel caso di 2 facce piccola correzione al modo di ordinare le facce. -- Tabella per definizione modulo local WPL = {} @@ -2233,7 +2234,8 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) -- se equivalente ad un contorno if abs( ptP1:getZ() - ptP2:getZ()) > 0.9 * b3Raw:getDimZ() then -- verifico ordinamento (esterno a destra) - if ( vtN[1] ^ ( ptP1 - ptC[1])) * Z_AX() < 0 then + local ptPM = ( ptP1 + ptP2) / 2 + if ( vtN[1] ^ ( ptPM - ptC[1])) * Z_AX() < 0 then EgtSurfTmSwapFacets( Proc.Id, 0, 1) end -- applico lavorazione di contorno libero