From 6892759956aa5bd13199914924662deda05c7df7 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 17 Mar 2026 13:08:36 +0100 Subject: [PATCH] - in LapJoint per Q02 solo contorno sono ammessi anche i tunnel; aggiunti messagi in caso di lavorazione incompleta --- LuaLibs/ProcessLapJoint.lua | 91 ++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 22 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 98fc381..9b64a98 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -2423,7 +2423,8 @@ local function MakeContourByMill( Proc, idContourPath, vtTunnelDirection, dTunne local bMultipleHeadsAvailble = BD.DOWN_HEAD or BD.TWO_EQUAL_HEADS local bMillFromBottom = vtTunnelDirection:getZ() < BD.NZ_MINA local bMillFromBottomOpposite = -vtTunnelDirection:getZ() < BD.NZ_MINA - local sWarn = '' + local sApplyWarning = '' + local bIncomplete = false -- ricerca lavorazione lato principale local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not bMillFromBottom, bMillFromBottom) @@ -2511,7 +2512,7 @@ local function MakeContourByMill( Proc, idContourPath, vtTunnelDirection, dTunne -- si arriva al massimo raggiungibile else dDepth = Tool.MaxDepth - dTunnelDepth / 2 - dCollSic - sWarn = 'Warning : incomplete' + bIncomplete = true end -- non c'è lavorazione opposta else @@ -2521,7 +2522,7 @@ local function MakeContourByMill( Proc, idContourPath, vtTunnelDirection, dTunne -- si arriva al massimo raggiungibile else dDepth = Tool.MaxDepth - dTunnelDepth / 2 - dCollSic - sWarn = 'Warning : incomplete' + bIncomplete = true end end EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) @@ -2533,14 +2534,14 @@ local function MakeContourByMill( Proc, idContourPath, vtTunnelDirection, dTunne -- eseguo local bMillingOk if ML.ApplyMachining( true, false) then - _, sWarn = EgtGetMachMgrWarning( 0) + _, sApplyWarning = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( idMachining, false) end bMillingOk = true -- altrimenti lavorazione non applicata else - _, sWarn = EgtGetLastMachMgrError() + _, sApplyWarning = EgtGetLastMachMgrError() EgtSetOperationMode( idMachining, false) bMillingOk = false end @@ -2599,7 +2600,7 @@ local function MakeContourByMill( Proc, idContourPath, vtTunnelDirection, dTunne -- si arriva al massimo raggiungibile else dDepth = Tool.MaxDepth - dTunnelDepth / 2 - dCollSic - sWarn = 'Warning : incomplete' + bIncomplete = true end EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- Note utente con dichiarazione nessuna generazione sfridi per Vmill e massima elevazione @@ -2609,21 +2610,28 @@ local function MakeContourByMill( Proc, idContourPath, vtTunnelDirection, dTunne EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo if ML.ApplyMachining( true, false) then - _, sWarn = EgtGetMachMgrWarning( 0) + _, sApplyWarning = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( idMachining, false) end bMillingOppositeOk = true -- altrimenti lavorazione non applicata else - _, sWarn = EgtGetLastMachMgrError() + _, sApplyWarning = EgtGetLastMachMgrError() EgtSetOperationMode( idMachining, false) bMillingOppositeOk = false end end if bMillingOk or ( bOppositeMillingNeeded and bMillingOppositeOk) then - return true, sWarn + local sWarning = '' + if bIncomplete then + sWarning = 'Warning : machining incomplete' + end + if #sApplyWarning > 0 then + sWarning = sApplyWarning .. '\n' .. sWarning + end + return true, sWarning else local sErr = 'Error : Not applicable' return false, sErr @@ -6889,17 +6897,53 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if bForceChainsaw then -- ottengo le dimensioni del tunnel dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace = BL.GetTunnelDimension( Proc, nPartId) - -- lavoro fessura con svuotature (singola o doppia contrapposta) + -- se non richiesto solo contorno, lavoro fessura con svuotature (singola o doppia contrapposta) else - local sMyMchFind = 'Pocket' - local nOk, sErr - nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, - nLundIdFace, sErr = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, false, b3Solid, bClosedOrthoFaces) - if nOk < 0 then - return false, sErr - elseif nOk > 0 then - sWarn = sErr - bTryWithBlades = false + local bOnlyContour = ( EgtGetInfo( Proc.Id, Q_ONLY_CONTOUR, 'i') or 0) > 0 + if bOnlyContour then + if Proc.TopologyLongName == 'Tunnel-Through-RightAngles-Parallel-4' then + -- direzione e faccia aggiunta del tunnel (la groove-3 passante è uno pseudotunnel) + local _, _, dTunnelDepth, vtTunnelDirection, _, idAddedTunnelTmFace = BL.GetTunnelDimension( Proc, nPartId) + -- si tiene il verso del tunnel dal lato Z positiva + if vtTunnelDirection:getZ() < GEO.EPS_SMALL then + vtTunnelDirection = -vtTunnelDirection + EgtInvertSurf( idAddedTunnelTmFace) + end + -- estrazione del contorno da lavorare + local idContourPath = EgtExtractSurfTmLoops( idAddedTunnelTmFace, nAddGrpId) + EgtModifyCurveExtrusion( idContourPath, vtTunnelDirection, GDB_RT.GLOB) + -- spessore codolo da lasciare + local dDimStrip = EgtGetInfo( Proc.Id, Q_DIM_STRIP, 'd') + if dDimStrip < 10 * GEO.EPS_SMALL then + dDimStrip = 5 + end + -- lavorazione + local bOkContour, sWarn2 = MakeContourByMill( Proc, idContourPath, vtTunnelDirection, dTunnelDepth, dDimStrip, nPhase) + if bOkContour then + return true, sWarn2 + else + return false, sWarn2 + end + if sWarn2 then + if not sWarn then sWarn = '' end + sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2) + end + else + local sErr2 = 'Error : Cannot use ' .. Q_ONLY_CONTOUR .. ' on this feature' + return false, sErr2 + end + -- svuotatura + else + local sMyMchFind = 'Pocket' + local nOk, sErr + nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, + nLundIdFace, sErr = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, false, b3Solid, bClosedOrthoFaces) + if nOk < 0 then + return false, sErr + elseif nOk > 0 then + sWarn = sErr + bTryWithBlades = false + end end end -- Se la svuotatura precedente non è stata fatta e chamfer non è mutuamente esclusivo provo con la sega-catena @@ -7798,7 +7842,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end end -- in tutti gli altri casi, a meno che non sia forzata sega a catena, lancio la MakeByPockets - -- lavorazione singola o doppia contrapposta, fondo della tasca una faccia fittizia perpendicolare al lato lungo + -- se non richiesto solo contorno, lavorazione singola o doppia contrapposta, fondo della tasca una faccia fittizia perpendicolare al lato lungo elseif not bForceChainsaw then local bOnlyContour = ( EgtGetInfo( Proc.Id, Q_ONLY_CONTOUR, 'i') or 0) > 0 -- richiesto solo contorno @@ -7811,7 +7855,6 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa vtTunnelDirection = -vtTunnelDirection EgtInvertSurf( idAddedTunnelTmFace) end - -- elevazione della faccia aggiunta -- estrazione del contorno da lavorare local idContourPath = EgtExtractSurfTmLoops( idAddedTunnelTmFace, nAddGrpId) EgtModifyCurveExtrusion( idContourPath, vtTunnelDirection, GDB_RT.GLOB) @@ -7819,7 +7862,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa BL.SetOpenSide( idContourPath, b3Solid) BL.ChangeOrOpenStart( idContourPath, 2) -- spessore codolo da lasciare - local dDimStrip = EgtGetInfo( Proc.Id, Q_DIM_STRIP, 'd') or 5 + local dDimStrip = EgtGetInfo( Proc.Id, Q_DIM_STRIP, 'd') + if dDimStrip < 10 * GEO.EPS_SMALL then + dDimStrip = 5 + end + -- lavorazione local bOkContour, sWarn2 = MakeContourByMill( Proc, idContourPath, vtTunnelDirection, dTunnelDepth, dDimStrip, nPhase) if bOkContour then return true, sWarn2