From e82a8c9c1fb9e65bfcee4f3f99f9d3eaa2fb2e9d Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 23 Nov 2023 13:06:13 +0100 Subject: [PATCH] -In Long2Cut, in implemento Q05 come LongCut, gestiti allungamenti e accorciamenti. Mancano le puliture. -In LongCut aggiunti alcuni commenti riguardo al Q05. --- LuaLibs/ProcessLongCut.lua | 2 + LuaLibs/ProcessLongDoubleCut.lua | 87 ++++++++++++++++++++++++++++---- 2 files changed, 80 insertions(+), 9 deletions(-) diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 9af60f7..3112607 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -655,6 +655,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- leggo il parametro Q05 solo se è una vera longcut L010 elseif ProcessLongCut.Identify( Proc) then nUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i') or 0 + -- funzionamento Q05 -- + -- 0: fresa; 1: lama solo se feature passante, faccia verso l'alto; 2: lama solo se feature passante, qualunque orientamento faccia; 3: lama con feature sia cieca che passante, faccia verso l'alto; 4: lama con feature sia cieca che passante, qualunque orientamento faccia end local bForceUseBladeOnNotThruFace if nCustForceUseBladeOnNCF then diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index d094ad6..7771858 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -367,11 +367,14 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster ---------------------------------------------------------------------------------------------------------------------------------------- local bUseBlade local nUseMillOnSide + local bForceUseBladeOnNotThruFace -- se presenti utilizzo i parametri dell'eventuale lua "padre" if bForcedBladeMaster ~= nil then bUseBlade = bForcedBladeMaster else local nUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i') + -- funzionamento Q05 -- + -- 0: fresa; 1: lama solo se feature passante, faccia verso l'alto; 2: lama solo se feature passante, qualunque orientamento faccia; 3: lama con feature sia cieca che passante, faccia verso l'alto; 4: lama con feature sia cieca che passante, qualunque orientamento faccia -- feature passante if nFaceLimit == 0 then if nUseBlade == 2 or nUseBlade == 4 or @@ -383,6 +386,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster if nUseBlade == 4 or ( nSide == 1 and ( nUseBlade == 3)) then bUseBlade = true + bForceUseBladeOnNotThruFace = true end end end @@ -478,23 +482,36 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end end end - -- se la distanza dal pezzo successivo è inferiore della metà lama, do un warning - if ( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2) then - sWarn = 'Warning : Cut machining can damage next piece' - EgtOutLog( sWarn) + -- se la fine (a sinistra) non è limitata e ho un pezzo successivo o grezzo riutilizzabile meno distante di metà raggio, setto la fine come limitata + if (( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) and nFaceLimit < 2 then + if bForceUseBladeOnNotThruFace then + nFaceLimit = nFaceLimit | 2 + bForcedLim = true + else + sWarn = 'Warning on saw cut : Cut machining can damage next piece' + EgtOutLog( sWarn) + end end -- determino gli estremi local dStartAccDist local dEndAccDist + local bStartFixed + local bEndFixed + local dStartDist + local dEndDist + local dStartDistUp = 0 + local dEndDistUp = 0 + local dStartDistDn = 0 + local dEndDistDn = 0 local dStartAccDistUp = BD.LONGCUT_ENDLEN local dEndAccDistUp = BD.LONGCUT_ENDLEN local dStartAccDistDn = BD.LONGCUT_ENDLEN local dEndAccDistDn = BD.LONGCUT_ENDLEN local nC - local dC - + local dC local nCUp local dCUp + -- determino numero di parti if bCanUseBlade then nCUp = ceil( ( dLen - dStartAccDistUp - dEndAccDistUp) / BD.LONGCUT_MAXLEN) @@ -610,8 +627,47 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster elseif vtN[vOrd[j]]:getZ() < -0.707 then nFaceSide = -1 end - -- ricavo box della faccia + -- ricavo informazioni della faccia local b3Fac = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vOrd[j]-1, GDB_BB.STANDARD) + local _, _, dWidth = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT) + -- determino accorciamenti se lavorazione cieca + if bForceUseBladeOnNotThruFace then + if bCanUseBlade then + bStartFixed = true + -- limitato a destra + if ( nFaceLimit & 1) ~= 0 then + local dRadius = dToolDiam / 2 + local dCat1 = dRadius - ( ( dWidth - dDimStrip) / 2) + bStartFixed = false + end + bEndFixed = true + -- limitato a sinistra + if ( nFaceLimit & 2) ~= 0 then + local dRadius = dToolDiam / 2 + local dCat1 = dRadius - ( ( dWidth - dDimStrip) / 2) + dEndDistUp = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1)) + bEndFixed = false + end + end + if bCanUseUnderBlade then + bStartFixed = true + -- limitato a destra + if ( nFaceLimit & 1) ~= 0 then + local dRadius = dToolDiamDn / 2 + local dCat1 = dRadius - ( ( dWidth - dDimStrip) / 2) + dStartDistDn = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1)) + bStartFixed = false + end + bEndFixed = true + -- limitato a sinistra + if ( nFaceLimit & 2) ~= 0 then + local dRadius = dToolDiamDn / 2 + local dCat1 = dRadius - ( ( dWidth - dDimStrip) / 2) + dEndDistDn = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1)) + bEndFixed = false + end + end + end -- ciclo sulle passate for k = 1, 2 do local dLioPerp = ( vWidth[vOrd[j]] - dDimStrip) / 2 + BD.CUT_SIC @@ -628,6 +684,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- setto le variabili delle distanze dagli estremi dEndAccDist = dEndAccDistUp dStartAccDist = dStartAccDistUp + dStartDist = dStartDistUp + dEndDist = dEndDistUp elseif bCanUseUnderBlade and not bCanUseBlade then sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) nMchFId = EgtAddMachining( sNameF, sCuttingDn) @@ -635,6 +693,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- setto le variabili delle distanze dagli estremi dEndAccDist = dEndAccDistDn dStartAccDist = dStartAccDistDn + dStartDist = dStartDistDn + dEndDist = dEndDistDn bMachDown = true -- entrambe le possibilità di lama else @@ -647,6 +707,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- setto le variabili delle distanze dagli estremi dEndAccDist = dEndAccDistDn dStartAccDist = dStartAccDistDn + dStartDist = dStartDistDn + dEndDist = dEndDistDn bMachDown = true -- se di fronte e prima faccia o dietro e seconda faccia, sta lavorando quella più in basso in Z (posizione) elseif ( ( bFront and j == 1) or ( not bFront and j == 2)) and k == 2 then @@ -656,6 +718,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- setto le variabili delle distanze dagli estremi dEndAccDist = dEndAccDistDn dStartAccDist = dStartAccDistDn + dStartDist = dStartDistDn + dEndDist = dEndDistDn bMachDown = true -- se di fronte e seconda faccia o dietro e prima faccia, sta lavorando la faccia più in alto in Z (posizione) elseif ( ( bFront and j == 2) or ( not bFront and j == 1)) and k == 1 then @@ -665,6 +729,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- setto le variabili delle distanze dagli estremi dEndAccDist = dEndAccDistUp dStartAccDist = dStartAccDistUp + dStartDist = dStartDistUp + dEndDist = dEndDistUp -- se di fronte e seconda faccia o dietro e prima faccia, sta lavorando la faccia più in alto in Z (posizione) elseif ( ( bFront and j == 2) or ( not bFront and j == 1)) and k == 2 then sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) @@ -673,6 +739,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- setto le variabili delle distanze dagli estremi dEndAccDist = dEndAccDistUp dStartAccDist = dStartAccDistUp + dStartDist = dStartDistUp + dEndDist = dEndDistUp end end if not nMchFId then @@ -720,8 +788,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- settaggio di workside, uso faccia e eventuale inversione -- limito opportunamente la lavorazione - local dSalInner, dSalOuter = - dEndAccDist - ( i - 2) * dC, 0 - local dEalInner, dEalOuter = - dStartAccDist - ( nC - i - 1) * dC, 0 + local dSalInner, dSalOuter = - dEndAccDist - ( i - 2) * dC, -dEndDist + local dEalInner, dEalOuter = - dStartAccDist - ( nC - i - 1) * dC, -dStartDist local dSal = EgtIf( i == 1, dSalOuter, dSalInner) local dEal = EgtIf( i == nC, dEalOuter, dEalInner) if ( bFront and k == 1) or ( not bFront and k == 2) then @@ -827,6 +895,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end end end + end end -- altrimenti concavo