From 162d3870f2c0bfd7b531d388de02c547f18ef3a9 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 22 Sep 2020 17:31:47 +0000 Subject: [PATCH] =?UTF-8?q?DataBeam=20:=20-=20aggiunta=20gestione=20featur?= =?UTF-8?q?e=20senza=20geometria=20-=20migliorato=20calcolo=20attacchi/usc?= =?UTF-8?q?ite=20lama=20con=20angoli=2045deg=20-=20in=20foratura=20si=20ti?= =?UTF-8?q?ene=20conto=20anche=20della=20profondit=C3=A0=20del=20foro=20pe?= =?UTF-8?q?r=20scegliere=20la=20punta=20pi=C3=B9=20adatta=20-=20in=20tagli?= =?UTF-8?q?=20corretto=20problema=20con=20tagli=20orizzontali=20(da=20sott?= =?UTF-8?q?o=20o=20sopra)=20con=20taglio=20pi=C3=B9=20alto=20dell'utile=20?= =?UTF-8?q?lama=20-=20in=20LapJoint=20e=20simili=20migliorati=20antischegg?= =?UTF-8?q?ia=20con=20lama=20-=20in=20Tenoni=20migliorata=20lavorazione=20?= =?UTF-8?q?faccia=20di=20testa=20con=20fresa.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/BeamExec.lua | 20 +++++- LuaLibs/BeamLib.lua | 12 +++- LuaLibs/MachiningLib.lua | 18 ++++-- LuaLibs/ProcessCut.lua | 6 +- LuaLibs/ProcessDrill.lua | 106 +++++++++++++++++++++++-------- LuaLibs/ProcessDtTenon.lua | 4 +- LuaLibs/ProcessLapJoint.lua | 72 ++++++++++----------- LuaLibs/ProcessLongDoubleCut.lua | 6 +- LuaLibs/ProcessTenon.lua | 85 +++++++++++++++++++------ 9 files changed, 234 insertions(+), 95 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 727636b..3fa0c70 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -378,6 +378,10 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH) end end else + Proc.Head = false + Proc.Tail = false + Proc.Flg = 0 + table.insert( vProc, Proc) EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)') end end @@ -396,6 +400,14 @@ local function OrderFeatures( vProc, b3Raw) -- funzione di confronto -- secondo centro box in X (taglio di intestazione prima di altri tagli di testa e taglio di separazione però prima di altri tagli di coda) local function CompareFeatures( B1, B2) + -- se primo disabilitato va sempre alla fine + if B1.Flg == 0 then + return false + end + -- se secondo disabilitato va sempre alla fine + if B2.Flg == 0 then + return true + end -- se primo è intestazione va sempre prima if Hcut.Identify( B1) then return true @@ -538,8 +550,11 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) local bDown = false local bSide = false local bDownSideOnHeadOk = false + -- se senza geometria (già disabilitato + if Proc.Flg == 0 then + bOk = false -- se intestatura - if Hcut.Identify( Proc) then + elseif Hcut.Identify( Proc) then nHeading = i -- se separazione elseif Split.Identify( Proc) then @@ -662,6 +677,9 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) if bDown then bSomeDown = true end if bSide then bSomeSide = true end end + elseif Proc.Flg == 0 then + bAllOk = false + table.insert( Stats, {Err = 1, Msg='Error : out of the part', CutId=Proc.CutId, TaskId=Proc.TaskId}) else Proc.Flg = 0 bAllOk = false diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 348a82d..860c176 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,4 +1,4 @@ --- BeamLib.lua by Egaltech s.r.l. 2020/09/07 +-- BeamLib.lua by Egaltech s.r.l. 2020/09/17 -- 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. @@ -558,7 +558,15 @@ function BeamLib.CalcLeadInOutGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vtRef, dC local dCos1 = vtV1 * vtRef local dCos2 = vtV2 * vtRef local vtLi, vtLo - if dCos1 > dCos2 then + if abs( dCos1 - dCos2) < 0.001 then + if abs( vtV1:getZ()) < abs( vtV2:getZ()) then + vtLi = vtV1 + vtLo = vtV1 + else + vtLi = vtV2 + vtLo = vtV2 + end + elseif dCos1 > dCos2 then vtLi = vtV1 vtLo = vtV1 else diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index fa5fd7f..49ddbdb 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -1,4 +1,4 @@ --- MachiningLib.lua by Egaltech s.r.l. 2020/05/16 +-- MachiningLib.lua by Egaltech s.r.l. 2020/09/15 -- Libreria ricerca lavorazioni per Travi -- Tabella per definizione modulo @@ -79,15 +79,20 @@ function MachiningLib.FindSawing( sType) end --------------------------------------------------------------------- -function MachiningLib.FindDrilling( dDiam) +function MachiningLib.FindDrilling( dDiam, dDepth) -- ricerca sulle forature, dal diametro maggiore al minore for i = #Drillings, 1, -1 do local Drilling = Drillings[i] if Drilling.On and Drilling.Type == 'Drill' and SetCurrMachiningAndTool( Drilling.Name) then local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) + local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dDiamTh = EgtTdbGetCurrToolThDiam() if dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL then - return Drilling.Name, Drilling.Type, dTMaxMat + if not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL then + return Drilling.Name, Drilling.Type, dTMaxMat, dMaxToolLength, dToolDiam, dDiamTh + end end end end @@ -97,8 +102,13 @@ function MachiningLib.FindDrilling( dDiam) if Drilling.On and Drilling.Type == 'Pocket' and SetCurrMachiningAndTool( Drilling.Name) then local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() + local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dDiamTh = EgtTdbGetCurrToolThDiam() if dTDiam < dDiam - 10 * GEO.EPS_SMALL then - return Drilling.Name, Drilling.Type, dTMaxDepth + if not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL then + return Drilling.Name, Drilling.Type, dTMaxDepth, dMaxToolLength, dToolDiam, dDiamTh + end end end end diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 7f431d7..5cfdb29 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2020/07/29 +-- ProcessCut.lua by Egaltech s.r.l. 2020/09/22 -- Gestione calcolo singoli tagli di lama per Travi -- Tabella per definizione modulo @@ -330,9 +330,9 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom) vtOrthoO = -Z_AX() elseif bHorizCut then vtOrthoO = Z_AX() - elseif Proc.Head and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then + elseif Proc.Head and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then vtOrthoO = X_AX() - elseif Proc.Tail and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then + elseif Proc.Tail and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then vtOrthoO = -X_AX() elseif vtN:getY() > -0.02 then vtOrthoO = Y_AX() diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index a5a6925..1d07524 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2020/07/27 +-- ProcessDrill.lua by Egaltech s.r.l. 2020/09/16 -- Gestione calcolo forature per Travi -- Tabella per definizione modulo @@ -184,38 +184,98 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) if Proc.Fcs == 0 then bToInvert = true end if bToInvert then vtExtr = - vtExtr end if Proc.Flg == -2 then bToInvert = true end - -- recupero la lavorazione - local sDrilling, nType = ML.FindDrilling( dDiam) - if not sDrilling then - local sErr = 'Error : drilling not found in library' - EgtOutLog( sErr) - return false, sErr + -- profondità geometria foro + local dDepth = dLen + if Proc.Flg == 2 or Proc.Flg == -2 then + dDepth = dLen / 2 + BD.DRILL_OVERLAP end - -- recupero i dati dell'utensile - local dMaxDepth = 20 - local dDiamTh = 35 - if EgtMdbSetCurrMachining( sDrilling) then - local bIsDrilling = ( EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) == MCH_MY.DRILLING) - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then - if bIsDrilling then - dMaxDepth = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxDepth - else - dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth + local dCheckDepth = dDepth + -- se troppo inclinata sulla X e Y va troppo dietro e Z va in negativo e se il foro è splittato, + -- annullo il valore della profondità nella ricerca utensile + if abs(vtExtr:getX()) > 0.707 or vtExtr:getY() > 0.5 or vtExtr:getZ() < BD.DRILL_VZ_MIN or abs(Proc.Flg) == 2 then + dCheckDepth = nil + end + -- recupero la lavorazione + local sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh = ML.FindDrilling( dDiam, dCheckDepth) + if not sDrilling then + -- se non ho passato altezza di taglio utensile allora non è stato trovato utensile + if not dCheckDepth then + local sErr = 'Error : drilling not found in library' + EgtOutLog( sErr) + return false, sErr + -- altrimenti rifaccio la ricerca foratura senza passare altezza uensile + else + dCheckDepth = nil + sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh = ML.FindDrilling( dDiam) + if not sDrilling then + local sErr = 'Error : drilling not found in library' + EgtOutLog( sErr) + return false, sErr end - dDiamTh = EgtTdbGetCurrToolThDiam() end end - -- se foro intermedio e inclinato, limito il massimo affondamento + -- se la lunghezza utensile massima supera il valore limite del BeamData e la componente Z supera i 10 gradi + -- allore ricerco un utensile senza lunghezza massima + if dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then + -- se non ho passato altezza di taglio utensile allora la lunghezza utensile non è idonea per il taglio + if not dCheckDepth then + local sErr = 'Error : tool too long to machine with big angle from vertical' + EgtOutLog( sErr) + return false, sErr + -- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto) + else + sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh = ML.FindDrilling( dDiam) + if not sDrilling then + local sErr = 'Error : drilling not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- ultimo controllo sulla lunghezza utensile + if dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then + local sErr = 'Error : tool too long to machine with big angle from vertical' + EgtOutLog( sErr) + return false, sErr + end + end + end + + local dSubL1 = 0 + local dSubL2 = 0 + local dSubL3 = 0 + -- se foro su testa o coda e inclinato, limito il massimo affondamento if not ( ( Proc.Fcs == 5 or Proc.Fcs == 6) or ( bToInvert and ( Proc.Fce == 5 or Proc.Fce == 6))) then local CosB = abs( vtExtr:getX()) if CosB < BD.DRILL_VX_MAX then local TgA = CosB / sqrt( 1 - CosB * CosB) - dMaxDepth = dMaxDepth - dDiamTh / 2 * TgA + dSubL1 = ( dDiamTh - dToolDiam) / 2 * TgA else dMaxDepth = 0 end end + -- se foro davanti o dietro e inclinato, limito il massimo affondamento + if dMaxDepth > 0 and abs( vtExtr:getY()) > abs( vtExtr:getZ()) then + local CosB = abs( vtExtr:getZ()) + if CosB < BD.DRILL_VX_MAX then + local TgA = CosB / sqrt( 1 - CosB * CosB) + dSubL2 = ( dDiamTh - dToolDiam) / 2 * TgA + else + dMaxDepth = 0 + end + end + -- se foro sopra o sotto e inclinato, limito il massimo affondamento + if dMaxDepth > 0 and abs( vtExtr:getZ()) > abs( vtExtr:getY()) then + local CosB = abs( vtExtr:getY()) + if CosB < BD.DRILL_VX_MAX then + local TgA = CosB / sqrt( 1 - CosB * CosB) + dSubL3 = ( dDiamTh - dToolDiam) / 2 * TgA + else + dMaxDepth = 0 + end + end + local dSubL = max( dSubL1, dSubL2, dSubL3) + if dMaxDepth > 0 then + dMaxDepth = dMaxDepth - dSubL + end -- inserisco la lavorazione local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchId = EgtAddMachining( sName, sDrilling) @@ -240,10 +300,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- aggiusto l'affondamento local sMyWarn - local dDepth = dLen - if Proc.Flg == 2 or Proc.Flg == -2 then - dDepth = dLen / 2 + BD.DRILL_OVERLAP - end if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' dDepth = dMaxDepth diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index 63a7fef..7c44dd2 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -1,4 +1,4 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2020/04/27 +-- ProcessTenon.lua by Egaltech s.r.l. 2020/09/07 -- Gestione calcolo tenone a coda di rondine per Travi -- Tabella per definizione modulo @@ -162,7 +162,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- se pezzo piccolo, in coda e piano inclinato attorno a Z applico svuotatura if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then local sPocketing = ML.FindPocketing( 'OpenPocket') - local dMaxDepth = 100 + local dMaxDepth = 100 local dStep = 30 local nSurfStep -- acquisisco i dati necessari dall'utensile diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index b1df962..368764c 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2020/09/03 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/09/19 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. @@ -317,9 +317,16 @@ local function GetTunnelDimension( Proc, nPartId) -- se faccia pari alla larghezza fessura if abs(DimH - dDimMax) < GEO.EPS_SMALL or abs(DimV - dDimMax) < GEO.EPS_SMALL then nLongIdFace = nFacCnt-1 - -- altrimenti faccia pari allo spessore fessura + -- altrimenti verifico anche con la faccia precedente else - nLongIdFace = nFacCnt-2 + -- prendo le dimensioni della faccia e poi confronto con il minimo + _, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacCnt-2, GDB_ID.ROOT) + -- se trovato con il minimo, questa seconda faccia non è la più lunga + if abs(DimH - dDimMin) < GEO.EPS_SMALL or abs(DimV - dDimMin) < GEO.EPS_SMALL then + nLongIdFace = nFacCnt-1 + else + nLongIdFace = nFacCnt-2 + end end if not dDimMax then return dDimMin, dDimMax, dDepth, nil, nil @@ -2179,7 +2186,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw) end end -- eseguo il taglio - local bMadeASbyBld, sWarn, nIdMach = BL.MakeOneFaceBySaw( Proc.Id, nFacet, sCutting, dSawDiam, vtN, nil, 0, BD.CUT_SIC, 0, 0, nil, b3Raw) + local bMadeASbyBld, sWarn, nIdMach = BL.MakeOneFaceBySaw( Proc.Id, nFacet, sCutting, dSawDiam, vtN, nil, -0.5, BD.CUT_SIC, 0, 0, nil, b3Raw) return bMadeASbyBld, sWarn, nIdMach, dSawThick end @@ -3433,8 +3440,14 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, bSinglePart) end end -- va eseguito sulle facce diverse dalla principale + local nPrevSCC = nil for nFacet = 0, nNumFac do if nFacet ~= nFacInd then + -- lavoro + local dSawThick = 0 + bMadeASbyBld, sWarn, nIdMach, dSawThick = MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw) + if not bMadeASbyBld then return false, sWarn end + -- verifico se da invertire local bInvertMach = false if bIsU then if abs(vtN:getZ()) > 0.7 or abs(vtN:getY()) > 0.7 then @@ -3467,49 +3480,32 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, bSinglePart) end end end - local dSawThick = 0 - bMadeASbyBld, sWarn, nIdMach, dSawThick = MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw) - if not bMadeASbyBld then return false, sWarn end + -- eseguo inversione if bInvertMach then - local bInvert = EgtGetMachiningParam( MCH_MP.INVERT) local bToolInvert = EgtGetMachiningParam( MCH_MP.TOOLINVERT) - local nSCC = EgtGetMachiningParam( MCH_MP.SCC) - local nInvSCC - if nSCC == MCH_SCC.ADIR_XP then - nInvSCC = MCH_SCC.ADIR_XM - elseif nSCC == MCH_SCC.ADIR_XM then - nInvSCC = MCH_SCC.ADIR_XP - elseif nSCC == MCH_SCC.ADIR_YP then - if abs( vtN:getY()) < 0.707 then - nInvSCC = MCH_SCC.ADIR_YM - else - nInvSCC = nSCC - end - elseif nSCC == MCH_SCC.ADIR_YM then - if abs( vtN:getY()) < 0.707 then - nInvSCC = MCH_SCC.ADIR_YP - else - nInvSCC = nSCC - end - else - nInvSCC = nSCC - end + local nWS = EgtGetMachiningParam( MCH_MP.WORKSIDE) + local nInvWS = EgtIf( nWS == MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT) local nFaceUse = EgtGetMachiningParam( MCH_MP.FACEUSE) local bOrtUp = ( nFaceUse >= MCH_MILL_FU.ORTUP_DOWN and nFaceUse <= MCH_MILL_FU.ORTUP_RIGHT) if not bOrtUp then - -- inverto i parametri - EgtSetMachiningParam( MCH_MP.INVERT, not bInvert) + -- assegno i parametri invertiti + EgtSetMachiningParam( MCH_MP.WORKSIDE, nInvWS) EgtSetMachiningParam( MCH_MP.TOOLINVERT, not bToolInvert) - EgtSetMachiningParam( MCH_MP.SCC, nInvSCC) -- setto l'offset pari allo spessore lama EgtSetMachiningParam( MCH_MP.OFFSL, -dSawThick) end - -- eseguo - if not EgtApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nIdMach, false) - return false, sErr - end + end + -- posizione del braccio : se primo taglio la recupero, altrimenti la imposto + if not nPrevSCC then + nPrevSCC = EgtGetMachiningParam( MCH_MP.SCC) + else + EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) + end + -- rieseguo + if not EgtApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nIdMach, false) + return false, sErr end end end diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index f95b9a3..dc8afa5 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2020/08/03 +-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2020/09/08 -- Gestione calcolo doppio taglio longitudinale per Travi -- Tabella per definizione modulo @@ -672,7 +672,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp) end -- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica) - local dCollSic = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( vtN[vOrd[i]]:getY() / vtN[vOrd[i]]:getZ()) - 3) + -- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione +-- local dCollSic = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( vtN[vOrd[i]]:getY() / vtN[vOrd[i]]:getZ()) - 3) + local dCollSic = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( vtN[vOrd[i]]:getY() / vtN[vOrd[i]]:getZ())) if vWidth[vOrd[i]] + dAgg > dMaxDepth - dCollSic then sWarn = 'Warning in LongDoubleCut : depth (' .. EgtNumToString( vWidth[vOrd[i]] + dAgg, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth - dCollSic, 1) .. ')' end diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index e180e8f..0976426 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -1,4 +1,4 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2020/07/25 +-- ProcessTenon.lua by Egaltech s.r.l. 2020/09/07 -- Gestione calcolo tenone per Travi -- Tabella per definizione modulo @@ -72,6 +72,38 @@ 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 = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- eseguo + if not EgtApplyMachining( 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) @@ -137,25 +169,42 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- se pezzo piccolo, in coda e piano inclinato attorno a Z applico svuotatura if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then local sPocketing = ML.FindPocketing( 'OpenPocket') - -- inserisco la lavorazione di svuotatura - local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchFId = EgtAddMachining( sName, sPocketing) - if not nMchFId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing - EgtOutLog( sErr) + 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 return false, sErr end - -- aggiungo geometria - EgtSetMachiningGeometry( {{ AddId, -1}}) - -- imposto uso faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) - -- imposto posizione braccio porta testa - local nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) - EgtSetMachiningParam( MCH_MP.SCC, nSCC) - -- eseguo - if not EgtApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchFId, false) + -- faccio ultima superfice + bOk, sErr = ApplyPocket( Proc, sPocketing, 1, EgtIf( nSurfStep > 1, ( dSurfStep + 0), 0), AddId, vtExtr) + if not bOk then return false, sErr end -- altrimenti applico taglio di lama