From 340345725fd9b1c2338498cca0f1d65aa970fbea Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 9 May 2025 16:03:30 +0200 Subject: [PATCH] - in BeamExec corretta eliminazione geometrie temporanee - in MachiningLib.GetTimeToMachineAllStepsWithLeadInOut i tempi di svuotatura ora sono precisi (si usa EgtPocketing) --- LuaLibs/BeamExec.lua | 13 ++++++++----- LuaLibs/FaceData.lua | 2 +- LuaLibs/MachiningLib.lua | 24 ++++++++++++++++-------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 2acb6e7..0b1967c 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1592,12 +1592,15 @@ function BeamExec.ProcessMachinings( PARTS) -- cancellazione entità create ma non usate -- TODO funzione? local idAddGroup = BeamLib.GetAddGroup( PARTS[nPart].id) - local idCreatedEntity = EgtGetFirstInGroup( idAddGroup or GDB_ID.NULL) - while idCreatedEntity do - if EgtGetLevel( idCreatedEntity) == GDB_LV.TEMP then - EgtErase( idCreatedEntity) + local idCurrentEntity = EgtGetFirstInGroup( idAddGroup or GDB_ID.NULL) + while idCurrentEntity do + if EgtGetLevel( idCurrentEntity) == GDB_LV.TEMP then + local idEntityToDelete = idCurrentEntity + idCurrentEntity = EgtGetNext( idCurrentEntity) + EgtErase( idEntityToDelete) + else + idCurrentEntity = EgtGetNext( idCurrentEntity) end - idCreatedEntity = EgtGetNext( idCreatedEntity) end -- ordinamento lavorazioni diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index 38b6867..4954559 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -335,7 +335,7 @@ local function GetBottomFaces( Proc) CurrentEdge.bIsStartOpen = BottomFaces[1].Edges[i].bIsStartOpen CurrentEdge.bIsEndOpen = BottomFaces[1].Edges[i].bIsEndOpen - -- se non c'è un LongEdge significa che non ci sono lati chiusi (facce convesse) + -- se non c'è un LongEdge significa che non ci sono lati chiusi (facce convesse): i MainEdges non si calcolano if nFirstLongEdgeIndex then if i == nFirstLongEdgeIndex then BottomFaces[1].MainEdges.LongEdges[1] = CurrentEdge diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 3d44477..77338c8 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -999,19 +999,27 @@ function MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machining, Part) end elseif Machining.nType == MCH_MY.POCKETING then -- TODO le chiamate alla pocketing vanno unificate e uniformate + -- TODO il calcolo va aggiustato con il confronto tra volume della feature e volume svuotato perchè i percorsi reali sono trimmati fuori dal grezzo local ProcTm = FeatureLib.GetProcFromTrimesh( Machining.Geometry[1][1], Part) local dDepthToMachine = min( ProcTm.Faces[Machining.Geometry[1][2] + 1].dElevation, ( Machining.dMaxElev or ProcTm.Faces[Machining.Geometry[1][2] + 1].dElevation)) - ( max( 0, Machining.dResidualDepth or 0)) local nSteps = ceil( ( dDepthToMachine - 50 * GEO.EPS_SMALL) / TOOLS[Machining.nToolIndex].dStep) - -- TODO bisogna calcolare correttamente per lati aperti e chiusi (aperti: aggiungi D/2 - Sidestep, chiusi: sottrai - D/2) - local _, dLongEdgeDimension, dShortEdgeDimension = EgtSurfTmFacetMinAreaRectangle( ProcTm.id, Machining.Geometry[1][2], GDB_ID.ROOT) - local nOffsets = ceil ( ( dShortEdgeDimension - TOOLS[Machining.nToolIndex].dSideStep) / TOOLS[Machining.nToolIndex].dSideStep) + 1 - for i = 1, floor( nOffsets / 2) do - dLengthToMachineAllStepsWithLeadInOut = dLengthToMachineAllStepsWithLeadInOut - + 2 * ( dShortEdgeDimension - 2 * ( i - 1) * TOOLS[Machining.nToolIndex].dSideStep) - + 2 * ( dLongEdgeDimension - 2 * ( i - 1) * TOOLS[Machining.nToolIndex].dSideStep) + local nAddGroupId = BeamLib.GetAddGroup( Part.id) + -- TODO in futuro creare flatregion (se ci fossero isole il calcolo del percorso non sarebbe corretto) + local idFaceContour = EgtExtractSurfTmFacetLoops( ProcTm.id, Machining.Geometry[1][2], nAddGroupId) + -- si settano i lati aperti della curva derivata dalla superficie + for i = 1, #ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges do + if ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges[i].bIsOpen then + EgtCurveCompoSetTempProp( idFaceContour, ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges[i].id, 1) + end end - dLengthToMachineAllStepsWithLeadInOut = dLengthToMachineAllStepsWithLeadInOut * nSteps + local idPocketingPath = EgtPocketing( idFaceContour, TOOLS[Machining.nToolIndex].dDiameter / 2, TOOLS[Machining.nToolIndex].dSideStep, 0, Machining.nSubType, true, nAddGroupId) + local dPocketingPathLength = EgtCurveLength( idPocketingPath) + -- calcolo lunghezze e tempi totali + dLengthToMachineAllStepsWithLeadInOut = dPocketingPathLength * nSteps dTimeToMachineTotal = dLengthToMachineAllStepsWithLeadInOut / dToolFeed + -- le geometrie create si settano da cancellare + EgtSetLevel( idFaceContour, GDB_LV.TEMP) + EgtSetLevel( idPocketingPath, GDB_LV.TEMP) else error( 'GetTimeToMachineAllStepsWithLeadInOut : unknown machining type') end