- Librerie con nome esteso

- Piccole correzioni dopo merge con Branch GetMainFaces
This commit is contained in:
andrea.villa
2024-04-19 12:49:21 +02:00
parent 4f90b0704d
commit fb47b28173
7 changed files with 81 additions and 85 deletions
+26 -24
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,6 +80,9 @@ function FaceData.GetFacesByAdjacencyNumber( Proc)
local FacesByAdjacencyNumber = {}
for i = 1, Proc.Fct do
if not FacesByAdjacencyNumber[#Proc.Faces[i].Adjacencies] then
FacesByAdjacencyNumber[#Proc.Faces[i].Adjacencies] = {}
end
table.insert( FacesByAdjacencyNumber[#Proc.Faces[i].Adjacencies], i - 1)
end
@@ -100,10 +101,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
@@ -113,11 +114,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
@@ -131,7 +132,7 @@ local function GetLongFaces( Proc)
end
local idBottomFace = GDB_ID.NULL
if Proc.MainFaces.BottomFace.Id then
if Proc.MainFaces.BottomFace and Proc.MainFaces.BottomFace.Id then
idBottomFace = Proc.MainFaces.BottomFace.Id
else
local BottomFace = GetBottomFace( Proc)
@@ -149,8 +150,8 @@ local function GetLongFaces( Proc)
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
@@ -164,12 +165,12 @@ local function GetLongFaces( Proc)
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
@@ -179,10 +180,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
@@ -209,12 +211,12 @@ 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)
end
-- facce lunghe
if Proc.FeatureTopology.Family == 'Rabbet' or Proc.FeatureTopology.Family == 'VGroove' or Proc.FeatureTopology.Family == 'Groove' or Proc.FeatureTopology.Family == 'Pocket' or Proc.FeatureTopology.Family == 'Tunnel' then
if Proc.Topology.Family == 'Rabbet' or Proc.Topology.Family == 'VGroove' or Proc.Topology.Family == 'Groove' or Proc.Topology.Family == 'Pocket' or Proc.Topology.Family == 'Tunnel' then
MainFaces.LongFaces = GetLongFaces( Proc)
end