- in FaceData.GetFacesInfo aggiunta raccolta informazioni lati, ancora da gestire

- in FaceData ora funziona anche il tunnel
- in FaceData aggiunto campo Type per identificare le facce ('Bottom', 'Long', 'Side', 'Tunnel')
- in FaceData si usa ora la funzione più prestante EgtSurfTmResetTwoColors per resettare i colori delle facce della trimesh
This commit is contained in:
luca.mazzoleni
2024-05-15 19:06:27 +02:00
parent 5f30714a56
commit 6a89e6e29d
+22 -10
View File
@@ -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