diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index da8fe19..6bff6b5 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -645,6 +645,8 @@ local function CollectFeatures( Part, dRotIndex) Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part) -- volume feature approssimato Proc.dVolume = FeatureLib.GetFeatureVolume( Proc, Part) + -- se trimesh, numero di parti di cui è composta + Proc.nParts = EgtSurfTmPartCount( Proc.id) or 1 -- calcolo topologia solo se necessario, altrimenti si sfruttano le informazioni della feature BTL local bIsFeatureReadyForProcessing = false if FeatureLib.NeedTopologyFeature( Proc, Part) then diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index 18229e3..4bd64d9 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -91,7 +91,9 @@ function FaceData.GetFacesByAdjacencyNumber( Proc) FacesByAdjacencyNumber[i] = {} end for i = 1, Proc.nFct do - table.insert( FacesByAdjacencyNumber[#Proc.Faces[i].Adjacencies], Proc.Faces[i]) + if #Proc.Faces[i].Adjacencies > 0 then + table.insert( FacesByAdjacencyNumber[#Proc.Faces[i].Adjacencies], Proc.Faces[i]) + end end return FacesByAdjacencyNumber @@ -389,7 +391,21 @@ local function GetBottomFaces( Proc) BottomFaces = FacesByAdjacencyNumber[ Proc.nFct - 1] -- caso speciale DoubleBevel if #BottomFaces == 0 then - BottomFaces = FacesByAdjacencyNumber[ Proc.nFct / 2] + if Proc.nParts == 1 then + BottomFaces = FacesByAdjacencyNumber[ Proc.nFct / 2] + -- DoubleBevel composto da più parti + else + for i = #FacesByAdjacencyNumber, 1, -1 do + if #FacesByAdjacencyNumber[i] > 0 then + BottomFaces = FacesByAdjacencyNumber[i] + break + end + end + -- se non sono state trovate facce di fondo significa che nessuna faccia ha adiacenze -> DoubleBevel-2 + if #BottomFaces == 0 then + BottomFaces = Proc.Faces + end + end end -- si rimuovono le facce non adatte ad essere lavorate local nBottomFaces = #BottomFaces @@ -694,15 +710,21 @@ function FaceData.GetMainFaces( Proc, Part) Proc.Topology.sFamily == 'Pocket' or Proc.Topology.sFamily == 'Tunnel' or Proc.Topology.sFamily == 'Bevel' or Proc.Topology.sFamily == 'DoubleBevel' or Proc.Topology.sFamily == 'Cut' or Proc.Topology.sFamily == 'HeadCut' or Proc.Topology.sFamily == 'TailCut' then - if ( Proc.Topology.bIsThrough and Proc.Topology.bAllRightAngles and Proc.nFct < 5) - or ( Proc.nFct == 1) or Proc.Topology.sName == 'Bevel-2-Blind' then + if Proc.nParts == 1 and ( ( Proc.Topology.bIsThrough and Proc.Topology.bAllRightAngles and Proc.nFct < 5) + or ( Proc.nFct == 1) or Proc.Topology.sName == 'Bevel-2-Blind') then MainFaces.TunnelAddedFaces = GetTunnelFaces( Proc, Part) end MainFaces.BottomFaces = GetBottomFaces( Proc) - MainFaces.LongFaces = GetLongFaces( Proc, MainFaces) - MainFaces.SideFaces = GetSideFaces( Proc, MainFaces) + if Proc.nParts == 1 then + MainFaces.LongFaces = GetLongFaces( Proc, MainFaces) + MainFaces.SideFaces = GetSideFaces( Proc, MainFaces) + -- caso tipo DoubleBevel con facce separate + else + MainFaces.LongFaces = {} + MainFaces.SideFaces = {} + end else MainFaces = nil diff --git a/LuaLibs/FeatureLib.lua b/LuaLibs/FeatureLib.lua index 2fc439b..d083f81 100644 --- a/LuaLibs/FeatureLib.lua +++ b/LuaLibs/FeatureLib.lua @@ -226,13 +226,13 @@ function FeatureLib.ClassifyTopology( Proc, Part) elseif Proc.nFct == 2 and bAllAnglesConcave and #vTriangularFaces == 1 then sFamily = 'Bevel' bIsThrough = false - elseif Proc.nFct == 2 and bAllAnglesConcave and ( Proc.AffectedFaces.bLeft or Proc.AffectedFaces.bRight) and ( Proc.AffectedFaces.bFront or Proc.AffectedFaces.bBack) then + elseif Proc.nFct == 2 and bAllAnglesConcave and Proc.nParts == 1 and ( Proc.AffectedFaces.bLeft or Proc.AffectedFaces.bRight) and ( Proc.AffectedFaces.bFront or Proc.AffectedFaces.bBack) then sFamily = 'Rabbet' bIsThrough = true - elseif Proc.nFct == 2 and bAllAnglesConcave then + elseif Proc.nFct == 2 and bAllAnglesConcave and Proc.nParts == 1 then sFamily = 'VGroove' bIsThrough = true - elseif Proc.nFct == 2 and not bAllAnglesConcave and bIsAnyDimensionLongAsPart then + elseif Proc.nFct == 2 and ( not bAllAnglesConcave or Proc.nParts == 2) and bIsAnyDimensionLongAsPart then sFamily = 'DoubleBevel' bIsThrough = true elseif Proc.nFct == 3 and bAllAnglesConcave and #vFacesByAdjNumber[2] == 1 and #vTriangularFaces == 2 then @@ -244,7 +244,9 @@ function FeatureLib.ClassifyTopology( Proc, Part) elseif Proc.nFct == 3 and bAllAnglesConcave and #vFacesByAdjNumber[2] == 3 then sFamily = 'Groove' bIsThrough = false - elseif Proc.nFct == 4 and ( ( #vFacesByAdjNumber[2] == 2 and #vTriangularFaces == 2) or ( #vFacesByAdjNumber[3] == 2)) and not bAllAnglesConcave then + elseif Proc.nFct == 4 + and ( ( not bAllAnglesConcave and ( ( #vFacesByAdjNumber[2] == 2 and #vTriangularFaces == 2) or ( #vFacesByAdjNumber[3] == 2))) + or ( #vTriangularFaces == 2 and Proc.nParts == 2)) then sFamily = 'DoubleBevel' bIsThrough = false elseif Proc.nFct == 4 and bAllAnglesConcave and #vFacesByAdjNumber[3] == 2 then @@ -259,7 +261,9 @@ function FeatureLib.ClassifyTopology( Proc, Part) elseif Proc.nFct == 5 and bAllAnglesConcave and #vFacesByAdjNumber[4] == 1 then sFamily = 'Pocket' bIsThrough = false - elseif Proc.nFct == 6 and #vFacesByAdjNumber[1] == 4 and #vFacesByAdjNumber[3] == 2 and #vTriangularFaces == 4 and not bAllAnglesConcave then + elseif Proc.nFct == 6 + and ( ( #vFacesByAdjNumber[1] == 4 and #vFacesByAdjNumber[3] == 2 and #vTriangularFaces == 4 and not bAllAnglesConcave) + or ( #vFacesByAdjNumber[1] == 4 and #vTriangularFaces == 4 and Proc.nParts == 2)) then sFamily = 'DoubleBevel' bIsThrough = false end