From 3ca0ab1692ebc951f8a0f74c3fe66e1832efab8a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 7 Jul 2023 18:07:11 +0200 Subject: [PATCH] - altri piccoli miglioramenti legati al riconoscimento topologia --- LuaLibs/WFeatureTopology.lua | 21 ++++++++++++------ LuaLibs/WallExec.lua | 2 +- LuaLibs/WallLib.lua | 42 ++++++++++++++++++++---------------- 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/LuaLibs/WFeatureTopology.lua b/LuaLibs/WFeatureTopology.lua index 2d8dad1..0ae9bd1 100644 --- a/LuaLibs/WFeatureTopology.lua +++ b/LuaLibs/WFeatureTopology.lua @@ -61,7 +61,7 @@ local function AreAllAnglesConcaveOrRight( Proc) bAllConcave = false bAllRight = false break - elseif vAdj[i][j] and vAdj[i][j] ~= 0 and vAdj[i][j] + 90 > GEO.EPS_SMALL then + elseif vAdj[i][j] and vAdj[i][j] ~= 0 and vAdj[i][j] + 90 > 500 * GEO.EPS_ANG_SMALL then bAllRight = false end end @@ -77,7 +77,8 @@ end --------------------------------------------------------------------- local function IsAnyDimensionLongAsPart( Proc) local bResult = false - local b3Solid = EgtGetBBoxGlob( Proc.PartId, GDB_BB.STANDARD) + local nBoxSolidId = EgtGetFirstNameInGroup( Proc.PartId or GDB_ID.NULL, 'Box') + local b3Solid = EgtGetBBoxGlob( nBoxSolidId, GDB_BB.STANDARD) if Proc.Box:getDimX() > b3Solid:getDimX() - 1000 * GEO.EPS_SMALL or Proc.Box:getDimY() > b3Solid:getDimY() - 1000 * GEO.EPS_SMALL or Proc.Box:getDimZ() > b3Solid:getDimZ() - 1000 * GEO.EPS_SMALL then @@ -168,6 +169,8 @@ function WFeatureTopology.Classify( Proc) if Proc.IsOutline then sFamily = 'OUTLINE' + elseif Proc.Prc == 40 then + sFamily = 'DRILLING' elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart then sFamily = 'Bevel' bIsThrough = true @@ -189,23 +192,29 @@ function WFeatureTopology.Classify( Proc) elseif Proc.Fct == 3 and bAllAnglesConcave and #vFacesWithTwoAdj == 3 then sFamily = 'Groove' bIsThrough = false - elseif Proc.Fct == 4 and #vFacesWithThreeAdj == 2 then + elseif Proc.Fct == 4 and bAllAnglesConcave and #vFacesWithThreeAdj == 2 then sFamily = 'Groove' bIsThrough = false - elseif Proc.Fct == 4 and #vFacesWithTwoAdj == 4 and bIsAnyDimensionLongAsPart then + elseif Proc.Fct == 4 and bAllAnglesConcave and #vFacesWithTwoAdj == 4 and bIsAnyDimensionLongAsPart then sFamily = 'Tunnel' bIsThrough = true - elseif Proc.Fct == 5 and #vFacesWithFourAdj == 1 then + elseif Proc.Fct == 5 and bAllAnglesConcave and #vFacesWithFourAdj == 1 then sFamily = 'Tunnel' bIsThrough = false end local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily) bIsParallel = ( #vFacesParallelToPart == Proc.Fct) - if sFamily then + if sFamily == 'OUTLINE' or sFamily == 'DRILLING' then + Proc.Topology = sFamily + Proc.TopologyLongName = sFamily + elseif sFamily then sLongName = GetTopologyLongName( sFamily, bIsThrough, bAllRightAngles, bIsParallel, Proc.Fct) Proc.Topology, Proc.IsThrough, Proc.AllRightAngles, Proc.IsParallel, Proc.TopologyLongName = sFamily, bIsThrough, bAllRightAngles, bIsParallel, sLongName bRecognized = true + else + Proc.Topology = 'OTHER' + Proc.TopologyLongName = 'OTHER' end return bRecognized diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index d947d7f..427674e 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -194,7 +194,7 @@ function WallExec.CollectFeatures( PartId, b3Raw) Proc.IsOutline = ( Proc.Prc == 251 or Proc.Prc == 252) -- recupero l'elenco delle facce della parte interessate dalla feature - Proc.AffectedFaces = WL.GetProcessAffectedFaces( Proc, PartId) + Proc.AffectedFaces = WL.GetProcessAffectedFaces( Proc) -- recupero informazioni sulle facce della feature Proc.Face = {} diff --git a/LuaLibs/WallLib.lua b/LuaLibs/WallLib.lua index e456e33..f6945db 100644 --- a/LuaLibs/WallLib.lua +++ b/LuaLibs/WallLib.lua @@ -402,27 +402,31 @@ end ------------------------------------------------------------------------------------------------------------- -- restituisce le facce del grezzo interessate dalla feature Proc -function WallLib.GetProcessAffectedFaces( Proc, nPartId) - local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD) +function WallLib.GetProcessAffectedFaces( Proc) + local nBoxSolidId = EgtGetFirstNameInGroup( Proc.PartId or GDB_ID.NULL, 'Box') + local b3Part = EgtGetBBoxGlob( nBoxSolidId, GDB_BB.STANDARD) local vtFacesAffected = { Bottom = false, Back = false, Top = false, Front = false, Left = false, Right = false} - if Proc.Box:getMin():getZ() < b3Part:getMin():getZ() + 10 * GEO.EPS_SMALL then - vtFacesAffected.Bottom = true - end - if Proc.Box:getMax():getY() > b3Part:getMax():getY() - 10 * GEO.EPS_SMALL then - vtFacesAffected.Back = true - end - if Proc.Box:getMax():getZ() > b3Part:getMax():getZ() - 10 * GEO.EPS_SMALL then - vtFacesAffected.Top = true - end - if Proc.Box:getMin():getY() < b3Part:getMin():getY() + 10 * GEO.EPS_SMALL then - vtFacesAffected.Front = true - end - if Proc.Box:getMin():getX() < b3Part:getMin():getX() + 10 * GEO.EPS_SMALL then - vtFacesAffected.Left = true - end - if Proc.Box:getMax():getX() > b3Part:getMax():getX() - 10 * GEO.EPS_SMALL then - vtFacesAffected.Right = true + if Proc.Box and not Proc.Box:isEmpty() then + if Proc.Box:getMin():getZ() < b3Part:getMin():getZ() + 10 * GEO.EPS_SMALL then + vtFacesAffected.Bottom = true + end + if Proc.Box:getMax():getY() > b3Part:getMax():getY() - 10 * GEO.EPS_SMALL then + vtFacesAffected.Back = true + end + if Proc.Box:getMax():getZ() > b3Part:getMax():getZ() - 10 * GEO.EPS_SMALL then + vtFacesAffected.Top = true + end + if Proc.Box:getMin():getY() < b3Part:getMin():getY() + 10 * GEO.EPS_SMALL then + vtFacesAffected.Front = true + end + if Proc.Box:getMin():getX() < b3Part:getMin():getX() + 10 * GEO.EPS_SMALL then + vtFacesAffected.Left = true + end + if Proc.Box:getMax():getX() > b3Part:getMax():getX() - 10 * GEO.EPS_SMALL then + vtFacesAffected.Right = true + end end + return vtFacesAffected end