- Facce e adiacenze calcolate solo per feature con topologia
- Prima versione GetMainFaces funzionante - Prima bozza struttura codice per scelta strategie - Calcolo delle 4 rotazioni per il recupero dei dati - Prima bozza struttura calcolo voto strategie - Modificate strategie di prova STR0001 e STR0002 con nuovo standard
This commit is contained in:
+64
-38
@@ -39,6 +39,11 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce un vettore con gli indici (0 based) delle facce triangolari (o quasi) di Proc
|
||||
function FaceData.GetTriangularFaces( Proc)
|
||||
-- se la feature ha una sola faccia, esco subito
|
||||
if Proc.Fct <= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
local vTriangularFaces = {}
|
||||
|
||||
for i = 1, Proc.Fct do
|
||||
@@ -74,7 +79,13 @@ end
|
||||
---------------------------------------------------------------------
|
||||
local function GetFacesContactLength( Proc, idFace1, idFace2)
|
||||
local _, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, idFace1, idFace2, GDB_ID.ROOT)
|
||||
local dLength = dist( ptP1, ptP2)
|
||||
|
||||
local dLength = 0
|
||||
if ptP1 and ptP2 then
|
||||
dLength = dist( ptP1, ptP2)
|
||||
else
|
||||
-- TODO se non trova lunghezza serve dare messaggio di errore?
|
||||
end
|
||||
|
||||
return dLength
|
||||
end
|
||||
@@ -82,6 +93,11 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce una tabella che correla numero di adiacenze e id delle facce con quello stesso numero di adiacenze
|
||||
function FaceData.GetFacesByAdjacencyNumber( Proc)
|
||||
-- se la feature ha una sola faccia, esco subito
|
||||
if Proc.Fct <= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
local FacesByAdjacencyNumber = {}
|
||||
|
||||
for i = 1, 10 do
|
||||
@@ -190,7 +206,7 @@ local function GetBottomFace( Proc)
|
||||
local BottomFace = {}
|
||||
|
||||
if Proc.Topology.Family == 'Tunnel' then
|
||||
return BottomFace
|
||||
return nil
|
||||
elseif not ( Proc.Topology.Family == 'Rabbet' or Proc.Topology.Family == 'VGroove' or Proc.Topology.Family == 'Groove' or Proc.Topology.Family == 'Pocket') then
|
||||
error( 'GetBottomFace : Topology not implemented')
|
||||
end
|
||||
@@ -222,13 +238,6 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
end
|
||||
|
||||
local idBottomFace = GDB_ID.NULL
|
||||
if MainFaces.BottomFace then
|
||||
idBottomFace = MainFaces.BottomFace.Id
|
||||
else
|
||||
local BottomFace = GetBottomFace( Proc)
|
||||
idBottomFace = BottomFace.Id or idBottomFace
|
||||
end
|
||||
|
||||
local idTunnelMiddleFace = GDB_ID.NULL
|
||||
if Proc.Topology.Family == 'Tunnel' then
|
||||
if MainFaces.TunnelAddedFaces then
|
||||
@@ -237,6 +246,13 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
local TunnelAddedFaces = GetTunnelFaces( Proc)
|
||||
idTunnelMiddleFace = TunnelAddedFaces.MiddleFaceTm.Id or idTunnelMiddleFace
|
||||
end
|
||||
else
|
||||
if MainFaces.BottomFace then
|
||||
idBottomFace = MainFaces.BottomFace.Id
|
||||
else
|
||||
local BottomFace = GetBottomFace( Proc)
|
||||
idBottomFace = BottomFace.Id or idBottomFace
|
||||
end
|
||||
end
|
||||
|
||||
local FacesToAnalyze = {}
|
||||
@@ -275,12 +291,15 @@ local function GetSideFaces( Proc, MainFaces)
|
||||
end
|
||||
|
||||
local idBottomFace = GDB_ID.NULL
|
||||
if MainFaces.BottomFace then
|
||||
idBottomFace = MainFaces.BottomFace.Id
|
||||
else
|
||||
local BottomFace = GetBottomFace( Proc)
|
||||
idBottomFace = BottomFace.Id or idBottomFace
|
||||
if Proc.Topology.Family ~= 'Tunnel' then
|
||||
if MainFaces.BottomFace then
|
||||
idBottomFace = MainFaces.BottomFace.Id
|
||||
else
|
||||
local BottomFace = GetBottomFace( Proc)
|
||||
idBottomFace = BottomFace.Id or idBottomFace
|
||||
end
|
||||
end
|
||||
|
||||
local LongFaces = {}
|
||||
if MainFaces.LongFaces then
|
||||
LongFaces = MainFaces.LongFaces
|
||||
@@ -288,8 +307,9 @@ local function GetSideFaces( Proc, MainFaces)
|
||||
LongFaces = GetLongFaces( Proc, MainFaces)
|
||||
end
|
||||
|
||||
|
||||
for i = 1, Proc.Fct do
|
||||
if i ~= idBottomFace + 1 then
|
||||
if not idBottomFace or i ~= ( idBottomFace + 1) then
|
||||
local bIsSideFace = true
|
||||
for j = 1, #LongFaces do
|
||||
if Proc.Faces[i].Id == LongFaces[j].Id then
|
||||
@@ -309,38 +329,44 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- recupero facce principali della feature, in base alla topologia
|
||||
function FaceData.GetMainFaces( Proc)
|
||||
|
||||
EgtOutLog( '---MainFaces START---')
|
||||
local MainFaces = {}
|
||||
|
||||
if Proc.Topology.IsThrough and Proc.Topology.AllRightAngles and Proc.Fct < 5 then
|
||||
MainFaces.TunnelAddedFaces = GetTunnelFaces( Proc)
|
||||
end
|
||||
|
||||
-- CASO 1 : Feature tipo LapJoint
|
||||
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
|
||||
|
||||
if Proc.Topology.IsThrough and Proc.Topology.AllRightAngles and Proc.Fct < 5 then
|
||||
MainFaces.TunnelAddedFaces = GetTunnelFaces( Proc)
|
||||
end
|
||||
|
||||
MainFaces.BottomFace = GetBottomFace( Proc)
|
||||
MainFaces.LongFaces = GetLongFaces( Proc, MainFaces)
|
||||
MainFaces.SideFaces = GetSideFaces( Proc, MainFaces)
|
||||
-- TODO funzione apposita per informazioni log?
|
||||
if EgtGetDebugLevel() >= 3 then
|
||||
if MainFaces.BottomFace then
|
||||
EgtOutLog( 'Bottom Face : ' .. MainFaces.BottomFace.Id)
|
||||
end
|
||||
if MainFaces.LongFaces then
|
||||
for i = 1, #MainFaces.LongFaces do
|
||||
EgtOutLog( 'Long Face : ' .. MainFaces.LongFaces[i].Id)
|
||||
end
|
||||
end
|
||||
if MainFaces.SideFaces then
|
||||
for i = 1, #MainFaces.SideFaces do
|
||||
EgtOutLog( 'Side Face : ' .. MainFaces.SideFaces[i].Id)
|
||||
end
|
||||
end
|
||||
if MainFaces.TunnelAddedFaces then
|
||||
EgtOutLog( 'Middle Face (Trimesh): ' .. MainFaces.TunnelAddedFaces.MiddleFaceTm.Id)
|
||||
end
|
||||
end
|
||||
else
|
||||
EgtOutLog( '---MainFaces NOT NEEDED---')
|
||||
end
|
||||
|
||||
-- TODO funzione apposita per informazioni log?
|
||||
if EgtGetDebugLevel() >= 3 then
|
||||
if MainFaces.BottomFace then
|
||||
EgtOutLog( 'Bottom Face : ' .. MainFaces.BottomFace.Id)
|
||||
end
|
||||
if MainFaces.LongFaces then
|
||||
for i = 1, #MainFaces.LongFaces do
|
||||
EgtOutLog( 'Long Face : ' .. MainFaces.LongFaces[i].Id)
|
||||
end
|
||||
end
|
||||
if MainFaces.SideFaces then
|
||||
for i = 1, #MainFaces.SideFaces do
|
||||
EgtOutLog( 'Side Face : ' .. MainFaces.SideFaces[i].Id)
|
||||
end
|
||||
end
|
||||
if MainFaces.TunnelAddedFaces then
|
||||
EgtOutLog( 'Middle Face (Trimesh): ' .. MainFaces.TunnelAddedFaces.MiddleFaceTm.Id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
EgtOutLog( '---MainFaces END---')
|
||||
return MainFaces
|
||||
|
||||
Reference in New Issue
Block a user