diff --git a/BatchProcess.lua b/BatchProcess.lua index f7d7b11..81bd501 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -1,9 +1,10 @@ --- BatchProcess.lua by Egaltech s.r.l. 2019/07/25 +-- BatchProcess.lua by Egaltech s.r.l. 2019/08/29 -- 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. -- 2019/07/24 Aggiunta gestione extra-corse. +-- 2019/08/29 Aggiunta possibilità di processare file NGE. -- Intestazioni require( 'EgtBase') @@ -12,7 +13,7 @@ EgtEnableDebug( false) -- Per test --BEAM = {} ---BEAM.FILE = 'c:\\EgtData\\Varie\\TestEssetreFast\\TestFabio\\Accettazione.btl' +--BEAM.FILE = 'c:\\EgtData\\Varie\\TestEssetreFast\\Xxx\\2-Banchina smussata.nge' --BEAM.MACHINE = 'FAST' --BEAM.FLAG = 3 @@ -57,7 +58,7 @@ local function PostWarnView( nWarn, sMsg) if nWarn ~= 0 and ( BEAM.FLAG == 1 or BEAM.FLAG == 2) then EgtSetView( SCE_VD.ISO_SW, false) EgtZoom( SCE_ZM.ALL) - EgtOutBox( sMsg, 'BatchProcess (wrn=' .. tostring( nErr) .. ')', 'WARNINGS') + EgtOutBox( sMsg, 'BatchProcess (wrn=' .. tostring( nWarn) .. ')', 'WARNINGS') end end @@ -107,14 +108,32 @@ local BL = require( 'BeamLib') -- Carico i dati globali local BD = require( 'BeamData') --- Importo il file Btl -EgtNewFile() -if not EgtImportBtl( BEAM.FILE, EIB_FL.TS3_POS) then - BEAM.ERR = 13 - BEAM.MSG = 'Error importing BTL file : ' .. BEAM.FILE - WriteErrToLogFile( BEAM.ERR, BEAM.MSG) - PostErrView( BEAM.ERR, BEAM.MSG) - return +-- Verifico il tipo di file +local _, _, sExt = EgtSplitPath( BEAM.FILE) +local bBtl = ( string.upper( sExt or '') ~= '.NGE') + +-- Se Btl, lo importo +if bBtl then + EgtNewFile() + if not EgtImportBtl( BEAM.FILE, EIB_FL.TS3_POS) then + BEAM.ERR = 13 + BEAM.MSG = 'Error importing BTL file : ' .. BEAM.FILE + WriteErrToLogFile( BEAM.ERR, BEAM.MSG) + PostErrView( BEAM.ERR, BEAM.MSG) + return + end +-- altrimenti apro Nge +else + if not EgtOpenFile( BEAM.FILE) then + BEAM.ERR = 13 + BEAM.MSG = 'Error opening NGE file : ' .. BEAM.FILE + WriteErrToLogFile( BEAM.ERR, BEAM.MSG) + PostErrView( BEAM.ERR, BEAM.MSG) + return + end + -- faccio copia del file originale + local sDir, sTitle, sExt = EgtSplitPath( BEAM.FILE) + EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt) end -- Recupero l'elenco ordinato delle travi @@ -215,9 +234,9 @@ if dRawW > BD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > BD.MAX_HEIGHT + 10 * GEO end -- Lunghezza della barra -local dRawL = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo'), 'BARLEN', 'd') or 12000 +local dRawL = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'BARLEN', 'd') or 12000 -- Sovramateriale di testa -local dOvmHead = EgtGetInfo( EgtGetFirstPart(), 'POSX', 'd') or 10 +local dOvmHead = vBeam[1].PosX or 10 -- Sistemo le travi nel grezzo local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 62df72d..25f266d 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,6 +1,7 @@ --- BeamExec.lua by Egaltech s.r.l. 2019/07/12 +-- BeamExec.lua by Egaltech s.r.l. 2019/09/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. -- Tabella per definizione modulo local BeamExec = {} @@ -207,12 +208,12 @@ end local function IsHeadFeature( Proc, b3Raw, dCurrOvmH) -- feature sempre di testa o coda per il gruppo if Proc.Grp == 1 or Proc.Grp == 2 then - return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX()) + return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH) end -- feature sempre di testa o coda nonostante il gruppo if ( Proc.Grp == 3 or Proc.Grp == 4) and ( Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then - return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX()) + return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH) end -- gestioni speciali if LapJoint.Identify( Proc) then @@ -232,15 +233,15 @@ local function IsHeadFeature( Proc, b3Raw, dCurrOvmH) end ------------------------------------------------------------------------------------------------------------- -local function IsTailFeature( Proc, b3Raw) +local function IsTailFeature( Proc, b3Raw, dCurrOvmH) -- feature sempre di testa o coda per il gruppo if Proc.Grp == 1 or Proc.Grp == 2 then - return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX()) + return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH) end -- feature sempre di testa o coda nonostante il gruppo if ( Proc.Grp == 3 or Proc.Grp == 4) and ( Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then - return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX()) + return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH) end -- gestioni speciali if LapJoint.Identify( Proc) then @@ -286,7 +287,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH) Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD) Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0 Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH) - Proc.Tail = IsTailFeature( Proc, b3Raw) + Proc.Tail = IsTailFeature( Proc, b3Raw, dCurrOvmH) Proc.Diam = 0 Proc.Fcs = 0 Proc.Fce = 0 @@ -314,7 +315,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH) Proc2.Fct = Proc.Fct Proc2.Diam = Proc.Diam Proc2.Head = Proc.Head - Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw) + Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH) Proc2.Fcs = Proc.Fce Proc2.Fce = Proc.Fcs Proc2.CutId = Proc.CutId @@ -332,17 +333,18 @@ end ------------------------------------------------------------------------------------------------------------- local function OrderFeatures( vProc, b3Raw) + -- funzione di confronto -- secondo centro box in X (taglio di intestazione prima di altri tagli di testa e taglio di separazione però prima di altri tagli di coda) local function CompareFeatures( B1, B2) - -- se l'altro è intestazione va sempre prima - if Hcut.Identify( B2) then - return false - end -- se primo è intestazione va sempre prima if Hcut.Identify( B1) then return true end + -- se l'altro è intestazione va sempre prima + if Hcut.Identify( B2) then + return false + end -- se primo è feature di coda e l'altro è separazione o non è feature di coda if B1.Tail and ( Split.Identify( B2) or not B2.Tail) then return false @@ -397,8 +399,10 @@ local function OrderFeatures( vProc, b3Raw) return B1.Box:getCenter():getZ() > B2.Box:getCenter():getZ() end end + -- eseguo ordinamento table.sort( vProc, CompareFeatures) + -- riunisco fori con lo stesso diametro e non troppo lontani for i = 1, #vProc do local ProcI = vProc[i] @@ -454,6 +458,9 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) -- se separazione elseif Split.Identify( Proc) then nSplitting = i + -- se taglio + elseif Cut.Identify( Proc) then + bOk, bDown = Cut.Classify( Proc) -- se doppio taglio elseif DoubleCut.Identify( Proc) then bOk, bDown = DoubleCut.Classify( Proc) @@ -524,7 +531,7 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) else Proc.Flg = 0 bAllOk = false - table.insert( Stats, {Err = 1, Msg='Error : classify failed', CutId=Proc.CutId, TaskId=Proc.TaskId}) + table.insert( Stats, {Err = 1, Msg='Error : impossible to machine', CutId=Proc.CutId, TaskId=Proc.TaskId}) end end -- se necessario ribaltamento, assegno intestatura alla fase ribaltata diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 2f01bc3..66431ee 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,4 +1,4 @@ --- BeamLib.lua by Egaltech s.r.l. 2019/07/25 +-- BeamLib.lua by Egaltech s.r.l. 2019/09/04 -- Libreria globale per Travi -- Tabella per definizione modulo @@ -616,10 +616,20 @@ function BeamLib.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dRad, vtRef, dCutExtra, end --------------------------------------------------------------------- -function BeamLib.MakeOneFaceBySaw( nSurfId, nFacet, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, sNotes, b3Raw) +function BeamLib.MakeOneFaceBySaw( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, sNotes, b3Raw) + -- risolvo paramentro ambiguo + local nOrthoOpposite + local vtOrthO + if isVector3d( Par5) then + nOrthoOpposite = BeamLib.GetNearestOrthoOpposite( Par5) + vtOrthO = Vector3d( Par5) + else + nOrthoOpposite = Par5 + vtOrthO = BeamLib.GetVersRef( Par5) + end -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) - -- linea o bilinea di lavorazione + -- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach) local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BeamLib.GetVersRef( nOrthoOpposite), GDB_ID.ROOT) if dLen < 1.1 or dWidth < 1.1 then local sWarn = 'Face ' .. string.format( '%d,%d', nSurfId, nFacet) .. ' skipped : too small' @@ -635,11 +645,14 @@ function BeamLib.MakeOneFaceBySaw( nSurfId, nFacet, sCutting, dSawDiam, nOrthoOp local vtTg = ptP2 - ptP1 ; vtTg:normalize() local dAllStart = 0 local dAllEnd = 0 - -- se bilinea, scarto la parte corta + -- se bilinea, scarto la parte più allineata con la direzione ortogonale if ( ( ptPm - ptP1) - ( ptPm - ptP1) * vtTg * vtTg):len() > 100 * GEO.EPS_SMALL then + local vtTg1 = ptPm - ptP1 ; vtTg1:normalize() + local vtTg2 = ptP2 - ptPm ; vtTg2:normalize() local dDist1 = dist( ptP1, ptPm) local dDist2 = dist( ptP2, ptPm) - if dDist1 >= dDist2 then + --if dDist1 >= dDist2 then + if abs( vtTg1 * vtOrthO) < abs( vtTg2 * vtOrthO) then ptP2 = Point3d( ptPm) dAllEnd = - dDist2 - 10 * GEO.EPS_SMALL else @@ -656,13 +669,13 @@ function BeamLib.MakeOneFaceBySaw( nSurfId, nFacet, sCutting, dSawDiam, nOrthoOp local bWsRight = ( bInvert ~= bDownUp) local nWorkSide = EgtIf( bWsRight, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT) -- Versore di riferimento - local vtRef = BeamLib.GetVersRef( nOrthoOpposite) - vtRef = vtRef - vtRef * vtN * vtN ; vtRef:normalize() + local vtRef = Vector3d( vtTg) + vtRef:rotate( vtN, EgtIf( bInvert, -90, 90)) -- Versore esterno local vtOut = vtRef - vtRef * vtTg * vtTg ; vtOut:normalize() -- Versore ausiliario (direzione braccio) local vtAux = Vector3d( vtN:getX(), vtN:getY(), 0) ; vtAux:normalize() - vtAux:rotate( Z_AX(), EgtIf( bWsRight, 90, - 90)) + vtAux:rotate( Z_AX(), EgtIf( bWsRight, 90, -90)) if vtAux:isSmall() then vtAux = Vector3d( vtOut:getX(), vtOut:getY(), 0) ; vtAux:normalize() else diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 6413da8..dcbcff8 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -1,4 +1,4 @@ --- FacesBySaw.lua by Egaltech s.r.l. 2019/04/26 +-- FacesBySaw.lua by Egaltech s.r.l. 2019/09/04 -- Gestione taglio con lama di feature con una, due o tre facce -- Tabella per definizione modulo @@ -55,14 +55,12 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, sCutName) return false, sErr end -- calcolo direzione di lavoro - local nOrthoOpposite = {} + local vtRef = {} local vtTg = ptT2 - ptT1 ; - local vtRef1 = vtN[1] ^ vtTg - if vtRef1 * vtN[2] < 0 then vtRef1 = - vtRef1 end - local vtRef2 = vtN[2] ^ vtTg - if vtRef2 * vtN[1] < 0 then vtRef2 = - vtRef2 end - nOrthoOpposite[1] = BL.GetNearestOrthoOpposite( vtRef1) - nOrthoOpposite[2] = BL.GetNearestOrthoOpposite( vtRef2) + vtRef[1] = vtN[1] ^ vtTg + if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end + vtRef[2] = vtN[2] ^ vtTg + if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end -- determino quale faccia è più grande local ptPs = ( ptT1 + ptT2) / 2 local dSqDim1 = ( ptC[1] - ptPs):sqlen() @@ -113,10 +111,10 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, sCutName) -- eseguo for i = 1, #vCuts do -- assegno il modo di tagliare - local nOrtOpp = EgtIf( ( i % 2) == 1, nOrthoOpposite[nSmaInd], nOrthoOpposite[nBigInd]) + local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nSmaInd], vtRef[nBigInd]) -- lavoro la faccia for j = 1, #vCuts[i] do - local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, nOrtOpp, nil, dCutExtra, BD.CUT_SIC, 0, 0, nil, b3Raw) + local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, nil, dCutExtra, BD.CUT_SIC, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end @@ -125,10 +123,10 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, sCutName) return true else -- lavoro la prima faccia - local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite[1], nil, dCutExtra, BD.CUT_SIC, 0, 0, nil, b3Raw) + local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 0, sCutting, dSawDiam, vtRef[1], nil, dCutExtra, BD.CUT_SIC, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end -- lavoro seconda faccia - bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 1, sCutting, dSawDiam, nOrthoOpposite[2], nil, dCutExtra, BD.CUT_SIC, 0, 0, nil, b3Raw) + bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 1, sCutting, dSawDiam, vtRef[2], nil, dCutExtra, BD.CUT_SIC, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end return true end diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 2ead82a..82a1719 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2019/07/08 +-- ProcessCut.lua by Egaltech s.r.l. 2019/09/04 -- Gestione calcolo singoli tagli di lama per Travi -- Tabella per definizione modulo @@ -21,6 +21,19 @@ function ProcessCut.Identify( Proc) return ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10) end +--------------------------------------------------------------------- +-- Classificazione della feature +function ProcessCut.Classify( Proc, b3Raw) + local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 then + local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0) + if DimH > BD.MAX_DIM_DICE then + return true, true + end + end + return true, false +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) @@ -101,24 +114,24 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- eseguo for i = 1, #vCuts do -- determino il modo di tagliare - local nOrthoOpposite + local vtOrthoO if vtO then if i % 2 == 1 then - nOrthoOpposite = BL.GetNearestOrthoOpposite( vtN) + vtOrthoO = vtN else if #vCuts[i-1] > 0 then - nOrthoOpposite = BL.GetNearestOrthoOpposite( vtO) + vtOrthoO = vtO else - nOrthoOpposite = MCH_MILL_FU.ORTHO_DOWN + vtOrthoO = Z_AX() end end else if bHorizCut then - nOrthoOpposite = MCH_MILL_FU.ORTHO_DOWN + vtOrthoO = Z_AX() elseif vtN:getY() > -0.02 then - nOrthoOpposite = MCH_MILL_FU.ORTHO_FRONT + vtOrthoO = Y_AX() else - nOrthoOpposite = MCH_MILL_FU.ORTHO_BACK + vtOrthoO = -Y_AX() end end -- lavoro la faccia @@ -128,11 +141,11 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- se strato pari composto da 1 o 2 elementi if i % 2 == 0 and #vCuts[i] <= 2 then -- il primo elemento prende la direzione prevista, il secondo quella opposta - local nNewOrthoOpposite = nOrthoOpposite + local vtNewOrthoO = vtOrthoO if j ~= 1 then - nNewOrthoOpposite = EgtIf( nOrthoOpposite == MCH_MILL_FU.ORTHO_FRONT, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT) + vtNewOrthoO = -vtOrthoO end - local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, nNewOrthoOpposite, nil, 0.1, BD.CUT_SIC, 0, 0, nil, b3Raw) + local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, nil, 0.1, BD.CUT_SIC, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end @@ -140,7 +153,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- tutti gli altri casi vengono saltati -- caso generale else - local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, nil, -0.5, BD.CUT_SIC, 0, 0, nil, b3Raw) + local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, -0.5, BD.CUT_SIC, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end @@ -150,15 +163,15 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- altrimenti tagli diretti della faccia else -- lavoro la faccia - local nOrthoOpposite + local vtOrthoO if bHorizCut then - nOrthoOpposite = MCH_MILL_FU.ORTHO_DOWN + vtOrthoO = Z_AX() elseif vtN:getY() > -0.02 then - nOrthoOpposite = MCH_MILL_FU.ORTHO_FRONT + vtOrthoO = Y_AX() else - nOrthoOpposite = MCH_MILL_FU.ORTHO_BACK + vtOrthoO = -Y_AX() end - local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, nil, b3Raw) + local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end diff --git a/LuaLibs/ProcessDoubleCut.lua b/LuaLibs/ProcessDoubleCut.lua index b8f1ff8..681310f 100644 --- a/LuaLibs/ProcessDoubleCut.lua +++ b/LuaLibs/ProcessDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2019/08/03 +-- ProcessDrill.lua by Egaltech s.r.l. 2019/09/04 -- Gestione calcolo doppi tagli di lama per Travi -- Tabella per definizione modulo @@ -9,6 +9,7 @@ require( 'EgtBase') local BL = require( 'BeamLib') local DC = require( 'DiceCut') local Cut = require( 'ProcessCut') +local Fbs = require( 'FacesBySaw') EgtOutLog( ' ProcessDoubleCut started', 1) @@ -181,41 +182,9 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end end end - end - -- se non ci sono tagli supplementari o convesso, tagli diretti delle facce - if #vCuts == 0 then - -- imposto eventuale affondamento aggiuntivo - local dExtraCut = EgtIf( bConvex, BD.CUT_EXTRA, 0) - -- eseguo sulle due facce - for j = 1, 2 do - -- determino ordine dei tagli - local i = j - if not bOnY and ptC[1]:getZ() > ptC[2]:getZ() then - i = 3 - j - end - -- lavoro la faccia - local nOrthoOpposite - if bOnY then - local bFront = ( ptC[i]:getY() < ptPs:getY()) - nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT) - else - if bConvex then - if dLen < dMaxDepth then - local bFront = ( vtN[i]:getY() < 0.02) - nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT) - else - nOrthoOpposite = MCH_MILL_FU.ORTHO_DOWN - end - else - local bOver = ( ptC[i]:getZ() > ptC[3-i]:getZ()) - nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP) - end - end - local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, i - 1, sCutting, dSawDiam, nOrthoOpposite, nil, dExtraCut, BD.CUT_SIC, 0, 0, nil, b3Raw) - if not bOk then - return bOk, sErr - end - end + -- altrimenti, tagli diretti delle facce + else + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, EgtIf( bHead, 'HeadSide', 'TailSide')) end end -- eventuale segnalazione ingombro di testa o coda diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 8bb00b3..9e13203 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2019/07/29 +-- ProcessDrill.lua by Egaltech s.r.l. 2019/08/29 -- Gestione calcolo forature per Travi -- Tabella per definizione modulo @@ -15,7 +15,7 @@ local ML = require( 'MachiningLib') -- Costanti local TH_RAD = 35 -- raggio portautensile -local COS_SLANT_LIM = 0.82 -- 35deg da piano +local COS_SLANT_LIM = 0.866 -- 30deg da piano --------------------------------------------------------------------- -- Riconoscimento della feature @@ -67,14 +67,14 @@ function ProcessDrill.Split( Proc, b3Raw) local dDiam = 2 * EgtArcRadius( AuxId) local dLen = abs( EgtCurveThickness( AuxId)) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) - local bOpen = ( EgtGetInfo( Proc.Id, 'FCE', 'i') ~= 0) + local bOpen = ( Proc.Fce ~= 0) -- recupero la lavorazione local sDrilling, _, dMaxMat = ML.FindDrilling( dDiam) if not sDrilling then return bOpen end -- restituisco se va fatto in doppio (solo fori orizzontali) - return ( bOpen and dLen > dMaxMat + 10 * GEO.EPS_SMALL and abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY()) + return ( bOpen and dLen > dMaxMat + 10 * GEO.EPS_SMALL and ( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6)) end --------------------------------------------------------------------- @@ -196,8 +196,13 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) EgtOutLog( sMyWarn .. ' (process ' .. tostring( Proc.Id) .. ')') end EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) - -- dichiaro non si generano sfridi per VMill - EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') + -- Note utente con dichiarazione nessuna generazione sfridi per Vmill + local sUserNotes = 'VMRS=0;' + -- se foratura, aggiungo alle note massima elevazione (coincide con affondamento) + if nType == 'Drill' then + sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dDepth, 1) .. ',' + end + EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 4ba4fea..32fad5b 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2019/08/09 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/08/29 -- Gestione calcolo mezzo-legno per Travi -- Tabella per definizione modulo @@ -269,12 +269,14 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId) -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}}) -- imposto uso faccia e lato correzione - if vtN[nOthInd]:getZ() < -0.1 then - EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_TOP) - elseif vtN[nOthInd]:getX() > 0 then + if vtN[nOthInd]:getX() > 0.1 then EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_LEFT) - else + elseif vtN[nOthInd]:getX() < -0.1 then EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_RIGHT) + elseif vtN[nOthInd]:getZ() < -0.1 then + EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_TOP) + else + EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_DOWN) end -- imposto lato di correzione EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index f134ba7..49ee116 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2019/08/27 +-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2019/09/04 -- Gestione calcolo doppio taglio longitudinale per Travi -- Tabella per definizione modulo @@ -155,10 +155,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId) local nO = 1 local dStep = 0 local dAgg = EgtIf( bConvex, 2 * BD.CUT_EXTRA, BD.CUT_EXTRA) - if vWidth[vOrd[i]] + dAgg > dToolDiam then - nO = ceil(( vWidth[vOrd[i]] + dAgg) / dToolDiam) + if vWidth[vOrd[i]] > 0.8 * dToolDiam then + nO = ceil( vWidth[vOrd[i]] / ( 0.6 * dToolDiam)) if nO > 1 then - dStep = ( vWidth[vOrd[i]] + dAgg - dToolDiam) / ( nO - 1) + dStep = vWidth[vOrd[i]] / nO end end for k = 1, nO do