diff --git a/LuaLibs/WMachiningLib.lua b/LuaLibs/WMachiningLib.lua index 159d96a..34d0eac 100644 --- a/LuaLibs/WMachiningLib.lua +++ b/LuaLibs/WMachiningLib.lua @@ -1,4 +1,4 @@ --- MachiningLib.lua by Egaltech s.r.l. 2021/11/09 +-- MachiningLib.lua by Egaltech s.r.l. 2022/01/12 -- Libreria ricerca lavorazioni per Pareti -- Tabella per definizione modulo @@ -51,7 +51,7 @@ function WMachiningLib.FindCutting( sType, dDepth, nTool_ID) end --------------------------------------------------------------------- -function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, dMaxMat) +function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, dMaxMat, bTipFeed) for i = 1, #Millings do local Milling = Millings[i] if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then @@ -60,12 +60,14 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, d local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, dTMaxMat, EgtTdbGetCurrToolMaxDepth()) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dTTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED) local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i') if nMchType == MCH_MY.MILLING and ( not sTuuid or sTuuid == sMyTuuid) and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and ( not dMaxMat or dTMaxMat < dMaxMat + GEO.EPS_SMALL) and + ( not bTipFeed or dTTipFeed > 1) and ( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then return Milling.Name, dTMaxDepth, dTMaxMat, dTDiam end diff --git a/LuaLibs/WProcessDrill.lua b/LuaLibs/WProcessDrill.lua index f568ef2..f580361 100644 --- a/LuaLibs/WProcessDrill.lua +++ b/LuaLibs/WProcessDrill.lua @@ -1,7 +1,8 @@ --- WProcessDrill.lua by Egaltech s.r.l. 2021/12/04 +-- WProcessDrill.lua by Egaltech s.r.l. 2022/01/12 -- Gestione calcolo forature per Pareti -- 2021/08/29 DS Se foratura di fianco setto flag per farla dopo i tagli. -- 2021/12/04 DS Modifiche per forature speciali lungo Y. +-- 2022/01/12 DS Se con fresatura richiedo che l'utensile possa lavorare di testa. -- Tabella per definizione modulo local WPD = {} @@ -281,7 +282,7 @@ function WPD.Make( Proc, nRawId, b3Raw) if sDrilling then sHead = '' end end else - sDrilling = WM.FindMilling( 'FreeContour', dLen) + sDrilling = WM.FindMilling( 'FreeContour', dLen, nil, nil, nil, nil, true) nType = 'Mill' end if not sDrilling then diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index da65f8a..975b1aa 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1,7 +1,8 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2021/12/10 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2022/01/12 -- Gestione calcolo profilo libero per Pareti -- 2021/11/15 Penna e chiodature sono sempre riportate sulla faccia sopra anche se nel progetto sono sotto. -- 2021/12/10 In taglio con lama aggiunta gestione SCC per testa Gearbox. +-- 2022/01/12 Aggiunta gestione massimo affondamento in Z anche per pulizia spigoli con fresa 60deg (WD.MAX_CLEAN_CRN60). -- Tabella per definizione modulo local WPF = {} @@ -15,6 +16,7 @@ EgtOutLog( ' WProcessFreeContour started', 1) -- Dati local WD = require( 'WallData') local WM = require( 'WMachiningLib') +if not WD.MAX_CLEAN_CRN60 then WD.MAX_CLEAN_CRN60 = 150 end local WHISK_OFFS = 0.1 local WHISK_SAFE = 5 local MIN_LEN_CUT = 250 @@ -1189,7 +1191,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd EgtSetInfo( nMchId, 'Part', Proc.PartId) -- calcolo l'affondamento local dDepth = vFace[i].Width + WD.CUT_EXTRA - dThick = dDepth + dThick = vFace[i].Width local vtNz = vFace[i].Norm:getZ() if vtNz < 0 then dDepth = dDepth - dMillDiam * abs( vtNz) / sqrt( 1 - vtNz * vtNz) @@ -1247,7 +1249,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd EgtSetInfo( nMchId, 'Part', Proc.PartId) -- calcolo l'affondamento local dDepth = vFace[i].Width + WD.CUT_EXTRA - dThick = dDepth + dThick = vFace[i].Width local vtNz = vFace[i].Norm:getZ() if vtNz < 0 then dDepth = dDepth - dMillDiam * abs( vtNz) / sqrt( 1 - vtNz * vtNz) @@ -1413,7 +1415,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd EgtSetInfo( nMchId, 'Part', Proc.PartId) -- calcolo l'affondamento local dDepth = vFace[i].Width + WD.CUT_EXTRA - dThick = dDepth + dThick = vFace[i].Width local vtNz = vFace[i].Norm:getZ() if vtNz < 0 then dDepth = dDepth - dMillDiam * abs( vtNz) / sqrt( 1 - vtNz * vtNz) @@ -1466,6 +1468,7 @@ end local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw) -- flag per tagli non passanti local bNotThrou + local dThick -- recupero i dati dell'utensile local dSawDiam = 0 local dMaxDepth = 0 @@ -1498,7 +1501,8 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw) EgtSetInfo( nMchId, 'Part', Proc.PartId) -- calcolo l'affondamento local dDepth = vFace[i].Width + WD.CUT_EXTRA - -- se affondamento superiore ai limiti della fresa + dThick = vFace[i].Width + -- se affondamento superiore ai limiti della sega a catena if dDepth > dMaxDepth then dDepth = dMaxDepth bNotThrou = true @@ -1546,7 +1550,8 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw) EgtSetInfo( nMchId, 'Part', Proc.PartId) -- calcolo l'affondamento local dDepth = vFace[i].Width + WD.CUT_EXTRA - -- se affondamento superiore ai limiti della fresa + dThick = vFace[i].Width + -- se affondamento superiore ai limiti della sega a catena if dDepth > dMaxDepth then dDepth = dMaxDepth bNotThrou = true @@ -1587,9 +1592,9 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw) end -- se fresature non sono passanti if bNotThrou then - return 2, dSawThick + return 2, dSawThick, dThick end - return 1, dSawThick + return 1, dSawThick, dThick end --------------------------------------------------------------------- @@ -1761,9 +1766,9 @@ local function MakeByCut( Proc, nRawId, b3Raw) -- recupero la lavorazione con sega a catena local sSawing = WM.FindSawing( 'Sawing') -- recupero la lavorazione di fresatura - local sMilling, dMillMaxDepth = WM.FindMilling( 'FreeContour', dMaxWidth + WD.CUT_EXTRA) + local sMilling, dMillMaxDepth = WM.FindMilling( 'FreeContour', dMaxWidth + WD.CUT_EXTRA, nil, nil, nil, nil, true) if not sMilling and ( not sSawing or bSlanting) then - sMilling = WM.FindMilling( 'FreeContour') + sMilling = WM.FindMilling( 'FreeContour', nil, nil, nil, nil, nil, true) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -1776,9 +1781,10 @@ local function MakeByCut( Proc, nRawId, b3Raw) if nMlOk == 0 then return false, sMlErr end -- se ci sono almeno due facce if Proc.Fct >= 2 then - -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante + -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante e spessore sotto il limite -- 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 + if ( nConeCut == 1 and nMlOk == 1 and dThick <= ( WD.MAX_CLEAN_CRN60 + 20 * GEO.EPS_SMALL)) 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) @@ -1786,8 +1792,14 @@ local function MakeByCut( Proc, nRawId, b3Raw) else -- messaggi nel log if nConeCut == 1 then - local sErr = 'Clean corner 60° not applid because Milling not thru the thickness' - EgtOutLog( sErr) + if nMlOk ~= 1 then + local sErr = 'Clean corner 60° not applid because Milling not thru the thickness' + EgtOutLog( sErr) + else + local sErr = 'Clean corner 60° not applid because thickness: ' .. EgtNumToString( dThick, 2) .. + ' is bigger than parameter MAX_CLEAN_CRN60: ' .. EgtNumToString( WD.MAX_CLEAN_CRN60 , 2) + EgtOutLog( sErr) + end 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) @@ -1797,20 +1809,26 @@ local function MakeByCut( Proc, nRawId, b3Raw) end -- altrimenti provo con la sega a catena else - local nCsOk, sCSErr = AddSawings( sSawing, vFace, Proc, nRawId, b3Raw) + local nCsOk, sCSErr, dThick = AddSawings( sSawing, vFace, Proc, nRawId, b3Raw) if nCsOk == 0 then return false, sCsErr end -- 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 + -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante e spessore sotto il limite + if nConeCut == 1 and nCsOk == 1 and dThick <= ( WD.MAX_CLEAN_CRN60 + 20 * GEO.EPS_SMALL) 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) + if nCsOk ~= 1 then + local sErr = 'Clean corner 60° not applied because Chainsawing not thru the thickness' + EgtOutLog( sErr) + else + local sErr = 'Clean corner 60° not applid because thickness: ' .. EgtNumToString( dThick, 2) .. + ' is bigger than parameter MAX_CLEAN_CRN60: ' .. EgtNumToString( WD.MAX_CLEAN_CRN60 , 2) + EgtOutLog( sErr) + end elseif nConeCut == 2 then local sErr = 'Not possible apply Clean corner 30° after use sawing' EgtOutLog( sErr) @@ -1846,7 +1864,7 @@ local function MakeByMill( Proc, nRawId, b3Raw) local bToolInv = ( vtExtr:getZ() < -0.1) local nTool_ID = EgtGetInfo( Proc.Id, 'CNT_DATA', 'i') -- recupero la lavorazione - local sMilling = WM.FindMilling( 'FreeContour', nil, nil, nTool_ID) + local sMilling = WM.FindMilling( 'FreeContour', nil, nil, nTool_ID, nil, nil, true) if not sMilling then local sErr = 'Error : milling not found in library' if nTool_ID then sErr = sErr .. ' (Tool_ID=' .. tostring( nTool_ID) .. ')' end @@ -2086,10 +2104,8 @@ local function MakeByPocket( Proc, nRawId, b3Raw) -- recupero i dati della curva e del profilo local dDepth = EgtIf( bPocketBotface, 0, abs( EgtCurveThickness( AuxId))) local dOriDepth = dDepth - local nFacet - local dDiam - local dElev -- cerco la faccia di fondo della superfice (deve avere direzione circa quella di estrusione della curva) + local nFacet for i = 1, Proc.Fct do local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT) if abs( vtN * vtExtr) > 0.99 then @@ -2102,8 +2118,8 @@ local function MakeByPocket( Proc, nRawId, b3Raw) end -- dati della faccia di fondo local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) - dDiam = min( dH, dV) - dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId) + local dDiam = min( dH, dV) + local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId) -- gruppo ausiliario local nAddGrpId = WL.GetAddGroup( Proc.PartId) local nNewProc, nNumFacet = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet) @@ -2210,17 +2226,22 @@ local function MakeByPocket( Proc, nRawId, b3Raw) vFace, dMaxWidth, nNewProc = GetFacesData( Proc, bOpposite, false, dMillDiam, dMaxDepth, (dMillDiam/2), nAddGrpId, b3Raw, 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 + -- se abilitata la lavorazione corner con stop macchina e affondamento non superiore al limite + local dDepthMach = EgtIf( bPocketBotface, dDepth, ( dDepth - dOriDepth)) + if nConeCut == 1 and dDepthMach <= ( WD.MAX_CLEAN_CRN60 + 20 * GEO.EPS_SMALL) then local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, - dMillDiam, nAddGrpId, nil, nNewProc, EgtIf( bPocketBotface, dDepth, ( dDepth - dOriDepth))) + dMillDiam, nAddGrpId, nil, nNewProc, dDepthMach) 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) + if nConeCut == 1 then + local sErr = 'Clean corner 60° not applid because thickness: ' .. EgtNumToString( dThick, 2) .. + ' is bigger than parameter MAX_CLEAN_CRN60: ' .. EgtNumToString( WD.MAX_CLEAN_CRN60 , 2) + EgtOutLog( sErr) + elseif nConeCut == 2 then + local sErr = 'Clean corner 30° is not applied on pocketing' + EgtOutLog( sErr) + end end end return true, sWarn diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index e54e464..cabf977 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -68,7 +68,7 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr -- Calcolo posizione estremo di riferimento della tavola rispetto a sua origine in BL local OrigOnTab local nCorner - local sOrigCorner = WD.ORIG_CORNER + local sOrigCorner = WD.ORIG_CORNER or 'BR' if WD.GetOrigCorner then sOrigCorner = WD.GetOrigCorner( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'REFPOS', 'i') or 1) end