From 09395eed782bb93f8a5b3a958e01eb9879091b39 Mon Sep 17 00:00:00 2001 From: Marco Salvi Date: Tue, 7 Jun 2022 13:36:51 +0000 Subject: [PATCH 01/13] Update percorso Artifacts su truenas --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d228d40..92b57e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: VERS_MAIN: '1.0' APP_NAME: 'Beam' NEW_REL: '' - NET_SHARE_R: '\\10.74.82.50\EgtTech' + NET_SHARE_R: '\\10.74.82.201\Artifacts\EGT_SRV\EgtTech' NET_USER: '10.74.82.50\Server' NET_SHARE_Z: '\\10.74.82.200\Artifacts' NET_USERQ: 'steamw\egalware' @@ -80,7 +80,7 @@ variables: .ReplicaR: &ReplicaR - | net use R: /delete - net use R: $env:NET_SHARE_R /u:$env:NET_USER $RDRIVE_PASSWD + net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD ROBOCOPY /MIR 32 R:\EgtData\$env:APP_NAME\32 ROBOCOPY /MIR 64 R:\EgtData\$env:APP_NAME\64 ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\32\Images From 84f2d30869d2f125e10d39ff05d195165373000e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 24 Jun 2022 19:17:03 +0200 Subject: [PATCH 02/13] DataBeam: - inseriti valori di default per parametri da BeamData OVM_BLADE_HBEAM e OVM_CHAIN_HBEAM --- LuaLibs/BeamExec.lua | 10 +++++++++- LuaLibs/ProcessSplit.lua | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 831c16d..ee38c51 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -361,7 +361,15 @@ end -- *** Inserimento delle travi nel grezzo *** ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk) - + + if not BD.OVM_BLADE_HBEAM then + BD.OVM_BLADE_HBEAM = 11 + end + + if not BD.OVM_CHAIN_HBEAM then + BD.OVM_CHAIN_HBEAM = 8 + end + -- Determinazione minimo grezzo scaricabile BeamExec.CalcMinUnloadableRaw( dRawW, dRawH) diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 2153567..8073f84 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -233,6 +233,9 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail) + if not BD.OVM_CHAIN_HBEAM then + BD.OVM_CHAIN_HBEAM = 8 + end -- ingombro del grezzo local b3Raw = EgtGetRawPartBBox( nRawId) -- inserimento smussi From cc22dbf589411e42d677e2d02b2c6d716a7b6377 Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 27 Jun 2022 08:38:21 +0200 Subject: [PATCH 03/13] DataBeam : - piccoli aggiustamenti e affinamenti. --- LuaLibs/BeamExec.lua | 406 ++++++++++++++-------------- LuaLibs/BeamLib.lua | 33 ++- LuaLibs/ProcessCut.lua | 25 +- LuaLibs/ProcessDovetail.lua | 5 +- LuaLibs/ProcessDrill.lua | 5 +- LuaLibs/ProcessFrenchRidgeLap.lua | 5 +- LuaLibs/ProcessLapJoint.lua | 104 ++----- LuaLibs/ProcessSawCut.lua | 5 +- LuaLibs/ProcessScarfJoint.lua | 5 +- LuaLibs/ProcessSimpleScarf.lua | 5 +- LuaLibs/ProcessSplit.lua | 9 +- LuaLibs/ProcessTyroleanDovetail.lua | 5 +- 12 files changed, 290 insertions(+), 322 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index ee38c51..f514d09 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,4 +1,4 @@ --- BeamExec.lua by Egaltech s.r.l. 2022/05/04 +-- BeamExec.lua by Egaltech s.r.l. 2022/06/25 -- 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. @@ -27,7 +27,8 @@ -- 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à. -- 2022/05/31 Aggiunta gestione sovramateriale per sezioni alte e larghe e informazione di eventuale creazione nuova fase dalla AddFeatureMachining. --- 2022/06/10 Per sezioni alte e larghe modificata la gestione del sovramateriale per considerare la presenza di feature preesistenti e eventuale parametro Q05, che determinano la presenza o meno della finitura. +-- 2022/06/10 Per sezioni alte e larghe modificata la gestione del sovramateriale per considerare la presenza di feature preesistenti ed +-- eventuale parametro Q05, che determinano la presenza o meno della finitura. -- Create le funzioni AnalyzeHeadFeatures e AnalyzeTailFeatures. Spostate più in alto le funzioni CollectFeatures, isHeadFeature e isTailFeature. -- Tabella per definizione modulo @@ -122,195 +123,12 @@ local FreeContour = require( 'ProcessFreeContour') local Decor = require( 'ProcessDecor') EgtOutLog( ' BeamExec started', 1) + EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC) EgtMdbSave() ------------------------------------------------------------------------------------------------------------- -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() - 0.5 * dCurrOvmH) - end - -- feature sempre di testa o coda nonostante il gruppo - if ( Proc.Grp == 3 or Proc.Grp == 4) and - ( Proc.Prc == 38 or 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() - 0.5 * dCurrOvmH) - end - -- gestioni speciali - if LapJoint.Identify( Proc) then - return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - if Drill.Identify( Proc) then - return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - if RoundArch.Identify( Proc) then - return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - if Dovetail.Identify( Proc) then - return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - if FreeContour.Identify( Proc) then - return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - -- non è di testa - return false -end - -------------------------------------------------------------------------------------------------------------- -local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) - -- lunghezza di riferimento per spostare le feature di coda appena prima - local dAdvTailLen = BD.LEN_VERY_SHORT_PART or BD.LEN_SHORT_PART - -- feature sempre di testa o coda per il gruppo (se non troppo lunga) - if Proc.Grp == 1 or Proc.Grp == 2 then - -- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda - if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then - -- se taglio, lo avanzo - if Proc.Prc == 10 then - return false, true - end - end - -- standard - return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA) - end - -- feature sempre di testa o coda nonostante il gruppo - if ( Proc.Grp == 3 or Proc.Grp == 4) and - ( Proc.Prc == 38 or 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 - -- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda - if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then - -- se profilo front solo con smusso, lo avanzo - if Proc.Prc == 100 and ProfFront.OnlyChamfer( Proc) then - return false, true - end - -- se profilo concavo solo con smusso, lo avanzo - if Proc.Prc == 101 and ProfConcave.OnlyChamfer( Proc) then - return false, true - end - -- se profilo convesso solo con smusso, lo avanzo - if Proc.Prc == 102 and ProfConvex.OnlyChamfer( Proc) then - return false, true - end - -- se profilo caudato solo con smusso, lo avanzo - if Proc.Prc == 103 and ProfCamb.OnlyChamfer( Proc) then - return false, true - end - -- se profilo head solo con smusso, lo avanzo - if Proc.Prc == 106 and ProfHead.OnlyChamfer( Proc) then - return false, true - end - end - -- standard - return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH) - end - -- gestioni speciali - if LapJoint.Identify( Proc) then - return LapJoint.IsTailFeature( Proc, b3Raw) - end - if Drill.Identify( Proc) then - return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT) - end - if DtMortise.Identify( Proc) then - return DtMortise.IsTailFeature( Proc, b3Raw) - end - if RoundArch.Identify( Proc) then - return RoundArch.IsTailFeature( Proc, b3Raw) - end - if Dovetail.Identify( Proc) then - return Dovetail.IsTailFeature( Proc, b3Raw) - end - if FreeContour.Identify( Proc) then - return FreeContour.IsTailFeature( Proc, b3Raw) - end - -- non è di coda - return false -end - -------------------------------------------------------------------------------------------------------------- -local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) - -- recupero le feature - local vProc = {} - local LayerId = {} - LayerId[1] = BL.GetAddGroup( PartId) - LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings') - for nInd = 1, 2 do - local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL) - while ProcId do - local nEntType = EgtGetType( ProcId) - if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or - nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then - local nGrp = EgtGetInfo( ProcId, 'GRP', 'i') - local nPrc = EgtGetInfo( ProcId, 'PRC', 'i') - local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1 - local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0 - local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0 - if nGrp and nPrc and nDo == 1 then - local Proc = {} - Proc.Id = ProcId - Proc.Grp = nGrp - Proc.Prc = nPrc - Proc.Flg = 1 - Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0 - Proc.Diam = 0 - Proc.Fcs = 0 - Proc.Fce = 0 - Proc.CutId = nCutId - Proc.TaskId = nTaskId - Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD) - if Proc.Box and not Proc.Box:isEmpty() then - Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH) - Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) - table.insert( vProc, Proc) - -- se foro - if Drill.Identify( Proc) then - -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) - Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw) - -- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta - if Drill.Split( Proc, b3Raw) then - -- aggiorno flags prima parte foro (dati tabelle sempre per riferimento) - Proc.Flg = 2 - Proc.Head = Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - Proc.Tail = Drill.IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) - -- definisco dati seconda parte - local Proc2 = {} - Proc2.Id = ProcId - Proc2.Grp = nGrp - Proc2.Prc = nPrc - Proc2.Flg = -2 - Proc2.Box = BBox3d( Proc.Box) - Proc2.Fct = Proc.Fct - Proc2.Diam = Proc.Diam - Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH) - Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH) - Proc2.Fcs = Proc.Fce - Proc2.Fce = Proc.Fcs - Proc2.CutId = Proc.CutId - Proc2.TaskId = Proc.TaskId - table.insert( vProc, Proc2) - end - -- se BlockHaus HalfLap - elseif Proc.Prc == 37 then - local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId) - if nFacInd then - local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) - if vtN then - Proc.vtN = Vector3d( vtN) - end - end - end - else - Proc.Head = false - Proc.Tail = false - Proc.Flg = 0 - table.insert( vProc, Proc) - EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)') - end - end - end - ProcId = EgtGetNext( ProcId) - end - end - return vProc -end - +-- *** Inserimento delle travi nel grezzo *** ------------------------------------------------------------------------------------------------------------- local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH) local nReplacedFeatureId = nil @@ -328,7 +146,8 @@ local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH) end if Proc.Head and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 340 then -- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria - bHeadFinishingNeeded = not ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH)) + bHeadFinishingNeeded = not (( abs( Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and + ( abs( Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH)) end end return bHeadFinishingNeeded, nReplacedFeatureId @@ -351,24 +170,19 @@ local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH) end if Proc.Tail and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 350 then -- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria - bTailFinishingNeeded = not ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH)) + bTailFinishingNeeded = not (( abs( Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and + ( abs( Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH)) end end return bTailFinishingNeeded, nReplacedFeatureId end -------------------------------------------------------------------------------------------------------------- --- *** Inserimento delle travi nel grezzo *** ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk) - - if not BD.OVM_BLADE_HBEAM then - BD.OVM_BLADE_HBEAM = 11 - end - - if not BD.OVM_CHAIN_HBEAM then - BD.OVM_CHAIN_HBEAM = 8 - end + + -- default per nuove costanti qualora non definite + BD.OVM_BLADE_HBEAM = ( BD.OVM_BLADE_HBEAM or 11) + BD.OVM_CHAIN_HBEAM = ( BD.OVM_CHAIN_HBEAM or 8) -- Determinazione minimo grezzo scaricabile BeamExec.CalcMinUnloadableRaw( dRawW, dRawH) @@ -562,6 +376,105 @@ local function Verify90DegRotation( nRawId) ( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL) 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() - 0.5 * dCurrOvmH) + end + -- feature sempre di testa o coda nonostante il gruppo + if ( Proc.Grp == 3 or Proc.Grp == 4) and + ( Proc.Prc == 38 or 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() - 0.5 * dCurrOvmH) + end + -- gestioni speciali + if LapJoint.Identify( Proc) then + return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + if Drill.Identify( Proc) then + return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + if RoundArch.Identify( Proc) then + return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + if Dovetail.Identify( Proc) then + return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + if FreeContour.Identify( Proc) then + return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + -- non è di testa + return false +end + +------------------------------------------------------------------------------------------------------------- +local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) + -- lunghezza di riferimento per spostare le feature di coda appena prima + local dAdvTailLen = BD.LEN_VERY_SHORT_PART or BD.LEN_SHORT_PART + -- feature sempre di testa o coda per il gruppo (se non troppo lunga) + if Proc.Grp == 1 or Proc.Grp == 2 then + -- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda + if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then + -- se taglio, lo avanzo + if Proc.Prc == 10 then + return false, true + end + end + -- standard + return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA) + end + -- feature sempre di testa o coda nonostante il gruppo + if ( Proc.Grp == 3 or Proc.Grp == 4) and + ( Proc.Prc == 38 or 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 + -- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda + if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then + -- se profilo front solo con smusso, lo avanzo + if Proc.Prc == 100 and ProfFront.OnlyChamfer( Proc) then + return false, true + end + -- se profilo concavo solo con smusso, lo avanzo + if Proc.Prc == 101 and ProfConcave.OnlyChamfer( Proc) then + return false, true + end + -- se profilo convesso solo con smusso, lo avanzo + if Proc.Prc == 102 and ProfConvex.OnlyChamfer( Proc) then + return false, true + end + -- se profilo caudato solo con smusso, lo avanzo + if Proc.Prc == 103 and ProfCamb.OnlyChamfer( Proc) then + return false, true + end + -- se profilo head solo con smusso, lo avanzo + if Proc.Prc == 106 and ProfHead.OnlyChamfer( Proc) then + return false, true + end + end + -- standard + return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH) + end + -- gestioni speciali + if LapJoint.Identify( Proc) then + return LapJoint.IsTailFeature( Proc, b3Raw) + end + if Drill.Identify( Proc) then + return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT) + end + if DtMortise.Identify( Proc) then + return DtMortise.IsTailFeature( Proc, b3Raw) + end + if RoundArch.Identify( Proc) then + return RoundArch.IsTailFeature( Proc, b3Raw) + end + if Dovetail.Identify( Proc) then + return Dovetail.IsTailFeature( Proc, b3Raw) + end + if FreeContour.Identify( Proc) then + return FreeContour.IsTailFeature( Proc, b3Raw) + end + -- non è di coda + return false +end + ------------------------------------------------------------------------------------------------------------- local function PrintFeatures( vProc, b3Raw) EgtOutLog( ' RawBox=' .. tostring( b3Raw)) @@ -581,6 +494,93 @@ local function PrintFeatures( vProc, b3Raw) end end +------------------------------------------------------------------------------------------------------------- +local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) + -- recupero le feature + local vProc = {} + local LayerId = {} + LayerId[1] = BL.GetAddGroup( PartId) + LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings') + for nInd = 1, 2 do + local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL) + while ProcId do + local nEntType = EgtGetType( ProcId) + if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or + nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then + local nGrp = EgtGetInfo( ProcId, 'GRP', 'i') + local nPrc = EgtGetInfo( ProcId, 'PRC', 'i') + local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1 + local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0 + local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0 + if nGrp and nPrc and nDo == 1 then + local Proc = {} + Proc.Id = ProcId + Proc.Grp = nGrp + Proc.Prc = nPrc + Proc.Flg = 1 + Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0 + Proc.Diam = 0 + Proc.Fcs = 0 + Proc.Fce = 0 + Proc.CutId = nCutId + Proc.TaskId = nTaskId + Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD) + if Proc.Box and not Proc.Box:isEmpty() then + Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH) + Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) + table.insert( vProc, Proc) + -- se foro + if Drill.Identify( Proc) then + -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) + Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw) + -- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta + if Drill.Split( Proc, b3Raw) then + -- aggiorno flags prima parte foro (dati tabelle sempre per riferimento) + Proc.Flg = 2 + Proc.Head = Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + Proc.Tail = Drill.IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) + -- definisco dati seconda parte + local Proc2 = {} + Proc2.Id = ProcId + Proc2.Grp = nGrp + Proc2.Prc = nPrc + Proc2.Flg = -2 + Proc2.Box = BBox3d( Proc.Box) + Proc2.Fct = Proc.Fct + Proc2.Diam = Proc.Diam + Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH) + Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH) + Proc2.Fcs = Proc.Fce + Proc2.Fce = Proc.Fcs + Proc2.CutId = Proc.CutId + Proc2.TaskId = Proc.TaskId + table.insert( vProc, Proc2) + end + -- se BlockHaus HalfLap + elseif Proc.Prc == 37 then + local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId) + if nFacInd then + local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) + if vtN then + Proc.vtN = Vector3d( vtN) + end + end + end + else + Proc.Head = false + Proc.Tail = false + Proc.Flg = 0 + table.insert( vProc, Proc) + EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)') + end + end + end + ProcId = EgtGetNext( ProcId) + end + end + return vProc +end + ------------------------------------------------------------------------------------------------------------- local function OrderFeatures( vProc, b3Raw) @@ -1332,10 +1332,10 @@ function BeamExec.ProcessFeatures() -- eventuale spostamento fori sui tenoni MoveDrillsOnTenon( vProc) -- identifico la condizione di lavorazione, in base a bSomeDown e bSomeSide - local sDownOrSideOrStd = 'standard' + local sDownOrSideOrStd = 'STD' -- se richiesto ribaltamento (oppure rotazione) if ( bSomeDown or bSomeSide) and not BD.DOWN_HEAD and not BD.TURN then - sDownOrSideOrStd = 'down' + sDownOrSideOrStd = 'DOWN' -- ribalto le travi della fase corrente local nRId = nRawId while nRId do @@ -1398,7 +1398,7 @@ function BeamExec.ProcessFeatures() end -- se richiesta rotazione if bSomeSide and not BD.DOWN_HEAD and not BD.TURN then - sDownOrSideOrStd = 'side' + sDownOrSideOrStd = 'SIDE' -- vettore movimento grezzi per rotazione di 90deg local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ() local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2) @@ -1470,7 +1470,7 @@ function BeamExec.ProcessFeatures() EgtSetInfo( nDispId, 'TYPE', EgtIf( not bSplitRot, 'MID', 'END2')) EgtSetInfo( nDispId, 'ORD', nOrd) end - sDownOrSideOrStd = 'standard' + sDownOrSideOrStd = 'STD' -- inserisco le lavorazioni non ribaltate della trave for i = 1, #vProc do -- creo la lavorazione diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index ed759c6..f557fc8 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,4 +1,4 @@ --- BeamLib.lua by Egaltech s.r.l. 2022/05/25 +-- BeamLib.lua by Egaltech s.r.l. 2022/06/25 -- 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. @@ -12,6 +12,7 @@ -- 2022/04/05 Modifiche a GetNzLimDownUp per FAST. -- 2022/05/03 Ulteriore limitazione a GetNzLimDownUp per FAST. -- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge. +-- 2022/06/25 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs prima in ProcessLapJpoint. -- Tabella per definizione modulo local BeamLib = {} @@ -735,5 +736,35 @@ function BeamLib.GetPhaseType( nPhase) return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '') end +--------------------------------------------------------------------- +function BeamLib.GetChainSawBlockedAxis( nInd) + if BD.GetChainSawBlockedAxis then + return BD.GetChainSawBlockedAxis( nInd) + else + if nInd == 1 then + return EgtIf( BD.C_SIMM, 'A=90', 'A=90') + else + return EgtIf( BD.C_SIMM, 'A=0', 'A=0') + end + end +end + +--------------------------------------------------------------------- +function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd) + if BD.GetChainSawInitAngs then + return BD.GetChainSawInitAngs( vtN, vtO, nInd) + else + if BD.C_SIMM then + return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180') + else + if nInd == 1 then + return '' + else + return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180') + end + end + end +end + ------------------------------------------------------------------------------------------------------------- return BeamLib diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 863e335..e1b29d3 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -10,6 +10,7 @@ -- 2022/02/06 Correzioni per tagli di coda spostati prima. -- 2022/05/31 Alcune modifiche per utilizzare la ProcessCut.Make in ProcessSplit e ProcessHeadCut, per le sezioni alte e larghe. -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) + -- Tabella per definizione modulo local ProcessCut = {} @@ -223,10 +224,8 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione con testa da sopra local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes) - if not b3Raw then - -- ingombro del grezzo - b3Raw = EgtGetRawPartBBox( nRawId) - end + -- ingombro del grezzo + b3Raw = b3Raw or EgtGetRawPartBBox( nRawId) -- ingombro del pezzo local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) -- dati geometrici del taglio @@ -332,11 +331,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b vtExtra = X_AX() bAutoCalcSurf = false end - if bForced then - vCuts = DC.GetDice( nAddGrpId, b3Raw, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA) - else - vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA) - end + vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA) -- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate if ( bFillTail or bCustDiceCut) and #vCuts == 0 then vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY()) @@ -672,13 +667,11 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng) - if not dOvmTail then - dOvmTail = BD.OVM_MID - end - if not b3Raw then - -- ingombro del grezzo - b3Raw = EgtGetRawPartBBox( nRawId) - end + -- sovramateriale di coda + dOvmTail = dOvmTail or BD.OVM_MID + -- ingombro del grezzo + b3Raw = b3Raw or EgtGetRawPartBBox( nRawId) + -- ingombro del pezzo local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) if not b3Solid then local sErr = 'Error : part box not found' diff --git a/LuaLibs/ProcessDovetail.lua b/LuaLibs/ProcessDovetail.lua index 0089713..ce72834 100644 --- a/LuaLibs/ProcessDovetail.lua +++ b/LuaLibs/ProcessDovetail.lua @@ -1712,9 +1712,8 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) - if not dOvmTail then - dOvmTail = BD.OVM_MID - end + -- sovramateriale di coda + dOvmTail = dOvmTail or BD.OVM_MID -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) -- in base al tipo di feature attribuisco il significato dei parametri Q diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 1427943..e3921dc 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -57,9 +57,8 @@ end --------------------------------------------------------------------- -- Verifica se feature di coda function ProcessDrill.IsTailFeature( Proc, b3Raw, dOvmTail) - if not dOvmTail then - dOvmTail = BD.OVM_MID - end + -- sovramateriale di coda + dOvmTail = dOvmTail or BD.OVM_MID -- verifico se è in coda if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + dOvmTail + BD.MAX_DIST_HTFEA then return false diff --git a/LuaLibs/ProcessFrenchRidgeLap.lua b/LuaLibs/ProcessFrenchRidgeLap.lua index 160ca5a..f388c26 100644 --- a/LuaLibs/ProcessFrenchRidgeLap.lua +++ b/LuaLibs/ProcessFrenchRidgeLap.lua @@ -40,9 +40,8 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) - if not dOvmTail then - dOvmTail = BD.OVM_MID - end + -- sovramateriale di coda + dOvmTail = dOvmTail or BD.OVM_MID -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 035bf74..332f902 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2022/06/15 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/06/25 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -42,7 +42,6 @@ -- 2022/04/28 Lavorazione BH forzata sempre OneWay. -- 2022/05/04 Corretta classificazione due facce sotto. Modificati criteri assegnazione due facce alla coda. -- 2022/05/24 Miglioramenti vari per BH, compreso controlli per lavorazione da sotto. --- 2022/05/31 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs per essere richiamate dalla ProcessSplit per taglio sega a catena in sezioni alte e larghe. -- 2022/06/13 Modifiche per feature lunga con due facce non equivalenti a taglio long. doppio o singolo con faccia terminale. -- 2022/06/15 Correzione calcolo normale alla faccia per sega catena di fianco. -- 2022/06/16 Implemento lavorazioni con fresatura di lato per L30 (al momento solo passanti) se parametro Q03=2. Modificate funzioni Make, MakeMoreFaces, Classify. @@ -259,36 +258,6 @@ local function TestElleShape4( Proc) end end ---------------------------------------------------------------------- -function ProcessLapJoint.GetChainSawBlockedAxis( nInd) - if BD.GetChainSawBlockedAxis then - return BD.GetChainSawBlockedAxis( nInd) - else - if nInd == 1 then - return EgtIf( BD.C_SIMM, 'A=90', 'A=90') - else - return EgtIf( BD.C_SIMM, 'A=0', 'A=0') - end - end -end - ---------------------------------------------------------------------- -function ProcessLapJoint.GetChainSawInitAngs( vtN, vtO, nInd) - if BD.GetChainSawInitAngs then - return BD.GetChainSawInitAngs( vtN, vtO, nInd) - else - if BD.C_SIMM then - return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180') - else - if nInd == 1 then - return '' - else - return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180') - end - end - end -end - --------------------------------------------------------------------- local function VerifyChainSaw( Proc, dMinDim, dMaxDim) local bUseChainSaw = false @@ -3062,8 +3031,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, 0, - dSawWidth / 2)) end -- imposto angolo 3° asse rot e eventuale angolo suggerito per inizio - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 1)) - EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 1)) -- imposto offset radiale local dOffs = ( i - 1) * dStep EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) @@ -3085,8 +3054,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, return false, sErr end -- impostazione alternativa angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 2)) - EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -3130,8 +3099,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- imposto uso del lato faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 1)) - EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtNL, vtOrtho, 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtNL, vtOrtho, 1)) -- imposto offset radiale local dOffs = ( i - 1) * dStep EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) @@ -3161,8 +3130,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, return false, sErr end -- impostazione alternativa angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 2)) - EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtNL, vtOrtho, 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtNL, vtOrtho, 2)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -4358,37 +4327,20 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, end --------------------------------------------------------------------- --- Trova il numero (0 based) della faccia meglio orientata come l'asse 'sAxis'. Restituisce anche vtN e ptC della faccia stessa. --- sAxis: 'X' o 'Y' o 'Z' -local function FindFaceBestOrientedAsAxis( Proc, sAxis) - local ptC = {} - local vtN = {} - local nFaceMaximumNormalComponentOnAxis = 0 - local dFaceMaximumNormalComponentOnAxisValue = 0 +-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. +local function FindFaceBestOrientedAsAxis( Proc, vtAx) + local nFaceIndMax = 0 + local dMaxComp = 0 ; for i = 1, Proc.Fct do - ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT) - if sAxis == 'X' then - if abs(vtN[i]:getX()) > dFaceMaximumNormalComponentOnAxisValue then - nFaceMaximumNormalComponentOnAxis = i - 1 - dFaceMaximumNormalComponentOnAxisValue = abs(vtN[i]:getX()) - end - elseif sAxis == 'Y' then - if abs(vtN[i]:getY()) > dFaceMaximumNormalComponentOnAxisValue then - nFaceMaximumNormalComponentOnAxis = i - 1 - dFaceMaximumNormalComponentOnAxisValue = abs(vtN[i]:getY()) - end - elseif sAxis == 'Z' then - if abs(vtN[i]:getZ()) > dFaceMaximumNormalComponentOnAxisValue then - nFaceMaximumNormalComponentOnAxis = i - 1 - dFaceMaximumNormalComponentOnAxisValue = abs(vtN[i]:getZ()) - end - else - local sErr = 'Error : FindFaceBestOrientedAsAxis - unknown axis name' - EgtOutLog( sErr) - return false, sErr + local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT) + local dComp = abs( vtN * vtAx) + if dComp > dMaxComp then + nFaceIndMax = i -1 + dMaxComp = dComp end end - return nFaceMaximumNormalComponentOnAxis, vtN[ nFaceMaximumNormalComponentOnAxis + 1], ptC[ nFaceMaximumNormalComponentOnAxis + 1] + local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFaceIndMax, GDB_ID.ROOT) + return nFaceIndMax, ptC, vtN end --------------------------------------------------------------------- @@ -4521,8 +4473,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT) -- imposto angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 1)) - EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, vtOrtho, 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) -- imposto offset radiale local dOffs = ( i - 1) * dStep EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) @@ -4542,8 +4494,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa EgtSetOperationMode( nMchFId, false) return false, sErr end - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 2)) - EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, vtOrtho, 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -4588,8 +4540,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) -- verifico se due facce o L con una o due facce di terminazione local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2) - -- se L30 e paramtetro Q03=2 forzo la fresatura di lato - local bForceSideMill = Proc.Prc == 30 and EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 and ( Proc.Fct == 4 or Proc.Fct == 3 or Proc.Fct == 2) + -- se parametro Q03=2 forzo la fresatura di lato + local bForceSideMill = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 and ( Proc.Fct == 4 or Proc.Fct == 3 or Proc.Fct == 2) -- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill) if bPrevBhSideMill == nil then @@ -5165,14 +5117,14 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- o passare subito dalla lavorazione con lama/sega catena if ( bTrySidePocketAtFirst and Proc.Fct == 3 and bIsU) or bForceSideMill then -- lavoro con svuotature (singola o doppia contrapposta) - local sMyMchFind = 'Pocket' + local sMyMchFind = EgtIf( bForceSideMill, 'OpenPocket', 'Pocket') local dDiamTool = 100 local nPathInt, nSurfInt, bOneShot, nFirstMachId local bIs3Faces = true local bOrthoFacesMaster = nil local bSetOpenBorders = nil -- trovo la faccia con normale più inclinata verso Y - local nFacApproxY, vtNFacApproxY, ptCFacApproxY = FindFaceBestOrientedAsAxis( Proc, 'Y') + local nFacApproxY, ptCFacApproxY, vtNFacApproxY = FindFaceBestOrientedAsAxis( Proc, Y_AX()) -- se Q03 = 2 e -- 3 facce a L, oppure -- 3 facce non a L ma con una faccia favorevole a Y, oppure diff --git a/LuaLibs/ProcessSawCut.lua b/LuaLibs/ProcessSawCut.lua index 37793e4..0cb81c4 100644 --- a/LuaLibs/ProcessSawCut.lua +++ b/LuaLibs/ProcessSawCut.lua @@ -38,9 +38,8 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) - if not dOvmTail then - dOvmTail = BD.OVM_MID - end + -- sovramateriale di coda + dOvmTail = dOvmTail or BD.OVM_MID -- ingombro del grezzo local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo diff --git a/LuaLibs/ProcessScarfJoint.lua b/LuaLibs/ProcessScarfJoint.lua index 22b7a28..cb00fcf 100644 --- a/LuaLibs/ProcessScarfJoint.lua +++ b/LuaLibs/ProcessScarfJoint.lua @@ -200,9 +200,8 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) - if not dOvmTail then - dOvmTail = BD.OVM_MID - end + -- sovramateriale di coda + dOvmTail = dOvmTail or BD.OVM_MID -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo diff --git a/LuaLibs/ProcessSimpleScarf.lua b/LuaLibs/ProcessSimpleScarf.lua index e25baf4..d80cc77 100644 --- a/LuaLibs/ProcessSimpleScarf.lua +++ b/LuaLibs/ProcessSimpleScarf.lua @@ -126,9 +126,8 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) - if not dOvmTail then - dOvmTail = BD.OVM_MID - end + -- sovramateriale di coda + dOvmTail = dOvmTail or BD.OVM_MID -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 8073f84..75cf220 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -10,7 +10,6 @@ local ProcessSplit = {} require( 'EgtBase') local BL = require( 'BeamLib') local Fbs = require( 'FacesBySaw') -local LapJoint = require( 'ProcessLapJoint') local Cut = require( 'ProcessCut') local Pocket = require( 'FaceByPocket') @@ -183,10 +182,10 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs) -- imposto uso del lato faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, LapJoint.GetChainSawBlockedAxis( 2)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT) vtOrthO = BL.GetVersRef( nFaceUse) - EgtSetMachiningParam( MCH_MP.INITANGS, LapJoint.GetChainSawInitAngs( vtN, vtOrtho, 2)) + EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2)) -- imposto offset radiale per mantenere il materiale in coda per la finitura EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) -- imposto allungamento percorso iniziale e finale a zero @@ -213,8 +212,8 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs) return false, sErr end -- impostazione alternativa angolo 3° asse rot - EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, LapJoint.GetChainSawBlockedAxis( 1)) - EgtSetMachiningParam( MCH_MP.INITANGS, LapJoint.GetChainSawInitAngs( vtN, vtOrtho, 1)) + EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) + EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) diff --git a/LuaLibs/ProcessTyroleanDovetail.lua b/LuaLibs/ProcessTyroleanDovetail.lua index 6bd9cc1..ba7b31d 100644 --- a/LuaLibs/ProcessTyroleanDovetail.lua +++ b/LuaLibs/ProcessTyroleanDovetail.lua @@ -673,9 +673,8 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) - if not dOvmTail then - dOvmTail = BD.OVM_MID - end + -- sovramateriale di coda + dOvmTail = dOvmTail or BD.OVM_MID -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) -- in base al tipo di feature attribuisco il significato dei parametri Q From 1286cfd77f96fbde4835cc5ac4531ad7d47eb58a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 27 Jun 2022 10:36:49 +0200 Subject: [PATCH 04/13] DataBeam: -bugfix: nella feature L30 con Q03=2 e parete di fondo funziona correttamente la pulitura contorno (Q01=1) --- LuaLibs/ProcessLapJoint.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 332f902..4f1aee6 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -5147,6 +5147,31 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2) end bTryWithBlades = false + -- se ho antischeggia con fresa le inserisco + -- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then + if nChamfer < 2 and nQAntisplintResult == 2 then + local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, + nFacInd, nAddGrpId, bMillDown, dDiamTool, bDoubleSide, + vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth, + bOneShot, nFirstMachId) + if sWarn2 then + if not sWarn then sWarn = '' end + sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2) + end + end + -- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola + local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0 + if nContourSmallTool > 0 then + local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw, + nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown, + bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid, + dDepth, bOneShotm) + if not bOk then return false, sWarn2 end + if sWarn2 then + if not sWarn then sWarn = '' end + sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2) + end + end -- in tutti gli altri casi lancio la MakeByPockets (lavorazione singola o doppia contrapposta, fondo della tasca una faccia fittizia perpendicolare al lato lungo) else -- se 2 facce setto i parametri corretti per la MakeByPockets From 80d37ef897d4b74caf97575a9f4c55d469472717 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 27 Jun 2022 17:48:11 +0200 Subject: [PATCH 05/13] DataBeam: -bugfix: piccola correzione a LapJoint --- LuaLibs/ProcessLapJoint.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 4f1aee6..f4ba2c6 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -5138,7 +5138,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd) dCollSic = CalcCollisionSafety( tvtNx[2]) local dMachDepth = dFacElev + dCollSic - local _, _, dDimMin = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) + _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) + local dDimMin = min( dH, dV) local _, sPocketing = VerifyPocket( Proc, dDimMin, dFacElev, nil, sMyMchFind) bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end From 86053c9dd85dd6bcea6a8d28242efa0c9eaa27ce Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 28 Jun 2022 11:14:58 +0200 Subject: [PATCH 06/13] DataBeam : - in GetBeamData forzata rilettura di BeamData della macchina corrente. --- GetBeamData.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GetBeamData.lua b/GetBeamData.lua index 6ffe321..aa01c49 100644 --- a/GetBeamData.lua +++ b/GetBeamData.lua @@ -1,4 +1,4 @@ --- GetWallData.lua by Egaltech s.r.l. 2021/11/22 +-- GetWallData.lua by Egaltech s.r.l. 2022/06/28 -- Recupero dati da file WallData.lua di macchina -- Intestazioni @@ -31,6 +31,7 @@ EgtRemoveBaseMachineDirFromPackagePath() EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua') -- Carico i dati globali +_G.package.loaded.BeamData = nil local BD = require( 'BeamData') -- Assegno valori di interesse From 8decc393e6dd54c147bff41dd7dce14ab74dc4f1 Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 29 Jun 2022 16:13:00 +0200 Subject: [PATCH 07/13] DataBeam : - in LongDoubleCut corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco - in Cut modificata determinazione taglio bFromBottom in MakeFromTop - in FacesBySaw.MakeTwo modificato controllo facce dirette verso il basso. --- LuaLibs/FacesBySaw.lua | 22 ++++++++++++---------- LuaLibs/ProcessCut.lua | 7 ++++--- LuaLibs/ProcessLongDoubleCut.lua | 29 ++++++++--------------------- 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 3853154..37ca39f 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -1,4 +1,4 @@ --- FacesBySaw.lua by Egaltech s.r.l. 2022/06/07 +-- FacesBySaw.lua by Egaltech s.r.l. 2022/06/29 -- Gestione taglio con lama di feature con una o due facce -- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom. -- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg. @@ -11,6 +11,7 @@ -- 2021/08/31 DS Aggiunta gestione nessun limite direzione da sotto per testa da sotto. -- 2021/11/26 DS Spostate qui MakeOneFaceBySaw (ora MakeOne), CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom. -- 2022/04/12 DS Aggiunta gestione speciale cubetti con fresa da sotto. +-- 2022/06/29 DS In MakeTwo modificato controllo facce dirette verso il basso. -- Tabella per definizione modulo local FacesBySaw = {} @@ -229,15 +230,6 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, local vtN = {} ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) - -- verifico non siano orientate verso il basso - 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 - local sErr = 'Error : TwoFacesBySaw from bottom impossible' - EgtOutLog( sErr) - return false, sErr - end -- recupero dati su giunzione tra facce local bTouch, ptT1, ptT2, dAngT = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) if not bTouch then @@ -247,6 +239,16 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, end local ptM = ( ptT1 + ptT2) / 2 local vtTg = ptT2 - ptT1 ; + local bConvex = ( dAngT > 0) + -- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg) + local bFaceOk = {} + bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or ( not bConvex and abs( vtN[1]:getY()) < 0.174)) + bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or ( not bConvex and abs( vtN[2]:getY()) < 0.174)) + if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then + local sErr = 'Error : TwoFacesBySaw from bottom impossible' + EgtOutLog( sErr) + return false, sErr + end -- calcolo direzione di lavoro local vtRef = {} vtRef[1] = vtN[1] ^ vtTg diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index e1b29d3..460eb98 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2022/02/11 +-- ProcessCut.lua by Egaltech s.r.l. 2022/06/28 -- Gestione calcolo singoli tagli di lama per Travi -- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito. -- 2021/06/06 Correzioni per tagli con testa da sotto. @@ -9,7 +9,8 @@ -- 2022/02/02 Modifiche per tagli di coda spostati prima come lavorazione su pezzi a caduta. -- 2022/02/06 Correzioni per tagli di coda spostati prima. -- 2022/05/31 Alcune modifiche per utilizzare la ProcessCut.Make in ProcessSplit e ProcessHeadCut, per le sezioni alte e larghe. --- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) +-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe). +-- 2022/06/28 Modificata determinazione taglio bFromBottom in MakeFromTop. -- Tabella per definizione modulo local ProcessCut = {} @@ -234,7 +235,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) if bFromBottom == nil then - bFromBottom = ( vtN:getZ() > 0.25 and b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and vtN:getX() < 0) + bFromBottom = ( vtN:getZ() > 0.25 and b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259) end -- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo) local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index da5aebc..2a0fa37 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/05/27 +-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/06/29 -- Gestione calcolo doppio taglio longitudinale per Travi -- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto. -- 2021/06/29 Corretta gestione caso equivalente a due smussi. @@ -8,6 +8,7 @@ -- 2022/02/15 Sistemati commenti. -- 2022/03/20 Tolta da scelta milling tipo Long2CutDown controllo max diametro fresa. -- 2022/05/27 Corretto ordine per casi sui lati. +-- 2022/06/29 Corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco. -- Tabella per definizione modulo local ProcessLong2Cut = {} @@ -1525,14 +1526,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- local dNz = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ()) local dNz = EgtIf( abs(nSide) == 1, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ()) local dNzMin = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ()) - local dLioPerp1, dLioPerp2 -- nel caso concavo, devo impostare la lunghezza di attacco ortogonale if not bConvex then - dLioPerp1 = EgtIf( i == 1, dFacElev1, dFacElev2) --- dLioPerp1 = vWidth[vOrd[i]] * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, sqrt( 1 - dNz * dNz) / abs( dNz)) + BD.COLL_SIC - dLioPerp2 = vWidth[ EgtIf( vOrd[i] == 1, 2,1)] + BD.COLL_SIC - EgtSetMachiningParam( MCH_MP.LIPERP, max( dLioPerp1, dLioPerp2)) - EgtSetMachiningParam( MCH_MP.LOPERP, max( dLioPerp1, dLioPerp2)) + local dLioPerp = EgtIf( i == 1, dFacElev1, dFacElev2) + BD.COLL_SIC + EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp) + EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp) end -- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica) -- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione @@ -1562,20 +1560,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end -- eseguo 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 ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchFId, false) - return false, sErr - end - else - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchFId, false) - return false, sErr - end + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr end -- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra) if bConvex and j == 1 and not bStartFixed and bRemoveToolRadius then From a5cf7e0783849b3e1185710e469c8bd49b8e5d45 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 29 Jun 2022 17:45:55 +0200 Subject: [PATCH 08/13] DataBeam: --- LuaLibs/ProcessLapJoint.lua | 50 +++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index f4ba2c6..a35dbc2 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -46,6 +46,7 @@ -- 2022/06/15 Correzione calcolo normale alla faccia per sega catena di fianco. -- 2022/06/16 Implemento lavorazioni con fresatura di lato per L30 (al momento solo passanti) se parametro Q03=2. Modificate funzioni Make, MakeMoreFaces, Classify. -- 2022/06/21 Implemento di lavorazioni non passanti con fresatura di lato per L30 se parametro Q03=2. Modificate funzioni MakeMoreFaces, Classify. +-- 2022/06/29 Migliorate lavorazioni con fresatura di lato per L30 se parametro Q03=2. Ora con 4 facce / 3 facce a L può entrare una fresa grande fino al doppio dell'altezza della tasca / doppio della dimensione minima. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -4345,6 +4346,9 @@ end --------------------------------------------------------------------- local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap) + if not BD.MAXDIAM_POCK_CORNER then + BD.MAXDIAM_POCK_CORNER = 30 + end local sWarn -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) @@ -4835,11 +4839,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa elseif Proc.Fct == 4 then -- se non angoli fittizi, per rifinire gli angoli premio utensile diam 25 o da BD if not bAllWithEndCap then - dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER or 30) + dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER) end elseif Proc.Fct == 3 and bIsL then -- per rifinire gli angoli premio utensile diam 25 o da BD - dDiam = min( 2 * dDiam, BD.MAXDIAM_POCK_CORNER or 30) + dDiam = min( ( 2 * dDiam) - 1, BD.MAXDIAM_POCK_CORNER) else dDiam = 2 * dDiam end @@ -5138,9 +5142,45 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd) dCollSic = CalcCollisionSafety( tvtNx[2]) local dMachDepth = dFacElev + dCollSic - _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) - local dDimMin = min( dH, dV) - local _, sPocketing = VerifyPocket( Proc, dDimMin, dFacElev, nil, sMyMchFind) + local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) + -- limito il diametro utensile massimo a 100 per queste lavorazioni + dToolTargetDiam = min( BD.MAXDIAM_POCK_CORNER, 100) + -- se è 4 facce devo capire quale è il lato libero e settare dH e dV di conseguenza + if Proc.Fct == 4 then + local vAdj = {} + local vtN2 + for i = 1, Proc.Fct do + -- recupero le adiacenze del loop esterno + local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, i - 1)[1] + -- le conto + local nCount = 0 + for j = 1, #vFacAdj do + if vFacAdj[j] >= 0 then + nCount = nCount + 1 + end + end + vAdj[i] = nCount + if vAdj[i] == Proc.Fct - 1 and i ~= nFacInd + 1 then + dV = BL.GetFaceElevation( Proc.Id, i - 1) + vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT) + end + end + local vtRes = vtN2 ^ vtN + if AreSameOrOppositeVectorApprox( frFacRec:getVersX(), vtRes) then + dH = dFacDim1 + else + dH = dFacDim2 + end + -- se la tasca ha dimensioni adeguate cerco di usare una fresa con raggio fino a metà altezza + dToolMaxDiam = EgtIf( dH >= dToolTargetDiam and dV > 0.5 * dToolTargetDiam, dToolTargetDiam, min( dH, dV, dToolTargetDiam)) + -- per le L a 3 facce, avendo due lati aperti per l'attacco, si considera un diametro utensile pari al doppio della dimensione minima; il "- 1" è un accorgimento per impedire bug derivanti da dimensione della tasca uguale a D\2 utensile + elseif Proc.Fct == 3 and bIsL then + dToolMaxDiam = min ( ( min( dFacDim1, dFacDim2) * 2) - 1, dToolTargetDiam) + -- in tutti gli altri casi l'utensile dovrà essere grande al massimo come il lato più piccolo + else + dToolMaxDiam = min ( dFacDim1, dFacDim2, dToolTargetDiam) + end + local _, sPocketing = VerifyPocket( Proc, dToolMaxDiam, dFacElev, nil, sMyMchFind) bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end if sWarn2 then From 59051cbf06c5cd5c49fac57cecd6dab15b7e0877 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 29 Jun 2022 17:46:05 +0200 Subject: [PATCH 09/13] Revert "DataBeam:" This reverts commit a5cf7e0783849b3e1185710e469c8bd49b8e5d45. --- LuaLibs/ProcessLapJoint.lua | 50 ++++--------------------------------- 1 file changed, 5 insertions(+), 45 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index a35dbc2..f4ba2c6 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -46,7 +46,6 @@ -- 2022/06/15 Correzione calcolo normale alla faccia per sega catena di fianco. -- 2022/06/16 Implemento lavorazioni con fresatura di lato per L30 (al momento solo passanti) se parametro Q03=2. Modificate funzioni Make, MakeMoreFaces, Classify. -- 2022/06/21 Implemento di lavorazioni non passanti con fresatura di lato per L30 se parametro Q03=2. Modificate funzioni MakeMoreFaces, Classify. --- 2022/06/29 Migliorate lavorazioni con fresatura di lato per L30 se parametro Q03=2. Ora con 4 facce / 3 facce a L può entrare una fresa grande fino al doppio dell'altezza della tasca / doppio della dimensione minima. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -4346,9 +4345,6 @@ end --------------------------------------------------------------------- local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap) - if not BD.MAXDIAM_POCK_CORNER then - BD.MAXDIAM_POCK_CORNER = 30 - end local sWarn -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) @@ -4839,11 +4835,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa elseif Proc.Fct == 4 then -- se non angoli fittizi, per rifinire gli angoli premio utensile diam 25 o da BD if not bAllWithEndCap then - dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER) + dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER or 30) end elseif Proc.Fct == 3 and bIsL then -- per rifinire gli angoli premio utensile diam 25 o da BD - dDiam = min( ( 2 * dDiam) - 1, BD.MAXDIAM_POCK_CORNER) + dDiam = min( 2 * dDiam, BD.MAXDIAM_POCK_CORNER or 30) else dDiam = 2 * dDiam end @@ -5142,45 +5138,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd) dCollSic = CalcCollisionSafety( tvtNx[2]) local dMachDepth = dFacElev + dCollSic - local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) - -- limito il diametro utensile massimo a 100 per queste lavorazioni - dToolTargetDiam = min( BD.MAXDIAM_POCK_CORNER, 100) - -- se è 4 facce devo capire quale è il lato libero e settare dH e dV di conseguenza - if Proc.Fct == 4 then - local vAdj = {} - local vtN2 - for i = 1, Proc.Fct do - -- recupero le adiacenze del loop esterno - local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, i - 1)[1] - -- le conto - local nCount = 0 - for j = 1, #vFacAdj do - if vFacAdj[j] >= 0 then - nCount = nCount + 1 - end - end - vAdj[i] = nCount - if vAdj[i] == Proc.Fct - 1 and i ~= nFacInd + 1 then - dV = BL.GetFaceElevation( Proc.Id, i - 1) - vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT) - end - end - local vtRes = vtN2 ^ vtN - if AreSameOrOppositeVectorApprox( frFacRec:getVersX(), vtRes) then - dH = dFacDim1 - else - dH = dFacDim2 - end - -- se la tasca ha dimensioni adeguate cerco di usare una fresa con raggio fino a metà altezza - dToolMaxDiam = EgtIf( dH >= dToolTargetDiam and dV > 0.5 * dToolTargetDiam, dToolTargetDiam, min( dH, dV, dToolTargetDiam)) - -- per le L a 3 facce, avendo due lati aperti per l'attacco, si considera un diametro utensile pari al doppio della dimensione minima; il "- 1" è un accorgimento per impedire bug derivanti da dimensione della tasca uguale a D\2 utensile - elseif Proc.Fct == 3 and bIsL then - dToolMaxDiam = min ( ( min( dFacDim1, dFacDim2) * 2) - 1, dToolTargetDiam) - -- in tutti gli altri casi l'utensile dovrà essere grande al massimo come il lato più piccolo - else - dToolMaxDiam = min ( dFacDim1, dFacDim2, dToolTargetDiam) - end - local _, sPocketing = VerifyPocket( Proc, dToolMaxDiam, dFacElev, nil, sMyMchFind) + _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) + local dDimMin = min( dH, dV) + local _, sPocketing = VerifyPocket( Proc, dDimMin, dFacElev, nil, sMyMchFind) bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end if sWarn2 then From ec5583366e86b82e0a4ece839f553263bcb5b293 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 29 Jun 2022 17:49:45 +0200 Subject: [PATCH 10/13] Revert "Revert "DataBeam:"" This reverts commit 59051cbf06c5cd5c49fac57cecd6dab15b7e0877. --- LuaLibs/ProcessLapJoint.lua | 50 +++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index f4ba2c6..a35dbc2 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -46,6 +46,7 @@ -- 2022/06/15 Correzione calcolo normale alla faccia per sega catena di fianco. -- 2022/06/16 Implemento lavorazioni con fresatura di lato per L30 (al momento solo passanti) se parametro Q03=2. Modificate funzioni Make, MakeMoreFaces, Classify. -- 2022/06/21 Implemento di lavorazioni non passanti con fresatura di lato per L30 se parametro Q03=2. Modificate funzioni MakeMoreFaces, Classify. +-- 2022/06/29 Migliorate lavorazioni con fresatura di lato per L30 se parametro Q03=2. Ora con 4 facce / 3 facce a L può entrare una fresa grande fino al doppio dell'altezza della tasca / doppio della dimensione minima. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -4345,6 +4346,9 @@ end --------------------------------------------------------------------- local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap) + if not BD.MAXDIAM_POCK_CORNER then + BD.MAXDIAM_POCK_CORNER = 30 + end local sWarn -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) @@ -4835,11 +4839,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa elseif Proc.Fct == 4 then -- se non angoli fittizi, per rifinire gli angoli premio utensile diam 25 o da BD if not bAllWithEndCap then - dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER or 30) + dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER) end elseif Proc.Fct == 3 and bIsL then -- per rifinire gli angoli premio utensile diam 25 o da BD - dDiam = min( 2 * dDiam, BD.MAXDIAM_POCK_CORNER or 30) + dDiam = min( ( 2 * dDiam) - 1, BD.MAXDIAM_POCK_CORNER) else dDiam = 2 * dDiam end @@ -5138,9 +5142,45 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd) dCollSic = CalcCollisionSafety( tvtNx[2]) local dMachDepth = dFacElev + dCollSic - _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) - local dDimMin = min( dH, dV) - local _, sPocketing = VerifyPocket( Proc, dDimMin, dFacElev, nil, sMyMchFind) + local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) + -- limito il diametro utensile massimo a 100 per queste lavorazioni + dToolTargetDiam = min( BD.MAXDIAM_POCK_CORNER, 100) + -- se è 4 facce devo capire quale è il lato libero e settare dH e dV di conseguenza + if Proc.Fct == 4 then + local vAdj = {} + local vtN2 + for i = 1, Proc.Fct do + -- recupero le adiacenze del loop esterno + local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, i - 1)[1] + -- le conto + local nCount = 0 + for j = 1, #vFacAdj do + if vFacAdj[j] >= 0 then + nCount = nCount + 1 + end + end + vAdj[i] = nCount + if vAdj[i] == Proc.Fct - 1 and i ~= nFacInd + 1 then + dV = BL.GetFaceElevation( Proc.Id, i - 1) + vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT) + end + end + local vtRes = vtN2 ^ vtN + if AreSameOrOppositeVectorApprox( frFacRec:getVersX(), vtRes) then + dH = dFacDim1 + else + dH = dFacDim2 + end + -- se la tasca ha dimensioni adeguate cerco di usare una fresa con raggio fino a metà altezza + dToolMaxDiam = EgtIf( dH >= dToolTargetDiam and dV > 0.5 * dToolTargetDiam, dToolTargetDiam, min( dH, dV, dToolTargetDiam)) + -- per le L a 3 facce, avendo due lati aperti per l'attacco, si considera un diametro utensile pari al doppio della dimensione minima; il "- 1" è un accorgimento per impedire bug derivanti da dimensione della tasca uguale a D\2 utensile + elseif Proc.Fct == 3 and bIsL then + dToolMaxDiam = min ( ( min( dFacDim1, dFacDim2) * 2) - 1, dToolTargetDiam) + -- in tutti gli altri casi l'utensile dovrà essere grande al massimo come il lato più piccolo + else + dToolMaxDiam = min ( dFacDim1, dFacDim2, dToolTargetDiam) + end + local _, sPocketing = VerifyPocket( Proc, dToolMaxDiam, dFacElev, nil, sMyMchFind) bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end if sWarn2 then From 661c398fb84c6ac668e3470552ba8a70c7137246 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 29 Jun 2022 18:19:00 +0200 Subject: [PATCH 11/13] DataBeam: - correzione ordine funzioni in BeamExec --- LuaLibs/BeamExec.lua | 372 +++++++++++++++++++++---------------------- 1 file changed, 186 insertions(+), 186 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index f514d09..85a8ac7 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -129,6 +129,192 @@ EgtMdbSave() ------------------------------------------------------------------------------------------------------------- -- *** Inserimento delle travi nel grezzo *** +------------------------------------------------------------------------------------------------------------- +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() - 0.5 * dCurrOvmH) + end + -- feature sempre di testa o coda nonostante il gruppo + if ( Proc.Grp == 3 or Proc.Grp == 4) and + ( Proc.Prc == 38 or 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() - 0.5 * dCurrOvmH) + end + -- gestioni speciali + if LapJoint.Identify( Proc) then + return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + if Drill.Identify( Proc) then + return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + if RoundArch.Identify( Proc) then + return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + if Dovetail.Identify( Proc) then + return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + if FreeContour.Identify( Proc) then + return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + end + -- non è di testa + return false +end + +------------------------------------------------------------------------------------------------------------- +local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) + -- lunghezza di riferimento per spostare le feature di coda appena prima + local dAdvTailLen = BD.LEN_VERY_SHORT_PART or BD.LEN_SHORT_PART + -- feature sempre di testa o coda per il gruppo (se non troppo lunga) + if Proc.Grp == 1 or Proc.Grp == 2 then + -- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda + if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then + -- se taglio, lo avanzo + if Proc.Prc == 10 then + return false, true + end + end + -- standard + return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA) + end + -- feature sempre di testa o coda nonostante il gruppo + if ( Proc.Grp == 3 or Proc.Grp == 4) and + ( Proc.Prc == 38 or 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 + -- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda + if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then + -- se profilo front solo con smusso, lo avanzo + if Proc.Prc == 100 and ProfFront.OnlyChamfer( Proc) then + return false, true + end + -- se profilo concavo solo con smusso, lo avanzo + if Proc.Prc == 101 and ProfConcave.OnlyChamfer( Proc) then + return false, true + end + -- se profilo convesso solo con smusso, lo avanzo + if Proc.Prc == 102 and ProfConvex.OnlyChamfer( Proc) then + return false, true + end + -- se profilo caudato solo con smusso, lo avanzo + if Proc.Prc == 103 and ProfCamb.OnlyChamfer( Proc) then + return false, true + end + -- se profilo head solo con smusso, lo avanzo + if Proc.Prc == 106 and ProfHead.OnlyChamfer( Proc) then + return false, true + end + end + -- standard + return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH) + end + -- gestioni speciali + if LapJoint.Identify( Proc) then + return LapJoint.IsTailFeature( Proc, b3Raw) + end + if Drill.Identify( Proc) then + return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT) + end + if DtMortise.Identify( Proc) then + return DtMortise.IsTailFeature( Proc, b3Raw) + end + if RoundArch.Identify( Proc) then + return RoundArch.IsTailFeature( Proc, b3Raw) + end + if Dovetail.Identify( Proc) then + return Dovetail.IsTailFeature( Proc, b3Raw) + end + if FreeContour.Identify( Proc) then + return FreeContour.IsTailFeature( Proc, b3Raw) + end + -- non è di coda + return false +end + +------------------------------------------------------------------------------------------------------------- +local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) + -- recupero le feature + local vProc = {} + local LayerId = {} + LayerId[1] = BL.GetAddGroup( PartId) + LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings') + for nInd = 1, 2 do + local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL) + while ProcId do + local nEntType = EgtGetType( ProcId) + if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or + nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then + local nGrp = EgtGetInfo( ProcId, 'GRP', 'i') + local nPrc = EgtGetInfo( ProcId, 'PRC', 'i') + local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1 + local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0 + local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0 + if nGrp and nPrc and nDo == 1 then + local Proc = {} + Proc.Id = ProcId + Proc.Grp = nGrp + Proc.Prc = nPrc + Proc.Flg = 1 + Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0 + Proc.Diam = 0 + Proc.Fcs = 0 + Proc.Fce = 0 + Proc.CutId = nCutId + Proc.TaskId = nTaskId + Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD) + if Proc.Box and not Proc.Box:isEmpty() then + Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH) + Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) + table.insert( vProc, Proc) + -- se foro + if Drill.Identify( Proc) then + -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) + Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw) + -- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta + if Drill.Split( Proc, b3Raw) then + -- aggiorno flags prima parte foro (dati tabelle sempre per riferimento) + Proc.Flg = 2 + Proc.Head = Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH) + Proc.Tail = Drill.IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) + -- definisco dati seconda parte + local Proc2 = {} + Proc2.Id = ProcId + Proc2.Grp = nGrp + Proc2.Prc = nPrc + Proc2.Flg = -2 + Proc2.Box = BBox3d( Proc.Box) + Proc2.Fct = Proc.Fct + Proc2.Diam = Proc.Diam + Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH) + Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH) + Proc2.Fcs = Proc.Fce + Proc2.Fce = Proc.Fcs + Proc2.CutId = Proc.CutId + Proc2.TaskId = Proc.TaskId + table.insert( vProc, Proc2) + end + -- se BlockHaus HalfLap + elseif Proc.Prc == 37 then + local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId) + if nFacInd then + local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) + if vtN then + Proc.vtN = Vector3d( vtN) + end + end + end + else + Proc.Head = false + Proc.Tail = false + Proc.Flg = 0 + table.insert( vProc, Proc) + EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)') + end + end + end + ProcId = EgtGetNext( ProcId) + end + end + return vProc +end + ------------------------------------------------------------------------------------------------------------- local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH) local nReplacedFeatureId = nil @@ -376,105 +562,6 @@ local function Verify90DegRotation( nRawId) ( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL) 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() - 0.5 * dCurrOvmH) - end - -- feature sempre di testa o coda nonostante il gruppo - if ( Proc.Grp == 3 or Proc.Grp == 4) and - ( Proc.Prc == 38 or 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() - 0.5 * dCurrOvmH) - end - -- gestioni speciali - if LapJoint.Identify( Proc) then - return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - if Drill.Identify( Proc) then - return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - if RoundArch.Identify( Proc) then - return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - if Dovetail.Identify( Proc) then - return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - if FreeContour.Identify( Proc) then - return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - end - -- non è di testa - return false -end - -------------------------------------------------------------------------------------------------------------- -local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) - -- lunghezza di riferimento per spostare le feature di coda appena prima - local dAdvTailLen = BD.LEN_VERY_SHORT_PART or BD.LEN_SHORT_PART - -- feature sempre di testa o coda per il gruppo (se non troppo lunga) - if Proc.Grp == 1 or Proc.Grp == 2 then - -- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda - if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then - -- se taglio, lo avanzo - if Proc.Prc == 10 then - return false, true - end - end - -- standard - return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA) - end - -- feature sempre di testa o coda nonostante il gruppo - if ( Proc.Grp == 3 or Proc.Grp == 4) and - ( Proc.Prc == 38 or 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 - -- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda - if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then - -- se profilo front solo con smusso, lo avanzo - if Proc.Prc == 100 and ProfFront.OnlyChamfer( Proc) then - return false, true - end - -- se profilo concavo solo con smusso, lo avanzo - if Proc.Prc == 101 and ProfConcave.OnlyChamfer( Proc) then - return false, true - end - -- se profilo convesso solo con smusso, lo avanzo - if Proc.Prc == 102 and ProfConvex.OnlyChamfer( Proc) then - return false, true - end - -- se profilo caudato solo con smusso, lo avanzo - if Proc.Prc == 103 and ProfCamb.OnlyChamfer( Proc) then - return false, true - end - -- se profilo head solo con smusso, lo avanzo - if Proc.Prc == 106 and ProfHead.OnlyChamfer( Proc) then - return false, true - end - end - -- standard - return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH) - end - -- gestioni speciali - if LapJoint.Identify( Proc) then - return LapJoint.IsTailFeature( Proc, b3Raw) - end - if Drill.Identify( Proc) then - return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT) - end - if DtMortise.Identify( Proc) then - return DtMortise.IsTailFeature( Proc, b3Raw) - end - if RoundArch.Identify( Proc) then - return RoundArch.IsTailFeature( Proc, b3Raw) - end - if Dovetail.Identify( Proc) then - return Dovetail.IsTailFeature( Proc, b3Raw) - end - if FreeContour.Identify( Proc) then - return FreeContour.IsTailFeature( Proc, b3Raw) - end - -- non è di coda - return false -end - ------------------------------------------------------------------------------------------------------------- local function PrintFeatures( vProc, b3Raw) EgtOutLog( ' RawBox=' .. tostring( b3Raw)) @@ -494,93 +581,6 @@ local function PrintFeatures( vProc, b3Raw) end end -------------------------------------------------------------------------------------------------------------- -local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) - -- recupero le feature - local vProc = {} - local LayerId = {} - LayerId[1] = BL.GetAddGroup( PartId) - LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings') - for nInd = 1, 2 do - local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL) - while ProcId do - local nEntType = EgtGetType( ProcId) - if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or - nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then - local nGrp = EgtGetInfo( ProcId, 'GRP', 'i') - local nPrc = EgtGetInfo( ProcId, 'PRC', 'i') - local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1 - local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0 - local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0 - if nGrp and nPrc and nDo == 1 then - local Proc = {} - Proc.Id = ProcId - Proc.Grp = nGrp - Proc.Prc = nPrc - Proc.Flg = 1 - Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0 - Proc.Diam = 0 - Proc.Fcs = 0 - Proc.Fce = 0 - Proc.CutId = nCutId - Proc.TaskId = nTaskId - Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD) - if Proc.Box and not Proc.Box:isEmpty() then - Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH) - Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) - table.insert( vProc, Proc) - -- se foro - if Drill.Identify( Proc) then - -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) - Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw) - -- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta - if Drill.Split( Proc, b3Raw) then - -- aggiorno flags prima parte foro (dati tabelle sempre per riferimento) - Proc.Flg = 2 - Proc.Head = Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH) - Proc.Tail = Drill.IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) - -- definisco dati seconda parte - local Proc2 = {} - Proc2.Id = ProcId - Proc2.Grp = nGrp - Proc2.Prc = nPrc - Proc2.Flg = -2 - Proc2.Box = BBox3d( Proc.Box) - Proc2.Fct = Proc.Fct - Proc2.Diam = Proc.Diam - Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH) - Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH) - Proc2.Fcs = Proc.Fce - Proc2.Fce = Proc.Fcs - Proc2.CutId = Proc.CutId - Proc2.TaskId = Proc.TaskId - table.insert( vProc, Proc2) - end - -- se BlockHaus HalfLap - elseif Proc.Prc == 37 then - local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId) - if nFacInd then - local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) - if vtN then - Proc.vtN = Vector3d( vtN) - end - end - end - else - Proc.Head = false - Proc.Tail = false - Proc.Flg = 0 - table.insert( vProc, Proc) - EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)') - end - end - end - ProcId = EgtGetNext( ProcId) - end - end - return vProc -end - ------------------------------------------------------------------------------------------------------------- local function OrderFeatures( vProc, b3Raw) From c722186118775484a52fdb03fd7121c1c18de00f Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 29 Jun 2022 18:23:55 +0200 Subject: [PATCH 12/13] DataBeam: - correzione commenti --- LuaLibs/BeamExec.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 85a8ac7..e3f2bf4 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -127,9 +127,6 @@ EgtOutLog( ' BeamExec started', 1) EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC) EgtMdbSave() -------------------------------------------------------------------------------------------------------------- --- *** Inserimento delle travi nel grezzo *** -------------------------------------------------------------------------------------------------------------- local function IsHeadFeature( Proc, b3Raw, dCurrOvmH) -- feature sempre di testa o coda per il gruppo if Proc.Grp == 1 or Proc.Grp == 2 then @@ -363,6 +360,8 @@ local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH) return bTailFinishingNeeded, nReplacedFeatureId end +------------------------------------------------------------------------------------------------------------- +-- *** Inserimento delle travi nel grezzo *** ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk) From e882e70c0c1f877b7ca546c28a821e28792b2390 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 29 Jun 2022 18:25:02 +0200 Subject: [PATCH 13/13] DataBeam: - correzione commenti --- LuaLibs/BeamExec.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index e3f2bf4..facd6ad 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -127,6 +127,7 @@ EgtOutLog( ' BeamExec started', 1) EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC) EgtMdbSave() +------------------------------------------------------------------------------------------------------------- local function IsHeadFeature( Proc, b3Raw, dCurrOvmH) -- feature sempre di testa o coda per il gruppo if Proc.Grp == 1 or Proc.Grp == 2 then