Merge remote-tracking branch 'origin/develop' into STR0002_ImprovePocketing

This commit is contained in:
andrea.villa
2024-06-03 17:05:47 +02:00
2 changed files with 61 additions and 13 deletions
+55 -7
View File
@@ -125,7 +125,7 @@ function FaceData.GetFacesInfo( Proc, Part)
Faces[i].dArea = dShortEdgeDimension * dLongEdgeDimension
local nFaceType, vEdges = EgtSurfTmGetFacetOutlineInfo( Proc.id, i - 1, GDB_ID.ROOT)
Faces[i].IsOkForMachining = nFaceType < 1
Faces[i].bIsOkForMachining = nFaceType < 1
Faces[i].Edges = vEdges
-- TODO valutare se fare un output unico alla fine o gestire log in altro modo
@@ -220,7 +220,7 @@ local function GetBottomFace( Proc)
end
end
if not BottomFace.IsOkForMachining then
if not BottomFace.bIsOkForMachining then
return nil
end
@@ -308,10 +308,10 @@ local function GetLongFaces( Proc, MainFaces)
idSecondLongFace = BottomFace.MainEdges.LongEdges[2].idAdjacentFace
end
end
if idFirstLongFace > -1 then
if idFirstLongFace > -1 and Proc.Faces[idFirstLongFace + 1].bIsOkForMachining then
table.insert( LongFaces, Proc.Faces[idFirstLongFace + 1])
end
if idSecondLongFace > -1 then
if idSecondLongFace > -1 and Proc.Faces[idSecondLongFace + 1].bIsOkForMachining then
table.insert( LongFaces, Proc.Faces[idSecondLongFace + 1])
end
@@ -375,6 +375,7 @@ local function GetSideFaces( Proc, MainFaces)
error( 'GetSideFaces : Topology not implemented')
end
local BottomFace = MainFaces.BottomFace or GetBottomFace( Proc)
local LongFaces = MainFaces.LongFaces or GetLongFaces( Proc, MainFaces)
local idFirstSideFace = GDB_ID.NULL
@@ -385,16 +386,63 @@ local function GetSideFaces( Proc, MainFaces)
if not LongFaces[1].MainEdges.SideEdges[2].bIsOpen then
idSecondSideFace = LongFaces[1].MainEdges.SideEdges[2].idAdjacentFace
end
if idFirstSideFace > -1 then
if idFirstSideFace > -1 and Proc.Faces[idFirstSideFace + 1].bIsOkForMachining then
table.insert( SideFaces, Proc.Faces[idFirstSideFace + 1])
SideFaces[#SideFaces].Type = 'Side'
end
if idSecondSideFace > -1 then
if idSecondSideFace > -1 and Proc.Faces[idSecondSideFace + 1].bIsOkForMachining then
table.insert( SideFaces, Proc.Faces[idSecondSideFace + 1])
SideFaces[#SideFaces].Type = 'Side'
end
-- TODO aggiungere anche informazioni Edges??
for i = 1, #SideFaces do
SideFaces[i].Type = 'Side'
SideFaces[i].MainEdges = {}
SideFaces[i].MainEdges.LongEdges = {}
SideFaces[i].MainEdges.OppositeEdges = {}
for j = 1, #SideFaces[i].Edges do
local nPreviousEdgeIndex = j - 1
if j == 1 then
nPreviousEdgeIndex = #SideFaces[1].Edges
end
local nNextEdgeIndex = j + 1
if j == #SideFaces[i].Edges then
nNextEdgeIndex = 1
end
local CurrentEdge = {}
CurrentEdge.idAdjacentFace = SideFaces[i].Edges[j].Adj
CurrentEdge.vtToolDirection = Vector3d( SideFaces[i].Edges[j].Norm)
CurrentEdge.dLength = SideFaces[i].Edges[j].Len
CurrentEdge.dElevation = SideFaces[i].Edges[j].Elev
CurrentEdge.bIsOpen = SideFaces[i].Edges[j].Open
CurrentEdge.bIsStartOpen = SideFaces[i].Edges[nPreviousEdgeIndex].Open
CurrentEdge.bIsEndOpen = SideFaces[i].Edges[nNextEdgeIndex].Open
if Proc.Topology.sFamily == 'Tunnel' then
if CurrentEdge.idAdjacentFace > -1 then
table.insert( SideFaces[i].MainEdges.LongEdges, CurrentEdge)
else
table.insert( SideFaces[i].MainEdges.OppositeEdges, CurrentEdge)
end
else
if CurrentEdge.idAdjacentFace == BottomFace.id then
SideFaces[i].MainEdges.BottomEdge = CurrentEdge
SideFaces[i].MainEdges.BottomEdge.Type = 'Bottom'
elseif SideFaces[i].Edges[nNextEdgeIndex].Adj == BottomFace.id then
SideFaces[i].MainEdges.LongEdges[1] = CurrentEdge
SideFaces[i].MainEdges.LongEdges[1].Type = 'Long'
elseif SideFaces[i].Edges[nPreviousEdgeIndex].Adj == BottomFace.id then
SideFaces[i].MainEdges.LongEdges[2] = CurrentEdge
SideFaces[i].MainEdges.LongEdges[2].Type = 'Long'
else
table.insert( SideFaces[i].MainEdges.OppositeEdges, CurrentEdge)
SideFaces[i].MainEdges.OppositeEdges[#SideFaces[i].MainEdges.OppositeEdges].Type = 'Opposite'
end
end
end
end
return SideFaces
end
+6 -6
View File
@@ -31,13 +31,13 @@ end
local function CalcMachinedPercentage( Proc, Machining)
local dPercentage
local dBottomElevation = Proc.MainFaces.BottomFace.dElevation
local dBottomPrercentage = ( dBottomElevation - Machining[1].ToolInfo.dResidualDepth) / dBottomElevation
local dBottomPrercentageLeft = 1 - dBottomPrercentage
local dBottomPercentage = ( dBottomElevation - Machining[1].ToolInfo.dResidualDepth) / dBottomElevation
local dBottomPercentageLeft = 1 - dBottomPercentage
if Machining.sTypeMachining == 'None' then
dPercentage = 0
elseif Machining.sTypeMachining == 'Bottom' then
dPercentage = dBottomPrercentage
dPercentage = dBottomPercentage
elseif Proc.MainFaces.TunnelAddedFaces then
local TunnelAddedFacesElevation = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation
local dSide1Prercentage = ( ( TunnelAddedFacesElevation * 2) - Machining[2].ToolInfo.dResidualDepth) / ( TunnelAddedFacesElevation * 2)
@@ -47,11 +47,11 @@ local function CalcMachinedPercentage( Proc, Machining)
elseif Machining.sTypeMachining == 'Side2' then
dPercentage = dSide2Prercentage
elseif Machining.sTypeMachining == 'Bottom-Side1-Side2' then
dPercentage = dBottomPrercentage + ( dBottomPrercentageLeft * ( dSide1Prercentage + dSide2Prercentage))
dPercentage = dBottomPercentage + ( dBottomPercentageLeft * ( dSide1Prercentage + dSide2Prercentage))
elseif Machining.sTypeMachining == 'Bottom-Side1' then
dPercentage = dBottomPrercentage + ( dBottomPrercentageLeft * dSide1Prercentage)
dPercentage = dBottomPercentage + ( dBottomPercentageLeft * dSide1Prercentage)
elseif Machining.sTypeMachining == 'Bottom-Side2' then
dPercentage = dBottomPrercentage + ( dBottomPrercentageLeft * dSide2Prercentage)
dPercentage = dBottomPercentage + ( dBottomPercentageLeft * dSide2Prercentage)
elseif Machining.sTypeMachining == 'Side1-Side2' then
dPercentage = dSide1Prercentage + dSide2Prercentage
end