From 1b86003ed85895122990f71355feffed75b29f3e Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 20 May 2022 15:52:56 +0200 Subject: [PATCH 01/13] DataBeam : - migliorata scelta punto di attacco lavorazione tenoni (meglio gestita testa sopra/sotto) - corretta scelta lavorazione tenoni per macchine con testa da sotto - corretta scelta lavorazione BH per feature BH (ora si tiene conto anche dell'affondamento). --- LuaLibs/BeamLib.lua | 35 +++++++------ LuaLibs/MachiningLib.lua | 2 +- LuaLibs/ProcessLapJoint.lua | 97 +++++++++++++++++++++++-------------- LuaLibs/ProcessTenon.lua | 13 +++-- 4 files changed, 91 insertions(+), 56 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 7d16652..18ddfe3 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,4 +1,4 @@ --- BeamLib.lua by Egaltech s.r.l. 2022/05/03 +-- BeamLib.lua by Egaltech s.r.l. 2022/05/18 -- 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. @@ -11,6 +11,7 @@ -- 2022/01/11 In GetNearest*Opposite ridotto vantaggio XY rispetto a Z da 1 -> 0.9 a 1 -> 0.99. -- 2022/04/05 Modifiche a GetNzLimDownUp per FAST. -- 2022/05/03 Ulteriore limitazione a GetNzLimDownUp per FAST. +-- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge. -- Tabella per definizione modulo local BeamLib = {} @@ -194,30 +195,36 @@ function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, bDown) -- recupero il versore normale al piano di lavoro o estrusione local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT) -- coefficienti per riportare la distanza nel piano di lavoro - local dCoeffX = 1 / ( sqrt( 1 - vtN:getX() * vtN:getX())) - local dCoeffY = 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) - local dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ())) + local dCoeffY = 0 + if abs( vtN:getY()) < 0.999 then dCoeffY= 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) end + local dCoeffZ = 0 + if abs( vtN:getZ()) < 0.999 then dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ())) end -- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa) local dUopt = 0 local dDopt = GEO.INFINITO + local dZopt = GEO.INFINITO local dUi, dUf = EgtCurveDomain( nCrvId) for dU = dUi, dUf, 0.5 do local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT) - if ptP then + local vtDp = EgtUV( nCrvId, dU, -1, GDB_ID.ROOT) + local vtDs = EgtUV( nCrvId, dU, 1, GDB_ID.ROOT) + local bTg = ( vtDp and vtDs and vtDp * vtDs > 0.96) + if ptP and bTg then local vtMin = ptP - b3Raw:getMin() local vtMax = ptP - b3Raw:getMax() - local dD = abs( vtMin:getX()) * dCoeffX - dD = min( abs( vtMax:getX()) * dCoeffX, dD) - dD = min( abs( vtMin:getY()) * dCoeffY, dD) + local dD = abs( vtMin:getY()) * dCoeffY dD = min( abs( vtMax:getY()) * dCoeffY, dD) - if bDown then - dD = min( abs( vtMin:getZ()) * dCoeffZ, dD) - else - dD = min( abs( vtMax:getZ()) * dCoeffZ, dD) - end - if dD < dDopt + GEO.EPS_SMALL then + dD = min( abs( vtMin:getZ()) * dCoeffZ, dD) + dD = min( abs( vtMax:getZ()) * dCoeffZ, dD) + local dZ = abs( EgtIf( bDown, vtMin:getZ(), vtMax:getZ())) * dCoeffZ + if dD < dDopt + 10 and dZ < dZopt + GEO.EPS_SMALL then + dUopt = dU + dDopt = min( dD, dDopt) + dZopt = dZ + elseif dD < dDopt - 10 or ( dD < dDopt + GEO.EPS_SMALL and dZ < dZopt + GEO.EPS_SMALL) then dDopt = dD dUopt = dU + dZopt = dZ end end end diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 926e5b2..555e551 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -356,7 +356,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead) end end local bH2, sOrigType = EndsWith( sType, '_H2') - if ( not BEAM or not BEAM.BW) and MachineHeadUse == TWO_UP_DOWN_HEADS and bH2 and bTopHead then + if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then return FindMachining( MachiningType, sOrigType, Params, true, false) end end diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 6e58fa1..2ecc723 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -382,7 +382,7 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill) -- le facce devono contenere X e quelle di chiusura devono essere perpendicolari a X local bStopY, bStopZ for i = 1, Proc.Fct do - local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT) + local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT) if abs( vtN:getX()) > 0.001 and abs( vtN:getX()) < 0.999962 then return false end @@ -412,20 +412,35 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill) -- recupero i dati dell'utensile local dToolLength = 0 local dToolDiam = 0 - local dMaxDepth = 0 - local dThickTool = 0 + local dToolMaxDepth = 0 + local dToolThick = 0 + local dToolFreeLen = 0 if EgtMdbSetCurrMachining( sMilling) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam - dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth - dThickTool = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThickTool + local dToolThDiam = EgtTdbGetCurrToolThDiam() or 150 + if ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0 then + dToolMaxDepth = EgtTdbGetCurrToolMaxDepth() or dToolMaxDepth + dToolThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dToolThick + dToolFreeLen = dToolLength + else + dToolMaxDepth = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 0.5 * ( dToolDiam - dToolThDiam) + dToolThick = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) + dToolFreeLen = EgtTdbGetCurrToolMaxDepth() or dToolFreeLen + end end end -- verifico se abbastanza larga (oppure L) rispetto all'utensile - if Proc.Box:getDimX() < dThickTool - 15 * GEO.EPS_SMALL and not bIsL then + if Proc.Box:getDimX() < dToolThick - 15 * GEO.EPS_SMALL and not bIsL then + return false + end + + -- limiti trasversali + local dDepth = min( Proc.Box:getDimY(), Proc.Box:getDimZ()) + if dDepth > dToolMaxDepth then return false end @@ -440,14 +455,14 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill) local bHead = bHeadDir -- verifico se raggiungibile con la testa senza collisioni - local bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dMaxDepth + local bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dToolFreeLen -- se diametro utensile maggiore della testa - if BD.HEAD_DIM_FOR_BH and dToolDiam > BD.HEAD_DIM_FOR_BH then + if BD.HEAD_DIM_FOR_BH and dToolDiam - 2 * dDepth > BD.HEAD_DIM_FOR_BH then bHead = true bUseBHSideMill = true end - return bUseBHSideMill, bHead, bHeadDir, sMilling, dThickTool, dToolDiam + return bUseBHSideMill, bHead, bHeadDir, sMilling, dToolThick, dToolDiam end --------------------------------------------------------------------- @@ -557,6 +572,29 @@ local function CalcCollisionSafety( vtDir) return dCollSic end +--------------------------------------------------------------------- +local function UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid) + -- verifico siano una o due facce + if Proc.Fct > 2 then return end + -- eventuale segnalazione ingombro di testa o coda + local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ()) + if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then + if Proc.Head then + local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() + BL.UpdateHCING( nRawId, dOffs) + elseif Proc.Tail then + local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX() + BL.UpdateTCING( nRawId, dOffs) + elseif Proc.Fct > 1 and Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then + local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() + local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX() + -- sempre concavo aumento la distanza (rimane una punta...) + dDist = dDist + 10 + BL.UpdateHCING( nRawId, dOffs, dDist) + end + end +end + --------------------------------------------------------------------- -- Verifica se feature di testa function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH) @@ -863,16 +901,7 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) return false, sErr end -- eventuale segnalazione ingombro di testa o coda - local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ()) - if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then - if Proc.Head then - local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() - BL.UpdateHCING( nRawId, dOffs) - elseif Proc.Tail then - local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX() - BL.UpdateTCING( nRawId, dOffs) - end - end + UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid) return true end @@ -1040,22 +1069,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) return false, sErr end -- eventuale segnalazione ingombro di testa o coda - local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ()) - if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then - if Proc.Head then - local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() - BL.UpdateHCING( nRawId, dOffs) - elseif Proc.Tail then - local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX() - BL.UpdateTCING( nRawId, dOffs) - elseif Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then - local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() - local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX() - -- sempre concavo aumento la distanza (rimane una punta...) - dDist = dDist + 10 - BL.UpdateHCING( nRawId, dOffs, dDist) - end - end + UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid) return true end @@ -2664,7 +2678,6 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd, return false, sErr end end - if bOrthoFaces then -- ottengo le dimensioni del tunnel local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId) @@ -4531,6 +4544,14 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if bMakeBySideMill then -- se smusso non è esclusivo if nChamfer < 2 then + -- verifico che la faccia non sia diretta come X, altrimenti cerco di cambiarla + if abs( vtN:getX()) > 0.866 and nFacInd2 then + local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd2, GDB_ID.ROOT) + if vtN2 and abs( vtN2:getX()) < 0.866 then + nFacInd, nFacInd2 = nFacInd2, nFacInd + vtN, vtN2 = vtN2, vtN + end + end -- se lavorazione da sotto e lunga, va divisa in due metà local bDouble = ( vtN:getZ() < -0.5 and dH > ( BD.MAX_LEN_BH_FROM_BOTTOM or 200)) -- inserisco la lavorazione di fresatura @@ -4573,7 +4594,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + b3Raw:getDimY() + BD.CUT_SIC)) - EgtSetMachiningParam( MCH_MP.LOPERP, dFacElev + BD.COLL_SIC) + EgtSetMachiningParam( MCH_MP.LOPERP, EgtIf( vtN:getZ() > -0.5, dFacElev + BD.COLL_SIC, BD.COLL_SIC)) if bDouble then EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dH / 2) EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + dH / 2 + BD.CUT_SIC)) @@ -5298,6 +5319,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end end end + -- eventuale segnalazione ingombro di testa o coda + UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid) end return true, sWarn, bPrevBhSideMill diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index 38a360a..f752202 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -1,7 +1,8 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2022/02/15 +-- ProcessTenon.lua by Egaltech s.r.l. 2022/05/18 -- Gestione calcolo tenone per Travi -- 2021/10/04 Corretto calcolo HCING per pezzi piccoli. -- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto. +-- 2022/05/18 Migliorata gestione attacco. -- Tabella per definizione modulo local ProcessTenon = {} @@ -160,8 +161,6 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- abilitazione lavorazione da sotto local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1) - -- porto inizio curva il più possibile sul bordo - BL.PutStartNearestToEdge( AuxId, b3Solid, bMillDown and not bShortPart) -- se vero tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa if Proc.Prc ~= 52 and ( not AreSameOrOppositeVectorApprox( vtN, X_AX()) or @@ -234,7 +233,10 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- recupero la lavorazione local sMillType = 'Tenon' - local sMilling = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown) or ML.FindMilling( sMillType, nil, nil, nil, bMillUp, bMillDown) + local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown) + if not sMilling then + sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) + end if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -253,6 +255,9 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) bCW = ( dSpeed >= 0) end end + -- porto inizio curva il più possibile sul bordo + local bMyShortPart = ( bShortPart and abs( vtN:getX()) < 0.999) + BL.PutStartNearestToEdge( AuxId, b3Solid, bH2 ~= bMyShortPart) -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente local sWarn local dDepth = 0 From 213c2111319de8fc563d60073dcb550d89cf1710 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 24 May 2022 08:41:27 +0200 Subject: [PATCH 02/13] DataBeam : - in LapJoint miglioramenti vari per BH, compreso controlli per lavorazione da sotto - in LapJoint corretta assegnazione elevazione quando si scambia la faccia principale tra due - in LongDoubleCut piccole modifiche e migliorie. --- LuaLibs/ProcessLapJoint.lua | 18 +++++----- LuaLibs/ProcessLongDoubleCut.lua | 59 +++++++++++++++++--------------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 2ecc723..399a1c7 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2022/05/04 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/05/24 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -41,6 +41,7 @@ -- 2022/03/29 Aggiunta gestione antischeggia con Q06 anche su 3/4-033-X. -- 2022/04/28 Lavorazione BH forzata sempre OneWay. -- 2022/05/04 Corretta classificazione due facce sotto. Modificati criteri assegnazione due facce alla coda. +-- 2022/05/24 Miglioramenti vari per BH, compreso controlli per lavorazione da sotto. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -698,11 +699,6 @@ end function ProcessLapJoint.Classify( Proc, b3Raw) -- se 1 faccia if Proc.Fct == 1 then - -- dati della faccia - --local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - -- verifico se è lavorabile solo dal basso - --local bDown = ( vtN:getZ() < BD.NZ_MINA) - --return true, bDown return true, false -- se 2 facce elseif Proc.Fct == 2 then @@ -802,9 +798,14 @@ function ProcessLapJoint.Classify( Proc, b3Raw) rfFac:rotate( rfFac:getOrigin(), rfFac:getVersZ(), 90) end -- se può essere fatto con utensile tipo lama - local bUseBHSideMill = VerifyBHSideMill( Proc) + local bUseBHSideMill, _, _, _, _, dTDiam = VerifyBHSideMill( Proc) if bUseBHSideMill then - return true, false + local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) + if vtN:getZ() > -0.5 or b3Raw:getDimZ() - Proc.Box:getDimZ() < ( BD.MAX_DIST_BH_FROM_BOTTOM or 395) - dTDiam / 2 then + return true, false + else + return true, true + end -- altrimenti controllo se deve essere ruotato con le altre lavorazioni else -- dati della faccia @@ -4549,6 +4550,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd2, GDB_ID.ROOT) if vtN2 and abs( vtN2:getX()) < 0.866 then nFacInd, nFacInd2 = nFacInd2, nFacInd + dFacElev, dFacElev2 = dFacElev2, dFacElev vtN, vtN2 = vtN2, vtN end end diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index d2b425a..f380f79 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -254,7 +254,7 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex, end end else - if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) or ( vtN2 and vtN2:getZ() >= -0.5) then + if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then bCanUseBlade = true end end @@ -305,39 +305,21 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster local bConvex local bOrtho local ptM + local ptRef = ( ptC[1] + ptC[2]) / 2 if bInt then bConvex = ( dAng >= 0) bOrtho = ( abs( dAng + 90) < 1) ptM = ( ptP1 + ptP2) / 2 else - bConvex = true + ptM = ptRef + local vtM1 = ptC[1] - ptM ; vtM1:normalize() + local vtM2 = ptC[2] - ptM ; vtM2:normalize() + bConvex = ( vtM1 * vtN[1] > 0 and vtM2 * vtN[2] > 0) bOrtho = false dAng = acos( vtN[1] * vtN[2]) - ptM = ( ptC[1] + ptC[2]) / 2 + -- se facce contrapposte e quindi concavo, angolo sempre negativo + if not bConvex and dAng > 0 then dAng = -dAng end end - local ptRef = ( ptC[1] + ptC[2]) / 2 - -- analisi del taglio - local vOrd = {} - local vFaceUse = {} - if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then - vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) - vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} - elseif nSide == -1 then - vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1}) - vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)} - else - local bFront = ( vtN[1]:getY() < 0) - if bFront then - vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 1, 2}, { 2, 1}) - vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} - else - vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 2, 1}, { 1, 2}) - vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} - end - end - local vWidth = {} - _, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1]) - _, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2]) -- ottengo la distanza tra la fine del pezzo e il pezzo successivo local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4 @@ -380,6 +362,29 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster return false, sErr end + -- analisi del taglio + local vOrd = {} + local vFaceUse = {} + if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then + vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) + vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} + elseif nSide == -1 then + vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) + vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)} + else + local bFront = ( vtN[1]:getY() < 0) + if bFront then + vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1}) + vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} + else + vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 2, 1}, { 1, 2}) + vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} + end + end + local vWidth = {} + _, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1]) + _, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2]) + -- Se senza facce limitanti, da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima if nFaceLimit == 0 and ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then @@ -755,7 +760,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- se faccia da sotto e Z centro faccia è minore del centro altra faccia, segno il limite angolare da passare -- dovrebbe essere il limite angolare della testa 1 in sottosquadra if nSide == -1 and not BD.DOWN_HEAD then - if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() then + if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() - 1. then dSinLimit = -0.0157 else dSinLimit = -0.5 From e7a7f7b88b88d119495ca0f3a3cd9dde316e1b8f Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 25 May 2022 08:03:14 +0200 Subject: [PATCH 03/13] DataBeam : - modifica lunghezza pezzi corti per feature di coda da anticipare prima del taglio. --- LuaLibs/BeamExec.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 9dc9dcf..6709730 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -312,10 +312,12 @@ end ------------------------------------------------------------------------------------------------------------- local function IsTailFeature( Proc, b3Raw, dCurrOvmH) + -- 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() < BD.LEN_SHORT_PART and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then + 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 @@ -328,7 +330,7 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH) 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() < BD.LEN_SHORT_PART and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then + 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 From a983e51718a2bda39709a5b6fe2e981c2fad3835 Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 25 May 2022 12:39:31 +0200 Subject: [PATCH 04/13] DataBeam : - migliorate funzioni GetNearestOrthoOpposite e GetNearestParalOpposite per casi limite. --- LuaLibs/BeamLib.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 18ddfe3..0487a70 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,4 +1,4 @@ --- BeamLib.lua by Egaltech s.r.l. 2022/05/18 +-- BeamLib.lua by Egaltech s.r.l. 2022/05/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. @@ -273,7 +273,7 @@ function BeamLib.GetNearestParalOpposite( vtRef, vtNorm) vtMyRef:normalize() end -- se prevalente una componente orizzontale (con piccolissimo vantaggio) - if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then + if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then if abs( vtMyRef:getX()) > abs( vtMyRef:getY()) - GEO.EPS_SMALL then if vtMyRef:getX() > -GEO.EPS_SMALL then return MCH_MILL_FU.PARAL_LEFT @@ -307,7 +307,7 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm) vtMyRef:normalize() end -- se prevalente una componente orizzontale (con piccolissimo vantaggio) - if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then + if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then -- se prevale la componente destra/sinistra (con piccolo vantaggio) if abs( vtMyRef:getX()) > 0.9 * abs( vtMyRef:getY()) then if vtMyRef:getX() > -GEO.EPS_SMALL then From b5e486d3cad6522cab77c4257d23e22eccb5edf6 Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 25 May 2022 16:25:05 +0200 Subject: [PATCH 05/13] DataBeam : - sui profili aggiunta lavorazione con fresa da sotto per macchine con testa da sotto (riportata modifica ES in nuova gestione). --- LuaLibs/ProcessProfCamb.lua | 204 +++++++++++++++++++-------------- LuaLibs/ProcessProfConcave.lua | 184 +++++++++++++++++------------ LuaLibs/ProcessProfConvex.lua | 182 +++++++++++++++++------------ LuaLibs/ProcessProfFront.lua | 171 ++++++++++++++++----------- LuaLibs/ProcessProfHead.lua | 177 ++++++++++++++++------------ 5 files changed, 553 insertions(+), 365 deletions(-) diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index a346bcc..cbccf1f 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -1,4 +1,4 @@ --- ProcessProfCamb.lua by Egaltech s.r.l. 2022/02/02 +-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/05/24 -- Gestione calcolo profilo caudato per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. @@ -6,6 +6,7 @@ -- 2021/10/12 Portato a 30deg l'angolo limite per fare l'antischeggia. -- 2022/01/26 Migliorato controllo lavorazione con fresa su testa da sotto. -- 2022/02/02 Aggiunta funzione OnlyChamfer. +-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- Tabella per definizione modulo local ProcessProfCamb = {} @@ -204,6 +205,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) + local sWarn -- ingombro del grezzo local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo @@ -443,9 +445,124 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- se il chamfer non è esclusivo continuo con le altre lavorazioni if nChamfer < 2 then -- verifico se necessario lavorare in doppio - local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) + local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) - -- inserisco la lavorazione + -- se lavorazione da due parti, aggiungo la seconda + local sMillingDown + if bDouble then + if nSide == 0 then + if BD.DOWN_HEAD then + -- recupero la lavorazione + sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) + if not sMillingDown then + sWarn = 'Warning : milling from bottom not found in library' + EgtOutLog( sWarn) + bDouble = false + end + else + sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')' + EgtOutLog( sWarn) + bDouble = false + end + end + end + -- se orizzontale o trovata lavorazione per doppio verticale + if bDouble then + -- inserisco la lavorazione + local sName + if bMakeAs then + sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + else + sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + end + local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling)) + if not nMchId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- se lavorazione da sopra e da sotto + if ( nSide == 0) then + if vtExtr:getZ() > 0.1 then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + end + -- altrimenti lavorazione davanti e dietro + else + -- se lavorazione a destra di fronte o sinistra da dietro, inverto + if ( bHead and vtExtr:getY() > 0.1) or + ( not bHead and vtExtr:getY() < -0.1) then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + end + end + -- imposto l'affondamento + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + -- posizione braccio porta testa + EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) + -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale + local bFinish + local dOriOffset = 0 + local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + bFinish = true + end + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + end + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchId, false) + return false, sErr + else + -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno + -- della feature inverto il punto di inizio della lavorazione + ModifySideAndInvert( Proc, bHead) + end + -- se devo fare l'antischeggia in testa + if bMakeAs then + local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + -- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale) + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + -- rendo corrente la precedente, la inverto e modifico il parametri di uscita + EgtSetCurrMachining( nMchId) + local dCrvLen = EgtCurveLength( AuxId) + if dCrvLen > abs(dMakeAntiSplintOnHead) then + ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen)) + end + -- rendo corrente la copia (cioè la lavorazione completa) + EgtSetCurrMachining( nMch2Id) + nMchId = nMch2Id + end + -- se abilitata, aggiungo lavorazione di finitura + if bFinish then + -- inserisco la lavorazione + local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + else + -- riporto il sovramateriale originale e tolgo i passi inutili + EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) + EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMch2Id, false) + return false, sErr + end + end + end + end + -- inserisco la prima lavorazione local sName if bMakeAs then sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) @@ -553,85 +670,6 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end end - -- se lavorazione da due parti, aggiungo la seconda - if bDouble then - -- inserisco la lavorazione - local sName - if bMakeAs then - sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - else - sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - end - local nMchId = EgtAddMachining( sName, sMilling) - if not nMchId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - end - -- aggiungo geometria - EgtSetMachiningGeometry( {{ AuxId, -1}}) - -- sempre lavorazione da sopra o da sotto - -- se lavorazione a destra di fronte o sinistra da dietro, inverto - if ( bHead and vtExtr:getY() > 0.1) or - ( not bHead and vtExtr:getY() < -0.1) then - EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) - EgtSetMachiningParam( MCH_MP.INVERT, true) - end - -- imposto l'affondamento - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) - -- posizione braccio porta testa - EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) - -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente - if dOffsetPar > 0 then - EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) - end - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) - return false, sErr - else - -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno - -- della feature inverto il punto di inizio della lavorazione - ModifySideAndInvert( Proc, bHead) - end - -- se devo fare l'antischeggia in testa - if bMakeAs then - local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - -- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale) - local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) - -- rendo corrente la precedente, la inverto e modifico il parametri di uscita - EgtSetCurrMachining( nMchId) - local dCrvLen = EgtCurveLength( AuxId) - if dCrvLen > abs(dMakeAntiSplintOnHead) then - ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen)) - end - -- rendo corrente la copia (cioè la lavorazione completa) - EgtSetCurrMachining( nMch2Id) - nMchId = nMch2Id - end - -- se abilitata, aggiungo lavorazione di finitura - if bFinish then - -- inserisco la lavorazione - local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) - if not nMch2Id then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - else - -- riporto il sovramateriale originale e tolgo i passi inutili - EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) - EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMch2Id, false) - return false, sErr - end - end - end - end -- se non da sotto e parametro Q abilitato, inserisco lavorazione finitura angolo if ( nSide ~= -1 or bMillDown) and EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') == 1 then sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) @@ -684,7 +722,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX()) end end - return true + return true, sWarn end --------------------------------------------------------------------- diff --git a/LuaLibs/ProcessProfConcave.lua b/LuaLibs/ProcessProfConcave.lua index 9b26dd6..79ecaac 100644 --- a/LuaLibs/ProcessProfConcave.lua +++ b/LuaLibs/ProcessProfConcave.lua @@ -1,8 +1,9 @@ --- ProcessProfConcave.lua by Egaltech s.r.l. 2022/02/02 +-- ProcessProfConcave.lua by Egaltech s.r.l. 2022/05/24 -- Gestione calcolo profilo concavo per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2022/02/02 Aggiunta funzione OnlyChamfer. +-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- Tabella per definizione modulo local ProcessProfConcave = {} @@ -89,8 +90,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, -- confronto il punto iniziale e finale della lavorazione con il box della feature -- e se è vicino alla parte esterna della trave inverto la lavorazione - ptSP = EgtGetMachiningStartPoint() - ptEp = EgtGetMachiningEndPoint() + local ptSP = EgtGetMachiningStartPoint() + local ptEp = EgtGetMachiningEndPoint() local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE) if nMachMode == 1 and ptSP and ptEp then if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) < @@ -195,6 +196,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) + local sWarn -- ingombro del grezzo local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo @@ -411,9 +413,109 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end -- verifico se necessario lavorare in doppio - local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) + local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) - -- inserisco la lavorazione + -- se lavorazione da due parti, aggiungo la seconda + local sMillingDown + if bDouble then + if nSide == 0 then + if BD.DOWN_HEAD then + -- recupero la lavorazione + sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) + if not sMillingDown then + sWarn = 'Warning : milling from bottom not found in library' + EgtOutLog( sWarn) + bDouble = false + end + else + sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')' + EgtOutLog( sWarn) + bDouble = false + end + end + end + -- se orizzontale o trovata lavorazione per doppio verticale + if bDouble then + -- inserisco la lavorazione + local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling)) + if not nMchId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false + -- se lavorazione da sopra e da sotto + if ( nSide == 0) then + if vtExtr:getZ() > 0.1 then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = true + end + -- altrimenti lavorazione davanti e dietro + else + -- se lavorazione a destra di fronte o sinistra da dietro, inverto + if ( bHead and vtExtr:getY() > 0.1) or + ( not bHead and vtExtr:getY() < -0.1) then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = true + end + end + -- imposto l'affondamento + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + -- posizione braccio porta testa + EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) + -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale + local bFinish + local dOriOffset = 0 + local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + bFinish = true + end + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + end + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchId, false) + return false, sErr + else + -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno + -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco + -- e uscita + ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) + end + -- se abilitata, aggiungo lavorazione di finitura + if bFinish then + -- inserisco la lavorazione + local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + else + -- riporto il sovramateriale originale e tolgo i passi inutili + EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) + EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMch2Id, false) + return false, sErr + end + end + end + end + -- inserisco la prima lavorazione local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchId = EgtAddMachining( sName, sMilling) if not nMchId then @@ -467,7 +569,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale - local ptSP, ptEp local bFinish local dOriOffset = 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 @@ -491,7 +592,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) @@ -508,73 +609,10 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end end - -- se lavorazione da due parti, aggiungo la seconda - if bDouble then - -- inserisco la lavorazione - local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtAddMachining( sName, sMilling) - if not nMchId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - end - -- aggiungo geometria - EgtSetMachiningGeometry( {{ AuxId, -1}}) - -- resetto il flag inversione percorso - bFlagInvert = false - -- sempre lavorazione da sopra o da sotto - -- se lavorazione a destra di fronte o sinistra da dietro, inverto - if ( bHead and vtExtr:getY() > 0.1) or - ( not bHead and vtExtr:getY() < -0.1) then - EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) - EgtSetMachiningParam( MCH_MP.INVERT, true) - bFlagInvert = not bFlagInvert - end - -- imposto l'affondamento - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) - -- posizione braccio porta testa - EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) - -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente - if dOffsetPar > 0 then - EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) - end - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) - return false, sErr - else - -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno - -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco - -- e uscita - ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) - end - -- se abilitata, aggiungo lavorazione di finitura - if bFinish then - -- inserisco la lavorazione - local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) - if not nMch2Id then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - else - -- riporto il sovramateriale originale e tolgo i passi inutili - EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) - EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMch2Id, false) - return false, sErr - end - end - end - end -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and - ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then + ( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchVId = EgtAddMachining( sName, sMilling) if not nMchVId then @@ -610,7 +648,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and - ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then + ( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchV2Id = EgtAddMachining( sName, sMilling) if not nMchV2Id then @@ -656,7 +694,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX()) end end - return true + return true, sWarn end --------------------------------------------------------------------- diff --git a/LuaLibs/ProcessProfConvex.lua b/LuaLibs/ProcessProfConvex.lua index 6ca8742..6901f27 100644 --- a/LuaLibs/ProcessProfConvex.lua +++ b/LuaLibs/ProcessProfConvex.lua @@ -1,8 +1,9 @@ --- ProcessProfConvex.lua by Egaltech s.r.l. 2022/02/02 +-- ProcessProfConvex.lua by Egaltech s.r.l. 2022/05/24 -- Gestione calcolo profilo convesso per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2022/02/02 Aggiunta funzione OnlyChamfer. +-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- Tabella per definizione modulo local ProcessProfConvex = {} @@ -89,8 +90,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, -- confronto il punto iniziale e finale della lavorazione con il box della feature -- e se è vicino alla parte esterna della trave inverto la lavorazione - ptSP = EgtGetMachiningStartPoint() - ptEp = EgtGetMachiningEndPoint() + local ptSP = EgtGetMachiningStartPoint() + local ptEp = EgtGetMachiningEndPoint() local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE) if nMachMode == 1 and ptSP and ptEp then if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) < @@ -195,6 +196,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) + local sWarn -- ingombro del grezzo local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo @@ -411,9 +413,109 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end -- verifico se necessario lavorare in doppio - local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) + local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) - -- inserisco la lavorazione + -- se lavorazione da due parti, aggiungo la seconda + local sMillingDown + if bDouble then + if nSide == 0 then + if BD.DOWN_HEAD then + -- recupero la lavorazione + sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) + if not sMillingDown then + sWarn = 'Warning : milling from bottom not found in library' + EgtOutLog( sWarn) + bDouble = false + end + else + sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')' + EgtOutLog( sWarn) + bDouble = false + end + end + end + -- se orizzontale o trovata lavorazione per doppio verticale + if bDouble then + -- inserisco la lavorazione + local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling)) + if not nMchId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false + -- se lavorazione da sopra e da sotto + if ( nSide == 0) then + if vtExtr:getZ() > 0.1 then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = true + end + -- altrimenti lavorazione davanti e dietro + else + -- se lavorazione a destra di fronte o sinistra da dietro, inverto + if ( bHead and vtExtr:getY() > 0.1) or + ( not bHead and vtExtr:getY() < -0.1) then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = true + end + end + -- imposto l'affondamento + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + -- posizione braccio porta testa + EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) + -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale + local bFinish + local dOriOffset = 0 + local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + bFinish = true + end + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + end + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchId, false) + return false, sErr + else + -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno + -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco + -- e uscita + ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) + end + -- se abilitata, aggiungo lavorazione di finitura + if bFinish then + -- inserisco la lavorazione + local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + else + -- riporto il sovramateriale originale e tolgo i passi inutili + EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) + EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMch2Id, false) + return false, sErr + end + end + end + end + -- inserisco la prima lavorazione local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchId = EgtAddMachining( sName, sMilling) if not nMchId then @@ -467,7 +569,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale - local ptSP, ptEp local bFinish local dOriOffset = 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 @@ -508,73 +609,10 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end end - -- se lavorazione da due parti, aggiungo la seconda - if bDouble then - -- inserisco la lavorazione - local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtAddMachining( sName, sMilling) - if not nMchId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - end - -- aggiungo geometria - EgtSetMachiningGeometry( {{ AuxId, -1}}) - -- resetto il flag inversione percorso - bFlagInvert = false - -- sempre lavorazione da sopra o da sotto - -- se lavorazione a destra di fronte o sinistra da dietro, inverto - if ( bHead and vtExtr:getY() > 0.1) or - ( not bHead and vtExtr:getY() < -0.1) then - EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) - EgtSetMachiningParam( MCH_MP.INVERT, true) - bFlagInvert = not bFlagInvert - end - -- imposto l'affondamento - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) - -- posizione braccio porta testa - EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) - -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente - if dOffsetPar > 0 then - EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) - end - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) - return false, sErr - else - -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno - -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco - -- e uscita - ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) - end - -- se abilitata, aggiungo lavorazione di finitura - if bFinish then - -- inserisco la lavorazione - local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) - if not nMch2Id then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - else - -- riporto il sovramateriale originale e tolgo i passi inutili - EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) - EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMch2Id, false) - return false, sErr - end - end - end - end -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and - ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then + ( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchVId = EgtAddMachining( sName, sMilling) if not nMchVId then @@ -610,7 +648,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and - ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then + ( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchV2Id = EgtAddMachining( sName, sMilling) if not nMchV2Id then @@ -655,7 +693,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX()) end end - return true + return true, sWarn end --------------------------------------------------------------------- diff --git a/LuaLibs/ProcessProfFront.lua b/LuaLibs/ProcessProfFront.lua index 3a68535..1b2fdbf 100644 --- a/LuaLibs/ProcessProfFront.lua +++ b/LuaLibs/ProcessProfFront.lua @@ -1,8 +1,9 @@ --- ProcessProfFront.lua by Egaltech s.r.l. 2022/02/02 +-- ProcessProfFront.lua by Egaltech s.r.l. 2022/05/24 -- Gestione calcolo profilo frontale per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2022/02/02 Aggiunta funzione OnlyChamfer. +-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- Tabella per definizione modulo local ProcessProfFront = {} @@ -167,6 +168,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) + local sWarn -- ingombro del grezzo local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo @@ -370,8 +372,104 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end -- verifico se necessario lavorare in doppio - local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) + local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) + -- se lavorazione da due parti, aggiungo la seconda + local sMillingDown + if bDouble then + if nSide == 0 then + if BD.DOWN_HEAD then + -- recupero la lavorazione + sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) + if not sMillingDown then + sWarn = 'Warning : milling from bottom not found in library' + EgtOutLog( sWarn) + bDouble = false + end + else + sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')' + EgtOutLog( sWarn) + bDouble = false + end + end + end + -- se orizzontale o trovata lavorazione per doppio verticale + if bDouble then + -- inserisco la lavorazione + local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling)) + if not nMchId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- se lavorazione da sopra e da sotto + if ( nSide == 0) then + if vtExtr:getZ() > 0.1 then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + end + -- altrimenti lavorazione davanti e dietro + else + -- se lavorazione a destra di fronte o sinistra da dietro, inverto + if ( bHead and vtExtr:getY() > 0.1) or + ( not bHead and vtExtr:getY() < -0.1) then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + end + end + -- imposto l'affondamento + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + -- posizione braccio porta testa + EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) + -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale + local bFinish + local dOriOffset = 0 + local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + bFinish = true + end + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + end + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchId, false) + return false, sErr + else + -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno + -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco + -- e uscita + ModifySideInvertLead( Proc, bHead, dToolDiam) + end + -- se abilitata, aggiungo lavorazione di finitura + if bFinish then + -- inserisco la lavorazione + local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + else + -- riporto il sovramateriale originale e tolgo i passi inutili + EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) + EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMch2Id, false) + return false, sErr + end + end + end + end -- inserisco la lavorazione local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchId = EgtAddMachining( sName, sMilling) @@ -420,7 +518,6 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale - local ptSP, ptEp local bFinish local dOriOffset = 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 @@ -461,70 +558,10 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end end - -- se lavorazione da due parti, aggiungo la seconda - if bDouble then - -- inserisco la lavorazione - local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtAddMachining( sName, sMilling) - if not nMchId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - end - -- aggiungo geometria - EgtSetMachiningGeometry( {{ AuxId, -1}}) - -- sempre lavorazione da sopra o da sotto - -- se lavorazione a destra di fronte o sinistra da dietro, inverto - if ( bHead and vtExtr:getY() > 0.1) or - ( not bHead and vtExtr:getY() < -0.1) then - EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) - EgtSetMachiningParam( MCH_MP.INVERT, true) - end - -- imposto l'affondamento - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) - -- posizione braccio porta testa - EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) - -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente - if dOffsetPar > 0 then - EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) - end - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) - return false, sErr - else - -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno - -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco - -- e uscita - ModifySideInvertLead( Proc, bHead, dToolDiam) - end - -- se abilitata, aggiungo lavorazione di finitura - if bFinish then - -- inserisco la lavorazione - local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) - if not nMch2Id then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - else - -- riporto il sovramateriale originale e tolgo i passi inutili - EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) - EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMch2Id, false) - return false, sErr - end - end - end - end -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and - ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then + ( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then -- se non da sotto, inserisco lavorazione finitura angolo --if nSide ~= -1 then sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) @@ -547,7 +584,9 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) -- imposto tipo uso faccia local nFaceUse = MCH_MILL_FU.PARAL_DOWN - if nSide ~= 1 then + if nSide == -1 then + nFaceUse = EgtIf( vtN:getX() > 0.1, MCH_MILL_FU.PARAL_LEFT, MCH_MILL_FU.PARAL_RIGHT) + elseif nSide ~= 1 then nFaceUse = EgtIf( vtN:getY() > 0.1, MCH_MILL_FU.PARAL_FRONT, MCH_MILL_FU.PARAL_BACK) end EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) @@ -587,7 +626,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX()) -- end --end - return true + return true, sWarn end --------------------------------------------------------------------- diff --git a/LuaLibs/ProcessProfHead.lua b/LuaLibs/ProcessProfHead.lua index 7dd73d9..3067d8c 100644 --- a/LuaLibs/ProcessProfHead.lua +++ b/LuaLibs/ProcessProfHead.lua @@ -1,9 +1,10 @@ --- ProcessProfHead.lua by Egaltech s.r.l. 2022/02/02 +-- ProcessProfHead.lua by Egaltech s.r.l. 2022/05/24 -- Gestione calcolo profilo di testa per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2021/10/12 Estesa gestione di testa da sotto, se presente. -- 2022/02/02 Aggiunta funzione OnlyChamfer. +-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- Tabella per definizione modulo local ProcessProfHead = {} @@ -82,8 +83,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, -- confronto il punto iniziale e finale della lavorazione con il box della feature -- e se è vicino alla parte esterna della trave inverto la lavorazione - ptSP = EgtGetMachiningStartPoint() - ptEp = EgtGetMachiningEndPoint() + local ptSP = EgtGetMachiningStartPoint() + local ptEp = EgtGetMachiningEndPoint() local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE) if nMachMode == 1 and ptSP and ptEp then if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) < @@ -418,9 +419,108 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end -- verifico se necessario lavorare in doppio - local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) + local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) - -- inserisco la lavorazione + -- se lavorazione da due parti, aggiungo la seconda + local sMillingDown + if bDouble then + if nSide == 0 then + if BD.DOWN_HEAD then + -- recupero la lavorazione + sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) + if not sMillingDown then + sWarn = 'Warning : milling from bottom not found in library' + EgtOutLog( sWarn) + bDouble = false + end + else + sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')' + EgtOutLog( sWarn) + bDouble = false + end + end + end + -- se orizzontale o trovata lavorazione per doppio verticale + if bDouble then + -- inserisco la lavorazione + local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling)) + if not nMchId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false + -- se lavorazione da sopra e da sotto + if ( nSide == 0) then + if vtExtr:getZ() > 0.1 then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + end + -- altrimenti lavorazione davanti e dietro + else + -- se lavorazione a destra di fronte o sinistra da dietro, inverto + if ( bHead and vtExtr:getY() > 0.1) or + ( not bHead and vtExtr:getY() < -0.1) then + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + end + end + -- imposto l'affondamento + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + -- posizione braccio porta testa + EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) + -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale + local bFinish + local dOriOffset = 0 + local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + bFinish = true + end + -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente + if dOffsetPar > 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) + end + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchId, false) + return false, sErr + else + -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno + -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco + -- e uscita + ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, + dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar) + end + -- se abilitata, aggiungo lavorazione di finitura + if bFinish then + -- inserisco la lavorazione + local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + else + -- riporto il sovramateriale originale e tolgo i passi inutili + EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) + EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMch2Id, false) + return false, sErr + end + end + end + end + -- inserisco la prima lavorazione local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchId = EgtAddMachining( sName, sMilling) if not nMchId then @@ -474,7 +574,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale - local ptSP, ptEp local bFinish local dOriOffset = 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 @@ -516,70 +615,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end end - -- se lavorazione da due parti, aggiungo la seconda - if bDouble then - -- inserisco la lavorazione - local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtAddMachining( sName, sMilling) - if not nMchId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - end - -- aggiungo geometria - EgtSetMachiningGeometry( {{ AuxId, -1}}) - -- resetto il flag inversione percorso - bFlagInvert = false - -- sempre lavorazione da sopra o da sotto - -- se lavorazione a destra di fronte o sinistra da dietro, inverto - if ( bHead and vtExtr:getY() > 0.1) or - ( not bHead and vtExtr:getY() < -0.1) then - EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) - EgtSetMachiningParam( MCH_MP.INVERT, true) - bFlagInvert = not bFlagInvert - end - -- imposto l'affondamento - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) - -- posizione braccio porta testa - EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) - -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente - if dOffsetPar > 0 then - EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) - end - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) - return false, sErr - else - -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno - -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco - -- e uscita - ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, - dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar) - end - -- se abilitata, aggiungo lavorazione di finitura - if bFinish then - -- inserisco la lavorazione - local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) - if not nMch2Id then - local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling - EgtOutLog( sErr) - return false, sErr - else - -- riporto il sovramateriale originale e tolgo i passi inutili - EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) - EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMch2Id, false) - return false, sErr - end - end - end - end -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and #vAngs > 0 then @@ -681,7 +716,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX()) end end - return true + return true, sWarn end --------------------------------------------------------------------- From b921e1345d3a34cf3a3ef5f9948169dab6454d34 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 27 May 2022 11:50:41 +0200 Subject: [PATCH 06/13] DataBeam : - migliorie in LapJoint per U passanti da testa a coda e divise in parti - correzioni e migliorie in LongDoubleCut per casi con facce ortogonali tra loro e allineate con i piani XY e XZ. --- LuaLibs/ProcessLapJoint.lua | 83 +++++++++++++++++++++++++++----- LuaLibs/ProcessLongDoubleCut.lua | 19 +++++--- 2 files changed, 84 insertions(+), 18 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 399a1c7..e83491b 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -3229,7 +3229,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe end --------------------------------------------------------------------- -local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng) +local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng, bOpenOutRaw) -- calcolo l'elevazione dal punto medio local dElev @@ -3332,6 +3332,9 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo -- imposto elevazione e dichiaro non si generano sfridi per VMill local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' sNotes = sNotes .. 'VMRS=0;' + if bOpenOutRaw then + sNotes = sNotes .. 'OpenOutRaw=1;' + end EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca @@ -4341,7 +4344,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, end --------------------------------------------------------------------- -local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill) +local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap) local sWarn -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) @@ -4822,14 +4825,16 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- settaggio voluto da Alessandro/Fabio (per fare angoli con fresa piccola) sMchFind = 'Pocket' local dDiam = min( dH, dV) - local bTailOnSide = ( Proc.Box:getMin():getX() - b3Solid:getMin():getX() < 0.1 and not Proc.Tail) + local bTailOnSide = ( Proc.Box:getMin():getX() - b3Solid:getMin():getX() < 0.1 and not Proc.Tail and not bAllWithEndCap) if ( Proc.Fct == 1) or (( Proc.Fct == 2 or Proc.Fct == 3) and bIsL) or ((( Proc.Fct == 3 and bIsU) or ( Proc.Fct == 4 and not bTailOnSide)) and bSinglePart) then sMchFind = 'OpenPocket' if bIsU then dDiam = GetUShapeWidth( Proc, nFacInd) or dDiam elseif Proc.Fct == 4 then - -- per rifinire gli angoli premio utensile diam 25 o da BD - dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER or 30) + -- 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) + 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) @@ -5244,7 +5249,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local tvtNx = {} tvtNx[2] = vtN local bOk, sWarn2 - bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dFacElev + dCollSic) + bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dFacElev + dCollSic, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end if sWarn2 then if not sWarn then sWarn = '' end @@ -5339,8 +5344,34 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) + -- ottengo la distanza tra la fine del pezzo e il pezzo successivo + local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID + -- verifico se applicare gestione speciale delle giunzioni (U diretta come asse X) + local bAddEndCap = false + local dAddLen = 0 + local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) + if bIsU then + local ptC0, vtN0 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + local ptC1, vtN1 = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) + local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, 2, GDB_ID.ROOT) + if vtN0:getX() < 0.0175 and vtN1:getX() < 0.0175 and vtN2:getX() < 0.0175 then + local dWidth = 0 + if vtN0 * vtN1 < -0.9998 then + bAddEndCap = true + dWidth = ( ptC1 - ptC0) * vtN0 + elseif vtN0 * vtN2 < -0.9998 then + bAddEndCap = true + dWidth = ( ptC2 - ptC0) * vtN0 + elseif vtN1 * vtN2 < -0.9998 then + bAddEndCap = true + dWidth = ( ptC2 - ptC1) * vtN1 + end + dAddLen = min( dWidth, 100) / 2 + end + end -- la divido in parti lungo X local vAddId = {} + local bAllWithEndCap = bAddEndCap local nPart = max( ceil( Proc.Box:getDimX() / BD.LONGCUT_MAXLEN), 2) local dPartLen = Proc.Box:getDimX() / nPart local Xmin = Proc.Box:getMin():getX() @@ -5348,13 +5379,43 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) -- eseguo divisione local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL EgtSetName( AddId, 'AddPart_' .. tostring( Proc.Id) .. '_' .. tostring( i)) - if i > 1 then - local ptOn = Point3d( Xmin + ( i - 1) * dPartLen, 0, 0) - EgtCutSurfTmPlane( AddId, ptOn, -X_AX(), true, GDB_RT.GLOB) + if i > 1 or bAddEndCap then + -- definizione del piano + local dAdd = EgtIf( i > 1, dAddLen, 0) + local ptOn = Point3d( Xmin - dAdd + ( i - 1) * dPartLen, 0, 0) + local vtN = -X_AX() + -- se richiesto, creazione tappo + local CapId + if bAddEndCap then + local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOn, vtN, AddId, nAddGrpId, GDB_RT.GLOB) + if nPnt == 0 and nCrv == 1 and nSrf == 0 then + EgtCloseCurveCompo( nFirstId) + CapId = EgtSurfTmByFlatContour( nAddGrpId, nFirstId) + if not CapId then bAllWithEndCap = false end + end + if nFirstId then + for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do + EgtErase( nId) + end + end + end + -- taglio della superficie + EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB) + -- se esiste, aggiunta del tappo + if CapId then + AddId = EgtSurfTmBySewing( nAddGrpId, { AddId, CapId}) + -- se prima spezzatura, allungamento per non lasciare archi + if i == 1 then + local b3Box = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD) + local dCoeffX = 1 + min( dAddLen, dDistToNextPiece) / b3Box:getDimX() + EgtScale( AddId, Frame3d( b3Box:getMax()), dCoeffX, 1, 1, GDB_RT.GLOB) + end + end end if i < nPart then local ptOn = Point3d( Xmin + i * dPartLen, 0, 0) - EgtCutSurfTmPlane( AddId, ptOn, X_AX(), true, GDB_RT.GLOB) + local vtN = X_AX() + EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB) end -- eseguo inserimento in modo da ordinare da X+ a X- table.insert( vAddId, 1, AddId) @@ -5368,7 +5429,7 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg} -- lasciare il false nel sesto parametro (perchè internamente viene verificato se diverso da nil) local bOk, sMyWarn - bOk, sMyWarn, bPrevBhSideMill = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, dOvmHead, false, bPrevBhSideMill) + bOk, sMyWarn, bPrevBhSideMill = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, dOvmHead, bAllWithEndCap, bPrevBhSideMill, bAllWithEndCap) if not sWarn then sWarn = sMyWarn end if not bOk then return bOk, sWarn end end diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index f380f79..2acca11 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/03/20 +-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/05/27 -- 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. @@ -7,6 +7,7 @@ -- 2022/02/08 Sistemate lunghezze fresature quando due sole. -- 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. -- Tabella per definizione modulo local ProcessLong2Cut = {} @@ -294,9 +295,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- verifico posizione (+1=sopra, -1=sotto, 0=sui lati) local nSide = 0 - if vtN[1]:getZ() > -10 * GEO.EPS_SMALL and vtN[2]:getZ() > -10 * GEO.EPS_SMALL then + if vtN[1]:getZ() > 0.0175 and vtN[2]:getZ() > 0.0175 then nSide = 1 - elseif vtN[1]:getZ() < 10 * GEO.EPS_SMALL and vtN[2]:getZ() < 10 * GEO.EPS_SMALL then + elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then nSide = -1 end @@ -372,7 +373,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)} else - local bFront = ( vtN[1]:getY() < 0) + local bFront = ( vtN[1]:getY() < 0 or vtN[2]:getY() < 0) if bFront then vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1}) vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} @@ -898,10 +899,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end - -- se la fine (a sinistra) non è limitata e ho un pezzo successivo più distante da metà raggio. setto la fine come limitata - if dDistToNextPiece < dToolDiam/2 and nFaceLimit < 2 then + -- se ho un pezzo successivo più distante di metà raggio : setto la fine come limitata + if dDistToNextPiece < dToolDiam/2 then bForcedLim = true - nFaceLimit = nFaceLimit + 2 + nFaceLimit = nFaceLimit | 2 end -- se chiuso e corto, applico svuotatura con fresa opportuna if nFaceLimit == 3 and Proc.Box:getDimX() < 2 * dToolDiam then @@ -1022,6 +1023,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end end end + if nIni == 2 then + dStartDist, dEndDist = dEndDist, dStartDist + dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist + end -- ciclo sulle parti local nM = 0 for j = 1, nC do From f7beede72ed82100e425a68c4d7e5064dc8bf8f4 Mon Sep 17 00:00:00 2001 From: DarioS Date: Sun, 29 May 2022 16:31:41 +0200 Subject: [PATCH 07/13] =?UTF-8?q?DataBeam=20:=20-=20aggiunto=20modulo=20Fa?= =?UTF-8?q?ceByPocket=20per=20lavorazione=20per=20svuotatura=20di=20una=20?= =?UTF-8?q?faccia=20da=20sorgenti=20in=20tenone=20-=20aggiunta=20possibili?= =?UTF-8?q?t=C3=A0=20di=20svuotatura=20per=20piano=20sgrossatura=20profili?= =?UTF-8?q?=20su=20macchine=20PF=20e=20pezzi=20alti=20-=20aggiunto=20modul?= =?UTF-8?q?o=20GetBeamData.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GetBeamData.lua | 43 ++++++++++++++ LuaLibs/FaceByPocket.lua | 101 +++++++++++++++++++++++++++++++++ LuaLibs/FacesBySaw.lua | 2 +- LuaLibs/ProcessProfCamb.lua | 37 +++++++++--- LuaLibs/ProcessProfConcave.lua | 37 +++++++++--- LuaLibs/ProcessProfConvex.lua | 37 +++++++++--- LuaLibs/ProcessProfFront.lua | 37 +++++++++--- LuaLibs/ProcessProfHead.lua | 37 +++++++++--- LuaLibs/ProcessTenon.lua | 82 ++++---------------------- 9 files changed, 302 insertions(+), 111 deletions(-) create mode 100644 GetBeamData.lua create mode 100644 LuaLibs/FaceByPocket.lua diff --git a/GetBeamData.lua b/GetBeamData.lua new file mode 100644 index 0000000..6ffe321 --- /dev/null +++ b/GetBeamData.lua @@ -0,0 +1,43 @@ +-- GetWallData.lua by Egaltech s.r.l. 2021/11/22 +-- Recupero dati da file WallData.lua di macchina + +-- Intestazioni +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( false) + +-- Per test +--GWD = {} +--GWD.MACHINE = 'Essetre-90480019_MW' + +local sLog = 'GetBeamData : ' .. GWD.MACHINE +EgtOutLog( sLog) + +-- Imposto direttorio libreria specializzata per Travi +EgtAddToPackagePath( GWD.BASEDIR .. '\\LuaLibs\\?.lua') + +-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi +local sMachDir = EgtGetCurrMachineDir() +if not EgtExistsFile( sMachDir .. '\\Beam\\BeamData.lua') then + GWD.ERR = 12 + GWD.MSG = 'Error not configured for beam machine : ' .. GWD.MACHINE + WriteErrToLogFile( GWD.ERR, GWD.MSG) + PostErrView( GWD.ERR, GWD.MSG) + return +end + +-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie +EgtRemoveBaseMachineDirFromPackagePath() +EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua') + +-- Carico i dati globali +local BD = require( 'BeamData') + +-- Assegno valori di interesse +GWD.SIMUL_VIEW_DIR = BD.SIMUL_VIEW_DIR +GWD.OVM_MID = BD.OVM_MID + +-- Tutto ok +GWD.ERR = 0 + +EgtOutLog( ' +++ GetWallData completed') diff --git a/LuaLibs/FaceByPocket.lua b/LuaLibs/FaceByPocket.lua new file mode 100644 index 0000000..4d8bdcb --- /dev/null +++ b/LuaLibs/FaceByPocket.lua @@ -0,0 +1,101 @@ +-- FaceByPocket.lua by Egaltech s.r.l. 2022/05/82 +-- Gestione svuotatura di feature con una faccia + +-- Tabella per definizione modulo +local FaceByPocket = {} + +-- Include +require( 'EgtBase') +local BL = require( 'BeamLib') + +EgtOutLog( ' FaceByPocket started', 1) + +-- Dati +local BD = require( 'BeamData') +local ML = require( 'MachiningLib') + +--------------------------------------------------------------------- +local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN) + + -- inserisco la lavorazione di svuotatura + local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd + local nMchFId = EgtAddMachining( sName, sPocketing) + if not nMchFId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ nSurfId, nFacet}}) + -- imposto uso faccia + EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) + if dMaxElev > 0.1 then + -- imposto elevazione + local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 2) .. ';' + EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) + end + -- imposto posizione braccio porta testa + local nSCC = MCH_SCC.NONE + if not BD.C_SIMM and not BD.TURN then + nSCC = EgtIf( vtN:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) + end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr + end + + return true +end + +--------------------------------------------------------------------- +function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid) + local bOk = true + local sErr + -- recupero gruppo per geometria addizionale + local nAddGrpId = BL.GetAddGroup( nPartId) + if not nAddGrpId then + local sErr = 'Error : missing AddGroup' + EgtOutLog( sErr) + return false, sErr + end + -- recupero i dati dell'utensile + local dStep = 30 + local dMaxDepth = 100 + if EgtMdbSetCurrMachining( sPocketing) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth + end + end + -- dati della faccia + local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) + local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId) + -- determino numero e valore degli step di lavorazione + local nSurfStep = ceil( dElev / dMaxDepth) + local dSurfStep = dElev / nSurfStep + -- copio superfice al passo superfice e vi applico la lavorazione + for i = nSurfStep, 2, -1 do + local ptOn = ptC + ( dSurfStep * ( i - 1)) * vtN + local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptOn, vtN, b3Solid, GDB_RT.GLOB) + if nAddIdTmp then + EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id)) + EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId) + -- aggiungo lavorazione + bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN) + if not bOk then + return false, sErr + end + end + end + -- faccio ultima superfice + bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN) + if not bOk then + return false, sErr + end + return true +end + +return FaceByPocket diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 140c65b..823e866 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -622,4 +622,4 @@ function FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dRad, vtRef, dCutExt return dLiTang, dLiPerp, dLoTang, dLoPerp end -return FacesBySaw \ No newline at end of file +return FacesBySaw diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index cbccf1f..2f67a9b 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -1,4 +1,4 @@ --- ProcessProfCamb.lua by Egaltech s.r.l. 2022/05/24 +-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/05/28 -- Gestione calcolo profilo caudato per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. @@ -7,6 +7,7 @@ -- 2022/01/26 Migliorato controllo lavorazione con fresa su testa da sotto. -- 2022/02/02 Aggiunta funzione OnlyChamfer. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. +-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- Tabella per definizione modulo local ProcessProfCamb = {} @@ -15,6 +16,7 @@ local ProcessProfCamb = {} require( 'EgtBase') local BL = require( 'BeamLib') local Fbs = require( 'FacesBySaw') +local Fbp = require( 'FaceByPocket') local Cut = require( 'ProcessCut') EgtOutLog( ' ProcessProfCamb started', 1) @@ -277,19 +279,38 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bMakeAs = true end end - -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama + -- se smusso non è esclusivo, aggiungo sgrossatura if nChamfer < 2 then - -- aggiungo taglio di lama di sgrossatura e lo lavoro + -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtNF) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) - -- applico la lavorazione - local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, - Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} - local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) - if not bOk then return bOk, sErr end + -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura + if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then + -- recupero la lavorazione + local sPockType = 'OpenPocket' + local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) + if not sPocketing then + local sErr = 'Error : pocketing '..sPockType..' not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- eseguo le svuotature necessarie + local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid) + if not bOk then + return false, sErr + end + -- altrimenti applico taglio di lama + else + local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, + Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} + local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) + if not bOk then + return false, sErr + end + end end -- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama -- recupero la lavorazione di fresatura diff --git a/LuaLibs/ProcessProfConcave.lua b/LuaLibs/ProcessProfConcave.lua index 79ecaac..7c7d93d 100644 --- a/LuaLibs/ProcessProfConcave.lua +++ b/LuaLibs/ProcessProfConcave.lua @@ -1,9 +1,10 @@ --- ProcessProfConcave.lua by Egaltech s.r.l. 2022/05/24 +-- ProcessProfConcave.lua by Egaltech s.r.l. 2022/05/28 -- Gestione calcolo profilo concavo per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2022/02/02 Aggiunta funzione OnlyChamfer. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. +-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- Tabella per definizione modulo local ProcessProfConcave = {} @@ -11,6 +12,7 @@ local ProcessProfConcave = {} -- Include require( 'EgtBase') local BL = require( 'BeamLib') +local Fbp = require( 'FaceByPocket') local Cut = require( 'ProcessCut') EgtOutLog( ' ProcessProfConcave started', 1) @@ -258,19 +260,38 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if nChamfer < 0 then return false, sChamfer end - -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama + -- se smusso non è esclusivo, aggiungo sgrossatura if nChamfer < 2 then - -- aggiungo taglio di lama di sgrossatura e lo lavoro + -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtN) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) - -- applico la lavorazione - local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, - Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} - local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) - if not bOk then return bOk, sErr end + -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura + if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then + -- recupero la lavorazione + local sPockType = 'OpenPocket' + local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) + if not sPocketing then + local sErr = 'Error : pocketing '..sPockType..' not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- eseguo le svuotature necessarie + local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid) + if not bOk then + return false, sErr + end + -- altrimenti applico taglio di lama + else + local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, + Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} + local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) + if not bOk then + return false, sErr + end + end end end -- se devo inserire il chamfer diff --git a/LuaLibs/ProcessProfConvex.lua b/LuaLibs/ProcessProfConvex.lua index 6901f27..e3c6a2f 100644 --- a/LuaLibs/ProcessProfConvex.lua +++ b/LuaLibs/ProcessProfConvex.lua @@ -1,9 +1,10 @@ --- ProcessProfConvex.lua by Egaltech s.r.l. 2022/05/24 +-- ProcessProfConvex.lua by Egaltech s.r.l. 2022/05/28 -- Gestione calcolo profilo convesso per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2022/02/02 Aggiunta funzione OnlyChamfer. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. +-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- Tabella per definizione modulo local ProcessProfConvex = {} @@ -11,6 +12,7 @@ local ProcessProfConvex = {} -- Include require( 'EgtBase') local BL = require( 'BeamLib') +local Fbp = require( 'FaceByPocket') local Cut = require( 'ProcessCut') EgtOutLog( ' ProcessProfConvex started', 1) @@ -258,19 +260,38 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if nChamfer < 0 then return false, sChamfer end - -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama + -- se smusso non è esclusivo, aggiungo sgrossatura if nChamfer < 2 then - -- aggiungo taglio di lama di sgrossatura e lo lavoro + -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtN) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) - -- applico la lavorazione - local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, - Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} - local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) - if not bOk then return bOk, sErr end + -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura + if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then + -- recupero la lavorazione + local sPockType = 'OpenPocket' + local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) + if not sPocketing then + local sErr = 'Error : pocketing '..sPockType..' not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- eseguo le svuotature necessarie + local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid) + if not bOk then + return false, sErr + end + -- altrimenti applico taglio di lama + else + local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, + Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} + local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) + if not bOk then + return false, sErr + end + end end end -- se devo inserire il chamfer diff --git a/LuaLibs/ProcessProfFront.lua b/LuaLibs/ProcessProfFront.lua index 1b2fdbf..e56f930 100644 --- a/LuaLibs/ProcessProfFront.lua +++ b/LuaLibs/ProcessProfFront.lua @@ -1,9 +1,10 @@ --- ProcessProfFront.lua by Egaltech s.r.l. 2022/05/24 +-- ProcessProfFront.lua by Egaltech s.r.l. 2022/05/28 -- Gestione calcolo profilo frontale per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2022/02/02 Aggiunta funzione OnlyChamfer. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. +-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- Tabella per definizione modulo local ProcessProfFront = {} @@ -11,6 +12,7 @@ local ProcessProfFront = {} -- Include require( 'EgtBase') local BL = require( 'BeamLib') +local Fbp = require( 'FaceByPocket') local Cut = require( 'ProcessCut') EgtOutLog( ' ProcessProfFront started', 1) @@ -229,19 +231,38 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if nChamfer < 0 then return false, sChamfer end - -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama + -- se smusso non è esclusivo, aggiungo sgrossatura if nChamfer < 2 then - -- aggiungo taglio di lama di sgrossatura e lo lavoro + -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtN) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) - -- applico la lavorazione - local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, - Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} - local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) - if not bOk then return bOk, sErr end + -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura + if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then + -- recupero la lavorazione + local sPockType = 'OpenPocket' + local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) + if not sPocketing then + local sErr = 'Error : pocketing '..sPockType..' not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- eseguo le svuotature necessarie + local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid) + if not bOk then + return false, sErr + end + -- altrimenti applico taglio di lama + else + local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, + Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} + local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) + if not bOk then + return false, sErr + end + end end end -- se devo inserire il chamfer diff --git a/LuaLibs/ProcessProfHead.lua b/LuaLibs/ProcessProfHead.lua index 3067d8c..9464fe6 100644 --- a/LuaLibs/ProcessProfHead.lua +++ b/LuaLibs/ProcessProfHead.lua @@ -1,10 +1,11 @@ --- ProcessProfHead.lua by Egaltech s.r.l. 2022/05/24 +-- ProcessProfHead.lua by Egaltech s.r.l. 2022/05/28 -- Gestione calcolo profilo di testa per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2021/10/12 Estesa gestione di testa da sotto, se presente. -- 2022/02/02 Aggiunta funzione OnlyChamfer. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. +-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- Tabella per definizione modulo local ProcessProfHead = {} @@ -12,6 +13,7 @@ local ProcessProfHead = {} -- Include require( 'EgtBase') local BL = require( 'BeamLib') +local Fbp = require( 'FaceByPocket') local Cut = require( 'ProcessCut') EgtOutLog( ' ProcessProfHead started', 1) @@ -260,19 +262,38 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if nChamfer < 0 then return false, sChamfer end - -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama + -- se smusso non è esclusivo, aggiungo sgrossatura if nChamfer < 2 then - -- aggiungo taglio di lama di sgrossatura e lo lavoro + -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtN) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) - -- applico la lavorazione - local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, - Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} - local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) - if not bOk then return bOk, sErr end + -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura + if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then + -- recupero la lavorazione + local sPockType = 'OpenPocket' + local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) + if not sPocketing then + local sErr = 'Error : pocketing '..sPockType..' not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- eseguo le svuotature necessarie + local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid) + if not bOk then + return false, sErr + end + -- altrimenti applico taglio di lama + else + local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, + Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} + local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) + if not bOk then + return false, sErr + end + end end end -- se devo inserire il chamfer diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index f752202..5fc7803 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -1,8 +1,9 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2022/05/18 +-- ProcessTenon.lua by Egaltech s.r.l. 2022/05/28 -- Gestione calcolo tenone per Travi -- 2021/10/04 Corretto calcolo HCING per pezzi piccoli. -- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto. -- 2022/05/18 Migliorata gestione attacco. +-- 2022/05/28 Spostato calcolo svuotatura in modulo di libreria. -- Tabella per definizione modulo local ProcessTenon = {} @@ -10,6 +11,7 @@ local ProcessTenon = {} -- Include require( 'EgtBase') local BL = require( 'BeamLib') +local Fbp = require( 'FaceByPocket') local Cut = require( 'ProcessCut') EgtOutLog( ' ProcessTenon started', 1) @@ -79,41 +81,6 @@ function ProcessTenon.Classify( Proc, b3Raw) return true, bDown end ---------------------------------------------------------------------- -local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr) - - -- inserisco la lavorazione di svuotatura - local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nStep - local nMchFId = EgtAddMachining( sName, sPocketing) - if not nMchFId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing - return false, sErr - end - -- aggiungo geometria - EgtSetMachiningGeometry( {{ nIdSurf, -1}}) - -- imposto uso faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) - if dSurfStep > 0 then - -- imposto elevazione - local sNotes = 'MaxElev=' .. EgtNumToString( dSurfStep, 2) .. ';' - EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) - end - -- imposto posizione braccio porta testa - local nSCC = MCH_SCC.NONE - if not BD.C_SIMM and not BD.TURN then - nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) - end - EgtSetMachiningParam( MCH_MP.SCC, nSCC) - -- eseguo - if not ML.ApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchFId, false) - return false, sErr - end - - return true -end - --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) @@ -180,43 +147,16 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) -- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then + -- recupero la lavorazione local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket') local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown) - local dMaxDepth = 100 - local dStep = 30 - local nSurfStep - -- acquisisco i dati necessari dall'utensile - if EgtMdbSetCurrMachining( sPocketing) then - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep - if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then - dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth - end - end - -- acquisisco elevazione - local dElev = BL.GetFaceElevation( AddId, 0, nPartId) - nSurfStep = ceil( dElev / dMaxDepth) - dSurfStep = dElev / nSurfStep - local bOk = true - local sErr - -- copio superfice al passo superfice e ci applico la lavorazione - for i = nSurfStep, 2, -1 do - local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptC+((dSurfStep*(i-1))*vtN), vtN, b3Solid, GDB_RT.GLOB) - if nAddIdTmp then - EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id)) - EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId) - -- aggiungo lavorazione - bOk, sErr = ApplyPocket( Proc, sPocketing, i, (dSurfStep + 0), nAddIdTmp, vtExtr) - if not bOk then - break - end - end - end - if not bOk then + if not sPocketing then + local sErr = 'Error : pocketing '..sPockType..' not found in library' + EgtOutLog( sErr) return false, sErr end - -- faccio ultima superfice - bOk, sErr = ApplyPocket( Proc, sPocketing, 1, EgtIf( nSurfStep > 1, ( dSurfStep + 0), 0), AddId, vtExtr) + -- eseguo le svuotature necessarie + local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid) if not bOk then return false, sErr end @@ -227,7 +167,9 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom) - if not bOk then return bOk, sErr end + if not bOk then + return false, sErr + end end end end From 7b1075bc12f25989f47bc9972c302cabd02e2480 Mon Sep 17 00:00:00 2001 From: DarioS Date: Sun, 29 May 2022 16:37:14 +0200 Subject: [PATCH 08/13] DataBeam : - aggiornato Compile.bat per nuovi sorgenti. --- Compile.bat | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Compile.bat b/Compile.bat index 634b322..23e3e76 100644 --- a/Compile.bat +++ b/Compile.bat @@ -7,6 +7,7 @@ REM Compilazione 32 bit \EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua @@ -45,6 +46,7 @@ REM Compilazione 32 bit \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua \EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua \EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua +\EgtProg\Dll32\luac53 -o 32\GetBeamData.lua GetBeamData.lua \EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua \EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua \EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.lua @@ -55,6 +57,7 @@ REM Compilazione 64 bit \EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua \EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua \EgtProg\Dll64\luac53 -o 64\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua \EgtProg\Dll64\luac53 -o 64\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua \EgtProg\Dll64\luac53 -o 64\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua \EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua @@ -93,6 +96,7 @@ REM Compilazione 64 bit \EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua \EgtProg\Dll64\luac53 -o 64\BatchProcess.lua BatchProcess.lua \EgtProg\Dll64\luac53 -o 64\BatchProcessNew.lua BatchProcessNew.lua +\EgtProg\Dll64\luac53 -o 64\GetBeamData.lua GetBeamData.lua \EgtProg\Dll64\luac53 -o 64\NestProcess.lua NestProcess.lua \EgtProg\Dll64\luac53 -o 64\Process.lua Process.lua \EgtProg\Dll64\luac53 -o 64\Rotate.lua Rotate.lua From 721ffb40743e790d58ba529f907ceebc8b8ca96c Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 6 Jun 2022 08:07:02 +0200 Subject: [PATCH 09/13] DataBeam : - in mortase a coda di rondine fatte modifiche per evitare di entrare direttamente nel legno quando sono parziali. --- LuaLibs/ProcessDtMortise.lua | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index d9eaf3d..fde8a9b 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -1,10 +1,11 @@ --- ProcessDtMortise.lua by Egaltech s.r.l. 2022/05/01 +-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/06/01 -- Gestione calcolo mortase a coda di rondine per Travi -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto. -- 2021/06/28 Aggiunta gestione attacco e uscita con pocket. -- 2021/07/20 Aggiunta gestione rinvio angolare su FAST. -- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda). +-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali. -- Tabella per definizione modulo local ProcessDtMortise = {} @@ -119,6 +120,21 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol return NewAuxId end +--------------------------------------------------------------------- +-- verifica che il box includa il punto in XY +function EnclosesPoint( b3Box, ptP) + if b3Box[2][1] < ptP[1] - GEO.EPS_SMALL or b3Box[1][1] > ptP[1] + GEO.EPS_SMALL then + return false + end + if b3Box[2][2] < ptP[2] - GEO.EPS_SMALL or b3Box[1][2] > ptP[2] + GEO.EPS_SMALL then + return false + end + if b3Box[2][3] < ptP[3] - GEO.EPS_SMALL or b3Box[1][3] > ptP[3] + GEO.EPS_SMALL then + return false + end + return true +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) @@ -424,6 +440,23 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2) EgtSetMachiningParam( MCH_MP.LIPERP, 5) EgtSetMachiningParam( MCH_MP.LIELEV, 0) + -- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno + else + local ptS = EgtSP( AuxId, GDB_ID.ROOT) + local ptE = EgtEP( AuxId, GDB_ID.ROOT) + local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX()) + local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX()) + local dIni, dFin = EgtCurveDomain( AuxId) + local nCrvCnt = dFin - dIni - 1 + if abs( dDistS - dDistE) > 20 then + local b3Test = BBox3d( b3Solid) + b3Test:expand( -5) + if dDistS < dDistE and EnclosesPoint( b3Test, ptS) and EgtCurveCompoAngCenter( AuxId, 0) == 0 then + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dDistE - dDistS) + elseif dDistE < dDistS and EnclosesPoint( b3Test, ptE) and EgtCurveCompoAngCenter( AuxId, nCrvCnt) == 0 then + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dDistS - dDistE) + end + end end -- dichiaro non si generano sfridi per VMill local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' From aa4f0781cb75bf73f8fa5738baffd214a751f614 Mon Sep 17 00:00:00 2001 From: Marco Salvi Date: Tue, 7 Jun 2022 13:51:39 +0000 Subject: [PATCH 10/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 2506cefcbfdd459f9a2d7e9a4cda168277ded1a5 Mon Sep 17 00:00:00 2001 From: Marco Salvi Date: Tue, 7 Jun 2022 14:02:15 +0000 Subject: [PATCH 11/13] Update .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 92b57e5..2ade710 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -71,7 +71,7 @@ variables: .CodeReplicaR: &CodeReplicaR - | 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 . R:\EgtData\$env:APP_NAME /MIR /XF .git* /XD .git SLEEP 2 net use R: /delete From 953c01fe20544ab9b0e51a37bc46c673c2b967c6 Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 8 Jun 2022 11:58:59 +0200 Subject: [PATCH 12/13] =?UTF-8?q?DataBeam=20:=20-=20modifiche=20alle=20lav?= =?UTF-8?q?orazioni=20per=20gestione=20macchina=20TURN=20-=20in=20tagli=20?= =?UTF-8?q?con=20lama=20aggiunta=20possibilit=C3=A0=20di=20ritorno=20all'i?= =?UTF-8?q?nizio=20con=20macchina=20TURN.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/BeamLib.lua | 6 +++--- LuaLibs/FacesBySaw.lua | 26 +++++++++++++++----------- LuaLibs/ProcessCut.lua | 7 ++++--- LuaLibs/ProcessDrill.lua | 2 +- LuaLibs/ProcessDtMortise.lua | 30 ++++++++++++++++++++++++++---- LuaLibs/ProcessDtTenon.lua | 17 +++++++++++++---- LuaLibs/ProcessHeadCut.lua | 4 ++-- LuaLibs/ProcessLapJoint.lua | 6 +++--- LuaLibs/ProcessLongDoubleCut.lua | 8 +++++--- LuaLibs/ProcessMark.lua | 4 ++-- LuaLibs/ProcessSplit.lua | 4 ++-- 11 files changed, 76 insertions(+), 38 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 0487a70..6e4572a 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -689,7 +689,9 @@ end ------------------------------------------------------------------------------------------------------------- function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho) - if not BD.C_SIMM then + if BD.C_SIMM or BD.TURN then + return -0.484 + else if vtOrtho and vtOrtho:getZ() > 0.5 then if vtN and ( abs( vtN:getY()) < 0.1 or abs( vtN:getY()) > 0.49) then return -0.708 @@ -709,8 +711,6 @@ function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho) end end end - else - return -0.484 end end diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 823e866..700af9c 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -1,4 +1,4 @@ --- FacesBySaw.lua by Egaltech s.r.l. 2022/04/12 +-- FacesBySaw.lua by Egaltech s.r.l. 2022/06/07 -- 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. @@ -129,15 +129,21 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local dLenLi2 = abs( dLi2Tang) local dLenLo2 = abs( dLo2Tang) -- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale) + local bTurnTang local Ktp = 1.1 if BD.KIOTP then Ktp = BD.KIOTP end if ( not bDownUp or abs( vtTg:getY()) > 0.5) and ( not bDownHead or abs( vtTg:getZ()) < 0.51) and abs( vtTg:getX()) < 0.9848 and - ( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5)) or + ( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or ( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450) or ( Ktp * dLenLi2 < dLenLi and Ktp * dLenLo2 < dLenLo) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp + if BD.TURN then + bTurnTang = true + dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dLen) + dLoPerp = BD.COLL_SIC + end end -- posizione braccio EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3) @@ -149,14 +155,11 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) end else - if abs( vtN:getZ()) > GEO.EPS_SMALL then - if dLiPerp > 10 * GEO.EPS_SMALL or dLoPerp > 10 * GEO.EPS_SMALL then - nSCC = EgtIf( ( vtOut:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) - else - nSCC = MCH_SCC.ADIR_YP - end - else - nSCC = MCH_SCC.ADIR_ZP + local vtTest = EgtIf( bTurnTang, EgtIf( bInvert, vtTg, -vtTg), vtOut) + if abs( vtTest:getY()) > abs( vtTest:getZ()) then + nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) + else + nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM) end end -- inserisco la lavorazione di taglio @@ -184,6 +187,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw -- imposto attacco/uscita EgtSetMachiningParam( MCH_MP.LITANG, dLiTang) EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp) + if bTurnTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang) EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp) -- imposto allungamenti iniziale e finale @@ -311,7 +315,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, end end -- con testa da sopra - if not bDownHead then + if not bDownHead or BD.TURN then -- eseguo for i = 1, #vCuts do -- assegno il modo di tagliare diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index ff41a07..200fa0b 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -34,8 +34,8 @@ end --------------------------------------------------------------------- -- Classificazione della feature function ProcessCut.Classify( Proc, b3Raw) - -- se PF con testa da sotto, ammessa qualunque orientazione - if BD.C_SIMM and BD.DOWN_HEAD then + -- se PF con testa da sotto o TURN, ammessa qualunque orientazione + if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then return true end -- recupero i dati del taglio @@ -717,6 +717,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, -- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto) local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and ( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART)) + local bDownTurn = ( BD.TURN and vtN:getZ() < -0.017) local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead)) -- recupero la lavorazione local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide') @@ -728,7 +729,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, return false, sErr end -- se taglio con testa da sopra - if not bDownHead then + if not bDownHead and not bDownTurn then return MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut) -- altrimenti taglio con testa da sotto else diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index b0ddbca..f65917d 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -120,7 +120,7 @@ function ProcessDrill.Split( Proc, b3Raw) local bHoriz = ( abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and ( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6)) local bSlant = ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX) - return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD) and not bSlant) + return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and not bSlant) end --------------------------------------------------------------------- diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index fde8a9b..aa1d8ab 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -1,4 +1,4 @@ --- ProcessDtMortise.lua by Egaltech s.r.l. 2022/06/01 +-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/06/07 -- Gestione calcolo mortase a coda di rondine per Travi -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto. @@ -60,6 +60,10 @@ end --------------------------------------------------------------------- -- Classificazione della feature function ProcessDtMortise.Classify( Proc) + -- se PF con testa da sotto o TURN, ammessa qualunque orientazione + if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then + return true + end -- recupero i dati della curva di contorno della faccia di fondo local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') if not AuxId then return false end @@ -158,7 +162,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local ptBC = EgtGP( AuxId, GDB_RT.GLOB) -- verifico che la mortasa non sia orientata verso il basso (-5 deg) o che ci sia una testa da sotto o un rinvio angolare local bFaceDown = ( vtExtr:getZ() < -0.1) - if bFaceDown and not BD.DOWN_HEAD and not BD.ANG_TRASM then + if bFaceDown and not BD.DOWN_HEAD and not BD.TURN and not BD.ANG_TRASM then local sErr = 'Machining from bottom impossible : Error on DtMortise ' .. tostring( Proc.Id) EgtOutLog( sErr) return false, sErr @@ -167,6 +171,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local rfDtMrt, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB) local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt) local dAltMort = b3DtMrt:getDimZ() + -- ne determino l'asse (valido se non pocket) + local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB) + vtAx:normalize() -- verifico se di tipo pocket local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1) if bPocket then bMakeAntiSplitPath = false end @@ -312,6 +319,15 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) return false, sErr end end + -- eventuale calcolo SCC + local nSCC + if BD.TURN and not bPocket then + if abs( vtAx:getY()) > abs( vtAx:getZ()) then + nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) + else + nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM) + end + end -- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then -- recupero gruppo per geometria addizionale @@ -384,6 +400,10 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- sistemo il lato e la direzione di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true)) + -- se necessario, imposto SCC + if nSCC then + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + end -- dichiaro non si generano sfridi per VMill local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) @@ -406,8 +426,6 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse) local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB) - local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB) - vtAx:normalize() local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx local dDist = min( vtOrtDiff:len(), dWidthMrt) -- calcolo le passate @@ -458,6 +476,10 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end end + -- se necessario, imposto SCC + if nSCC then + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + end -- dichiaro non si generano sfridi per VMill local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index 9bfe86c..da8aedf 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -1,4 +1,4 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2022/04/14 +-- ProcessTenon.lua by Egaltech s.r.l. 2022/06/07 -- Gestione calcolo tenone a coda di rondine per Travi -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF. @@ -20,8 +20,8 @@ local ML = require( 'MachiningLib') --------------------------------------------------------------------- local function VerifyOrientation( Proc, vtN, b3Raw) - -- se PF con testa da sotto, ammessa qualunque orientazione - if BD.C_SIMM and BD.DOWN_HEAD then + -- se PF con testa da sotto o TURN, ammessa qualunque orientazione + if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then return true end -- se trave molto bassa @@ -160,6 +160,9 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) -- porto inizio curva a Zmax BL.PutStartOnTop( AuxId) + -- ne determino l'asse + local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB) + vtAx:normalize() -- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or ( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and @@ -302,7 +305,13 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false)) -- imposto posizione braccio porta testa local nSCC = MCH_SCC.NONE - if not BD.C_SIMM then + if BD.TURN then + if abs( vtAx:getY()) > abs( vtAx:getZ()) then + nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) + else + nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM) + end + elseif not BD.C_SIMM then nSCC = MCH_SCC.ADIR_YM if abs( vtExtr:getY()) > 0.088 then nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 090675f..81be523 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -1,4 +1,4 @@ --- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25 +-- ProcessSplit.lua by Egaltech s.r.l. 2022/06/07 -- Gestione calcolo tagli di testa per Travi -- Tabella per definizione modulo @@ -172,7 +172,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- caratteristiche taglio local bHorizCut = (( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM) - local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) + local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index e83491b..35235fb 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -666,9 +666,9 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) if dEndDist > BD.MAX_DIST_HTFEA then return false end - -- se lunga come trave, oppure non è trave corta e la sua lunghezza supera il massimo o il 60% della lunghezza della trave + -- se lunga come trave, oppure non è trave corta e la sua lunghezza supera il massimo o il 70% della lunghezza della trave if Proc.Box:getDimX() > b3Solid:getDimX() - 1 or - ( b3Solid:getDimX() > BD.LEN_SHORT_PART and Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.6 * b3Solid:getDimX())) then + ( b3Solid:getDimX() > BD.LEN_SHORT_PART and Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.7 * b3Solid:getDimX())) then return false end -- se una o due facce e interessa veramente la coda, allora di coda @@ -5643,7 +5643,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- se smusso non esclusivo if nChamfer < 2 then - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead or BD.TURN) end return true end diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 2acca11..da5aebc 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1046,10 +1046,12 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster if not BD.TURN then nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) else - if vtN[vOrd[i]]:getY() < -0.1 then - nSCC = MCH_SCC.ADIR_YM + if nSide == 1 then + nSCC = EgtIf( vtN[vOrd[i]]:getY() < -0.5, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP) + elseif nSide == -1 then + nSCC = EgtIf( vtN[vOrd[i]]:getY() < 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP) else - nSCC = MCH_SCC.ADIR_YP + nSCC = MCH_SCC.ADIR_ZP end end end diff --git a/LuaLibs/ProcessMark.lua b/LuaLibs/ProcessMark.lua index 3af4b44..a88acfe 100644 --- a/LuaLibs/ProcessMark.lua +++ b/LuaLibs/ProcessMark.lua @@ -1,4 +1,4 @@ --- ProcessMark.lua by Egaltech s.r.l. 2021/05/03 +-- ProcessMark.lua by Egaltech s.r.l. 2022/06/07 -- Gestione calcolo marcatura per Travi -- 2020/05/28 Tipo di lavorazione passato da Mark a Text. -- 2021/05/03 Aggiunta gestione testa da sotto. @@ -60,7 +60,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) return false, sErr end -- verifico che la marcatura non sia orientata verso il basso (-5 deg) - if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD then + if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible' EgtOutLog( sErr) return false, sErr diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index ab690e9..2416ee7 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -1,4 +1,4 @@ --- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25 +-- ProcessSplit.lua by Egaltech s.r.l. 2022/06/07 -- Gestione calcolo tagli di separazione per Travi -- Tabella per definizione modulo @@ -172,7 +172,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId) -- caratteristiche taglio local bHorizCut = (( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM) - local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) + local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) From bde704ec3a1070859c319252796b3db9b19ac81c Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 10 Jun 2022 17:12:48 +0200 Subject: [PATCH 13/13] DataBeam : - correzione a NestProcess. --- NestProcess.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NestProcess.lua b/NestProcess.lua index 3c09f69..e113aad 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -131,7 +131,7 @@ local function TotPartLen(Parts) end -- Imposto direttorio libreria specializzata per Travi -EgtAddToPackagePath( NEST.BASEDIR .. 'LuaLibs\\?.lua') +EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua') -- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi EgtSetCurrMachine( NEST.MACHINE) @@ -311,6 +311,7 @@ _G.BEAM = {} BEAM.FILE = NEST.FILE BEAM.MACHINE = NEST.MACHINE BEAM.FLAG = 6 -- CREATE_PANEL +BEAM.BASEDIR = NEST.BASEDIR nMachGroup = EgtGetFirstMachGroup() while nMachGroup do local nNextMachGroup = EgtGetNextMachGroup( nMachGroup)