From bfaa85bbf20844212392ed1e2224c9a4ec2eea7b Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 14 Oct 2024 14:26:58 +0200 Subject: [PATCH] - in squadratura aggiunta gestione truciolatore e ritorno errori --- LuaLibs/WallExec.lua | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index 03da372..d1976e4 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -1107,9 +1107,9 @@ function Squaring.GetMachining( dDepth) end -- truciolatore if not Machining.sSquaring and ( nSquaringToolType == 0 or nSquaringToolType == 3) then - Machining.sSquaring = WM.FindMilling( 'Squaring', dDepth, nil, nil, nil, nil, false) + Machining.sSquaring = WM.FindMilling( 'Squaring', nil, nil, nil, nil, nil, nil, dDepth) if Machining.sSquaring then - Machining.sType = 'Milling' + Machining.sType = 'DiskMilling' end end @@ -1153,6 +1153,12 @@ function Squaring.CreateGeometry( RawPart, Machining) local nRightLineId = EgtLine( RawPart.nId, pt2, pt3, GDB_RT.GLOB) local nBackLinedId = EgtLine( RawPart.nId, pt3, pt4, GDB_RT.GLOB) local nLeftLineId = EgtLine( RawPart.nId, pt4, pt1, GDB_RT.GLOB) + if Machining.sType == 'DiskMilling' then + EgtModifyCurveExtrusion( nFrontLineId, -Y_AX(), GDB_RT.GLOB) + EgtModifyCurveExtrusion( nRightLineId, X_AX(), GDB_RT.GLOB) + EgtModifyCurveExtrusion( nBackLinedId, Y_AX(), GDB_RT.GLOB) + EgtModifyCurveExtrusion( nLeftLineId, -X_AX(), GDB_RT.GLOB) + end EgtSetName( nFrontLineId, 'SquaringGeometry' ) EgtSetName( nRightLineId, 'SquaringGeometry' ) EgtSetName( nBackLinedId, 'SquaringGeometry' ) @@ -1213,16 +1219,21 @@ end ------------------------------------------------------------------------------------------------------------- function Squaring.AddMachinings( Machining, SquaringGeometries, nFirstOperationId) + local nNotOkCount = 0 + local sMsgTotal = '' + for i = 1, #SquaringGeometries do local nSquaringOperationId = EgtAddMachining('SQUARING', Machining.sSquaring) EgtSetMachiningGeometry( SquaringGeometries[i].nId) -- in base al verso di percorrenza modifico i parametri significativi di lavorazione if Machining.bIsPathCW then - if Machining.sType == 'Sawing' then + if Machining.sType == 'Sawing'then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_SAW_WS.LEFT) EgtSetMachiningParam( MCH_MP.HEADSIDE, MCH_SAW_HS.LEFT) elseif Machining.sType == 'Milling' then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + elseif Machining.sType == 'DiskMilling' then + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) end EgtSetMachiningParam( MCH_MP.INVERT, true) else @@ -1231,12 +1242,21 @@ function Squaring.AddMachinings( Machining, SquaringGeometries, nFirstOperationI EgtSetMachiningParam( MCH_MP.HEADSIDE, MCH_SAW_HS.RIGHT) elseif Machining.sType == 'Milling' then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + elseif Machining.sType == 'DiskMilling' then + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) end EgtSetMachiningParam( MCH_MP.INVERT, false) end - EgtApplyMachining( true, false) + local bOk = EgtApplyMachining( true, false) EgtRelocateGlob( nSquaringOperationId, nFirstOperationId, GDB_IN.BEFORE) + if not bOk then + local _, sMsg = EgtGetLastMachMgrError() + nNotOkCount = nNotOkCount + 1 + sMsgTotal = sMsgTotal ..'\n' .. ( sMsg or '') + end end + + return ( nNotOkCount < 1), sMsgTotal end ------------------------------------------------------------------------------------------------------------- @@ -1401,7 +1421,15 @@ function WallExec.ProcessFeatures() local SquaringGeometries = Squaring.CreateGeometry( RawPart, Machining) -- applicazione lavorazioni - local bIsApplyOk = Squaring.AddMachinings( Machining, SquaringGeometries, nFirstOperationId) + local bIsApplyOk, sMsg = Squaring.AddMachinings( Machining, SquaringGeometries, nFirstOperationId) + if not bIsApplyOk then + nTotErr = nTotErr + 1 + table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=0, TaskId=0}) + elseif sMsg and #sMsg > 0 then + table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=0, TaskId=0}) + else + table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=0, TaskId=0}) + end -- pulizia sfridi alla prima lavorazione dopo la squadratura EgtSetCurrMachining( nFirstOperationId)