diff --git a/BatchProcess.lua b/BatchProcess.lua index f77fdff..c80541d 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -1,4 +1,4 @@ --- BatchProcess.lua by Egaltech s.r.l. 2022/02/24 +-- BatchProcess.lua by Egaltech s.r.l. 2022/04/28 -- Gestione calcolo batch disposizione e lavorazioni per Pareti -- 2020/07/24 Nuvola di punti riferita allo Zero Tavola. -- 2020/10/28 Corretto spostamento pezzi per rotazioni (0 o 180) e inversioni( 0, 90, 180, o 270). @@ -10,7 +10,7 @@ -- 2021/07/28 Aggiunta scelta direzione di vista per modifica e simulazione. -- 2021/10/27 Nel controllo spessore si deve considerare anche PosY. -- 2022/02/24 Se ricalcolo si aggiorna il setup. In ogni caso si verifica prima di simulazione. - +-- 2022/04/28 In info generazione aggiunta indicazione se 64bit. -- Intestazioni require( 'EgtBase') @@ -554,10 +554,11 @@ end -- *** Genero programma CN *** ( se richiesto) if WALL.FLAG == 0 or WALL.FLAG == 4 then EgtOutLog( ' +++ Generating NC part program >>>') - local sInfo = 'EgtCAM5 - ' + local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '') if EgtGetExeVersion then - sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - ' + sInfo = sInfo .. ' ver.' .. EgtGetExeVersion() end + sInfo = sInfo .. ' - ' if not EgtGenerate( '', sInfo .. sNgeFile) then WALL.ERR = 20 local _, sName, _ = EgtSplitPath( WALL.FILE) diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index ae9a6f5..5c49274 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -1,11 +1,11 @@ --- BatchProcess.lua by Egaltech s.r.l. 2022/01/20 +-- BatchProcess.lua by Egaltech s.r.l. 2022/04/28 -- Gestione calcolo batch disposizione e lavorazioni per Pareti -- 2021/01/15 Per nuova interfaccia Egt. -- 2021/11/10 Aggiunta modifica per gestione modifiche manuali come in Beam. -- 2022/01/06 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo. -- 2022/01/17 Eliminata assegnazione Feature ok se non calcolata. -- 2022/01/20 Si aggiorna il setup anche quando si creano le lavorazioni (MachGroup vecchio...). - +-- 2022/04/28 In info generazione aggiunta indicazione se 64bit. -- Intestazioni require( 'EgtBase') @@ -608,10 +608,11 @@ end -- *** Genero programma CN *** ( se richiesto) if WALL.FLAG == 0 or WALL.FLAG == 4 then EgtOutLog( ' +++ Generating NC part program >>>') - local sInfo = 'EgtCAM5 - ' + local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '') if EgtGetExeVersion then - sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - ' + sInfo = sInfo .. ' ver.' .. EgtGetExeVersion() end + sInfo = sInfo .. ' - ' if not EgtGenerate( '', sInfo .. sNgeFile) then WALL.ERR = 20 local _, sName, _ = EgtSplitPath( WALL.FILE) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 30e3e46..06cc7fc 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1,4 +1,4 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2022/04/04 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2022/04/26 -- 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. @@ -9,6 +9,7 @@ -- 2022/03/16 Ulteriore modifica per riconoscimento lato esterno (aggiunto uso vExtr a GetFacesExternalSide). -- 2022/04/03 Correzioni e modifiche per pulitura spigoli tipo 2 e 3. -- 2022/04/19 Aggiunta passibilita' fresatura ad affondamento ridotto quando non possibile completa o sega a catena. +-- 2022/04/26 Migliorata gestione caso pocketing. -- Tabella per definizione modulo local WPF = {} @@ -54,15 +55,25 @@ function WPF.Classify( Proc, b3Raw) local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') if not AuxId then return false end AuxId = AuxId + Proc.Id - local vtN = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) + local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) -- recupero il tipo di lavorazione local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0 -- se tasca if bPocket then - local bDown = ( vtN:getZ() < - 0.5) + -- 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 = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT) + if abs( vtN * vtExtr) > 0.99 then + nFacet = i - 1 + vtExtr = vtN + break + end + end + local bDown = ( vtExtr:getZ() < - 0.5) return not bDown -- se altrimenti profilo orizzontale - elseif abs( vtN:getZ()) < 0.5 then + elseif abs( vtExtr:getZ()) < 0.5 then return false -- se penna o chiodatura va sempre bene (vengono sempre riportati sopra) elseif nCntType == 10 or nCntType == 20 then @@ -525,6 +536,7 @@ local function GetTunnelDimension( nId, nPartId, nAddGrpId) -- ottengo i versori delle 4 facce e ottengo l'orientamento del tunnel -- recupero il numero di facce local nFacCnt = EgtSurfTmFacetCount( nId) + if nFacCnt < 2 then return end -- recupero l'ingombro della trave local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) -- variabili dimensioni fessura e id faccia lunga @@ -535,14 +547,14 @@ local function GetTunnelDimension( nId, nPartId, nAddGrpId) local bOppoFace = false -- ottengo il versore ortogonale local ptN1, vtN1 = EgtSurfTmFacetCenter( nId, 0, GDB_ID.ROOT) - local _, vtN2 = EgtSurfTmFacetCenter( nId, 1, GDB_ID.ROOT) + local vtN2 = EgtSurfTmFacetNormVersor( nId, 1, GDB_ID.ROOT) local vtOrtho = vtN1 ^ vtN2 if vtOrtho:isSmall() then - _, vtN2 = EgtSurfTmFacetCenter( nId, 2, GDB_ID.ROOT) + vtN2 = EgtSurfTmFacetNormVersor( nId, 2, GDB_ID.ROOT) or V_NULL() vtOrtho = vtN1 ^ vtN2 bOppoFace = true end - vtOrtho:normalize() + if not vtOrtho:normalize() then return end if vtOrtho:getZ() < -0.5 then vtOrtho = -vtOrtho bNegFace = true @@ -2293,13 +2305,10 @@ local function MakeByPocket( Proc, nRawId, b3Raw) if not EgtCurveIsClosed( AuxId) then bPocketBotface = true end - -- recupero i dati della curva e del profilo - local dDepth = EgtIf( bPocketBotface, 0, abs( EgtCurveThickness( AuxId))) - local dOriDepth = dDepth -- 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) + local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT) if abs( vtN * vtExtr) > 0.99 then nFacet = i - 1 break @@ -2308,6 +2317,17 @@ local function MakeByPocket( Proc, nRawId, b3Raw) if not nFacet then return MakeByCut( Proc, nRawId, b3Raw) end + -- se la faccia di fondo ha confini aperti, devo lavorarla direttamente + vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1] or {} + for i = 1, #vAdj do + if vAdj[i] == - 1 then + bPocketBotface = true + break + end + end + -- recupero i dati della curva e del profilo + local dDepth = EgtIf( bPocketBotface, 0, abs( EgtCurveThickness( AuxId))) + local dOriDepth = dDepth -- dati della faccia di fondo local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) local dDiam = min( dH, dV) @@ -2317,7 +2337,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw) local nNewProc, nNumFacet = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet) -- se ho forma a L local bIsL = ( nNumFacet == 2 or TestElleShape3( nNewProc, nNumFacet) or TestElleShape4( nNewProc, nNumFacet) == 2) - -- verifico se U + -- verifico se U local bIsU = ( nNumFacet == 3 and not TestElleShape3( nNewProc, nNumFacet)) local dMiddleFacetLength = 0 if bIsU then @@ -2416,8 +2436,8 @@ 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 ci sono almeno due facce - if Proc.Fct >= 2 then + -- se ci sono almeno due facce più quella di fondo + if Proc.Fct >= 3 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