From 26753f8aabe1066487bf3e0f8ee01e2b72e0b275 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 19 Oct 2021 08:07:01 +0200 Subject: [PATCH] =?UTF-8?q?DataWall=20:=20-=20aggiunto=20controllo=20tipo?= =?UTF-8?q?=20lavorazione=20nelle=20ricerche=20-=20corretto=20controllo=20?= =?UTF-8?q?inclinazione=20tagli=20per=20essere=20lavorabili=20-=20in=20for?= =?UTF-8?q?atura=20nella=20ricerca=20dell'utensile/lavorazione=20si=20tien?= =?UTF-8?q?e=20conto=20della=20profondit=C3=A0=20del=20foro=20-=20in=20tag?= =?UTF-8?q?lio=20con=20lama=20possibilit=C3=A0=20di=20demandare=20lato=20m?= =?UTF-8?q?andrino=20a=20funzione=20di=20macchina=20WallData.GetSawHeadSid?= =?UTF-8?q?e=20-=20in=20chiodature=20aggiunta=20possibilit=C3=A0=20di=20la?= =?UTF-8?q?vorare=20in=20doppio=20con=20funzione=20di=20macchina=20WallDat?= =?UTF-8?q?a.FindFeaturesInDouble.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/WMachiningLib.lua | 40 ++++++++++++++++++++++++--------- LuaLibs/WProcessCut.lua | 2 +- LuaLibs/WProcessDrill.lua | 4 ++-- LuaLibs/WProcessFreeContour.lua | 24 ++++++++++++++++---- LuaLibs/WallExec.lua | 11 ++++++--- 5 files changed, 61 insertions(+), 20 deletions(-) diff --git a/LuaLibs/WMachiningLib.lua b/LuaLibs/WMachiningLib.lua index 63fc6d8..5653403 100644 --- a/LuaLibs/WMachiningLib.lua +++ b/LuaLibs/WMachiningLib.lua @@ -1,4 +1,4 @@ --- MachiningLib.lua by Egaltech s.r.l. 2021/09/17 +-- MachiningLib.lua by Egaltech s.r.l. 2021/10/18 -- Libreria ricerca lavorazioni per Pareti -- Tabella per definizione modulo @@ -36,10 +36,12 @@ function WMachiningLib.FindCutting( sType, dDepth) for i = 1, #Cuttings do local Cutting = Cuttings[i] if Cutting.On and Cutting.Type == sType and SetCurrMachiningAndTool( Cutting.Name) then + local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) local dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0 local dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or 0 local dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or 0 - if not dDepth or dSawMaxDepth > dDepth - 10 * GEO.EPS_SMALL then + if nMchType == MCH_MY.SAWING and + not dDepth or dSawMaxDepth > dDepth - 10 * GEO.EPS_SMALL then return Cutting.Name, dSawDiam, dSawThick, dSawMaxDepth end end @@ -51,12 +53,14 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID) for i = 1, #Millings do local Milling = Millings[i] if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then + local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) local sMyTuuid = EgtGetMachiningParam( MCH_MP.TUUID) local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, dTMaxMat, EgtTdbGetCurrToolMaxDepth()) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i') - if ( not sTuuid or sTuuid == sMyTuuid) and + if nMchType == MCH_MY.MILLING and + ( not sTuuid or sTuuid == sMyTuuid) and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and ( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then return Milling.Name, dTMaxDepth, dTMaxMat, dTDiam @@ -70,8 +74,10 @@ function WMachiningLib.FindNailing( nType) for i = 1, #Millings do local Milling = Millings[i] if Milling.On and Milling.Type == 'Nailing' and SetCurrMachiningAndTool( Milling.Name) then + local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) local sTName = EgtTdbGetCurrToolParam( MCH_TP.NAME) - if sTName == tostring( nType) then + if nMchType == MCH_MY.MILLING and + sTName == tostring( nType) then return Milling.Name end end @@ -83,10 +89,12 @@ function WMachiningLib.FindPocketing( sType, dMaxDiam, dDepth, nTool_ID) for i = 1, #Pocketings do local Pocketing = Pocketings[i] if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then + local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth()) local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i') - if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and + if nMchType == MCH_MY.POCKETING and + ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and ( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then return Pocketing.Name, dTDiam, dTMaxDepth @@ -100,20 +108,26 @@ function WMachiningLib.FindSawing( sType) for i = 1, #Sawings do local Sawing = Sawings[i] if Sawing.On and Sawing.Type == sType and SetCurrMachiningAndTool( Sawing.Name) then - return Sawing.Name + local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) + if nMchType == MCH_MY.MORTISING then + return Sawing.Name + end end end end --------------------------------------------------------------------- -function WMachiningLib.FindDrilling( dDiam) +function WMachiningLib.FindDrilling( dDiam, dDepth) -- ricerca sulle forature, dal diametro maggiore al minore for i = #Drillings, 1, -1 do local Drilling = Drillings[i] if Drilling.On and Drilling.Type == 'Drill' and SetCurrMachiningAndTool( Drilling.Name) then + local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) - if dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - WD.DRILL_TOL - 10 * GEO.EPS_SMALL then + if nMchType == MCH_MY.DRILLING and + dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - WD.DRILL_TOL - 10 * GEO.EPS_SMALL and + ( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) then return Drilling.Name, Drilling.Type, dTMaxMat end end @@ -122,9 +136,12 @@ function WMachiningLib.FindDrilling( dDiam) for i = #Drillings, 1, -1 do local Drilling = Drillings[i] if Drilling.On and Drilling.Type == 'Pocket' and SetCurrMachiningAndTool( Drilling.Name) then + local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth()) - if dTDiam < dDiam - 10 * GEO.EPS_SMALL then + if nMchType == MCH_MY.POCKETING and + dTDiam < dDiam - 10 * GEO.EPS_SMALL and + ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then return Drilling.Name, Drilling.Type, dTMaxDepth end end @@ -137,7 +154,10 @@ function WMachiningLib.FindSurfacing( sType) for i = 1, #Surfacings do local Surfacing = Surfacings[i] if Surfacing.On and Surfacing.Type == sType and SetCurrMachiningAndTool( Surfacing.Name) then - return Surfacing.Name + local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) + if nMchType == MCH_MY.SURFFINISHING then + return Surfacing.Name + end end end end diff --git a/LuaLibs/WProcessCut.lua b/LuaLibs/WProcessCut.lua index 2be55df..b485c8c 100644 --- a/LuaLibs/WProcessCut.lua +++ b/LuaLibs/WProcessCut.lua @@ -30,7 +30,7 @@ function WPC.Classify( Proc, b3Raw) if Proc.Fct ~= 1 then return false end -- controllo la normale local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - if abs( vtN:getZ()) < -0.5 then return false end + if abs( vtN:getZ()) < WD.NZ_MINA then return false end return true end diff --git a/LuaLibs/WProcessDrill.lua b/LuaLibs/WProcessDrill.lua index be9d054..225c460 100644 --- a/LuaLibs/WProcessDrill.lua +++ b/LuaLibs/WProcessDrill.lua @@ -96,9 +96,9 @@ function WPD.Make( Proc, nRawId, b3Raw) -- recupero la lavorazione local sDrilling, nType if dDiam < 200 then - sDrilling, nType = WM.FindDrilling( dDiam) + sDrilling, nType = WM.FindDrilling( dDiam, dLen) else - sDrilling = WM.FindMilling( 'FreeContour') + sDrilling = WM.FindMilling( 'FreeContour', dLen) nType = 'Mill' end if not sDrilling then diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 9a9df2b..e83f1a5 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1,4 +1,4 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/05 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/18 -- Gestione calcolo profilo libero per Pareti -- Tabella per definizione modulo @@ -1555,6 +1555,7 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick) end EgtSetInfo( nMchId, 'Part', Proc.PartId) local dSpeed = EgtGetMachiningParam( MCH_MP.SPEED) + local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) -- aggiungo geometria EgtSetMachiningGeometry( { { Proc.Id, vFace[i].Fac}}) -- assegno affondamento @@ -1570,8 +1571,10 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick) EgtSetMachiningParam( MCH_MP.INVERT, bInvert) -- imposto lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bInvert, MCH_SAW_WS.LEFT, MCH_SAW_WS.RIGHT)) - -- lato mandrino ( a sinistra se rotazione CCW, altrimenti a destra) - EgtSetMachiningParam( MCH_MP.HEADSIDE, EgtIf( dSpeed < 0, MCH_SAW_HS.LEFT, MCH_SAW_HS.RIGHT)) + -- lato mandrino ( standard a sinistra se rotazione CCW, altrimenti a destra, oppure da funzione di macchina) + local nHeadSide = EgtIf( dSpeed < 0, MCH_SAW_HS.LEFT, MCH_SAW_HS.RIGHT) + if WD.GetSawHeadSide then nHeadSide = WD.GetSawHeadSide( dSpeed, sHead) end + EgtSetMachiningParam( MCH_MP.HEADSIDE, nHeadSide) -- assegno i dati di attacco (sicurezza solo se angolo interno) local nLeadIn = MCH_SAW_LI.CENT if ( not bInvert and ( vFace[i].Type & 1) ~= 0) or ( bInvert and ( vFace[i].Type & 2) ~= 0) then @@ -1901,8 +1904,21 @@ local function MakeByNail( Proc, nRawId, b3Raw) EgtSetMachiningParam( MCH_MP.DEPTH, 10) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER) + -- se in doppio lungo Y, devo dimezzare opportunamente la lavorazione + if Proc.Double == 2 then + if Proc.Delta > 0 then + EgtSetMachiningParam( MCH_MP.ENDADDLEN, -abs( Proc.Delta) - 0.9 * dCntPar) + else + EgtSetMachiningParam( MCH_MP.STARTADDLEN, -abs( Proc.Delta) - 0.9 * dCntPar) + end + end -- assegno parametro a note utente - EgtSetMachiningParam( MCH_MP.USERNOTES, 'Par='..dCntPar..';') + local sUserNotes = 'Par=' .. EgtNumToString( dCntPar, 0) .. ';' + if Proc.Double and Proc.Double > 0 then + sUserNotes = sUserNotes .. 'Dbl=' .. EgtNumToString( Proc.Double, 0) .. ';' .. + 'Dlt=' .. EgtNumToString( Proc.Delta, 0) .. ';' + end + EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index 93b1261..ca7ab9b 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -1,4 +1,4 @@ --- WallExec.lua by Egaltech s.r.l. 2021/09/20 +-- WallExec.lua by Egaltech s.r.l. 2021/10/18 -- Libreria esecuzione lavorazioni per Pareti -- Tabella per definizione modulo @@ -229,9 +229,9 @@ local function PrintFeatures( vProc) EgtOutLog( ' *** Feature List ***') for i = 1, #vProc do local Proc = vProc[i] - local sOut = string.format( 'Part=%3d Proc=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s', + local sOut = string.format( 'Part=%3d Proc=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Fcse=%1d,%1d Diam=%.2f Fct=%2d Dbl=%2d Dlt=%.1f Box=%s', Proc.PartId, Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId, - Proc.Flg, Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box)) + Proc.Flg, Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, Proc.Double or 0, Proc.Delta or 0, tostring( Proc.Box)) EgtOutLog( sOut) end end @@ -426,6 +426,11 @@ function WallExec.ProcessFeatures() end -- classifico le feature ClassifyFeatures( vProc, b3Raw) + -- Eventuale determinazione delle feature lavorabili in parallelo (implementata nella configurazione macchina) + -- si impostano i flag Double (nil/0=no, 1=su X, 2=su Y) e Delta (offset tra T14 e T12 positivo o negativo) + if WD.FindFeaturesInDouble then + WD.FindFeaturesInDouble( vProc, b3Raw) + end -- debug if EgtGetDebugLevel() >= 1 then PrintFeatures( vProc)