Merge remote-tracking branch 'origin/feature/GetForcedStrategy' into feature/GetMainFaces

This commit is contained in:
luca.mazzoleni
2024-04-19 13:03:11 +02:00
12 changed files with 514 additions and 159 deletions
+24 -23
View File
@@ -5,9 +5,6 @@
-- Tabella per definizione modulo
local FaceData = {}
-- Carico i dati globali
local BD = require( 'BeamData')
-- carico librerie
local BeamLib = require( 'BeamLib')
@@ -68,6 +65,7 @@ local function GetAdjacentFaces( Proc, idFace)
if vAdj[idFace + 1][i] and vAdj[idFace + 1][i] ~= 0 and ( idFace + 1 ~= i) then
local _, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, idFace, i - 1, GDB_ID.ROOT)
local dLength = dist( ptP1, ptP2)
AdjacentFaces[i] = {}
AdjacentFaces[i].Id = i - 1
AdjacentFaces[i].LengthOnMainFace = dLength
end
@@ -82,7 +80,9 @@ function FaceData.GetFacesByAdjacencyNumber( Proc)
local FacesByAdjacencyNumber = {}
for i = 1, Proc.Fct do
-- TODO questo non funziona!!
if not FacesByAdjacencyNumber[#Proc.Faces[i].Adjacencies] then
FacesByAdjacencyNumber[#Proc.Faces[i].Adjacencies] = {}
end
table.insert( FacesByAdjacencyNumber[#Proc.Faces[i].Adjacencies], i - 1)
end
@@ -107,10 +107,10 @@ local function GetBottomFace( Proc)
local dMinElevation = GEO.INFINITO
for i = 1, #vBottomFace do
for j = 1, Proc.Fct do
if vBottomFace[i] == Proc.Face[j].Id then
if Proc.Face[j].Elevation < dMinElevation then
dMinElevation = Proc.Face[j].Elevation
nBottomFace = Proc.Face[j].Id
if vBottomFace[i] == Proc.Faces[j].Id then
if Proc.Faces[j].Elevation < dMinElevation then
dMinElevation = Proc.Faces[j].Elevation
nBottomFace = Proc.Faces[j].Id
end
end
end
@@ -120,11 +120,11 @@ local function GetBottomFace( Proc)
end
BottomFace.Id = nBottomFace
BottomFace.FrameHV = Proc.Face[nBottomFace + 1].FrameHV
BottomFace.Width = Proc.Face[nBottomFace + 1].Width
BottomFace.Height = Proc.Face[nBottomFace + 1].Height
BottomFace.Elevation = Proc.Face[nBottomFace + 1].Elevation
BottomFace.VtN = Proc.Face[nBottomFace + 1].VtN
BottomFace.FrameHV = Proc.Faces[nBottomFace + 1].FrameHV
BottomFace.Width = Proc.Faces[nBottomFace + 1].Width
BottomFace.Height = Proc.Faces[nBottomFace + 1].Height
BottomFace.Elevation = Proc.Faces[nBottomFace + 1].Elevation
BottomFace.VtN = Proc.Faces[nBottomFace + 1].VtN
return BottomFace
end
@@ -168,8 +168,8 @@ local function GetLongFaces( Proc, MainFaces)
for i = 1, Proc.Fct do
if ( i - 1) ~= idBottomFace and ( i - 1) ~= LongFaces[1].Id then
local bIsAdjacent = false
for j = 1, #Proc.Face[i].Adjacences do
if Proc.Face[i].Adjacences[j].Id == LongFaces[i].Id then
for j = 1, #Proc.Faces[i].Adjacences do
if Proc.Faces[i].Adjacences[j].Id == LongFaces[i].Id then
bIsAdjacent = true
end
end
@@ -183,12 +183,12 @@ local function GetLongFaces( Proc, MainFaces)
for i = 1, #LongFaces do
for j = 1, Proc.Fct do
if LongFaces[i].Id == Proc.Face[j].Id then
LongFaces[i].Frame = Proc.Face[j].FrameHV
LongFaces[i].Width = Proc.Face[j].Width
LongFaces[i].Height = Proc.Face[j].Height
LongFaces[i].Elevation = Proc.Face[j].Elevation
LongFaces[i].VtN = Proc.Face[j].VtN
if LongFaces[i].Id == Proc.Faces[j].Id then
LongFaces[i].Frame = Proc.Faces[j].FrameHV
LongFaces[i].Width = Proc.Faces[j].Width
LongFaces[i].Height = Proc.Faces[j].Height
LongFaces[i].Elevation = Proc.Faces[j].Elevation
LongFaces[i].VtN = Proc.Faces[j].VtN
end
end
end
@@ -198,10 +198,11 @@ end
-------------------------------------------------------------------------------------------------------------
function FaceData.GetFacesInfo( Proc, b3Raw)
Faces = {}
local Faces = {}
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Proc.PartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
for i = 1, Proc.Fct do
Faces[i] = {}
Faces[i].Id = i - 1
Faces[i].VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT )
if Proc.Fct < 6 then
@@ -228,7 +229,7 @@ function FaceData.GetMainFaces( Proc)
local MainFaces = {}
-- faccia di fondo
if Proc.FeatureTopology.Family == 'Rabbet' or Proc.FeatureTopology.Family == 'VGroove' or Proc.FeatureTopology.Family == 'Groove' or Proc.FeatureTopology.Family == 'Pocket' then
if Proc.Topology.Family == 'Rabbet' or Proc.Topology.Family == 'VGroove' or Proc.Topology.Family == 'Groove' or Proc.Topology.Family == 'Pocket' then
MainFaces.BottomFace = GetBottomFace( Proc)
MainFaces.LongFaces = GetLongFaces( Proc, MainFaces)
end