diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index af2d211..eed5a0a 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1275,6 +1275,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN local bOk = true local sErr = '' local nNewPhase = -1 + local AddedIds EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1) -- se intestatura ( 1-340-X ) if Hcut.Identify( Proc) then @@ -1300,7 +1301,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN elseif Long2Cut.Identify( Proc) then -- se due facce longitudinali, eseguo doppio taglio longitudinale if Long2Cut.GetLongFacesCount( Proc) == 2 then - bOk, sErr = Long2Cut.Make( Proc, nPhase, nRawId, nPartId) + bOk, sErr, _, AddedIds = Long2Cut.Make( Proc, nPhase, nRawId, nPartId) -- altrimenti eseguo singolo taglio longitudinale else bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId) @@ -1318,7 +1319,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN -- o se rivestimento ( 3/4-034-X) o se mezzolegno chalet ( 4-037-X) o se tasca ( 4-039-X) o se taglio triangolato ( 4-120-X) elseif LapJoint.Identify( Proc) then -- esecuzione mezzo-legno o scanalatura - bOk, sErr = LapJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) + bOk, sErr, _, AddedIds = LapJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- se smusso ( 3/4-036-X) elseif Chamfer.Identify( Proc) then -- esecuzione smusso @@ -1423,7 +1424,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN EgtOutLog( sErr) bOk = false end - return bOk, sErr, ( nNewPhase or -1) + return bOk, sErr, ( nNewPhase or -1), AddedIds end ------------------------------------------------------------------------------------------------------------- @@ -2096,7 +2097,8 @@ function BeamExec.ProcessFeatures() -- flag feature precedente in doppio local nPrevDouble = 0 -- inserisco le lavorazioni da lavorare ribaltate - for i = 1, #vProc do + local i = 1 + while i <= #vProc do -- creo la lavorazione local Proc = vProc[i] if Proc.Flg ~= 0 and Proc.Down then @@ -2107,7 +2109,13 @@ function BeamExec.ProcessFeatures() Proc.DistanceToNextPart = BL.GetDistanceToNextPart( nRawId, nPhase) Proc.PrevDouble = nPrevDouble nPrevDouble = Proc.Double - local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT) + local bOk, sMsg, nNewPhase, AddedIds = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT) + -- lavorazioni da fare dopo separazione + if AddedIds and #AddedIds > 0 then + for j = 1, #AddedIds do + table.insert( vProc, AddedIds[j]) + end + end if not bOk then nTotErr = nTotErr + 1 table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) @@ -2137,6 +2145,7 @@ function BeamExec.ProcessFeatures() EgtSetInfo( nDispId, 'ROT', -2) end end + i = i + 1 end -- se separazione non ancora effettuata, aggiungo nuova fase con le travi in posizione standard if not bSplitRot then @@ -2178,7 +2187,8 @@ function BeamExec.ProcessFeatures() local nPrevDouble = 0 -- inserisco le lavorazioni da lavorare ruotate local nSideMchOk = 0 - for i = 1, #vProc do + local i = 1 + while i <= #vProc do -- creo la lavorazione local Proc = vProc[i] if Proc.Flg ~= 0 and Proc.Side then @@ -2189,7 +2199,13 @@ function BeamExec.ProcessFeatures() Proc.DistanceToNextPart = BL.GetDistanceToNextPart( nRawId, nPhase) Proc.PrevDouble = nPrevDouble nPrevDouble = Proc.Double - local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT) + local bOk, sMsg, nNewPhase, AddedIds = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT) + -- lavorazioni da fare dopo separazione + if AddedIds and #AddedIds > 0 then + for j = 1, #AddedIds do + table.insert( vProc, AddedIds[j]) + end + end if not bOk then nTotErr = nTotErr + 1 table.insert( Stats, {Err=1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId}) @@ -2222,6 +2238,7 @@ function BeamExec.ProcessFeatures() EgtSetInfo( nDispId, 'ROT', -1) end end + i = i + 1 end -- se non sono state inserite lavorazioni di fianco, elimino la fase perchè inutile e dannosa if nSideMchOk == 0 then @@ -2248,7 +2265,8 @@ function BeamExec.ProcessFeatures() -- flag feature precedente in doppio local nPrevDouble = 0 -- inserisco le lavorazioni non ribaltate della trave - for i = 1, #vProc do + local i = 1 + while i <= #vProc do -- creo la lavorazione local Proc = vProc[i] if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then @@ -2259,7 +2277,13 @@ function BeamExec.ProcessFeatures() Proc.DistanceToNextPart = BL.GetDistanceToNextPart( nRawId, nPhase) Proc.PrevDouble = nPrevDouble nPrevDouble = Proc.Double - local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT) + local bOk, sMsg, nNewPhase, AddedIds = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT) + -- lavorazioni da fare dopo separazione + if AddedIds and #AddedIds > 0 then + for j = 1, #AddedIds do + table.insert( vProc, AddedIds[j]) + end + end if not bOk then nTotErr = nTotErr + 1 table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) @@ -2287,6 +2311,7 @@ function BeamExec.ProcessFeatures() EgtSetInfo( nDispId, 'ORD', nOrd) end end + i = i + 1 end EgtOutLog( ' *** End AddMachinings ***', 1) -- passo al grezzo successivo diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 2ca42cd..d6acd24 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -7210,13 +7210,13 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- leggo i parametri Q per utilizzare la fresa di fianco e/o lama local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 local bUseBlade = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') == 1 - local bOk, sMyWarn = Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool) + local bOk, sMyWarn, _, AddedIds = Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool) -- se non sono riuscito a farlo di lama, riprovo con la fresa if not bOk and bUseBlade then bUseBlade = false return Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool) else - return bOk, sMyWarn + return bOk, sMyWarn, nil, AddedIds end -- prima faccia terminale elseif b3Fac1:getDimX() < 1 and abs( vtN2:getX()) < GEO.EPS_SMALL then diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index e6e9934..c16493b 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -37,6 +37,7 @@ EgtOutLog( ' ProcessLongDoubleCut started', 1) -- Dati local BD = require( 'BeamData') local ML = require( 'MachiningLib') +local Topology = require( 'FeatureTopology') local dLimMinPiece = BD.LEN_SHORT_PART or 1000 @@ -324,6 +325,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster local nFaceLimit, tFaceLong, ptC, vtN = IdentifyFaces( Proc) local dLen = Proc.Box:getDimX() + -- inizializzazione tabella con eventuali lavorazioni create a posteriori da ritornare al chiamante + local AddedIds = {} + -- recupero lunghezza grezzo totale da info sulla macchinata local dBarLen = EgtGetInfo( EgtGetCurrMachGroup(), 'BARLEN', 'd') local dOvmHead = b3Raw:getMax():getX() - b3Solid:getMax():getX() @@ -1269,6 +1273,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end end end + if Proc.bMoveAfterSplit then + nC = 1 + dStartDist = Proc.Box:getDimX() - ( dToolDiam / 2 + 5) + dEndDist = - ( dToolDiam / 2 + 5) + end if nIni == 2 then dStartDist, dEndDist = dEndDist, dStartDist dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist @@ -1380,6 +1389,19 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end end end + if not Proc.MoveAfterSplit and not bEndFixed and not bConvex then + -- recupero gruppo per geometria addizionale + local nAddGrpId = BL.GetAddGroup( nPartId) + if not nAddGrpId then + local sErr = 'Error : missing AddGroup' + EgtOutLog( sErr) + return false, sErr + end + local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + local AddProc = { Id = AddId, Grp = 0, Prc = 12, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId, bMoveAfterSplit = true} + Topology.Classify( AddProc, b3Raw) + table.insert( AddedIds, AddProc) + end -- altrimenti lavorazione di fianco : Long2CutSide o Long2CutDown else @@ -1822,8 +1844,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end end - return true, sWarn -end + return true, sWarn, nil, AddedIds +end --------------------------------------------------------------------- return ProcessLong2Cut