From 764c80824acfbcde06dd7c728d91bfd42a5cf0e0 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 11 Dec 2023 11:27:54 +0100 Subject: [PATCH 1/3] modifiche a WallExec, WallLib, FeatureTopology per allineamento Topology con Beam --- LuaLibs/WFeatureTopology.lua | 28 +++++++++++++++++++++++----- LuaLibs/WallExec.lua | 8 +++++--- LuaLibs/WallLib.lua | 10 +++++++++- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/LuaLibs/WFeatureTopology.lua b/LuaLibs/WFeatureTopology.lua index 191c868..033756c 100644 --- a/LuaLibs/WFeatureTopology.lua +++ b/LuaLibs/WFeatureTopology.lua @@ -1,5 +1,6 @@ -- WFeatureTopology.lua by Egaltech s.r.l. 2023/06/23 -- Libreria per classificazione topologica feature pareti +-- 2023/12/11 Modifiche varie per allineamento con Beam. -- Tabella per definizione modulo local WFeatureTopology = {} @@ -104,11 +105,11 @@ end --------------------------------------------------------------------- -- restituisce un vettore contenente gli indici delle facce di Proc parallele ad una delle direzioni principali; il check varia in base alla famiglia topologica -local function GetFacesParallelToPart( Proc, sFamily) +local function GetFacesParallelToPart( Proc, sFamily, bIsThrough) local vFacesParallelToPart = {} for i = 0, Proc.Fct - 1 do local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i, GDB_ID.ROOT) - if sFamily == 'Bevel' or sFamily == 'DoubleBevel' then + if sFamily == 'Rabbet' or sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' or sFamily == 'Tunnel' or ( sFamily == 'Groove' and bIsThrough) then local vTriangularFaces = GetTriangularFaces( Proc) local bIsTriangularFace = false -- verifico se la faccia è triangolare @@ -158,7 +159,13 @@ end --------------------------------------------------------------------- -- riconosce se Proc è una delle topologie standard e, in caso positivo, ne scrive le caratteristiche in campi specifici della Proc stessa restituendo true -function WFeatureTopology.Classify( Proc) +function WFeatureTopology.Classify( Proc, b3Raw) + + if not Proc.AffectedFaces then Proc.AffectedFaces = WL.GetProcessAffectedFaces( Proc) end + if not Proc.Box or Proc.Box:isEmpty() then + return false + end + local bRecognized = false local sFamily local bIsThrough @@ -172,23 +179,31 @@ function WFeatureTopology.Classify( Proc) bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( Proc) local vTriangularFaces = GetTriangularFaces( Proc) local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc) + local vFacesWithOneAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 1) local vFacesWithTwoAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 2) local vFacesWithThreeAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 3) local vFacesWithFourAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 4) + local dRawW, dRawH, dRawL = b3Raw:getDimY(), b3Raw:getDimZ(), b3Raw:getDimX() + local bIsFeatureCuttingEntireSection = WL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH, dRawL) if Proc.IsOutline then sFamily = 'OUTLINE' elseif Proc.Prc == 40 then sFamily = 'DRILLING' + elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart and bIsFeatureCuttingEntireSection then + sFamily = 'Cut' elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart then sFamily = 'Bevel' bIsThrough = true elseif Proc.Fct == 2 and bAllAnglesConcave and #vTriangularFaces == 1 then sFamily = 'Bevel' bIsThrough = false - elseif Proc.Fct == 2 and bAllAnglesConcave then + elseif Proc.Fct == 2 and bAllAnglesConcave and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) then sFamily = 'Rabbet' bIsThrough = true + elseif Proc.Fct == 2 and bAllAnglesConcave then + sFamily = 'Groove' + bIsThrough = true elseif Proc.Fct == 2 and not bAllAnglesConcave and bIsAnyDimensionLongAsPart then sFamily = 'DoubleBevel' bIsThrough = true @@ -207,11 +222,14 @@ function WFeatureTopology.Classify( Proc) elseif Proc.Fct == 4 and bAllAnglesConcave and #vFacesWithTwoAdj == 4 and bIsAnyDimensionLongAsPart then sFamily = 'Tunnel' bIsThrough = true + elseif Proc.Fct >= 4 and #vFacesWithOneAdj == 2 and bIsAnyDimensionLongAsPart then + sFamily = 'Strip' + bIsThrough = true elseif Proc.Fct == 5 and bAllAnglesConcave and #vFacesWithFourAdj == 1 then sFamily = 'Pocket' bIsThrough = false end - local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily) + local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily, bIsThrough) bIsParallel = ( #vFacesParallelToPart == Proc.Fct) if sFamily == 'OUTLINE' or sFamily == 'DRILLING' then diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index 4ffabc6..d262e1e 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -7,6 +7,7 @@ -- 2023/10/16 Aggiunta gestione Aree vietate (LockOut) per chiodature. -- 2023/11/14 Modifiche sostanziali per l'aggiunta delle lavorazioni in doppio. -- In Collect aggiunto il recupero preliminare di varie informazioni sulla feature. +-- 2023/12/11 In ClassifyTopology si passa ora anche l'Id del grezzo (allineamento Topology con Beam). -- Tabella per definizione modulo local WallExec = {} @@ -309,11 +310,12 @@ local function ClassifyFeatures( vProc, b3Raw) end ------------------------------------------------------------------------------------------------------------- -local function ClassifyTopology( vProc) +local function ClassifyTopology( vProc, nRawId) + local b3Raw = EgtGetRawPartBBox( nRawId) local nRecognized = 0 for i = 1, #vProc do local Proc = vProc[i] - if Topology.Classify( Proc) then + if Topology.Classify( Proc, b3Raw) then nRecognized = nRecognized + 1 end end @@ -1085,7 +1087,7 @@ function WallExec.ProcessFeatures() vProc = EgtJoinTables( vProc, vPartProc) end -- classifico topologicamente le feature - ClassifyTopology( vProc) + ClassifyTopology( vProc, nRawId) -- classifico le feature ClassifyFeatures( vProc, b3Raw) -- recupero l'elenco delle aree vietate alle chiodature diff --git a/LuaLibs/WallLib.lua b/LuaLibs/WallLib.lua index 485adaa..3796cb8 100644 --- a/LuaLibs/WallLib.lua +++ b/LuaLibs/WallLib.lua @@ -2,6 +2,7 @@ -- Libreria globale per Pareti -- 2023/06/26 Spostata qui Is3EdgesApprox da FreeContour. Ora cerca autonomamente il gruppo se non viene passato. -- 2023/11/14 Aggiunte funzioni GetProcessAffectedFaces, GetProcessDistanceToNearestParts, GetProcessDistanceToRawPart. +-- 2023/12/11 Aggiunta funzione IsFeatureCuttingEntireSection (allineamento Topology con Beam). -- Tabella per definizione modulo local WallLib = {} @@ -534,7 +535,7 @@ function WallLib.GetNailLockOutAreas( vProc) if AuxId then AuxId = AuxId + vProc[i].Id end if AuxId then local nAddGrpId = WallLib.GetAddGroup( vProc[i].PartId) - local nSfrId = EgtSurfFlatRegion( nAddGrpId, {AuxId}) + local nSfrId = EgtSurfFlatRegion( nAddGrpId, {AuxId}) if nSfrId then table.insert( vNLO, nSfrId) end @@ -544,5 +545,12 @@ function WallLib.GetNailLockOutAreas( vProc) return vNLO end + +------------------------------------------------------------------------------------------------------------- +-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della parete, rappresentata dalle sue dimensioni W, H e L +function WallLib.IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH, dRawL) + return ( ( ( abs( b3Proc:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or b3Proc:getDimY() > dRawW) or ( abs( b3Proc:getDimX() - dRawL) < 10 * GEO.EPS_SMALL or b3Proc:getDimX() > dRawL)) and (abs(b3Proc:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or b3Proc:getDimZ() > dRawH)) +end + ------------------------------------------------------------------------------------------------------------- return WallLib From 89838c6f28bd77f85bda2878cd810e22a39b2ba3 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 13 Dec 2023 16:57:30 +0100 Subject: [PATCH 2/3] =?UTF-8?q?-In=20FreeContour=20->=20MakeByPocket=20agg?= =?UTF-8?q?iunta=20la=20possibilit=C3=A0=20di=20svuotare=20tasche=20passan?= =?UTF-8?q?ti=20-In=20FreeContour=20->=20MakeByPocket=20in=20tasche=20spec?= =?UTF-8?q?iali=20cliente=2090480029=20forzato=20step=20unico?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/WProcessFreeContour.lua | 72 ++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 9a0ebbb..f49eb8e 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -27,6 +27,7 @@ -- 2023/10/02 Correzione a MakeCustomPath per calcolare correttamente puliture spigoli di tipo 2 (Clean 30) e 3 (Gola di Scarico). -- 2023/11/14 Spostamento di alcune funzioni in WallLib. -- Aggiunta dei FreeContour in doppio. +-- 2023/12/13 In MakeByPocket aggiunta la possibilità di svuotare tasche passanti. -- Tabella per definizione modulo local WPF = {} @@ -2100,7 +2101,7 @@ local function MakeByMill( Proc, nRawId, b3Raw) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) end - -- se lamatura affondata speciale, setto attacco e stacco al centro + -- se lamatura affondata speciale (cliente 90480029), setto attacco e stacco al centro local bIsRecessedCounterBore = ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() + 10 * GEO.EPS_SMALL) and ( nTool_ID == WD.RECESSED_COUNTERBORE_TOOLID or 0) and ( EgtCurveIsACircle( AuxId)) @@ -2120,12 +2121,16 @@ local function MakeByMill( Proc, nRawId, b3Raw) EgtSetMachiningParam( MCH_MP.LOELEV, 0) -- imposto step local dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or 0 - local dStep = EgtGetMachiningParam( MCH_MP.STEP) - if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end - local nStep = ceil( ( dDepth - dMaxMat) / dStep) - dStep = max( ( dDepth - dMaxMat) / max( nStep, 1), 0) - local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0) - EgtSetMachiningParam( MCH_MP.STEP, dStep) + -- + -- su richiesta del cliente 90480029 si usa sempre step unico a prescindere dalla geometria + -- +-- local dStep = EgtGetMachiningParam( MCH_MP.STEP) +-- if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end +-- local nStep = ceil( ( dDepth - dMaxMat) / dStep) +-- dStep = max( ( dDepth - dMaxMat) / max( nStep, 1), 0) +-- local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0) + EgtSetMachiningParam( MCH_MP.STEP, dMaxMat) + local dMaxElev = dMaxMat -- imposto elevazione e forzo attacco dal lato aperto EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';OutRaw=3;') end @@ -2350,6 +2355,7 @@ end --------------------------------------------------------------------- local function MakeByPocket( Proc, nRawId, b3Raw) -- recupero e verifico l'entità curva + local nAddGrpId = WL.GetAddGroup( Proc.PartId) local bOpposite = false local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 local vtExtr @@ -2382,11 +2388,48 @@ local function MakeByPocket( Proc, nRawId, b3Raw) break end end + -- se tasca verticale si permette la svuotatura anche se passante, lavorando la faccia di fondo aggiunta + local nProcTmWithAddedBottomSurfaceId + if not nFacet and not bPocketBotface and Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then + local nFirstLoopId, nLoopsCount = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId) + local dMinZ = GEO.INFINITO + local nBottomLoopId = GDB_ID.NULL + for i = 1, nLoopsCount do + local nCurrentLoopId = nFirstLoopId + i - 1 + local b3Loop = EgtGetBBoxGlob( nCurrentLoopId, GDB_BB.STANDARD) + local dCurrentZ = b3Loop:getMin():getZ() + if dCurrentZ < dMinZ then + dMinZ = dCurrentZ + nBottomLoopId = nCurrentLoopId + end + end + local nAddedBottomSurface = EgtSurfTmByFlatContour( nAddGrpId, nBottomLoopId) + local vtNAddedBottomSurface = EgtSurfTmFacetNormVersor( nAddedBottomSurface, 0) + if AreOppositeVectorApprox( vtNAddedBottomSurface, Z_AX()) then EgtInvertSurf( nAddedBottomSurface) end + nProcTmWithAddedBottomSurfaceId = EgtSurfTmBySewing( nAddGrpId, { nAddedBottomSurface, Proc.Id}) + if nProcTmWithAddedBottomSurfaceId then + -- ricerco la faccia di fondo della trimesh (gli id potrebbero essere cambiati) + for i = 1, Proc.Fct do + local vtN = EgtSurfTmFacetNormVersor( nProcTmWithAddedBottomSurfaceId, i-1, GDB_ID.ROOT) + if abs( vtN * vtExtr) > 0.99 then + nFacet = i - 1 + break + end + end + end + -- elimino le geometrie che non servono più + for i = 1, nLoopsCount do + EgtErase( nFirstLoopId + i - 1) + end + EgtErase( nAddedBottomSurface) + end if not nFacet then return MakeByMill( Proc, nRawId, b3Raw) end + -- se ho creato la faccia di fondo utilizzo quella + local nSurfId = nProcTmWithAddedBottomSurfaceId or Proc.Id -- se la faccia di fondo ha confini aperti, devo lavorarla direttamente - local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1] or {} + local vAdj = EgtSurfTmFacetAdjacencies( nSurfId, nFacet)[1] or {} for i = 1, #vAdj do if vAdj[i] == - 1 then bPocketBotface = true @@ -2397,11 +2440,10 @@ local function MakeByPocket( Proc, nRawId, b3Raw) 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 _, dH, dV = EgtSurfTmFacetMinAreaRectangle( nSurfId, nFacet, GDB_ID.ROOT) local dDiam = min( dH, dV) - local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId) + local dElev = WL.GetFaceElevation( nSurfId, nFacet, nRawId) -- gruppo ausiliario - local nAddGrpId = WL.GetAddGroup( Proc.PartId) local nNewProc, nNumFacet = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet) -- se ho forma a L local bIsL = ( nNumFacet == 2 or WL.TestElleShape3( nNewProc, nNumFacet) or WL.TestElleShape4( nNewProc, nNumFacet) == 2) @@ -2440,7 +2482,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw) end end -- inserisco la lavorazione di svuotatura - local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local sName = 'Pock_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) local nMchFId = WM.AddMachining( Proc, sName, sPocketing) if not nMchFId then local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing @@ -2450,7 +2492,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw) EgtSetInfo( nMchFId, 'Part', Proc.PartId) -- aggiungo geometria if bPocketBotface then - EgtSetMachiningGeometry( {{ Proc.Id, nFacet}}) + EgtSetMachiningGeometry( {{ nSurfId, nFacet}}) else EgtSetMachiningGeometry( {{ AuxId, -1}}) end @@ -2483,7 +2525,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw) local bAppOk = EgtApplyMachining( true, false) if not bAppOk and not bPocketBotface then bPocketBotface = true - EgtSetMachiningGeometry( {{ Proc.Id, nFacet}}) + EgtSetMachiningGeometry( {{ nSurfId, nFacet}}) dDepth = 0 local dThElev = dThDiam / 2 * sqrt( vtExtr:getX() * vtExtr:getX() + vtExtr:getY() * vtExtr:getY()) if dElev + dThElev > dMaxDepth + 10 * GEO.EPS_SMALL then @@ -2515,7 +2557,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw) else EgtErase( nNewProc) if nConeCut == 1 then - local sErr = 'Clean corner 60° not applid because thickness: ' .. EgtNumToString( dThick, 2) .. + local sErr = 'Clean corner 60° not applied because thickness: ' .. EgtNumToString( dThick, 2) .. ' is bigger than parameter MAX_CLEAN_CRN60: ' .. EgtNumToString( WD.MAX_CLEAN_CRN60 , 2) EgtOutLog( sErr) elseif nConeCut == 2 then From 07a80248dcf83e78e410f17542f65e1ac7e693c8 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 13 Dec 2023 17:07:52 +0100 Subject: [PATCH 3/3] update log e version --- UpdateLog.txt | 5 +++++ Version.lua | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/UpdateLog.txt b/UpdateLog.txt index aa988f9..2c4b05e 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,10 @@ ==== Wall Update Log ==== +Versione 2.5l1 (13/12/2023) +- Modif : modifiche a WallExec, WallLib, FeatureTopology per allineamento Topology con Beam +- Modif : In FreeContour -> MakeByPocket aggiunta la possibilità di svuotare tasche passanti +- Modif : In FreeContour -> MakeByPocket in tasche speciali cliente 90480029 forzato step unico + Versione 2.5k1 (14/11/2023) - Added : aggiunte lavorazioni in doppio. - Modif : miglioramenti vari alla lavorazione tasche, in particolare in presenza di pezzi vicini. diff --git a/Version.lua b/Version.lua index 96fd52b..dc46022 100644 --- a/Version.lua +++ b/Version.lua @@ -1,6 +1,6 @@ --- Version.lua by Egalware s.r.l. 2023/10/11 +-- Version.lua by Egalware s.r.l. 2023/12/13 -- Gestione della versione di Wall NAME = 'Wall' -VERSION = '2.5k1' +VERSION = '2.5l1' MIN_EXE = '2.5b3'