- altri piccoli miglioramenti legati al riconoscimento topologia

This commit is contained in:
luca.mazzoleni
2023-07-07 18:07:11 +02:00
parent 51e1425921
commit 3ca0ab1692
3 changed files with 39 additions and 26 deletions
+15 -6
View File
@@ -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
+1 -1
View File
@@ -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 = {}
+23 -19
View File
@@ -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