- in FaceData, IsFaceRectangular e IsFaceRhomboid ricevono solamente il parametro Face; utilizzano il gruppo per geometrie temporanee invece di AddGroup

This commit is contained in:
luca.mazzoleni
2025-10-24 18:54:49 +02:00
parent 070ad50d73
commit 0afcd786d1
4 changed files with 45 additions and 18 deletions
+15
View File
@@ -292,6 +292,21 @@ function BeamLib.CreateOrEmptyAddGroup( PartId)
return true
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.CreateTempGroup()
local idTempGroup = EgtGroup( GDB_ID.ROOT)
EgtSetName( idTempGroup, "#TEMP_GROUP#")
return idTempGroup
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetTempGroup()
local idTempGroup = EgtGetFirstNameInGroup( GDB_ID.ROOT, "#TEMP_GROUP#") or nil
return idTempGroup
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetAddGroup( PartId)
-- recupero il nome del gruppo di lavoro corrente
+26 -14
View File
@@ -216,29 +216,41 @@ function FaceData.GetFacesInfo( Proc, Part, FacesToGet)
end
-------------------------------------------------------------------------------------------------------------
-- TODO valutare se scrivere in gruppo temporaneo che non richiede di passare ogni volta idPart
function FaceData.IsFaceRectangular( Proc, Face)
local nAddGrpId = BeamLib.GetAddGroup( Proc.idPart)
local nContourId, nContourCnt = EgtExtractSurfTmFacetLoops( Proc.id, Face.id, nAddGrpId)
function FaceData.IsFaceRectangular( Face)
-- recupero gruppo per geometrie temporanee
local bIsTempGroupToDelete = false
local idTempGroup = BeamLib.GetTempGroup()
if not idTempGroup then
idTempGroup = BeamLib.CreateTempGroup()
bIsTempGroupToDelete = true
end
local nContourId, nContourCnt = EgtExtractSurfTmFacetLoops( Face.idTrimesh, Face.id, idTempGroup)
if nContourCnt > 1 then
error( 'IsFaceRectangular : too many loops')
end
local bIsRectangular = EgtCurveIsARectangle( nContourId)
-- elimino curve create
for i = 1, nContourCnt do
EgtErase( nContourId + i - 1)
-- se necessario, elimino il gruppo temporaneo
if bIsTempGroupToDelete then
EgtErase( idTempGroup)
end
return bIsRectangular
end
-------------------------------------------------------------------------------------------------------------
-- TODO valutare se scrivere in gruppo temporaneo che non richiede di passare ogni volta idPart
function FaceData.IsFaceRhomboid( Proc, Face)
local nAddGrpId = BeamLib.GetAddGroup( Proc.idPart)
local nContourId, nContourCnt = EgtExtractSurfTmFacetLoops( Proc.id, Face.id, nAddGrpId)
function FaceData.IsFaceRhomboid( Face)
-- recupero gruppo per geometrie temporanee
local bIsTempGroupToDelete = false
local idTempGroup = BeamLib.GetTempGroup()
if not idTempGroup then
idTempGroup = BeamLib.CreateTempGroup()
bIsTempGroupToDelete = true
end
local nContourId, nContourCnt = EgtExtractSurfTmFacetLoops( Face.idTrimesh, Face.id, idTempGroup)
if nContourCnt > 1 then
error( 'IsFaceRhomboid : too many loops')
end
@@ -253,9 +265,9 @@ function FaceData.IsFaceRhomboid( Proc, Face)
bIsRhomboid = true
end
-- elimino curve create
for i = 1, nContourCnt do
EgtErase( nContourId + i - 1)
-- se necessario, elimino il gruppo temporaneo
if bIsTempGroupToDelete then
EgtErase( idTempGroup)
end
return bIsRhomboid
+2 -2
View File
@@ -381,7 +381,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters)
nToolIndex, sChosenBladeType = GetBestBlade( Proc, Part, FaceToMachine, OptionalParametersGetBestBlade)
-- se possibile, upgrade del taglio tipo 'Top' a taglio a ghigliottina. Si tenta anche se il taglio singolo non è riuscito.
if ( sChosenBladeType == 'Top' or not nToolIndex) and bReduceBladePath and FaceData.IsFaceRectangular( Proc, FaceToMachine.id) then
if ( sChosenBladeType == 'Top' or not nToolIndex) and bReduceBladePath and FaceData.IsFaceRectangular( FaceToMachine) then
local nToolIndexGuillotine
-- ricerca lama migliore testa sopra
@@ -586,7 +586,7 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
-- se taglio da un lato non ce la fa, si prova da due lati
-- TODO valutare se estendere ai non parallelogrammi
elseif FaceData.IsFaceRhomboid( Proc, Proc.Faces[1]) then
elseif FaceData.IsFaceRhomboid( Proc.Faces[1]) then
local CuttingParametersList
CuttingParametersList, EdgeToMachine = GetDualSideCutStrategy( Proc, Part, OptionalParameters)
+2 -2
View File
@@ -361,7 +361,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.bInvert = false
end
-- se OppositeToolDirectionMode è Optimized, se possibile e necessario, si attiva per garantire taglio concorde e verso l'alto (massima qualità)
if ( OppositeToolDirectionMode == 'Optimized') and ( Proc.nFct == 1) and ( FaceData.IsFaceRhomboid( Proc, FaceToMachine)) then
if ( OppositeToolDirectionMode == 'Optimized') and ( Proc.nFct == 1) and ( FaceData.IsFaceRhomboid( FaceToMachine)) then
OppositeToolDirectionMode = 'Disabled'
-- la direzione di percorrenza del lato deve essere verso l'alto; bInvert va considerata perchè inverte la direzione di percorrenza.
if ( Cutting.bInvert and Cutting.vtEdgeDirection:getZ() > 100 * GEO.EPS_SMALL)
@@ -417,7 +417,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.sEdgeUsage = 'Standard'
if bReduceBladePath
and ( Proc.nFct == 1)
and FaceData.IsFaceRectangular( Proc, FaceToMachine.id) then
and FaceData.IsFaceRectangular( FaceToMachine) then
local bIsTopBlade = TOOLS[nToolIndex].SetupInfo.HeadType.bTop
Cutting.dMaxRadialOffset = TOOLS[nToolIndex].dMaxMaterial - Cutting.dDepthToMachine - BeamData.CUT_SIC