From abe712151f2750409d05c0315fd4c0649b9a84ad Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 7 Jul 2021 18:12:14 +0200 Subject: [PATCH] DataWall : - correzioni per pulizia spigoli. --- LuaLibs/WProcessFreeContour.lua | 103 +++++++++++++++++++------------- 1 file changed, 60 insertions(+), 43 deletions(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 72cd3e8..c80c33f 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1,4 +1,4 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2021/06/30 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/07/07 -- Gestione calcolo profilo libero per Pareti -- Tabella per definizione modulo @@ -244,9 +244,17 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa local nFac = EgtIf( bOpposite, nNumFacet - i, i - 1) local nPrecFac if bOpposite then - nPrecFac = EgtIf( i == 1, 0, nFac + 1) + if nNumFacet > 2 then + nPrecFac = EgtIf( i == 1, 0, nFac + 1) + else + nPrecFac = EgtIf( i == 1, -1, nFac + 1) + end else - nPrecFac = EgtIf( i == 1, nNumFacet - 1, i - 2) + if nNumFacet > 2 then + nPrecFac = EgtIf( i == 1, nNumFacet - 1, i - 2) + else + nPrecFac = EgtIf( i == 1, - 1, i - 2) + end end -- recupero centro e normale della faccia local ptCen, vtN = EgtSurfTmFacetCenter( nNewProc, nFac, GDB_ID.ROOT) @@ -1679,41 +1687,47 @@ local function MakeByCut( Proc, nRawId, b3Raw) if sMilling then local nMlOk, sMlErr, dThick = AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAddGrpId) if nMlOk == 0 then return false, sMlErr end - -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante - -- o con fresa cono piccola e spessore sotto il limite - if ( nConeCut == 1 and nMlOk == 1) or ( nConeCut == 2 and dThick <= ( WD.MAX_CLEAN_CRN30 + 20 * GEO.EPS_SMALL)) then - local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, - sMlErr, nAddGrpId, dThick, nNewProc, 0, - true) - if not bMcok then return bMcok, sMcErr end - else - -- messaggi nel log - if nConeCut == 1 then - local sErr = 'Clean corner 60° not applid because Milling not thru the thickness' - EgtOutLog( sErr) - elseif nConeCut == 2 then - local sErr = 'Clean corner 30° not applid because thickness: ' .. EgtNumToString( dThick, 2) .. - ' is bigger than parameter MAX_CLEAN_CRN30: ' .. EgtNumToString( WD.MAX_CLEAN_CRN30 , 2) - EgtOutLog( sErr) + -- se ci sono almeno due facce + if Proc.Fct >= 2 then + -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante + -- o con fresa cono piccola e spessore sotto il limite + if ( nConeCut == 1 and nMlOk == 1) or ( nConeCut == 2 and dThick <= ( WD.MAX_CLEAN_CRN30 + 20 * GEO.EPS_SMALL)) then + local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, + sMlErr, nAddGrpId, dThick, nNewProc, 0, + true) + if not bMcok then return bMcok, sMcErr end + else + -- messaggi nel log + if nConeCut == 1 then + local sErr = 'Clean corner 60° not applid because Milling not thru the thickness' + EgtOutLog( sErr) + elseif nConeCut == 2 then + local sErr = 'Clean corner 30° not applid because thickness: ' .. EgtNumToString( dThick, 2) .. + ' is bigger than parameter MAX_CLEAN_CRN30: ' .. EgtNumToString( WD.MAX_CLEAN_CRN30 , 2) + EgtOutLog( sErr) + end end end -- altrimenti provo con la sega a catena else local nCsOk, sCSErr = AddSawings( sSawing, vFace, Proc, nRawId, b3Raw) if nCsOk == 0 then return false, sCsErr end - -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante - if nConeCut == 1 and nCsOk == 1 then - local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, - sCSErr, nAddGrpId, nil, nNewProc, 0, - true) - if not bMcok then return bMcok, sMcErr end - else - if nConeCut == 1 then - local sErr = 'Clean corner 60° not applied because Sawing not thru the thickness' - EgtOutLog( sErr) - elseif nConeCut == 2 then - local sErr = 'Not possible apply Clean corner 30° after use sawing' - EgtOutLog( sErr) + -- se ci sono almeno due facce + if Proc.Fct >= 2 then + -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante + if nConeCut == 1 and nCsOk == 1 then + local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, + sCSErr, nAddGrpId, nil, nNewProc, 0, + true) + if not bMcok then return bMcok, sMcErr end + else + if nConeCut == 1 then + local sErr = 'Clean corner 60° not applied because Sawing not thru the thickness' + EgtOutLog( sErr) + elseif nConeCut == 2 then + local sErr = 'Not possible apply Clean corner 30° after use sawing' + EgtOutLog( sErr) + end end end end @@ -2026,17 +2040,20 @@ local function MakeByPocket( Proc, nRawId, b3Raw) -- recupero i dati di tutte le facce local vFace, dMaxWidth vFace, dMaxWidth, nNewProc = GetFacesData( Proc, bOpposite, false, dMillDiam, dMaxDepth, (dMillDiam/2), nAddGrpId, b3Raw, nNewProc) - -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante - if nConeCut == 1 then - local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, - dMillDiam, nAddGrpId, nil, nNewProc, EgtIf( bPocketBotface, dDepth, ( dDepth - dOriDepth))) - if not bMcok then return bMcok, sMcErr end - elseif nConeCut == 2 then - local sErr = 'Clean corner 30° is not applied on pocketing' - EgtOutLog( sErr) - EgtErase( nNewProc) - else - EgtErase( nNewProc) + -- se ci sono almeno due facce + if Proc.Fct >= 2 then + -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante + if nConeCut == 1 then + local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, + dMillDiam, nAddGrpId, nil, nNewProc, EgtIf( bPocketBotface, dDepth, ( dDepth - dOriDepth))) + if not bMcok then return bMcok, sMcErr end + elseif nConeCut == 2 then + local sErr = 'Clean corner 30° is not applied on pocketing' + EgtOutLog( sErr) + EgtErase( nNewProc) + else + EgtErase( nNewProc) + end end return true, sWarn end