diff --git a/BatchProcess.lua b/BatchProcess.lua index 2974832..96b0aa2 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -1,17 +1,16 @@ --- BatchProcess.lua by Egaltech s.r.l. 2019/07/12 +-- BatchProcess.lua by Egaltech s.r.l. 2019/07/19 -- 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. +-- 2019/07/19 Aggiunta gestione collisioni. -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() EgtEnableDebug( false) --- Per test ---BEAM = {} ---BEAM.FILE = 'c:\\TechnoEssetre7\\EgtBtl\\Part_15_116.btl' ---BEAM.MACHINE = 'FAST' ---BEAM.FLAG = 3 +-- Flag abilitazione controllo collisione +local bVerifyCollision = true -- Log dati di generazione local sLog = 'BatchProcess : ' .. BEAM.FILE .. ', ' .. BEAM.MACHINE .. ', ' .. tostring( BEAM.FLAG) @@ -84,6 +83,12 @@ end EgtRemoveBaseMachineDirFromPackagePath() EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua') +-- Se modalità visualizzazione finestre per DB esco +if BEAM.FLAG > 10 then + BEAM.ERR = 0 + return +end + -- Segnalazione avvio EgtOutLog( '*** Beam BatchProcess Start ***', 1) @@ -293,6 +298,29 @@ local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot') local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1) EgtOutLog( sTime) +-- Se verifica, eseguo simulazione in cieco +if BEAM.FLAG == 3 and bVerifyCollision then + local bSimOk, nErr, sErr = EgtSimulate() + if not bSimOk then + BEAM.ERR = 22 + BEAM.MSG = 'Head-Part Collision' + BEAM.ROT = 0 + BEAM.CUTID = 0 + BEAM.TASKID = 0 + local vItem = EgtSplitString( sErr, ';') or {} + for i = 1, #vItem do + vItem[i] = EgtTrim( vItem[i] or '') + if string.find( vItem[i], 'CUTID', 1, true) then + BEAM.CUTID = EgtGetVal( vItem[i], 'CUTID', 'i') or 0 + elseif string.find( vItem[i], 'TASKID', 1, true) then + BEAM.TASKID = EgtGetVal( vItem[i], 'TASKID', 'i') or 0 + end + end + WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) + return + end +end + -- Imposto la vista ISO 3d, se richiesto if BEAM.FLAG == 1 or BEAM.FLAG == 2 then EgtSetView( SCE_VD.ISO_SW, false) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 9dda800..6413da8 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -107,6 +107,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, sCutName) for j = 1, #vCuts[i] do EgtRelocateGlob( vCuts[i][j], nAddGrpId) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) + EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) end end -- eseguo diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 8e907f5..2ead82a 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -86,6 +86,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) for j = 1, #vCuts[i] do EgtRelocateGlob( vCuts[i][j], nAddGrpId) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) + EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) end end -- recupero la normale dei tagli ortogonali diff --git a/LuaLibs/ProcessDoubleCut.lua b/LuaLibs/ProcessDoubleCut.lua index 47ed51d..11a1d49 100644 --- a/LuaLibs/ProcessDoubleCut.lua +++ b/LuaLibs/ProcessDoubleCut.lua @@ -140,6 +140,7 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) for j = 1, #vCuts[i] do EgtRelocateGlob( vCuts[i][j], nAddGrpId) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) + EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) end end -- eseguo diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 7e4b8ae..4acfe1b 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2019/07/08 +-- ProcessDrill.lua by Egaltech s.r.l. 2019/07/19 -- Gestione calcolo forature per Travi -- Tabella per definizione modulo @@ -147,6 +147,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end + if nType == 'Pocket' then + dMaxDepth = dMaxDepth - 4 + end -- se foro intermedio e inclinato, limito il massimo affondamento if not ( Proc.Fcs == 5 or Proc.Fcs == 6) then local CosB = abs( vtExtr:getX()) diff --git a/LuaLibs/ProcessFreeContour.lua b/LuaLibs/ProcessFreeContour.lua index e830f7b..a8975ae 100644 --- a/LuaLibs/ProcessFreeContour.lua +++ b/LuaLibs/ProcessFreeContour.lua @@ -1,4 +1,4 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2019/06/29 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2019/07/19 -- Gestione calcolo profilo libero per Travi -- Tabella per definizione modulo @@ -121,14 +121,28 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtOutLog( string.format( 'CrvLen=%.1f StepNbr=%d StepLen=%.1f', dCrvLen, nStep, dStep), 3) end -- verifiche per affondamento ( possibili lavorazioni in doppio) + local bCross = false + if abs( vtExtr:getY()) > 0.707 then + if b3Aux:getDimY() > b3Raw:getDimY() - 1.0 then + bCross = true + dDepth = min( dDepth, b3Raw:getDimY()) + end + elseif abs( vtExtr:getZ()) > 0.707 then + if b3Aux:getDimZ() > b3Raw:getDimZ() - 1.0 then + bCross = true + dDepth = min( dDepth, b3Raw:getDimZ()) + end + end local nDouble = 1 - local bCanDouble = ( abs( vtExtr:getZ()) < 0.5 and abs( vtExtr:getX()) < 0.1 and b3Aux:getDimY() > b3Raw:getDimY() - 1.0) - if nStep > 1 then - -- devo lasciare un codolo - dDepth = dDepth - BD.DIM_STRIP - else - -- devo affondare un poco oltre - dDepth = dDepth + BD.CUT_EXTRA + local bCanDouble = abs( vtExtr:getY()) > 0.707 and bCross + if bCross then + if nStep > 1 then + -- devo lasciare un codolo + dDepth = dDepth - BD.DIM_STRIP + else + -- devo affondare un poco oltre + dDepth = dDepth + BD.CUT_EXTRA + end end if dDepth > dMaxDepth then if bCanDouble then diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index a4d20d2..c2acdc5 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -177,6 +177,8 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) else EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end + -- dichiaro non si generano sfridi per VMill + EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -260,6 +262,8 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId) else EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end + -- dichiaro non si generano sfridi per VMill + EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -526,6 +530,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) end -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dFacElev, 1) .. ';') + -- dichiaro non si generano sfridi per VMill + EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 5ab4930..130eac3 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2019/07/12 +-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2019/07/17 -- Gestione calcolo doppio taglio longitudinale per Travi -- Tabella per definizione modulo @@ -69,13 +69,15 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId) -- angolo diedro per stabilire se taglio convesso local bInt, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFc[1], nFc[2], GDB_ID.ROOT) local bConvex + local bOrtho if bInt then bConvex = ( dAng >= 0) + bOrtho = ( abs( dAng + 90) < 1) else bConvex = true + bOrtho = false end local ptM = ( ptC[1] + ptC[2]) / 2 - local bOrtho = ( abs( dAng + 90) < 1) -- analisi del taglio local vOrd = {} local vFaceUse = {} diff --git a/LuaLibs/ProcessRidgeLap.lua b/LuaLibs/ProcessRidgeLap.lua index 49cf57e..0e36d87 100644 --- a/LuaLibs/ProcessRidgeLap.lua +++ b/LuaLibs/ProcessRidgeLap.lua @@ -140,6 +140,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) for j = 1, #vCuts[i] do EgtRelocateGlob( vCuts[i][j], nAddGrpId) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) + EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) end end -- calcolo riferimenti per facce inclinate diff --git a/LuaLibs/ProcessSimpleScarf.lua b/LuaLibs/ProcessSimpleScarf.lua index 4cb7bfd..9252e41 100644 --- a/LuaLibs/ProcessSimpleScarf.lua +++ b/LuaLibs/ProcessSimpleScarf.lua @@ -139,6 +139,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) for j = 1, #vCuts[i] do EgtRelocateGlob( vCuts[i][j], nAddGrpId) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) + EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) end end -- calcolo secondo riferimento per facce inclinate