From ceb52fbe22fbda2ade81ba86f8331c852c2e7c2b Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 13 Apr 2022 15:58:28 +0200 Subject: [PATCH 1/9] DataBeam : - in LapJoint eliminati parametri Q non utilizzati di 3/4-020-X. --- LuaLibs/ProcessLapJoint.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index f9ce87f..2b5f248 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -64,8 +64,6 @@ local Q_DEPTH_CHAMFER = '' -- d local Q_ONLY_CHAMFER = '' -- i local Q_USE_MILL = '' -- i local Q_USE_ROUGH_TOOL = '' -- i -local Q_USE_ROUGH_TOOL_B90 = '' -- i -local Q_USE_ROUGH_TOOL_B0 = '' -- i local Q_BORE_ON_CORNER = '' -- 1 local Q_CONTOUR_SMALL_TOOL = '' -- i local Q_ONLY_CONTOUR = '' -- i @@ -105,8 +103,6 @@ local function AssignQIdent( Proc) Q_ONLY_CHAMFER = '' Q_USE_MILL = '' Q_USE_ROUGH_TOOL = '' - Q_USE_ROUGH_TOOL_B90 = '' - Q_USE_ROUGH_TOOL_B0 = '' Q_BORE_ON_CORNER = '' Q_CONTOUR_SMALL_TOOL = '' Q_ONLY_CONTOUR = '' @@ -125,8 +121,6 @@ local function AssignQIdent( Proc) Q_DEPTH_CHAMFER = 'Q01' -- d Q_USE_MILL = 'Q02' -- i Q_USE_ROUGH_TOOL = 'Q03' -- i - Q_USE_ROUGH_TOOL_B90 = 'Q04' -- i - Q_USE_ROUGH_TOOL_B0 = 'Q05' -- i Q_BORE_ON_CORNER = 'Q06' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 25 then Q_BORE_ON_CORNER = 'Q01' -- i From d6485ddc0da6972729036daef7a80b03a623c115 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 19 Apr 2022 11:31:42 +0200 Subject: [PATCH 2/9] DataBeam : - prime modifiche per TURN in tagli con lama - allargata inclinazione verso il basso permessa sui tenoni. --- LuaLibs/FacesBySaw.lua | 6 ++++-- LuaLibs/ProcessDtTenon.lua | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 0417cb9..0678543 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -142,13 +142,15 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw -- posizione braccio EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3) local nSCC = MCH_SCC.NONE - --if not BD.C_SIMM or vtRef:getZ() < 0.866 or abs( vtTg:getZ()) > 0.02 then + if not BD.TURN then if abs( vtAux:getX()) > abs( vtAux:getY()) - GEO.EPS_SMALL then nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) else nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) end - --end + else + nSCC = MCH_SCC.ADIR_ZP + end -- inserisco la lavorazione di taglio local sName = 'Cut_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_' .. tostring( nFacet + 1) local nMchFId = EgtAddMachining( sName, sCutting) diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index 052fe30..264e90f 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -1,6 +1,7 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2022/02/10 +-- ProcessTenon.lua by Egaltech s.r.l. 2022/04/14 -- Gestione calcolo tenone a coda di rondine per Travi -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. +-- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF. -- Tabella per definizione modulo local ProcessDtTenon = {} @@ -24,36 +25,36 @@ local function VerifyOrientation( Proc, vtN, b3Raw) return true end -- se trave molto bassa - if b3Raw:getDimZ() <= 120 then + if b3Raw:getDimZ() < 121 then -- se tenone praticamente in asse, accetto fino a -45 deg - if abs( vtN:getY()) < 0.04 then + if abs( vtN:getY()) < 0.088 then return ( vtN:getZ() >= -0.7072) -- altrimenti accetto fino a -30deg else return ( vtN:getZ() >= -0.51) end -- se trave bassa - elseif b3Raw:getDimZ() <= 200 then + elseif b3Raw:getDimZ() < 201 then -- se tenone praticamente in asse, accetto fino a -30 deg - if abs( vtN:getY()) < 0.04 then + if abs( vtN:getY()) < 0.088 then return ( vtN:getZ() >= -0.51) - -- altrimenti accetto fino a -20deg + -- altrimenti accetto fino a -21deg else - return ( vtN:getZ() >= -0.343) + return ( vtN:getZ() >= -0.359) end -- se trave medio-bassa - elseif b3Raw:getDimZ() <= 280 then + elseif b3Raw:getDimZ() < 281 then -- se tenone praticamente in asse, accetto fino a -25 deg - if abs( vtN:getY()) < 0.04 then + if abs( vtN:getY()) < 0.088 then return ( vtN:getZ() >= -0.422) -- altrimenti, accetto fino a -15 deg else return ( vtN:getZ() >= -0.259) end -- se trave media - elseif b3Raw:getDimZ() <= 350 then + elseif b3Raw:getDimZ() < 351 then -- se tenone praticamente in asse, accetto fino a -22 deg - if abs( vtN:getY()) < 0.04 then + if abs( vtN:getY()) < 0.088 then return ( vtN:getZ() >= -0.375) -- altrimenti, accetto fino a -10 deg else From 2fc1e705895d2e83b0f1118cfe63d6d04783dc43 Mon Sep 17 00:00:00 2001 From: gitlab Date: Wed, 20 Apr 2022 10:18:03 +0000 Subject: [PATCH 3/9] spostato cartella Artifacts su Qnap --- .gitlab-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ab52ea9..e095e45 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,8 @@ variables: NEW_REL: '' NET_SHARE_R: '\\10.74.82.50\EgtTech' NET_USER: '10.74.82.50\Server' - NET_SHARE_Z: '\\10.74.82.201\Artifacts' + NET_SHARE_Z: '\\10.74.82.200\Artifacts' + NET_USERQ: 'steamw\egalware' #Note compilazione LUA: # lua53 -o 32\$FileName -s $FileName: -o = output, -s = NON include i debug symbols @@ -84,7 +85,7 @@ variables: .ReplicaZ: &ReplicaZ - | net use Z: /delete - net use Z: $env:NET_SHARE_Z + net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD ROBOCOPY /MIR 32 Z:\EgtData\$env:APP_NAME\32 ROBOCOPY /MIR 64 Z:\EgtData\$env:APP_NAME\64 ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\32\Images @@ -108,4 +109,4 @@ LuaCompile:build: - *CodeReplicaR - *ReplicaR - *ReplicaZ - \ No newline at end of file + From e0e9b7b08986df6e28f02b88521bf43eca9a47d9 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 22 Apr 2022 10:13:45 +0200 Subject: [PATCH 4/9] DataBeam : - modifiche per gestire macchina Turn (BD.TURN) - corretto riconoscimento fori di coda. --- LuaLibs/BeamExec.lua | 6 +++--- LuaLibs/FacesBySaw.lua | 6 +++++- LuaLibs/ProcessDrill.lua | 11 ++++++----- LuaLibs/ProcessHeadCut.lua | 2 +- LuaLibs/ProcessLapJoint.lua | 10 +++++----- LuaLibs/ProcessSplit.lua | 2 +- LuaLibs/ProcessTenon.lua | 4 ++-- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 5ed5705..e100eb6 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1225,7 +1225,7 @@ function BeamExec.ProcessFeatures() -- eventuale spostamento fori sui tenoni MoveDrillsOnTenon( vProc) -- se richiesto ribaltamento (oppure rotazione) - if ( bSomeDown or bSomeSide) and not BD.DOWN_HEAD then + if ( bSomeDown or bSomeSide) and not BD.DOWN_HEAD and not BD.TURN then -- ribalto le travi della fase corrente local nRId = nRawId while nRId do @@ -1285,7 +1285,7 @@ function BeamExec.ProcessFeatures() EgtSetInfo( nDispId, 'ORD', nOrd) end -- se richiesta rotazione - if bSomeSide and not BD.DOWN_HEAD then + if bSomeSide and not BD.DOWN_HEAD and not BD.TURN then -- vettore movimento grezzi per rotazione di 90deg local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ() local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2) @@ -1359,7 +1359,7 @@ function BeamExec.ProcessFeatures() for i = 1, #vProc do -- creo la lavorazione local Proc = vProc[i] - if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD) then + if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw) if not bOk then nTotErr = nTotErr + 1 diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 0678543..ad27a4c 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -149,7 +149,11 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) end else - nSCC = MCH_SCC.ADIR_ZP + if abs( vtOut:getY()) > abs( vtOut:getZ()) then + nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) + else + nSCC = MCH_SCC.ADIR_ZP + end end -- inserisco la lavorazione di taglio local sName = 'Cut_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_' .. tostring( nFacet + 1) diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 3d78d1c..ed4e289 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2022/03/29 +-- ProcessDrill.lua by Egaltech s.r.l. 2022/04/21 -- Gestione calcolo forature per Travi -- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile. -- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto. @@ -6,6 +6,7 @@ -- 2021/10/29 DS MaxElev anche su fori con svuotatura. -- 2022/03/26 DS Correzioni per fori testa-fianco nel piano. -- 2022/03/29 DS Corretta assegnazione fori molto inclinati fianco/coda a coda. +-- 2022/04/21 DS Corretto riconoscimento fori di coda. -- Tabella per definizione modulo local ProcessDrill = {} @@ -67,8 +68,8 @@ function ProcessDrill.IsTailFeature( Proc, b3Raw) end local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) -- se entrata principale + local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0 if ( Proc.Flg == 2 or ( Proc.Flg == 1 and vtExtr:getZ() >= BD.DRILL_VZ_MIN)) and ( nFcs == 5 or nFcs == 6 or abs( vtExtr:getX()) < BD.DRILL_VX_MAX) then - local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0 return ( ( nFcs == 5 or nFcs == 6) and vtExtr:getX() < -0.5) -- altrimenti entrata opposta else @@ -148,13 +149,13 @@ function ProcessDrill.Classify( Proc, b3Raw) return false, false, false end local bOpen = ( Proc.Fce ~= 0) - local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD) and ( Proc.Flg == 2 or Proc.Flg == -2)))) + local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and ( Proc.Flg == 2 or Proc.Flg == -2)))) -- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then if not bOpen then return true, true, false else - return true, not ( BD.ROT90 or BD.DOWN_HEAD), ( BD.ROT90 or BD.DOWN_HEAD) + return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) end else return true, false, false @@ -392,7 +393,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) end -- imposto posizione braccio porta testa local nSCC = MCH_SCC.NONE - if not BD.C_SIMM then + if not BD.C_SIMM and not BD.TURN then nSCC = MCH_SCC.ADIR_YM if AreSameVectorApprox( vtExtr, Z_AX()) then nSCC = MCH_SCC.ADIR_YM diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 2459acb..cac9da3 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -170,7 +170,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut end local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) -- caratteristiche taglio - local bHorizCut = ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) + local bHorizCut = (( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM) local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 2b5f248..210685a 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -682,7 +682,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw) local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or ( vtN[1]:getZ() < BD.NZ_MINA and vtN[2]:getZ() < 0.5 and ( vtN[2]:getZ() < -0.1 or not bSmall)) or ( vtN[2]:getZ() < BD.NZ_MINA and vtN[1]:getZ() < 0.5 and ( vtN[1]:getZ() < -0.1 or not bSmall)) - bDown = ( bDown and not BD.DOWN_HEAD) + bDown = ( bDown and not BD.DOWN_HEAD and not BD.TURN) return true, bDown -- se più di 2 facce else @@ -772,7 +772,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw) local nFaceAdj = GetFaceAdj( Proc, nFacInd, dH, dV) or -1 local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2) -- verifico se è lavorabile solo dal basso - local bDown = ( vtN:getZ() < BD.NZ_MINA and not BD.DOWN_HEAD) + local bDown = ( vtN:getZ() < BD.NZ_MINA and not BD.DOWN_HEAD and not BD.TURN) -- se verso il basso, verifico se utilizzabile seconda faccia if bDown then if nFacInd2 and dElev2 < 2 * dElev then @@ -917,7 +917,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) local bFaceOk = {} bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB) bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB) - if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then + if not bDownHead and not BD.TURN and not bFaceOk[1] and not bFaceOk[2] then local sErr = 'Error : LapJoint from bottom impossible' EgtOutLog( sErr) return false, sErr @@ -3276,7 +3276,7 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) -- imposto posizione braccio porta testa local nSCC = MCH_SCC.NONE - if not BD.C_SIMM then + if not BD.C_SIMM and not BD.TURN then nSCC = MCH_SCC.ADIR_YM if AreSameVectorApprox( tvtN[2], Z_AX()) then nSCC = MCH_SCC.ADIR_YM @@ -4745,7 +4745,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end -- verifico non sia orientata verso il basso o ci sia una testa dal basso local bFaceDown = ( vtN:getZ() < BD.NZ_MINA) - if bFaceDown and not BD.DOWN_HEAD then + if bFaceDown and not BD.DOWN_HEAD and not BD.TURN then local sErr = 'Error : LapJoint from bottom impossible' EgtOutLog( sErr) return false, sErr diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 505a7a2..af7488e 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -170,7 +170,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId) end local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) -- caratteristiche taglio - local bHorizCut = ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) + local bHorizCut = (( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM) local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index 7922b7f..2e650b0 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -99,7 +99,7 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr) end -- imposto posizione braccio porta testa local nSCC = MCH_SCC.NONE - if not BD.C_SIMM then + if not BD.C_SIMM and not BD.TURN then nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) @@ -298,7 +298,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- imposto posizione braccio porta testa local nSCC = MCH_SCC.NONE - if not BD.C_SIMM then + if not BD.C_SIMM and not BD.TURN then nSCC = MCH_SCC.ADIR_YM if abs( vtExtr:getY()) > 0.088 then nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) From 3c7c2f9c1daf6e5ab9a0eb31d737d8309acb1ddb Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 27 Apr 2022 00:06:44 +0200 Subject: [PATCH 5/9] DataBeam : - in ProcesslapJoint feature L025 sempre con fresa se di forma canonica. --- LuaLibs/ProcessLapJoint.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 210685a..ac3656b 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -547,7 +547,7 @@ local function CalcCollisionSafety( vtDir) dCollSic = 1 * BD.COLL_SIC elseif abs( vtDir:getX()) > 0.89 or abs( vtDir:getY()) > 0.89 or abs( vtDir:getZ()) > 0.89 then dCollSic = 2.5 * BD.COLL_SIC - elseif abs( vtDir:getX()) > 0.866 or abs( vtDir:getY()) > 0.866 or abs( vtDir:getZ()) > 0.866 then + elseif abs( vtDir:getX()) > 0.86 or abs( vtDir:getY()) > 0.86 or abs( vtDir:getZ()) > 0.86 then dCollSic = 4 * BD.COLL_SIC elseif abs( vtDir:getX()) > 0.707 or abs( vtDir:getY()) > 0.707 or abs( vtDir:getZ()) > 0.707 then dCollSic = 5.5 * BD.COLL_SIC @@ -4865,7 +4865,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- bMillDown = false --end if sMyPocketing and - ( dMyTMaxDepth > dFacElev + dCollSic - 10 * GEO.EPS_SMALL or ( dMyTMaxDepth > 0.8 * dFacElev + dCollSic and not bIsU) or ( bIsL and nUseRoughTool == 0)) then + ( dMyTMaxDepth > dFacElev + dCollSic - 10 * GEO.EPS_SMALL or ( dMyTMaxDepth > 0.8 * dFacElev + dCollSic and not bIsU) or ( bIsL and nUseRoughTool == 0) or + ( Proc.Prc == 25 and not bIsU and not bIsL)) then sPocketing = sMyPocketing end if bMillDown then From 5d23b2fde2cf5461932b69f0fb0fc63c0ba619f0 Mon Sep 17 00:00:00 2001 From: DarioS Date: Thu, 28 Apr 2022 10:23:30 +0200 Subject: [PATCH 6/9] DataBeam : - in generazione CN aggiunta info se programma a 64bit. --- BatchProcess.lua | 8 +++++--- BatchProcessNew.lua | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/BatchProcess.lua b/BatchProcess.lua index 2983ed7..f41ad50 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -1,4 +1,4 @@ --- BatchProcess.lua by Egaltech s.r.l. 2021/08/04 +-- BatchProcess.lua by Egaltech s.r.l. 2022/04/28 -- Gestione calcolo batch disposizione e lavorazioni per Travi -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita. @@ -22,6 +22,7 @@ -- 2021/02/25 Aggiunta gestione tipo scarico (standard, lav. incomplete, a caduta). -- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN. -- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste. +-- 2022/04/28 In info generazione aggiunta indicazione se 64bit. -- Intestazioni require( 'EgtBase') @@ -521,10 +522,11 @@ end -- *** Genero programma CN *** ( se richiesto) if BEAM.FLAG == 0 or BEAM.FLAG == 4 then EgtOutLog( ' +++ Generating NC part program >>>') - local sInfo = 'EgtCAM5 - ' + local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '') if EgtGetExeVersion then - sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - ' + sInfo = sInfo .. ' ver.' .. EgtGetExeVersion() end + sInfo = sInfo .. ' - ' if not EgtGenerate( '', sInfo .. sNgeFile) then BEAM.ERR = 20 local _, sName, _ = EgtSplitPath( BEAM.FILE) diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 70fb0c9..7469ad1 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -1,4 +1,4 @@ --- BatchProcessNew.lua by Egaltech s.r.l. 2022/02/09 +-- BatchProcessNew.lua by Egaltech s.r.l. 2022/04/28 -- Gestione calcolo batch disposizione e lavorazioni per Travi -- 2021/01/07 Per nuova interfaccia Egt. -- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5). @@ -9,6 +9,7 @@ -- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste. -- 2022/01/07 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo. -- 2022/02/09 Aggiornato come Wall per gestione errori e verifica attrezzaggio utensili. +-- 2022/04/28 In info generazione aggiunta indicazione se 64bit. -- Intestazioni require( 'EgtBase') @@ -621,10 +622,11 @@ end -- *** Genero programma CN *** ( se richiesto) if BEAM.FLAG == 0 or BEAM.FLAG == 4 then EgtOutLog( ' +++ Generating NC part program >>>') - local sInfo = 'EgtCAM5 - ' + local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '') if EgtGetExeVersion then - sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - ' + sInfo = sInfo .. ' ver.' .. EgtGetExeVersion() end + sInfo = sInfo .. ' - ' if not EgtGenerate( '', sInfo .. sNgeFile) then BEAM.ERR = 20 local _, sName, _ = EgtSplitPath( BEAM.FILE) From 14423b39f9965eec59c0d4dcabc75f540cd7d9ea Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 29 Apr 2022 08:04:21 +0200 Subject: [PATCH 7/9] DataBeam : - in ProcessLapJoint lavorazione BH forzata sempre OneWay. --- LuaLibs/ProcessLapJoint.lua | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index ac3656b..6b1d313 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2022/03/29 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/04/28 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -39,6 +39,7 @@ -- 2022/03/18 Corretta lavorazione BH. -- 2022/03/21 Quando si usa lama uso Q10 come massima elevazione. -- 2022/03/29 Aggiunta gestione antischeggia con Q06 anche su 3/4-033-X. +-- 2022/04/28 Lavorazione BH forzata sempre OneWay. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -4558,25 +4559,20 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa EgtSetMachiningParam( MCH_MP.LIPERP, dFacElev + BD.CUT_SIC) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI) else + EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0) EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + BD.CUT_SIC) EgtSetMachiningParam( MCH_MP.LIPERP, 0) - if ( nStep % 2) == 1 then - EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.LINEAR) - EgtSetMachiningParam( MCH_MP.LOTANG, 0) - else - EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) - EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + b3Raw:getDimY() + BD.CUT_SIC)) - end + EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0) + EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) + EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + b3Raw:getDimY() + BD.CUT_SIC)) EgtSetMachiningParam( MCH_MP.LOPERP, dFacElev + BD.COLL_SIC) if bDouble then EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dH / 2) - if ( nStep % 2) == 0 then - EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + b3Raw:getDimY() + dH / 2 + BD.CUT_SIC)) - end + EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + dH / 2 + BD.CUT_SIC)) end end -- tipo passate multiple - local nStepType = EgtIf( ( Proc.HeadDir and vtN:getY() < -0.5) or ( not Proc.HeadDir and vtN:getY() > 0.5), MCH_MILL_ST.ONEWAY, MCH_MILL_ST.ZIGZAG) + local nStepType = MCH_MILL_ST.ONEWAY EgtSetMachiningParam( MCH_MP.STEPTYPE, nStepType) -- imposto posizione braccio porta testa local nSCC = EgtIf( ( vtN:getY() > 0.5 or ( bHeadDir and vtN:getZ() > 0.5 ) or ( not bHeadDir and vtN:getZ() < -0.5)), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) From 6e0c482dab1f6009273ad11b03c353a74556b779 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 6 May 2022 17:03:30 +0200 Subject: [PATCH 8/9] =?UTF-8?q?DataBeam=20:=20-=20nell'ordinamento=20quand?= =?UTF-8?q?o=20si=20confrontano=20i=20box=20delle=20feature=20aggiunta=20v?= =?UTF-8?q?erifica=20preliminare=20della=20loro=20validit=C3=A0=20-=20ulte?= =?UTF-8?q?riore=20limitazione=20a=20GetNzLimDownUp=20per=20FAST=20-=20mig?= =?UTF-8?q?liorato=20calcolo=20larghezza=20DtMortise=20-=20in=20ProcessLap?= =?UTF-8?q?Joint=20corretta=20classificazione=20due=20facce=20sotto=20e=20?= =?UTF-8?q?modificati=20criteri=20assegnazione=20due=20facce=20alla=20coda?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/BeamExec.lua | 21 +++++++++++++++------ LuaLibs/BeamLib.lua | 5 +++-- LuaLibs/ProcessDtMortise.lua | 8 +++----- LuaLibs/ProcessLapJoint.lua | 28 ++++++++++++++++++---------- LuaLibs/ProcessLongDoubleCut.lua | 4 ++-- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index e100eb6..9dc9dcf 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,4 +1,4 @@ --- BeamExec.lua by Egaltech s.r.l. 2021/12/20 +-- BeamExec.lua by Egaltech s.r.l. 2022/05/04 -- Libreria esecuzione lavorazioni per Travi -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato. @@ -25,6 +25,7 @@ -- 2021/11/27 House mortise sempre prima di (dt)mortise, house tenon sempre dopo (dt)tenon. -- 2021/12/15 Corretta CompareFeature (risultato deve essere simmetrico scambiando le feature). -- 2021/12/20 Ulteriore correzione a CompareFeature (caso con entrambe senza geometria). +-- 2022/05/04 Nell'ordinamento quando si confrontano i box delle feature aggiunta verifica preliminare della loro validità. -- Tabella per definizione modulo local BeamExec = {} @@ -657,10 +658,13 @@ local function OrderFeatures( vProc, b3Raw) end for i = 1, #vProc do local ProcI = vProc[i] - if ProcI.Prc == 40 then + if ProcI.Prc == 40 and + ProcI.Box and not ProcI.Box:isEmpty() then for j = i + 1, #vProc do local ProcJ = vProc[j] - if ProcJ.Prc == 40 and ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and + if ProcJ.Prc == 40 and + ProcJ.Box and not ProcJ.Box:isEmpty() and + ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and abs( ProcJ.Diam - ProcI.Diam) < 1.0 and abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dDrillRange then if j > i + 1 then local ProcK = vProc[i+1] @@ -694,10 +698,12 @@ local function OrderFeatures( vProc, b3Raw) local dMarkRange = 300 for i = 1, #vProc do local ProcI = vProc[i] - if ProcI.Prc == 60 or ProcI.Prc == 61 or ProcI.Prc == 959 then + if ( ProcI.Prc == 60 or ProcI.Prc == 61 or ProcI.Prc == 959) and + ProcI.Box and not ProcI.Box:isEmpty() then for j = i + 1, #vProc do local ProcJ = vProc[j] if ( ProcJ.Prc == 60 or ProcJ.Prc == 61 or ProcJ.Prc == 959) and + ProcJ.Box and not ProcJ.Box:isEmpty() and ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dMarkRange then if j > i + 1 then @@ -712,10 +718,13 @@ local function OrderFeatures( vProc, b3Raw) local dBHHLRange = 100 for i = 1, #vProc do local ProcI = vProc[i] - if ProcI.Prc == 37 then + if ProcI.Prc == 37 and + ProcI.Box and not ProcI.Box:isEmpty() then for j = i + 1, #vProc do local ProcJ = vProc[j] - if ProcJ.Prc == 37 and abs( ProcI.Box:getCenter():getX() - ProcJ.Box:getCenter():getX()) < dBHHLRange then + if ProcJ.Prc == 37 and + ProcJ.Box and not ProcJ.Box:isEmpty() and + abs( ProcI.Box:getCenter():getX() - ProcJ.Box:getCenter():getX()) < dBHHLRange then if ProcI.HeadDir then if ProcJ.vtN:getY() < -0.5 then table.insert( vProc, i, table.remove( vProc, j)) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 2dbb682..7d16652 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,4 +1,4 @@ --- BeamLib.lua by Egaltech s.r.l. 2022/04/05 +-- BeamLib.lua by Egaltech s.r.l. 2022/05/03 -- Libreria globale per Travi -- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto. -- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm. @@ -10,6 +10,7 @@ -- 2021/09/12 Aggiustamenti in GetNearestParalOpposite e GetNearestOrthoOpposite. -- 2022/01/11 In GetNearest*Opposite ridotto vantaggio XY rispetto a Z da 1 -> 0.9 a 1 -> 0.99. -- 2022/04/05 Modifiche a GetNzLimDownUp per FAST. +-- 2022/05/03 Ulteriore limitazione a GetNzLimDownUp per FAST. -- Tabella per definizione modulo local BeamLib = {} @@ -695,7 +696,7 @@ function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho) if b3Raw:getDimZ() < 200 then return -0.5 elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then - return -0.258 + return -0.240 else return -0.174 end diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index 1dc409a..de29e1a 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -1,4 +1,4 @@ --- ProcessDtMortise.lua by Egaltech s.r.l. 2022/03/23 +-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/05/01 -- Gestione calcolo mortase a coda di rondine per Travi -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto. @@ -91,8 +91,6 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId) if not NewAuxId then return end -- ne allungo gli estremi - --EgtExtendCurveStartByLen( NewAuxId, 100) - --EgtExtendCurveEndByLen( NewAuxId, 100) EgtAddCurveCompoLineTg( NewAuxId, 100, false) EgtAddCurveCompoLineTg( NewAuxId, 100, true) EgtMergeCurvesInCurveCompo( NewAuxId) @@ -150,7 +148,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) return false, sErr end -- determino l'altezza della mortasa (0=faccia di fondo) - local rfDtMrt = Frame3d( ptBC, vtExtr) + local rfDtMrt, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB) local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt) local dAltMort = b3DtMrt:getDimZ() -- verifico se di tipo pocket @@ -395,7 +393,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB) vtAx:normalize() local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx - local dDist = vtOrtDiff:len() + local dDist = min( vtOrtDiff:len(), dWidthMrt) -- calcolo le passate local nPass = ceil( dDist / ( 1.9 * dToolDiam)) local dStep = ( dDist - 0.95 * dToolDiam) / ( 2 * nPass) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 6b1d313..5c12c40 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2022/04/28 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/05/04 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -40,6 +40,7 @@ -- 2022/03/21 Quando si usa lama uso Q10 come massima elevazione. -- 2022/03/29 Aggiunta gestione antischeggia con Q06 anche su 3/4-033-X. -- 2022/04/28 Lavorazione BH forzata sempre OneWay. +-- 2022/05/04 Corretta classificazione due facce sotto. Modificati criteri assegnazione due facce alla coda. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -606,7 +607,7 @@ end function ProcessLapJoint.IsTailFeature( Proc, b3Raw) -- se una sola faccia if Proc.Fct == 1 then - local _, vtN0 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + local vtN0 = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) if vtN0:getX() < -0.1 then return true end @@ -617,7 +618,6 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) local bUseBHSideMill, bHead, bHeadDir = VerifyBHSideMill( Proc) if bUseBHSideMill then Proc.HeadDir = bHeadDir - --return not bHead end -- recupero box del pezzo local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL) @@ -627,8 +627,9 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) if dEndDist > BD.MAX_DIST_HTFEA then return false end - -- la sua lunghezza non deve superare il massimo e 60% della lunghezza della trave - if Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.6 * b3Raw:getDimX()) then + -- se lunga come trave, oppure non è trave corta e la sua lunghezza supera il massimo o il 60% della lunghezza della trave + if Proc.Box:getDimX() > b3Solid:getDimX() - 1 or + ( b3Solid:getDimX() > BD.LEN_SHORT_PART and Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.6 * b3Solid:getDimX())) then return false end -- se una o due facce e interessa veramente la coda, allora di coda @@ -660,7 +661,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw) -- se 1 faccia if Proc.Fct == 1 then -- dati della faccia - local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + --local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- verifico se è lavorabile solo dal basso --local bDown = ( vtN:getZ() < BD.NZ_MINA) --return true, bDown @@ -673,13 +674,14 @@ function ProcessLapJoint.Classify( Proc, b3Raw) return true, false end -- dati delle facce - local ptC = {} local vtN = {} - ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) + vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) + vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) -- verifico se è lavorabile solo dal basso + local vtParX = vtN[1] ^ vtN[2] ; vtParX:normalize() + local bParX = ( abs( vtParX:getX()) > 0.985) local bSmall = ( ( Proc.Head or Proc.Tail) and Proc.Box:getDimX() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ())) or - ( not ( Proc.Head or Proc.Tail) and Proc.Box:getDimY() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ())) + ( not ( Proc.Head or Proc.Tail) and bParX and Proc.Box:getDimY() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ())) local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or ( vtN[1]:getZ() < BD.NZ_MINA and vtN[2]:getZ() < 0.5 and ( vtN[2]:getZ() < -0.1 or not bSmall)) or ( vtN[2]:getZ() < BD.NZ_MINA and vtN[1]:getZ() < 0.5 and ( vtN[1]:getZ() < -0.1 or not bSmall)) @@ -4395,6 +4397,12 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa bClosedOrthoFaces = false -- non setto come tunnel end end + -- se proviene da divisione in parti lungo X ed è un tunnel non è fattibile + if not bSinglePart and bClosedOrthoFaces then + local sErr = 'Error : long splitted tunnel not feasible' + EgtOutLog( sErr) + return false, sErr + end -- verifico se sono presenti i parametri Q per la profondità smusso e -- per eseguire in esclusiva solo lo smusso local nChamfer, dDepthCham, sErrCham, bForceUseBlade = EvaluateQParam( Proc) diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index d013981..0d7d12c 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -318,7 +318,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- analisi del taglio local vOrd = {} local vFaceUse = {} - if nSide == 1 or ( nSide == -1 and BD.DOWN_HEAD) then + if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} elseif nSide == -1 then @@ -368,7 +368,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- verifico se posso usare lame local bCanUseBlade, bCanUseUnderBlade = CalcBladeUse( bUseBlade, BD.DOWN_HEAD, nSide, vtN[1], vtN[2], bConvex) -- introduco messaggi di errore in caso sia settata la lama ma impossibile utilizzarla - -- se si toglie questa parte il processo continua utilizzandi però la fresa ma per il vincolo del parametro Q non è possibile + -- se si toglie questa parte il processo continua utilizzando però la fresa ma per il vincolo del parametro Q non è possibile if bUseBlade and not BD.DOWN_HEAD and not bCanUseBlade then local sErr = 'Error, impossible use blade on too negative face' EgtOutLog( sErr) From b51487f5afef35b0c7628658fcfb0c9676cb616c Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 9 May 2022 20:42:45 +0200 Subject: [PATCH 9/9] =?UTF-8?q?DataBeam=20:=20-=20modifiche=20per=20ottimi?= =?UTF-8?q?zzazione=20con=20pi=C3=B9=20teste=20-=20modifiche=20per=20compi?= =?UTF-8?q?lazione.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 + BatchProcess.lua | 3 +- BatchProcessNew.lua | 3 +- Compile.bat | 99 +++++++ LuaLibs/FacesBySaw.lua | 4 +- LuaLibs/MachiningLib.lua | 437 ++++++++++++++++++++++------ LuaLibs/ProcessChamfer.lua | 4 +- LuaLibs/ProcessCut.lua | 11 +- LuaLibs/ProcessDecor.lua | 2 +- LuaLibs/ProcessDoubleCut.lua | 13 +- LuaLibs/ProcessDovetail.lua | 6 +- LuaLibs/ProcessDrill.lua | 36 +-- LuaLibs/ProcessDtMortise.lua | 22 +- LuaLibs/ProcessDtTenon.lua | 9 +- LuaLibs/ProcessFreeContour.lua | 10 +- LuaLibs/ProcessHeadCut.lua | 6 +- LuaLibs/ProcessLapJoint.lua | 115 ++++---- LuaLibs/ProcessLapJointNew.lua | 93 +++--- LuaLibs/ProcessLongCut.lua | 36 +-- LuaLibs/ProcessLongDoubleCut.lua | 34 +-- LuaLibs/ProcessMark.lua | 11 +- LuaLibs/ProcessMortise.lua | 8 +- LuaLibs/ProcessProfCamb.lua | 34 +-- LuaLibs/ProcessProfConcave.lua | 22 +- LuaLibs/ProcessProfConvex.lua | 22 +- LuaLibs/ProcessProfFront.lua | 20 +- LuaLibs/ProcessProfHead.lua | 33 +-- LuaLibs/ProcessRidgeLap.lua | 2 +- LuaLibs/ProcessRoundArch.lua | 2 +- LuaLibs/ProcessSawCut.lua | 2 +- LuaLibs/ProcessScarfJoint.lua | 6 +- LuaLibs/ProcessSimpleScarf.lua | 4 +- LuaLibs/ProcessSplit.lua | 6 +- LuaLibs/ProcessStepJoint.lua | 11 +- LuaLibs/ProcessStepJointNotch.lua | 35 +-- LuaLibs/ProcessTenon.lua | 12 +- LuaLibs/ProcessText.lua | 9 +- LuaLibs/ProcessTyroleanDovetail.lua | 2 +- NestProcess.lua | 11 +- Process.lua | 3 +- 40 files changed, 740 insertions(+), 464 deletions(-) create mode 100644 Compile.bat diff --git a/.gitignore b/.gitignore index fce4515..89eac89 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,9 @@ /bin /obj /.vs +/32/*.lua +/32/LuaLibs/*.lua +/32/Images/*.png +/64/*.lua +/64/LuaLibs/*.lua +/64/Images/*.png \ No newline at end of file diff --git a/BatchProcess.lua b/BatchProcess.lua index f41ad50..7c53eee 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -117,8 +117,7 @@ local function UpdateAuxData( sAuxFile) end -- Imposto direttorio libreria specializzata per Travi -local sBaseDir = EgtGetSourceDir() -EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') +EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') -- Impostazione della macchina corrente EgtResetCurrMachGroup() diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 7469ad1..d2330d4 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -112,8 +112,7 @@ local function ResetMachGroup( vBeam) end -- Imposto direttorio libreria specializzata per Travi -local sBaseDir = EgtGetSourceDir() -EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') +EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') -- Se necessario, impostazione della macchina corrente local sMachine = BEAM.MACHINE diff --git a/Compile.bat b/Compile.bat new file mode 100644 index 0000000..634b322 --- /dev/null +++ b/Compile.bat @@ -0,0 +1,99 @@ + +REM Compilazione degli script Beam Egaltech 2022.05.09 +REM Per togliere info di debug aggiungere flag -s prima del nome del file di input + +REM Compilazione 32 bit + +\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua +\EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua +\EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua +\EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua +\EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua +\EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.lua +\EgtProg\Dll32\luac53 -o 32\Swap.lua Swap.lua + +REM Compilazione 64 bit + +\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua +\EgtProg\Dll64\luac53 -o 64\BatchProcess.lua BatchProcess.lua +\EgtProg\Dll64\luac53 -o 64\BatchProcessNew.lua BatchProcessNew.lua +\EgtProg\Dll64\luac53 -o 64\NestProcess.lua NestProcess.lua +\EgtProg\Dll64\luac53 -o 64\Process.lua Process.lua +\EgtProg\Dll64\luac53 -o 64\Rotate.lua Rotate.lua +\EgtProg\Dll64\luac53 -o 64\Swap.lua Swap.lua diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index ad27a4c..102f8ff 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -188,7 +188,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw -- eventuali note if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -261,7 +261,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, nUpInd = nBigInd end -- recupero la lavorazione - local sCutting = ML.FindCutting( sCutType) + local sCutting = ML.FindCutting( sCutType, nil, bDownHead) if not sCutting then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index d2f7d1f..926e5b2 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -1,5 +1,6 @@ --- MachiningLib.lua by Egaltech s.r.l. 2021/04/14 +-- MachiningLib.lua by Egaltech s.r.l. 2022/05/07 -- Libreria ricerca lavorazioni per Travi +-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste. -- Tabella per definizione modulo local MachiningLib = {} @@ -17,6 +18,83 @@ local Pocketings = require( 'PocketingData') local Sawings = require( 'SawingData') local Drillings = require( 'DrillData') +-- tipo di teste macchina +local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T) +local TWO_EQUAL_HEADS = 2 -- due teste uguali (PF, Turn) +local TWO_UP_DOWN_HEADS = 3 -- due teste una sopra l'altra sotto (PF1250) +local MachineHeadType = 0 + +-- testa correntementa attiva, e utensili correnti per ogni testa +local nActiveHead = 0 +local H1_TOOL = '' +local H2_TOOL = '' + +-- testa e utensile della lavorazione restituita ma non ancora confermata +local nNextMachHead = 0 +local H1_NEXT_TOOL = '' +local H2_NEXT_TOOL = '' + +-- teste con utensili fissi +local vFixedHeads = {} + +--------------------------------------------------------------------- +-- funzione che imposta il tipo di macchina corrente +local function SetCurrMachineHeadType() + -- se già inizializzato, esco + if MachineHeadType and MachineHeadType >= 1 and MachineHeadType <= 3 then return end + -- altrimenti, lo imposto + if BD.DOWN_HEAD then + MachineHeadType = TWO_UP_DOWN_HEADS + elseif BD.TWO_EQUAL_HEADS then + MachineHeadType = TWO_EQUAL_HEADS + else + MachineHeadType = ONE_HEAD + end + -- imposto eventuali teste con utensili fissi + if BD.C_SIMM then + vFixedHeads = { [31] = true} + elseif BD.TURN then + vFixedHeads = { [12] = true, [22] = true} + else -- FAST + vFixedHeads = { [2] = true} + end +end + +--------------------------------------------------------------------- +-- funzione che conferma e rende attivi testa e utensile ipotizzati +local function ConfirmNextMachining() + -- se non definita testa successiva, esco + if not nNextMachHead or nNextMachHead < 1 or nNextMachHead > 2 then return end + -- altrimenti, la confermo come attiva + nActiveHead = nNextMachHead + if nNextMachHead == 1 then + H1_TOOL = H1_NEXT_TOOL + elseif nNextMachHead == 2 then + H2_TOOL = H2_NEXT_TOOL + end + -- reset prossima testa + nNextMachHead = 0 + H1_NEXT_TOOL = '' + H2_NEXT_TOOL = '' +end + +--------------------------------------------------------------------- +-- funzione che traccia testa e utensile ipotizzati +local function SetNextMachining( sToolName, nHead, bFixed) + if nHead < 1 or nHead > 2 then return end + if bFixed then + nNextMachHead = 0 + H1_NEXT_TOOL = '' + H2_NEXT_TOOL = '' + end + nNextMachHead = nHead + if nHead == 1 then + H1_NEXT_TOOL = sToolName + elseif nHead == 2 then + H2_NEXT_TOOL = sToolName + end +end + --------------------------------------------------------------------- local function SetCurrMachiningAndTool( sMachName) if not EgtMdbSetCurrMachining( sMachName) then return false end @@ -24,106 +102,301 @@ local function SetCurrMachiningAndTool( sMachName) local sTool = EgtTdbGetToolFromUUID( sTuuid) if not sTool then return false end if not EgtTdbSetCurrTool( sTool) then return false end - return EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) + local bActive = EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) + local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) + local nHead = tonumber( sHead:sub( 2, #sHead)) + local bH2 = ( nHead >= 21 and nHead <= 29) + local bFixed = ( vFixedHeads[nHead]) + return bActive, sTool, bH2, bFixed end --------------------------------------------------------------------- -function MachiningLib.FindCutting( sType) - for i = 1, #Cuttings do - local Cutting = Cuttings[i] - if Cutting.On and Cutting.Type == sType and SetCurrMachiningAndTool( Cutting.Name) then - return Cutting.Name - end +local function StartsWith( sStr, sStart) + if ( sStart == "" or sStr:sub( 1, #sStart) == sStart) then + return true, sStr:sub( 1, #sStr - #sStart) + else + return false, sStr end end --------------------------------------------------------------------- -function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen) - for i = 1, #Millings do - local Milling = Millings[i] - if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then - local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID) - local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and - ( not sTuuidMstr or sTuuidMstr == sTuuid) and - ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and - ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then - return Milling.Name, dTMaxDepth, dTDiam +local function EndsWith( sStr, sEnd) + if ( sEnd == "" or sStr:sub(-#sEnd) == sEnd) then + return true, sStr:sub(1, #sStr - #sEnd) + else + return false, sStr + end +end + +--------------------------------------------------------------------- +function VerifyDrill( dDiam, dDepth, bH2) + local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) + local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dDiamTh = EgtTdbGetCurrToolThDiam() + local dLenTh = 72 + if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end + local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE) + if dTDiam < dDiam + 10 * GEO.EPS_SMALL and + dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and + ( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) then + return true, { TMaxMat = dTMaxMat, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2} + end +end + +--------------------------------------------------------------------- +function VerifyDrillPocket( dDiam, dDepth, bH2) + local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() + local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dDiamTh = EgtTdbGetCurrToolThDiam() + local dFreeLen = dTMaxDepth + if dTDiam < dDiam - 10 * GEO.EPS_SMALL and + ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then + return true, { TMaxDepth = dTMaxDepth, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2} + end +end + +--------------------------------------------------------------------- +function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2) + local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID) + local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() + local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and + ( not sTuuidMstr or sTuuidMstr == sTuuid) and + ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and + ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then + return true, { TMaxDepth = dTMaxDepth, TDiam = dTDiam, H2 = bH2} + end +end + +--------------------------------------------------------------------- +function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2) + local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() + local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and + ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and + ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then + return true, { TDiam = dTDiam, TMaxDepth = dTMaxDepth, H2 = bH2} + end +end + +--------------------------------------------------------------------- +function VerifyTool( MachiningType, sType, Params, bH2) + if MachiningType == MCH_MY.DRILLING then + if StartsWith( sType, 'Drill') then + return VerifyDrill( Params.Diam, Params.Depth, bH2) + elseif StartsWith( sType, 'Pocket') then + return VerifyDrillPocket( Params.Diam, Params.Depth, bH2) + end + elseif MachiningType == MCH_MY.SAWING then + return true, { H2 = bH2} + elseif MachiningType == MCH_MY.MILLING then + return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2) + elseif MachiningType == MCH_MY.POCKETING then + return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2) + elseif MachiningType == MCH_MY.MORTISING then + return true, { H2 = bH2} + else + return false + end +end + +--------------------------------------------------------------------- +function GetMachinings( MachiningType) + if MachiningType == MCH_MY.DRILLING then + return Drillings + elseif MachiningType == MCH_MY.SAWING then + return Cuttings + elseif MachiningType == MCH_MY.MILLING then + return Millings + elseif MachiningType == MCH_MY.POCKETING then + return Pocketings + elseif MachiningType == MCH_MY.MORTISING then + return Sawings + end +end + +--------------------------------------------------------------------- +function ReturnParams( MachiningType, MachiningName, sType, ToolParams) + if MachiningType == MCH_MY.DRILLING then + local _, sOrigType = EndsWith( sType, '_H2') + return MachiningName, sType, EgtIf( sOrigType == 'Drill', ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen + elseif MachiningType == MCH_MY.SAWING then + return MachiningName, ToolParams.H2 + elseif MachiningType == MCH_MY.MILLING then + return MachiningName, ToolParams.TMaxDepth, ToolParams.TDiam, ToolParams.H2 + elseif MachiningType == MCH_MY.POCKETING then + return MachiningName, ToolParams.TDiam, ToolParams.TMaxDepth, ToolParams.H2 + elseif MachiningType == MCH_MY.MORTISING then + return MachiningName + end +end + +--------------------------------------------------------------------- +local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead) + if bTopHead == nil and bDownHead == nil then + bTopHead = true + bDownHead = false + elseif bTopHead == nil then + bTopHead = not bDownHead + elseif bDownHead == nil then + bDownHead = not bTopHead + end + SetCurrMachineHeadType() + -- verifico se testa attiva va bene + local sH1Mach = '' + local sH1Tool = '' + local sH1Param + local sH2Mach = '' + local sH2Tool = '' + local sH2Param + -- ricerca sulle forature, dal diametro maggiore al minore + local Machinings = GetMachinings( MachiningType) + local ForStart = 1 + local ForEnd = #Machinings + local ForStep = 1 + if MachiningType == MCH_MY.DRILLING then + ForStart = #Machinings + ForEnd = 1 + ForStep = -1 + end + if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then + _, sType = EndsWith( sType, '_H2') + elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then + if not EndsWith( sType, '_H2') then + sType = sType .. '_H2' + end + end + local MachineHeadUse = MachineHeadType + if not BEAM or not BEAM.BW then + MachineHeadUse = ONE_HEAD + end + if BEAM and BEAM.BW and MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then + -- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra + MachineHeadUse = TWO_EQUAL_HEADS + end + for i = ForStart, ForEnd, ForStep do + local Machining = Machinings[i] + local sMachiningType = Machining.Type + if BEAM and BEAM.BW then + _, sMachiningType = EndsWith( Machining.Type, '_H2') + end + -- recupero dati utensile + local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name) + if Machining.On and sMachiningType == sType and bToolActive then + local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2) + if bOk then + if MachineHeadUse == ONE_HEAD then + SetNextMachining( sToolName, 1, bFixed) + return ReturnParams(MachiningType, Machining.Name, Machining.Type, ToolParams) + elseif MachineHeadUse == TWO_EQUAL_HEADS then + -- se nessuna testa attiva, prendo la prima lavorazione disponibile + if nActiveHead == 0 then + SetNextMachining( sToolName, EgtIf( bH2, 2, 1), bFixed) + return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) + -- verifico se posso usare lo stesso utensile della testa attiva + elseif ( nActiveHead == 1 and not bH2 and sToolName == H1_TOOL) or ( nActiveHead == 2 and bH2 and sToolName == H2_TOOL) then + SetNextMachining( sToolName, nActiveHead, bFixed) + return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) + else + -- segno le lavorazioni disponibili per entrambe le teste + if bH2 then + if not sH2Mach or sH2Mach == '' then + sH2Mach = Machining.Name + sH2Tool = sToolName + sH2Param = ToolParams + end + else + if not sH1Mach or sH1Mach == '' then + sH1Mach = Machining.Name + sH1Tool = sToolName + sH1Param = ToolParams + end + end + end + elseif MachineHeadUse == TWO_UP_DOWN_HEADS then + if bTopHead and not bH2 then + SetNextMachining( sToolName, 1, bFixed) + return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) + elseif bDownHead and bH2 then + SetNextMachining( sToolName, 2, bFixed) + return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) + end + end end end end -end - ---------------------------------------------------------------------- -function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen) - for i = 1, #Pocketings do - local Pocketing = Pocketings[i] - if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() - local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and - ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and - ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then - return Pocketing.Name, dTDiam, dTMaxDepth + if MachineHeadUse == TWO_EQUAL_HEADS then + -- verifico se cambiare testa o cambiare utensile su quella corrente + if nActiveHead == 1 then + if sH2Mach ~= "" then + SetNextMachining( sH2Tool, 2, bFixed) + return ReturnParams( MachiningType, sH2Mach, sType, sH2Param) + --return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen + elseif sH1Mach ~= "" then + SetNextMachining( sH1Tool, 1, bFixed) + return ReturnParams( MachiningType, sH1Mach, sType, sH1Param) + --return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen + end + elseif nActiveHead == 2 then + if sH1Mach ~= "" then + SetNextMachining( sH1Tool, 1, bFixed) + return ReturnParams( MachiningType, sH1Mach, sType, sH1Param) + --return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen + elseif sH2Mach ~= "" then + SetNextMachining( sH2Tool, 2, bFixed) + return ReturnParams( MachiningType, sH2Mach, sType, sH2Param) + --return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen end end end + local bH2, sOrigType = EndsWith( sType, '_H2') + if ( not BEAM or not BEAM.BW) and MachineHeadUse == TWO_UP_DOWN_HEADS and bH2 and bTopHead then + return FindMachining( MachiningType, sOrigType, Params, true, false) + end +end + +--------------------------------------------------------------------- +function MachiningLib.FindCutting( sType, bTopHead, bDownHead) + return FindMachining( MCH_MY.SAWING, sType, nil, bTopHead, bDownHead) +end + +--------------------------------------------------------------------- +function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead) + local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead) + if not MachiningName or MachiningName == '' then + MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead) + end + if MachiningName and MachiningName ~= '' then + return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 + end +end + +--------------------------------------------------------------------- +function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead) + return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead) +end + +--------------------------------------------------------------------- +function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead) + return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead) end --------------------------------------------------------------------- function MachiningLib.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 - end - end - + return FindMachining( MCH_MY.MORTISING, sType) end ---------------------------------------------------------------------- -function MachiningLib.FindDrilling( dDiam, dDepth, bDown) - -- ricerca sulle forature, dal diametro maggiore al minore - local sDrType = 'Drill' .. EgtIf( bDown, '_H2', '') - for i = #Drillings, 1, -1 do - local Drilling = Drillings[i] - if Drilling.On and Drilling.Type == sDrType and SetCurrMachiningAndTool( Drilling.Name) then - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) - local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dDiamTh = EgtTdbGetCurrToolThDiam() - local dLenTh = 72 - if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end - local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE) - if dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL then - if not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL then - return Drilling.Name, Drilling.Type, dTMaxMat, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen - end - end - end - end - -- ricerca sulle svuotature, dal diametro maggiore al minore - local sPkType = 'Pocket' .. EgtIf( bDown, '_H2', '') - for i = #Drillings, 1, -1 do - local Drilling = Drillings[i] - if Drilling.On and Drilling.Type == sPkType and SetCurrMachiningAndTool( Drilling.Name) then - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() - local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dDiamTh = EgtTdbGetCurrToolThDiam() - local dFreeLen = dTMaxDepth - if dTDiam < dDiam - 10 * GEO.EPS_SMALL then - if not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL then - return Drilling.Name, Drilling.Type, dTMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen - end - end - end - end +------------------------------------------------------------------------------------------------------------- +function MachiningLib.ApplyMachining( bRecalc, bApplyPost) + local bResult = EgtApplyMachining( bRecalc, bApplyPost) + if bResult then ConfirmNextMachining() end + return bResult end ------------------------------------------------------------------------------------------------------------- diff --git a/LuaLibs/ProcessChamfer.lua b/LuaLibs/ProcessChamfer.lua index 3540250..c6274e7 100644 --- a/LuaLibs/ProcessChamfer.lua +++ b/LuaLibs/ProcessChamfer.lua @@ -75,7 +75,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId) -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -178,7 +178,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId) -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, 0}}) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 03e7bf4..ff41a07 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -158,7 +158,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -181,7 +181,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -720,11 +720,8 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead)) -- recupero la lavorazione local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide') - local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) - if not sCutting and bTopHead then - sCutting = ML.FindCutting( sCutType) - bDownHead = false - end + local sCutting + sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead) if not sCutting then local sErr = 'Error : cutting not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessDecor.lua b/LuaLibs/ProcessDecor.lua index 3b0fb77..c88bbea 100644 --- a/LuaLibs/ProcessDecor.lua +++ b/LuaLibs/ProcessDecor.lua @@ -69,7 +69,7 @@ function ProcessDecor.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessDoubleCut.lua b/LuaLibs/ProcessDoubleCut.lua index 2d7c444..a019e86 100644 --- a/LuaLibs/ProcessDoubleCut.lua +++ b/LuaLibs/ProcessDoubleCut.lua @@ -119,7 +119,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtOutLog( sErr) return false, sErr end - local sMillingDw = ML.FindMilling( 'Mark_H2') + local sMillingDw = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if bVert and not sMillingDw then local sErr = 'Error : milling (Mark_H2) not found in library' EgtOutLog( sErr) @@ -141,7 +141,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -164,7 +164,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -259,11 +259,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < -0.5) -- recupero la lavorazione local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide') - local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) - if not sCutting and bTopHead then - sCutting = ML.FindCutting( sCutType) - bDownHead = false - end + local sCutting + sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead) if not sCutting then local sErr = 'Error : cutting not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessDovetail.lua b/LuaLibs/ProcessDovetail.lua index f19cb7a..9fbffac 100644 --- a/LuaLibs/ProcessDovetail.lua +++ b/LuaLibs/ProcessDovetail.lua @@ -592,7 +592,7 @@ local function MachChainFacesByBlade( Proc, nCFaceSide, nCFaceInt1, nCFaceInt2, EgtSetMachiningParam( MCH_MP.STARTADDLEN, 50) EgtSetMachiningParam( MCH_MP.ENDADDLEN, 50) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -836,7 +836,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling, end EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -1221,7 +1221,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol local nSCC = MCH_SCC.ADIR_YP EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index ed4e289..b0ddbca 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -214,16 +214,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) local bDrillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) -- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante -- recupero la lavorazione - local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillDown) - if not sDrilling and bDrillUp then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth) - end + local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown) if not sDrilling and dCheckDepth then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown) - if sDrilling then dCheckDepth = nil end - end - if not sDrilling and bDrillUp and dCheckDepth then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0) + sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) if sDrilling then dCheckDepth = nil end end if not sDrilling then @@ -237,10 +230,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) nErrorCode = 2 -- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto) else - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown) - if not sDrilling and bDrillUp then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0) - end + sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) if not sDrilling then nErrorCode = 1 elseif dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then @@ -252,16 +242,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) -- recupero la lavorazione local sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 if dDepth2 > dDepth + BD.DRILL_OVERLAP then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillDown) - if not sDrilling2 and bDrillUp then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2) - end + sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillUp, bDrillDown) if not sDrilling2 and dCheckDepth2 then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown) - if sDrilling2 then dCheckDepth2 = nil end - end - if not sDrilling2 and bDrillUp and dCheckDepth2 then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0) + sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) if sDrilling2 then dCheckDepth2 = nil end end if not sDrilling2 then @@ -275,10 +258,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) nErrorCode = 2 -- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto) else - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown) - if not sDrilling2 and bDrillUp then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0) - end + sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) if not sDrilling2 then nErrorCode = 1 elseif dMaxToolLength2 > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then @@ -432,14 +412,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) end EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - local bOk = EgtApplyMachining( true, false) + local bOk = ML.ApplyMachining( true, false) if not bOk and BD.DOWN_HEAD then if sType == 'Drill' or sType == 'Drill_H2' then EgtSetMachiningParam( MCH_MP.INVERT, true) else EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) end - bOk = EgtApplyMachining( true, false) + bOk = ML.ApplyMachining( true, false) end if not bOk then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index de29e1a..d9eaf3d 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -202,9 +202,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) sMchExt = '_AT' end -- recupero la lavorazione : prima ricerca per sola tipologia - local sMilling = ML.FindMilling( sMillType..sMchExt) + local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown) if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType) + sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) end if not sMilling then local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id) @@ -212,9 +212,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) return false, sErr end -- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo - sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad) + sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown) if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad) + sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown) sMchExt = '' end if not sMilling then @@ -261,14 +261,14 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- recupero la lavorazione local sPocketing - sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam) + sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown) if not sPocketing and bMillUp then - sPocketing = ML.FindPocketing( 'Mortise', dToolDiam) + sPocketing = ML.FindPocketing( 'Mortise', dToolDiam, nil, nil, bMillUp, bMillDown) end if not sPocketing then - sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam) + sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown) if not sPocketing and bMillUp then - sPocketing = ML.FindPocketing( 'Pocket', dToolDiam) + sPocketing = ML.FindPocketing( 'Pocket', dToolDiam, nil, nil, bMillUp, bMillDown) end end if not sPocketing then @@ -290,7 +290,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -372,7 +372,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -429,7 +429,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index 264e90f..9bfe86c 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -112,7 +112,7 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -232,10 +232,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) -- recupero la lavorazione local sMillType = 'DtTenon' - local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) - if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType) - end + local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -313,7 +310,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchRId, false) return false, sErr diff --git a/LuaLibs/ProcessFreeContour.lua b/LuaLibs/ProcessFreeContour.lua index 9650a7c..0b537cd 100644 --- a/LuaLibs/ProcessFreeContour.lua +++ b/LuaLibs/ProcessFreeContour.lua @@ -418,7 +418,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -479,7 +479,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -581,7 +581,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.OFFSR, dDepthCham) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -600,7 +600,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, 0) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -680,7 +680,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead) -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index cac9da3..090675f 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -109,7 +109,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -132,7 +132,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -220,7 +220,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- altrimenti necessari tagli da sopra e sotto con testa opportuna else -- recupero la lavorazione con lama da sotto - local sCutting2 = ML.FindCutting( 'HeadSide_H2') + local sCutting2 = ML.FindCutting( 'HeadSide_H2', false, true) if not sCutting2 then local sErr = 'Error : cutting H2 not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 5c12c40..6e58fa1 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -318,16 +318,16 @@ local function VerifyChainSaw( Proc, dMinDim, dMaxDim) end --------------------------------------------------------------------- -local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster) +local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketDown) -- tipo di svuotatura local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket') -- ricerca della svuotatura local sPocketing if dDepth then - sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen) or - ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen) or - ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen) or - ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen) or + sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) else sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) @@ -857,7 +857,7 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -894,9 +894,9 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) -- recupero la lavorazione local sMilling if nUseRM and nUseRM == 1 then - sMilling = ML.FindMilling( 'LongSmallCut' .. EgtIf( bDownHead, '_H2', '')) + sMilling = ML.FindMilling( 'LongSmallCut', nil, nil, nil, nil, not bDownHead, bDownHead) else - sMilling = ML.FindMilling( 'BirdsMouth' .. EgtIf( bDownHead, '_H2', '')) + sMilling = ML.FindMilling( 'BirdsMouth', nil, nil, nil, nil, not bDownHead, bDownHead) end if not sMilling then local sErr = 'Error : LongSmallCut & BirdsMouth not found in library' @@ -1001,7 +1001,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1034,7 +1034,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1216,7 +1216,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenStart, 0, - dTDiam / 2)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1487,7 +1487,7 @@ local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiam, bMillDown, bDoubleSide) -- recupero la lavorazione senza considerare l'elevazione - local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if not sMilling then local sMyWarn = 'Warning : SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1641,7 +1641,7 @@ local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( ( tFacAdj[i][3] + dDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -1667,7 +1667,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, dDepth, bOneShot) -- recupero la lavorazione senza considerare l'elevazione perché viene calcolata l'elevazione utile - local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if not sMilling then local sMyWarn = 'Warning : SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1683,7 +1683,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, dTMaxDepth = EgtTdbGetCurrToolMaxDepth() or dTMaxDepth end - local sMillingDn = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and bDoubleSide, '_H2', '')) + local sMillingDn = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not( bMillDown and bDoubleSide), bMillDown and bDoubleSide) if not sMillingDn then local sMyWarn = 'Warning : Opposite SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1880,7 +1880,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -1943,7 +1943,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -2154,7 +2154,7 @@ local function MakeSharpCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacI local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2303,7 +2303,7 @@ local function MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, -- aggiungo alle note massima elevazione (coincide con affondamento) sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dDepth, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2622,7 +2622,7 @@ local function MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfI -- EgtSetMachiningParam( MCH_MP.INVERT, true) -- end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return -1, sErr @@ -2774,7 +2774,7 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd, EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- tolgo eventuale step EgtSetMachiningParam( MCH_MP.STEP, 0) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2902,7 +2902,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local bCutDown = ( BD.DOWN_HEAD and rfFac:getVersZ():getZ() < - 0.5) -- Recupero il massimo affondamento possibile con la lama local dSawMaxDepth = 0 - local sCutting = ML.FindCutting( 'HeadSide'..EgtIf( bCutDown, '_H2', '')) + local sCutting = ML.FindCutting( 'HeadSide', not bCutDown, bCutDown) if sCutting then if EgtMdbSetCurrMachining( sCutting) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) @@ -3052,7 +3052,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 2) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -3061,7 +3061,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- impostazione alternativa angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3126,7 +3126,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -3135,7 +3135,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- impostazione alternativa angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho, 2)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3156,7 +3156,7 @@ end --------------------------------------------------------------------- local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDepth, bMillDown) -- Recupero la lavorazione di lama - local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', '')) + local sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown) if not sCutting then local sErr = 'Error : HeadSide (cutting) not found in library' EgtOutLog( sErr) @@ -3319,10 +3319,10 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3393,7 +3393,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3493,7 +3493,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas end end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3577,7 +3577,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind) local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn if bMillDown then - bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind..'_H2') + bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, true) -- se è negativo inverto il versore e la faccia if vtOrtho:getZ() < 0 then vtOrtho = -vtOrtho @@ -3696,10 +3696,10 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return -1, sErr @@ -3778,10 +3778,10 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return -1, sErr @@ -3848,10 +3848,10 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha local sNotes = 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return -1, sErr @@ -3955,7 +3955,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bM EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) end -- rieseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nIdMach, false) return false, false, sErr @@ -4112,7 +4112,7 @@ local function MakeAntiSplintByMill( Proc, nPartId, pPaths, nPathInt, vtN1, sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn2 = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -4162,9 +4162,9 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, dCheckDepth = dDepth end end - sMilling = ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''), dCheckDepth) or - ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide , '_H2', ''), 2/3 * dCheckDepth) or - ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide , '_H2', '')) + sMilling = ML.FindMilling( 'AntiSplintMillCut', dCheckDepth, nil, nil, nil, not( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or + ML.FindMilling( 'AntiSplintMillCut', 2/3 * dCheckDepth, nil, nil, nil, not( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or + ML.FindMilling( 'AntiSplintMillCut', nil, nil, nil, nil, not( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if sMilling then @@ -4471,7 +4471,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa EgtOutLog( sWarn) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -4479,7 +4479,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho, 2)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4586,7 +4586,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local nSCC = EgtIf( ( vtN:getY() > 0.5 or ( bHeadDir and vtN:getZ() > 0.5 ) or ( not bHeadDir and vtN:getZ() < -0.5)), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4606,7 +4606,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nWorkSide == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( nSCC == MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFNId, false) return false, sErr @@ -4716,10 +4716,10 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local sNotes = 'MaxElev=' .. EgtNumToString( dFacElev2, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4852,7 +4852,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end -- ricerca lavorazione local sPocketing - local _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', '')) + local _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind, bMillDown) if not sMyPocketing and bMillUp then _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind) bMillDown = false @@ -4925,11 +4925,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa ( Proc.TotBox and Proc.TotBox:getDimX() > BD.MIN_LEN_LAMELLO) or ( not Proc.TotBox and Proc.Box:getDimX() > BD.MIN_LEN_LAMELLO)) then -- recupero la lavorazione - if BD.DOWN_HEAD and vtN:getZ() < BD.NZ_MINA then - sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2') - else - sMillingOnSide = ML.FindMilling( 'SideMillAsBlade') - end + local bDownHead = BD.DOWN_HEAD and vtN:getZ() < BD.NZ_MINA + sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2', nil, nil, nil, nil, not bDownHead, bDownHead) if sMillingOnSide then -- recupero i dati dell'utensile @@ -5018,7 +5015,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if not sMchFind then sMchFind = sMchFindBackUp end - sPocketing = ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown) if not sPocketing then local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) @@ -5028,7 +5025,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa return false, sErr elseif nOk == 0 then if sStat == 'MNF' then - sPocketing = ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown) if not sPocketing then local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) @@ -5042,7 +5039,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa return bOk, sErr end else - sPocketing = ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown) if not sPocketing then local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) @@ -5093,7 +5090,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if not sMchFind then sMchFind = sMchFindBackUp end - sPocketing = ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown) if not sPocketing then local sErr2 = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr2) diff --git a/LuaLibs/ProcessLapJointNew.lua b/LuaLibs/ProcessLapJointNew.lua index 2eb55f7..e19ba4b 100644 --- a/LuaLibs/ProcessLapJointNew.lua +++ b/LuaLibs/ProcessLapJointNew.lua @@ -489,19 +489,19 @@ local function VerifyChainSaw( dMinDim, dMaxDim) end --------------------------------------------------------------------- -local function VerifyPocket( dDiam, dDepth, dMaxTotLen, sMchFindMaster) +local function VerifyPocket( dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketUp, bPocketDown) -- tipo di svuotatura local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket') -- ricerca della svuotatura local sPocketing if dDepth then - sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen) or + sPocketing, _, _, bPocketDown = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen) or ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen) or ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen) or ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen) or ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) else - sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) + sPocketing, _, _, bPocketDown = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) end if not sPocketing then return false @@ -516,7 +516,7 @@ local function VerifyPocket( dDiam, dDepth, dMaxTotLen, sMchFindMaster) dMaxDepth = TI.dMaxDepth or dMaxDepth bUsePocketing = true end - return bUsePocketing, sPocketing, dMaxDepth, dToolDiam + return bUsePocketing, sPocketing, dMaxDepth, dToolDiam, bPocketDown end --------------------------------------------------------------------- @@ -971,7 +971,7 @@ local function MakeOneFaceByMill( Proc) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1019,7 +1019,7 @@ local function DoMill( Proc, sName, sMilling, offset, nFacInd, nFac2Ind, vtN) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1034,11 +1034,7 @@ local function MakeTwoFacesByMill( Proc, bDownHead) assert( ( Proc.Fct == 2), 'Error : MakeTwoFacesByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces') -- recupero la lavorazione local sMilling - if Q_USE_MILL and Q_USE_MILL == 1 then - sMilling = ML.FindMilling( 'LongSmallCut' .. EgtIf( bDownHead, '_H2', '')) - else - sMilling = ML.FindMilling( 'BirdsMouth' .. EgtIf( bDownHead, '_H2', '')) - end + sMilling = ML.FindMilling( EgtIf( Q_USE_MILL and Q_USE_MILL == 1, 'LongSmallCut', 'BirdsMouth'), nil , nil, nil, nil, not bDownHead, bDownHead) if not sMilling then local sErr = 'Error : LongSmallCut & BirdsMouth not found in library' EgtOutLog( sErr) @@ -1283,7 +1279,7 @@ local function MakeByMill( Proc, tFData, dCollSic, bSpecialApp, sMillMaster) EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenStart, 0, - dTDiam / 2)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1557,7 +1553,7 @@ local function DoClean( sName, sMilling, nIdPath, vtN, dMaxElev, dMachDepth, dEx local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -1574,7 +1570,7 @@ end --------------------------------------------------------------------- local function MakeRoundCleanCorner( Proc, nFacInd, dDiam, bMillDown, bDoubleSide) -- recupero la lavorazione senza considerare l'elevazione - local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if not sMilling then local sMyWarn = 'Warning : SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1695,7 +1691,7 @@ local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown, dDepth, bOneShot) -- recupero la lavorazione senza considerare l'elevazione perché viene calcolata l'elevazione utile - local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if not sMilling then local sMyWarn = 'Warning : SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1711,7 +1707,7 @@ local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown, dTMaxDepth = TI.dMaxDepth or dTMaxDepth end - local sMillingDn = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and bDoubleSide, '_H2', '')) + local sMillingDn = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and bDoubleSide), bMillDown and bDoubleSide) if not sMillingDn then local sMyWarn = 'Warning : Opposite SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -2141,7 +2137,7 @@ local function MakeDrillOnCorner( Proc, nFacInd, dDiam, bSpecialMach) -- Note utente con dichiarazione nessuna generazione sfridi per Vmill e massima elevazione (coincide con affondamento) local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( dDepth, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2407,7 +2403,7 @@ local function MakeChamfer( Proc, vtOrtho, nSurfInt) -- EgtSetMachiningParam( MCH_MP.INVERT, true) -- end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return -1, sErr @@ -2526,7 +2522,7 @@ local function MakeByMillAsSaw( Proc, tFData, nBottomFace, sMillingOnSide, dSawD EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- tolgo eventuale step EgtSetMachiningParam( MCH_MP.STEP, 0) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2596,7 +2592,7 @@ local function DoHeadChainSaw( Proc, sName, sSawing, tFData, nFaceUse, nFacAdj, local sNotes = 'MaxElev=' .. EgtNumToString( tFData.dFacElev, 2) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -2605,7 +2601,7 @@ local function DoHeadChainSaw( Proc, sName, sSawing, tFData, nFaceUse, nFacAdj, -- impostazione alternativa angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, tFData.rfFac:getVersZ())) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -2688,7 +2684,7 @@ local function DoSideChainSaw( Proc, sName, sSawing, tFData, vtN, vtOrtho, nLong EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -2697,7 +2693,7 @@ local function DoSideChainSaw( Proc, sName, sSawing, tFData, vtN, vtOrtho, nLong -- impostazione alternativa angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -2946,7 +2942,7 @@ end --------------------------------------------------------------------- local function MakeAntiSplintBySaw( Proc, nFacet, vtN, nFacInd, bReduceDepth, bMillDown) -- Recupero la lavorazione di lama - local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', '')) + local sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown) if not sCutting then local sErr = 'Error : HeadSide (cutting) not found in library' EgtOutLog( sErr) @@ -3061,10 +3057,10 @@ local function DoPocketing( sName, sPocketing, sMchFind, vtN, nPathInt, nFaceIdx end EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local bOk, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3166,7 +3162,7 @@ local function DoHeadCut( Proc, sName, sMilling, nMchFId, dElev, nSideFace, tvtN -- imposto elevazione e dichiaro non si generano sfridi per VMill local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3302,7 +3298,7 @@ local function MachineByMill( Proc, tvtN, nBaseFace, nSideFace, ptPs, tDimAndRef end end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3381,7 +3377,7 @@ local function MakeByPockets( Proc, bOrthoFacesMaster, bMillDown) local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( dDimMin, dDepth / 2, nil, sMchFind) local bMakePocketDn, sPocketingDn, dMaxDepthDn if bMillDown then - bMakePocketDn, sPocketingDn, dMaxDepthDn = VerifyPocket( dDimMin, dDepth / 2, nil, sMchFind .. '_H2') + bMakePocketDn, sPocketingDn, dMaxDepthDn = VerifyPocket( dDimMin, dDepth / 2, nil, sMchFind .. '_H2', false, true) -- se è negativo inverto il versore e la faccia if vtOrtho:getZ() < 0 then vtOrtho = -vtOrtho @@ -3634,7 +3630,7 @@ local function ManageAntiSplintBySaw( Proc, bIsU, vtN, nFacInd, sWarn, bMillDown EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) end -- rieseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nIdMach, false) return false, false, sErr @@ -3788,7 +3784,7 @@ local function MakeAntiSplintByMill( Proc, pPaths, nPathInt, vtN1, local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn2 = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -3835,9 +3831,9 @@ local function ManageAntiSplintByMill( Proc, nFacInd, bMillDown, bDoubleSide, dCheckDepth = dDepth end end - sMilling = ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''), dCheckDepth) or - ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''), 2/3 * dCheckDepth) or - ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + sMilling = ML.FindMilling( 'AntiSplintMillCut', dCheckDepth, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or + ML.FindMilling( 'AntiSplintMillCut', 2/3 * dCheckDepth, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or + ML.FindMilling( 'AntiSplintMillCut', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if sMilling then @@ -4042,7 +4038,7 @@ local function DoSideMill( Proc, sName, sMilling, tFData, dMaxMat, dToolDiam, bH local nSCC = EgtIf( ( tFData.vtN:getY() > 0.5 or ( bHeadDir and tFData.vtN:getZ() > 0.5 ) or ( not bHeadDir and tFData.vtN:getZ() < -0.5)), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4062,7 +4058,7 @@ local function DoSideMill( Proc, sName, sMilling, tFData, dMaxMat, dToolDiam, bH EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nWorkSide == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( nSCC == MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFNId, false) return false, sErr @@ -4184,10 +4180,10 @@ local function MakeSpecialThreeFaces( Proc, tFData) local sNotes = 'MaxElev=' .. EgtNumToString( tFData.dFacElev2, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4256,7 +4252,7 @@ local function MakeByChainsaw( Proc, dDimMin, dDimMax, dDepth, vtOrtho, nLongFac EgtOutLog( sWarn) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -4264,7 +4260,7 @@ local function MakeByChainsaw( Proc, dDimMin, dDimMax, dDepth, vtOrtho, nLongFac end EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4432,7 +4428,7 @@ local function MakeSidePocketings( Proc, tFData, dCollSic, bSpecialMillOnSide, -- eseguo bOk, sWarn, sStat = MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho, nLongFaceId, bOrthoFaces, nBottomFace, nSurfInt) if not bOk and sStat == 'MNF' then - _, sPocketing = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, nil, sMchFind) + _, sPocketing = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, nil, sMchFind, bMillUp, bMillDown) if sPocketing then sWarn = '' else @@ -4565,12 +4561,8 @@ local function MakePocketingOrMilling( Proc, tFData, bSinglePart) dMaxTotLen = BD.GetBottomToolMaxTotLen( tFData.vtN) end -- ricerca lavorazione - local sPocketing - local _, sMyPocketing, dMyTMaxDepth, _ = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', '')) - if not sMyPocketing and bMillUp then - _, sMyPocketing, dMyTMaxDepth, _ = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, dMaxTotLen, sMchFind) - bMillDown = false - end + local sPocketing, sMyPocketing, dMyTMaxDepth + _, sMyPocketing, dMyTMaxDepth, _, bMillDown = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', ''), bMillUp, bMillDown) --local sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, dFacElev + dCollSic, dMaxTotLen) --if not sMyPocketing then -- sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, nil, dMaxTotLen) @@ -4638,11 +4630,8 @@ local function MakePocketingOrMilling( Proc, tFData, bSinglePart) ( Proc.TotBox and Proc.TotBox:getDimX() > BD.MIN_LEN_LAMELLO) or ( not Proc.TotBox and Proc.Box:getDimX() > BD.MIN_LEN_LAMELLO)) then -- recupero la lavorazione - if BD.DOWN_HEAD and tFData.vtN:getZ() < BD.NZ_MINA then - sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2') - else - sMillingOnSide = ML.FindMilling( 'SideMillAsBlade') - end + local bDownhead = BD.DOWN_HEAD and tFData.vtN:getZ() < BD.NZ_MINA + sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2', nil, nil, nil, nil, not bDownhead, bDownhead) if sMillingOnSide then -- recupero i dati dell'utensile diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index c2c0ea3..038ffaf 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -99,7 +99,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim, EgtSetMachiningParam( MCH_MP.LOPERP, 0) EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -114,7 +114,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe if sMasterCutting and #sMasterCutting > 0 then sCutting = sMasterCutting else - sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', '')) + sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown) end if not sCutting then local sErr = 'Error : HeadSide (cutting) not found in library' @@ -261,7 +261,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, s EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) end -- rieseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nIdMach, false) return false, false, sErr @@ -320,10 +320,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId) sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -473,7 +473,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus local dMaxDepthDn = 0 -- recupero la lavorazione if bCanUseUnderBlade then - sCuttingDn = ML.FindCutting( 'HeadSide_H2') + sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true) if not sCuttingDn then local sErr = 'Error : sawing HeadSide_H2 not found in library' EgtOutLog( sErr) @@ -668,12 +668,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- determino la massima elevazione local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) -- recupero la lavorazione - local sMilling - if bCanUseUnderBlade then - sMilling = ML.FindMilling( 'Long2Cut_H2', dElev) - else - sMilling = ML.FindMilling( 'Long2Cut', dElev) - end + local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade) if not sMilling then local sErr = 'Error : milling Long2Cut (_H2) not found in library' EgtOutLog( sErr) @@ -846,7 +841,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- imposto posizione braccio porta testa per non ingombrare agli estremi EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -859,8 +854,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- determino la massima elevazione local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) -- recupero la lavorazione - local sMchType = EgtIf( nSide ~= - 1, 'Long2Cut', 'Long2Cut_H2') - local sMilling = ML.FindMilling( sMchType, dElev) + local bDownHead = ( nSide == - 1) + sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut') + local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead) if not sMilling then local sErr = 'Error : milling '..sMchType..' not found in library' EgtOutLog( sErr) @@ -1014,7 +1010,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus local dDepth = min( 0, dMaxDepth - dElev ) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1076,7 +1072,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- se testa da sotto if nSide ~= 1 and BD.DOWN_HEAD then sMchTypeDn = 'Long2CutSide_H2' - sMillingDn = ML.FindMilling( sMchTypeDn) + sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true) sPrefixDn = 'L2CSH2_' end -- lavorazione da sotto @@ -1091,7 +1087,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- se testa da sotto if BD.DOWN_HEAD then sMchTypeDn = 'Long2CutDown_H2' - sMillingDn = ML.FindMilling( sMchTypeDn) + sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true) sPrefixDn = 'L2CDH2_' end end @@ -1399,12 +1395,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1) EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- se feature orientata su faccia da sotto provo a cambiare l'attacco if nSide == -1 then EgtSetMachiningParam( MCH_MP.LIPERP, min( dLioPerp1, dLioPerp2)) EgtSetMachiningParam( MCH_MP.LOPERP, min( dLioPerp1, dLioPerp2)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) -- esco se non sono nella seconda lavorazione o non nella faccia da sotto diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 0d7d12c..86342ff 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -144,7 +144,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide) EgtSetMachiningParam( MCH_MP.STARTPOS, 80) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -155,8 +155,9 @@ end -- Applicazione della lavorazione local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, dFacElev) -- cerco la svuotatura opportuna - local sPockType = EgtIf( nSide ~=1 and BD.DOWN_HEAD, 'OpenPocket_H2', 'OpenPocket') - local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX()) + local bDownHead = nSide ~=1 and BD.DOWN_HEAD + local sPockType = EgtIf( bDownHead, 'OpenPocket_H2', 'OpenPocket') + local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX(), nil, nil, not bDownHead, bDownHead) if not sPocketing then local sErr = 'Error : OpenPocket not found in library' EgtOutLog( sErr) @@ -197,10 +198,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, d sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -392,7 +393,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster local dMaxDepthDn = 0 -- recupero la lavorazione if bCanUseUnderBlade then - sCuttingDn = ML.FindCutting( 'HeadSide_H2') + sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true) if not sCuttingDn then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing underneath not found in library' EgtOutLog( sErr) @@ -715,7 +716,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- imposto posizione braccio porta testa per non ingombrare agli estremi EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -844,7 +845,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- determino e imposto l'utilizzo della faccia EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]]) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -868,11 +869,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end -- recupero la lavorazione local sMilling - if nSide == -1 and BD.DOWN_HEAD then - sMilling = ML.FindMilling( 'Long2Cut_H2', dElev) - else - sMilling = ML.FindMilling( 'Long2Cut', dElev) - end + local bDownHead = ( nSide == -1 and BD.DOWN_HEAD) + sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bDownHead, bDownHead) if not sMilling then local sErr = 'Error : Long2Cut not found in library' @@ -1097,7 +1095,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster EgtSetMachiningParam( MCH_MP.STARTPOS, 80) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1138,7 +1136,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- se testa da sotto if nSide ~= 1 and BD.DOWN_HEAD then sMchTypeDn = 'Long2CutSide_H2' - sMillingDn = ML.FindMilling( sMchTypeDn) + sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true) sPrefixDn = 'L2CSH2_' end -- lavorazione da sotto @@ -1153,7 +1151,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- se testa da sotto if BD.DOWN_HEAD then sMchTypeDn = 'Long2CutDown_H2' - sMillingDn = ML.FindMilling( sMchTypeDn) + sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true) sPrefixDn = 'L2CDH2_' end end @@ -1543,12 +1541,12 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- se feature orientata su faccia da sotto e concave provo a cambiare l'attacco if nSide == -1 and not bConvex then EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1) EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessMark.lua b/LuaLibs/ProcessMark.lua index aec2e5c..3af4b44 100644 --- a/LuaLibs/ProcessMark.lua +++ b/LuaLibs/ProcessMark.lua @@ -70,11 +70,8 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) -- recupero la lavorazione local sMillType = 'Text' - local sMchExt = EgtIf( bMillDown, '_H2', '') - local sMilling = ML.FindMilling( sMillType..sMchExt) - if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType) - end + --local sMchExt = EgtIf( bMillDown, '_H2', '') + local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) if not sMilling then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' EgtOutLog( sErr) @@ -97,7 +94,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -121,7 +118,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchF2Id, false) return false, sErr diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index a4d2f13..2eecb76 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -236,14 +236,14 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end local sPocketing if Proc.Prc ~= 53 then - sPocketing = ML.FindPocketing( sPockType..sMchExt, dW) + sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) if not sPocketing and bPockUp then sPocketing = ML.FindPocketing( sPockType, dW) end end if not sPocketing then sPockType = 'Pocket' - sPocketing = ML.FindPocketing( sPockType..sMchExt, dW) + sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) if not sPocketing and bPockUp then sPocketing = ML.FindPocketing( sPockType, dW) end @@ -321,7 +321,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -362,7 +362,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index a894ebd..a346bcc 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -135,7 +135,7 @@ local function ModifySideAndInvert( Proc, bHead, bForceInvert, nCutLengthMach) EgtSetMachiningParam( MCH_MP.ENDADDLEN, nCutLengthMach) end -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end end @@ -181,19 +181,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly -- recupero la lavorazione local sMilling, sMilling2 if nChamfer > 0 then - if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then - sMilling = ML.FindMilling( 'Mark_H2') - if not sMilling then sMilling = ML.FindMilling( 'Mark') end - else - sMilling = ML.FindMilling( 'Mark') - end + local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead) if not sMilling then local sErr = 'Error : chamfer not found in library' EgtOutLog( sErr) return -1, 0, sErr end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -296,11 +292,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama -- recupero la lavorazione di fresatura local sMillType = 'Prof' - sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) - if not sMilling and bMillDown then - sMilling = ML.FindMilling( sMillType) - bMillDown = false - end + sMilling, _, _, bMillDown = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown) if not sMilling then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' EgtOutLog( sErr) @@ -319,7 +311,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if ( nSide ~= -1 or bMillDown) and nLastFacet and EgtGetInfo( Proc.Id, sEnableExtraBladeUpperFace, 'i') == 1 then -- recupero la lavorazione local sCutType = 'HeadSide' - local sCutting = ML.FindCutting( sCutType .. EgtIf( bMillDown, '_H2', '')) + local sCutting = ML.FindCutting( sCutType, not bMillDown, bMillDown) -- se richiesto taglio con lama da sotto e non trovato non posso utilizzare quello da sopra if not sCutting then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library' @@ -390,7 +382,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -437,7 +429,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -516,7 +508,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -554,7 +546,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -594,7 +586,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -632,7 +624,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -670,7 +662,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr diff --git a/LuaLibs/ProcessProfConcave.lua b/LuaLibs/ProcessProfConcave.lua index d8fd375..9b26dd6 100644 --- a/LuaLibs/ProcessProfConcave.lua +++ b/LuaLibs/ProcessProfConcave.lua @@ -123,7 +123,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) end -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end @@ -171,7 +171,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly sMilling = ML.FindMilling( 'Mark') if not sMilling then if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then - sMilling = ML.FindMilling( 'Mark_H2') + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) end if not sMilling then local sErr = 'Error : chamfer not found in library' @@ -180,7 +180,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly end end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -328,7 +328,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -378,7 +378,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -477,7 +477,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -501,7 +501,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -539,7 +539,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -563,7 +563,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -601,7 +601,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr @@ -634,7 +634,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchV2Id, false) return false, sErr diff --git a/LuaLibs/ProcessProfConvex.lua b/LuaLibs/ProcessProfConvex.lua index 7664e1c..6ca8742 100644 --- a/LuaLibs/ProcessProfConvex.lua +++ b/LuaLibs/ProcessProfConvex.lua @@ -123,7 +123,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) end -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end @@ -171,7 +171,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly sMilling = ML.FindMilling( 'Mark') if not sMilling then if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then - sMilling = ML.FindMilling( 'Mark_H2') + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) end if not sMilling then local sErr = 'Error : chamfer not found in library' @@ -180,7 +180,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly end end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -328,7 +328,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -378,7 +378,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -477,7 +477,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -501,7 +501,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -539,7 +539,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -563,7 +563,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -601,7 +601,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr @@ -634,7 +634,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchV2Id, false) return false, sErr diff --git a/LuaLibs/ProcessProfFront.lua b/LuaLibs/ProcessProfFront.lua index 93cc78c..3a68535 100644 --- a/LuaLibs/ProcessProfFront.lua +++ b/LuaLibs/ProcessProfFront.lua @@ -94,7 +94,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam) local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT) EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode) -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end end @@ -143,7 +143,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly sMilling = ML.FindMilling( 'Mark') if not sMilling then if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then - sMilling = ML.FindMilling( 'Mark_H2') + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) end if not sMilling then local sErr = 'Error : chamfer not found in library' @@ -152,7 +152,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly end end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -289,7 +289,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -337,7 +337,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -430,7 +430,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -454,7 +454,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -489,7 +489,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -513,7 +513,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -558,7 +558,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr diff --git a/LuaLibs/ProcessProfHead.lua b/LuaLibs/ProcessProfHead.lua index 4f841b0..7dd73d9 100644 --- a/LuaLibs/ProcessProfHead.lua +++ b/LuaLibs/ProcessProfHead.lua @@ -116,7 +116,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) end -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end @@ -161,19 +161,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly -- recupero la lavorazione local sMilling, sMilling2 if nChamfer > 0 then - if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then - sMilling = ML.FindMilling( 'Mark_H2') - if not sMilling then sMilling = ML.FindMilling( 'Mark') end - else - sMilling = ML.FindMilling( 'Mark') - end + local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead) if not sMilling then local sErr = 'Error : chamfer not found in library' EgtOutLog( sErr) return -1, 0, sErr end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -335,7 +331,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -387,7 +383,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -403,10 +399,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if nChamfer < 2 then -- recupero la lavorazione local sMillType = 'Prof' - local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) - if not sMilling then - sMilling = ML.FindMilling( sMillType) - end + local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -491,7 +484,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -516,7 +509,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -554,7 +547,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -579,7 +572,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -625,7 +618,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchV2Id, false) return false, sErr @@ -665,7 +658,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr diff --git a/LuaLibs/ProcessRidgeLap.lua b/LuaLibs/ProcessRidgeLap.lua index e91c45b..e453b80 100644 --- a/LuaLibs/ProcessRidgeLap.lua +++ b/LuaLibs/ProcessRidgeLap.lua @@ -97,7 +97,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- determino se da lavorare con testa da sotto local bDownHead = ( BD.DOWN_HEAD and vtN[vFaceOrd[3]]:getZ() < -0.1) -- recupero la lavorazione - local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bDownHead, '_H2', '')) + local sCutting = ML.FindCutting( 'HeadSide', not bDownHead, bDownHead) if not sCutting then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessRoundArch.lua b/LuaLibs/ProcessRoundArch.lua index 08a30a5..31477a5 100644 --- a/LuaLibs/ProcessRoundArch.lua +++ b/LuaLibs/ProcessRoundArch.lua @@ -230,7 +230,7 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessSawCut.lua b/LuaLibs/ProcessSawCut.lua index 807f995..8e800d5 100644 --- a/LuaLibs/ProcessSawCut.lua +++ b/LuaLibs/ProcessSawCut.lua @@ -219,7 +219,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- imposto uso della faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessScarfJoint.lua b/LuaLibs/ProcessScarfJoint.lua index 04540e4..0f67f60 100644 --- a/LuaLibs/ProcessScarfJoint.lua +++ b/LuaLibs/ProcessScarfJoint.lua @@ -92,7 +92,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -115,7 +115,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -473,7 +473,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';') end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessSimpleScarf.lua b/LuaLibs/ProcessSimpleScarf.lua index 7f64b22..2d773e5 100644 --- a/LuaLibs/ProcessSimpleScarf.lua +++ b/LuaLibs/ProcessSimpleScarf.lua @@ -91,7 +91,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -114,7 +114,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index af7488e..ab690e9 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -109,7 +109,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -132,7 +132,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -237,7 +237,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId) -- altrimenti necessari tagli da sopra e sotto con testa opportuna else -- recupero la lavorazione con lama da sotto - local sCutting2 = ML.FindCutting( 'TailSide_H2') + local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true) if not sCutting2 then local sErr = 'Error : cutting H2 not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessStepJoint.lua b/LuaLibs/ProcessStepJoint.lua index 38e6f8d..1c4f6e8 100644 --- a/LuaLibs/ProcessStepJoint.lua +++ b/LuaLibs/ProcessStepJoint.lua @@ -83,11 +83,8 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- recupero la lavorazione local sMillType = 'Mark' local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) - local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', '')) - if not sMilling and bDownHead then - sMilling = ML.FindMilling( sMillType) - bDownHead = false - end + local sMilling + sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -109,7 +106,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -132,7 +129,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessStepJointNotch.lua b/LuaLibs/ProcessStepJointNotch.lua index edbfe86..5fabb26 100644 --- a/LuaLibs/ProcessStepJointNotch.lua +++ b/LuaLibs/ProcessStepJointNotch.lua @@ -57,11 +57,8 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid, local bDownHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() < -0.5) -- recupero la lavorazione local sCutType = 'HeadSide' - local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) - if not sCutting and bTopHead then - sCutting = ML.FindCutting( sCutType) - bDownHead = false - end + local sCutting + sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead) if not sCutting then local sErr = 'Error : cutting not found in library' EgtOutLog( sErr) @@ -162,11 +159,7 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1) local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1) -- recupero la lavorazione - local sPocketing = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic) - if not sPocketing and bTopHead then - sPocketing = ML.FindPocketing( sMchFind, dDiamTool, dElev + dCollSic) - bDownHead = false - end + local sPocketing, _, _, bDownHead = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic, nil, bTopHead, bDownHead) if not sPocketing then local sErr = 'Error : pocketing not found in library' EgtOutLog( sErr) @@ -202,10 +195,10 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF -- imposto elevazione local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -271,10 +264,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, -- scelta lavorazione local sMilling local sTypeMill = EgtIf( nUseRoughTool > 0, 'Long2Cut', 'LongSmallCut') - sMilling = ML.FindMilling( sTypeMill .. EgtIf( bDownHead, '_H2', ''), nil, sTuuidMstr) - if not sMilling and bTopHead then - sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr) - end + sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr, nil, nil, bTopHead, bDownHead) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -319,7 +309,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, EgtSetMachiningParam( MCH_MP.LIPERP, 20) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -534,11 +524,8 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- recupero la lavorazione local sMillType = 'Mark' local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) - local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', '')) - if not sMilling and bDownHead then - sMilling = ML.FindMilling( sMillType) - bDownHead = false - end + local sMilling + sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -561,7 +548,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -586,7 +573,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index 2e650b0..38a360a 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -104,7 +104,7 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -182,7 +182,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket') - local sPocketing = ML.FindPocketing( sPockType) + local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown) local dMaxDepth = 100 local dStep = 30 local nSurfStep @@ -234,11 +234,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- recupero la lavorazione local sMillType = 'Tenon' - local sCurrType = sMillType .. EgtIf( bMillDown, '_H2', '') - local sMilling = ML.FindMilling( sCurrType, dTenH) or ML.FindMilling( sCurrType) - if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType, dTenH) or ML.FindMilling( sMillType) - end + local sMilling = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown) or ML.FindMilling( sMillType, nil, nil, nil, bMillUp, bMillDown) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -306,7 +302,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessText.lua b/LuaLibs/ProcessText.lua index 040e3ac..aff5c02 100644 --- a/LuaLibs/ProcessText.lua +++ b/LuaLibs/ProcessText.lua @@ -56,11 +56,8 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId) local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174) -- recupero la lavorazione local sMillType = 'Text' - local sMchExt = EgtIf( bMillDown, '_H2', '') - local sMilling = ML.FindMilling( sMillType..sMchExt) - if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType) - end + --local sMchExt = EgtIf( bMillDown, '_H2', '') + local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) if not sMilling then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' EgtOutLog( sErr) @@ -83,7 +80,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessTyroleanDovetail.lua b/LuaLibs/ProcessTyroleanDovetail.lua index 4df1ffe..e3f3a3a 100644 --- a/LuaLibs/ProcessTyroleanDovetail.lua +++ b/LuaLibs/ProcessTyroleanDovetail.lua @@ -457,7 +457,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOf end EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/NestProcess.lua b/NestProcess.lua index 7bcb751..3c09f69 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -131,8 +131,7 @@ local function TotPartLen(Parts) end -- Imposto direttorio libreria specializzata per Travi -local sBaseDir = EgtGetSourceDir() -EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') +EgtAddToPackagePath( NEST.BASEDIR .. 'LuaLibs\\?.lua') -- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi EgtSetCurrMachine( NEST.MACHINE) @@ -149,14 +148,6 @@ end EgtRemoveBaseMachineDirFromPackagePath() EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua') ----- Carico le librerie ---_G.package.loaded.WallExec = nil ---local WE = require( 'BeamExec') ---_G.package.loaded.WallLib = nil ---local WL = require( 'BeamLib') ---_G.package.loaded.WProcessLapJoint = nil ---local LapJoint = require( 'WProcessLapJoint') - -- Inizializzo contatori errori e avvisi local nErrCnt = 0 local nWarnCnt = 0 diff --git a/Process.lua b/Process.lua index d9b7f05..396666c 100644 --- a/Process.lua +++ b/Process.lua @@ -11,8 +11,7 @@ _ENV = EgtProtectGlobal() EgtEnableDebug( false) -- Imposto direttorio libreria specializzata per Travi -local sBaseDir = EgtGetSourceDir() -EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') +EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') -- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi local sMachDir = EgtGetCurrMachineDir()