From 6a89e6e29dd9a7a2da545249d0c8619c71b1fd32 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 15 May 2024 19:06:27 +0200 Subject: [PATCH] =?UTF-8?q?-=20in=20FaceData.GetFacesInfo=20aggiunta=20rac?= =?UTF-8?q?colta=20informazioni=20lati,=20ancora=20da=20gestire=20-=20in?= =?UTF-8?q?=20FaceData=20ora=20funziona=20anche=20il=20tunnel=20-=20in=20F?= =?UTF-8?q?aceData=20aggiunto=20campo=20Type=20per=20identificare=20le=20f?= =?UTF-8?q?acce=20('Bottom',=20'Long',=20'Side',=20'Tunnel')=20-=20in=20Fa?= =?UTF-8?q?ceData=20si=20usa=20ora=20la=20funzione=20pi=C3=B9=20prestante?= =?UTF-8?q?=20EgtSurfTmResetTwoColors=20per=20resettare=20i=20colori=20del?= =?UTF-8?q?le=20facce=20della=20trimesh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/FaceData.lua | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index 25366b3..c6297d3 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -123,10 +123,10 @@ function FaceData.GetFacesInfo( Proc, Part) vAdj = FaceData.GetAdjacencyMatrix( Proc) end + -- reset eventuali visualizzazioni facce a due colori + EgtSurfTmResetTwoColors( Proc.Id) + for i = 1, Proc.nFct do - -- reset colore faccia - EgtSurfTmSetFaceColor( Proc.Id, i - 1, 0) - Faces[i] = {} Faces[i].Id = i - 1 Faces[i].ptCenter, Faces[i].vtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT) @@ -140,6 +140,12 @@ function FaceData.GetFacesInfo( Proc, Part) Faces[i].dHeight = dFaceHeight -- elevazione calcolata rispetto al box della parte Faces[i].dElevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, true, GDB_ID.ROOT) + -- TODO qui sarebbe meglio l'area vera e non quella del rettangolo minimo + local _, dLongEdgeDimension, dShortEdgeDimension = EgtSurfTmFacetMinAreaRectangle( Proc.Id, i - 1, GDB_ID.ROOT) + Faces[i].dArea = dShortEdgeDimension * dLongEdgeDimension + + -- TODO da scrivere in tabella. Cosa fare se nFaceType > 0? + local nFaceType, vEdges = EgtSurfTmGetFacetOutlineInfo( Proc.Id, i - 1, GDB_ID.ROOT) -- TODO valutare se fare un output unico alla fine o gestire log in altro modo EgtOutLog( 'Facet ' .. Faces[i].Id .. ' of ' .. Proc.nFct - 1) @@ -157,6 +163,7 @@ function FaceData.GetFacesInfo( Proc, Part) end end end + end EgtOutLog( '---Faces END---') @@ -200,6 +207,7 @@ local function GetTunnelFaces( Proc) for i = 1, Proc.nFct do EgtCutSurfTmPlane( TunnelAddedFaces.MiddleFaceTm.Id, Proc.Faces[i].ptCenter, -Proc.Faces[i].vtN, false, GDB_ID.ROOT) end + TunnelAddedFaces.MiddleFaceTm.Type = 'Tunnel' return TunnelAddedFaces end @@ -228,8 +236,10 @@ local function GetBottomFace( Proc) end else BottomFace = BottomFaces[1] + BottomFace.Type = 'Bottom' end end + return BottomFace end @@ -263,23 +273,24 @@ local function GetLongFaces( Proc, MainFaces) for i = 1, Proc.nFct do if Proc.Faces[i].Id ~= idBottomFace then table.insert( FacesToAnalyze, Proc.Faces[i]) - if Proc.Topology.sFamily == 'Tunnel' then - -- TODO questo non funziona nei tunnel, da modificare - FacesToAnalyze[#FacesToAnalyze].LengthOnMainFace = GetFacesContactLength( Proc, idTunnelMiddleFace, Proc.Faces[i].Id) - else - FacesToAnalyze[#FacesToAnalyze].LengthOnMainFace = GetFacesContactLength( Proc, idBottomFace, Proc.Faces[i].Id) - end + FacesToAnalyze[#FacesToAnalyze].LengthOnMainFace = GetFacesContactLength( Proc, idBottomFace, Proc.Faces[i].Id) end end - table.sort( FacesToAnalyze, function( a, b) return a.LengthOnMainFace > b.LengthOnMainFace end) + if Proc.Topology.sFamily == 'Tunnel' then + table.sort( FacesToAnalyze, function( a, b) return a.dArea > b.dArea end) + else + table.sort( FacesToAnalyze, function( a, b) return a.LengthOnMainFace > b.LengthOnMainFace end) + end -- la prima faccia lunga รจ sempre la prima della lista LongFaces[1] = FacesToAnalyze[1] + LongFaces[1].Type = 'Long' -- si cerca l'eventuale seconda faccia lunga, ossia quella non adiacente alla prima if Proc.nFct > 3 then local NotAdjacentFaces = GetNotAdjacentFaces(Proc, LongFaces[1].Id) if #NotAdjacentFaces > 0 then LongFaces[2] = NotAdjacentFaces[1] + LongFaces[2].Type = 'Long' end end @@ -323,6 +334,7 @@ local function GetSideFaces( Proc, MainFaces) end if bIsSideFace then table.insert( SideFaces, Proc.Faces[i]) + SideFaces[#SideFaces].Type = 'Side' end end end