- in BeamExec corretta eliminazione geometrie temporanee

- in MachiningLib.GetTimeToMachineAllStepsWithLeadInOut i tempi di svuotatura ora sono precisi (si usa EgtPocketing)
This commit is contained in:
luca.mazzoleni
2025-05-09 16:03:30 +02:00
parent 24245e8bd6
commit 340345725f
3 changed files with 25 additions and 14 deletions
+8 -5
View File
@@ -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
+1 -1
View File
@@ -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
+16 -8
View File
@@ -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