- Ottimizzazioni
This commit is contained in:
+86
-123
@@ -148,7 +148,7 @@ local function AssignQValues( Proc)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function EvaluateQParam( Proc)
|
||||
local function EvaluateQParam()
|
||||
|
||||
local sErr
|
||||
-- verifico che lo smusso sia richiesto
|
||||
@@ -231,7 +231,7 @@ local function InitGlob( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
AssignQValues( Proc)
|
||||
-- verifico se sono presenti i parametri Q per la profondità smusso e
|
||||
-- per eseguire in esclusiva solo lo smusso
|
||||
_nChamfer, _dDepthCham, _sErrCham, _bForceUseBlade = EvaluateQParam( Proc)
|
||||
_nChamfer, _dDepthCham, _sErrCham, _bForceUseBlade = EvaluateQParam()
|
||||
|
||||
return true, ''
|
||||
end
|
||||
@@ -359,6 +359,22 @@ local function TestUL( Proc)
|
||||
return bIsU, bIsL
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetIdIniEndPoints( ptP1, ptP2, tFac)
|
||||
local nIdIniPoint
|
||||
local nIdEndPoint
|
||||
if ptP1 and ptP2 then
|
||||
if dist( ptP1, tFac[4]) < GEO.EPS_SMALL or dist( ptP2, tFac[4]) < GEO.EPS_SMALL then
|
||||
nIdEndPoint = 4
|
||||
nIdIniPoint = 5
|
||||
elseif dist( ptP1, tFac[5]) < GEO.EPS_SMALL or dist( ptP2, tFac[5]) < GEO.EPS_SMALL then
|
||||
nIdEndPoint = 5
|
||||
nIdIniPoint = 4
|
||||
end
|
||||
end
|
||||
return nIdIniPoint, nIdEndPoint
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetChainSawBlockedAxis( nInd)
|
||||
if BD.GetChainSawBlockedAxis then
|
||||
@@ -541,7 +557,7 @@ local function VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
|
||||
end
|
||||
end
|
||||
end
|
||||
return bUseBHSideMill, bHead, bHeadDir, sMilling, dThickTool, dToolDiam
|
||||
return bUseBHSideMill, bHead, bHeadDir, dThickTool, dToolDiam
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -671,8 +687,8 @@ function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
-- deve avere la normale principale diretta verso la testa
|
||||
local nFacInd, dElev = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local nFacInd, _ = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
if vtN and vtN:getX() < 0.499 then
|
||||
return false
|
||||
elseif Proc.Fct >= 5 then
|
||||
@@ -724,9 +740,9 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
-- deve avere la normale principale diretta verso la coda (oppure tunnel)
|
||||
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
if vtN and vtN:getZ() < BD.NZ_MINA and nFacInd2 then
|
||||
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
|
||||
_, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
|
||||
dElev = dElev2
|
||||
end
|
||||
if not vtN or vtN:getX() > -0.001 or dEndDist + vtN:getX() * dElev > 0 then
|
||||
@@ -745,7 +761,7 @@ 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)
|
||||
--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
|
||||
@@ -753,10 +769,9 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
-- se 2 facce
|
||||
elseif Proc.Fct == 2 then
|
||||
-- dati delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
_, vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
_, vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
-- verifico se è lavorabile solo dal basso
|
||||
local bSmall = ( ( Proc.Head or Proc.Tail) and Proc.Box:getDimX() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ())) or
|
||||
( not ( Proc.Head or Proc.Tail) and Proc.Box:getDimY() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ()))
|
||||
@@ -816,7 +831,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
-- se facce formano un tunnel e sono ortogonali
|
||||
if bClosedOrthoFaces then
|
||||
-- ottengo le dimensioni del tunnel
|
||||
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc)
|
||||
local dDimMin, dDimMax, _, _, _, nSurfInt = GetTunnelDimension( Proc)
|
||||
EgtErase( nSurfInt)
|
||||
-- verifico se può essere fatto con svuotatura
|
||||
if VerifyPocket( Proc, dDimMin) then
|
||||
@@ -827,16 +842,16 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
return false
|
||||
end
|
||||
else
|
||||
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
-- se può essere fatto con utensile tipo lama
|
||||
local bUseBHSideMill, _, _, _, dMaxMat = VerifyBHSideMill( Proc)
|
||||
local bUseBHSideMill, _, _, dMaxMat = VerifyBHSideMill( Proc)
|
||||
-- if bUseBHSideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then
|
||||
if bUseBHSideMill and ( dMaxMat <= dH + 15 * GEO.EPS_SMALL) then
|
||||
return true, false
|
||||
-- altrimenti controllo se deve essere ruotato con le altre lavorazioni
|
||||
else
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
-- cerco se c'è faccia adiacente sul lato più lungo
|
||||
local nFaceAdj = GetFaceAdj( Proc, nFacInd, dH, dV) or -1
|
||||
local _, bIsL = TestUL( Proc)
|
||||
@@ -845,17 +860,17 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
-- se verso il basso, verifico se utilizzabile seconda faccia
|
||||
if bDown then
|
||||
if nFacInd2 and dElev2 < 2 * dElev then
|
||||
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
|
||||
local _, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
|
||||
bDown = ( vtN2:getZ() < BD.NZ_MINB)
|
||||
elseif not nFacInd2 and bIsL and nFaceAdj >= 0 then
|
||||
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFaceAdj, GDB_ID.ROOT)
|
||||
local _, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFaceAdj, GDB_ID.ROOT)
|
||||
bDown = ( vtN2:getZ() < BD.NZ_MINB)
|
||||
end
|
||||
-- verifico se la faccia principale è sottosquadra, ha forma L ed esiste la faccia adiacente
|
||||
elseif vtN:getZ() < -0.2589 and bIsL and nFaceAdj >= 0 then
|
||||
-- se il numero di facce > 2 o il box della feature supera una certa distanza dalle teste allora controllo la z della faccia ausiliaria
|
||||
if Proc.Fct > 2 or ( Proc.Box:getMax():getX() < _b3Solid:getMin():getX() - 150) or ( Proc.Box:getMin():getX() > _b3Solid:getMax():getX() + 150) then
|
||||
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFaceAdj, GDB_ID.ROOT)
|
||||
local _, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFaceAdj, GDB_ID.ROOT)
|
||||
bDown = ( vtN2:getZ() < BD.NZ_MINB)
|
||||
end
|
||||
end
|
||||
@@ -873,7 +888,7 @@ local function MakeOneFaceByMill( Proc)
|
||||
-- verifico il numero di facce della tacca
|
||||
assert( ( Proc.Fct == 1), 'Error : MakeOneFaceByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces')
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- verifico se orientata verso l'alto
|
||||
local bUp = ( vtN:getZ() >= BD.NZ_MINA)
|
||||
-- scelta faccia da lavorare
|
||||
@@ -1046,9 +1061,6 @@ local function MakeTwoFacesByMill( Proc, bDownHead)
|
||||
nFacInd = 1
|
||||
end
|
||||
local nOthInd = 1 - nFacInd
|
||||
local sName
|
||||
local nMchFId
|
||||
local nFaceUse
|
||||
local bOk, sErr
|
||||
-- se forzato uso fresa controllo se posso fare in una o più passate
|
||||
if Q_USE_MILL and Q_USE_MILL == 1 then
|
||||
@@ -1209,7 +1221,7 @@ local function MakeByMill( Proc, nFacInd, rfFac, dH, dV, dElev, dCollSic, bSpeci
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenEnd, dTDiam / 2, - dTDiam / 2))
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenStart, dTDiam / 2, - dTDiam / 2))
|
||||
-- confronto la faccia applicata nella lavorazione(faccia adiacente) con la seconda faccia passata nella funzione
|
||||
-- confronto la faccia applicata nella lavorazione (faccia adiacente) con la seconda faccia passata nella funzione
|
||||
-- se corrispondono allora aggiungo una estensione nei lati chiusi pari all'elevazione della stessa faccia corrispondente
|
||||
if nFacAdj == nFacInd2 then
|
||||
if not bOpenStart then
|
||||
@@ -1311,7 +1323,7 @@ local function CheckToInvert( AuxId, bPositive)
|
||||
local nNewEntId = EgtCopyGlob( AuxId, sParnt)
|
||||
-- chiudo il percorso
|
||||
if EgtCloseCurveCompo( nNewEntId) then
|
||||
local vtMPlane, dDist, dArea = EgtCurveArea( nNewEntId)
|
||||
local vtMPlane, _, dArea = EgtCurveArea( nNewEntId)
|
||||
-- cancello percorso copia
|
||||
EgtErase( nNewEntId)
|
||||
if dArea and abs(dArea) > 1 then
|
||||
@@ -1502,17 +1514,7 @@ local function MakeRoundCleanCorner( Proc, nFacInd, dDiam, bMillDown, bDoubleSid
|
||||
local dLen1 = dist( ptP1, ptP2)
|
||||
local dLen2 = dist( ptP1x, ptP2x)
|
||||
-- cerco il punto tra le 3 facce: nIdEndPoint
|
||||
local nIdIniPoint
|
||||
local nIdEndPoint
|
||||
if ptP1 and ptP2 then
|
||||
if dist( ptP1, tFacAdj[i][4]) < GEO.EPS_SMALL or dist( ptP2, tFacAdj[i][4]) < GEO.EPS_SMALL then
|
||||
nIdEndPoint = 4
|
||||
nIdIniPoint = 5
|
||||
elseif dist( ptP1, tFacAdj[i][5]) < GEO.EPS_SMALL or dist( ptP2, tFacAdj[i][5]) < GEO.EPS_SMALL then
|
||||
nIdEndPoint = 5
|
||||
nIdIniPoint = 4
|
||||
end
|
||||
end
|
||||
local _, nIdEndPoint = GetIdIniEndPoints(ptP1, ptP2, tFacAdj[i])
|
||||
-- devo avere un punto comune
|
||||
if not nIdEndPoint then
|
||||
goto continue
|
||||
@@ -1623,7 +1625,7 @@ local function MakeRoundCleanCorner( Proc, nFacInd, dDiam, bMillDown, bDoubleSid
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeRoundCleanContour( Proc, nFacInd, dDiam, nFunction, bMillDown,
|
||||
local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown,
|
||||
bDoubleSide, vtOrtho, nPathInt, nSurfInt,
|
||||
dDepth, bOneShot)
|
||||
|
||||
@@ -1935,7 +1937,7 @@ local function MakeRoundCleanCornerOrContour( Proc, nFacInd, dDiam, nFunction, b
|
||||
end
|
||||
-- se richiesta pulitura del contorno
|
||||
if nFunction == 1 then
|
||||
return MakeRoundCleanContour( Proc, nFacInd, dDiam, nFunction, bMillDown,
|
||||
return MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown,
|
||||
bDoubleSide, vtOrtho, nPathInt, nSurfInt,
|
||||
dDepth, bOneShot)
|
||||
-- se richiesta pulitura dei soli corner
|
||||
@@ -1970,17 +1972,7 @@ local function MakeSharpCleanCorner( Proc, nFacInd, dDiam)
|
||||
local vtN3 = EgtSurfTmFacetNormVersor( Proc.Id, tFacAdj[nIdLine][2], GDB_ID.ROOT)
|
||||
-- trovo il punto sulla superfice di riferimento
|
||||
local _, ptLocP1, ptLocP2 = EgtSurfTmFacetsContact( Proc.Id, nFacInd, tFacAdj[nIdLine][1], GDB_ID.ROOT)
|
||||
local nIdIniPoint
|
||||
local nIdEndPoint
|
||||
if ptLocP1 and ptLocP2 then
|
||||
if dist( ptLocP1, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL or dist( ptLocP2, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL then
|
||||
nIdEndPoint = 4
|
||||
nIdIniPoint = 5
|
||||
elseif dist( ptLocP1, tFacAdj[nIdLine][5]) < GEO.EPS_SMALL or dist( ptLocP2, tFacAdj[nIdLine][5]) < GEO.EPS_SMALL then
|
||||
nIdEndPoint = 5
|
||||
nIdIniPoint = 4
|
||||
end
|
||||
end
|
||||
local nIdIniPoint, nIdEndPoint = GetIdIniEndPoints(ptLocP1, ptLocP2, tFacAdj[nIdLine])
|
||||
-- versore direzione
|
||||
local vtExtr = tFacAdj[nIdLine][nIdIniPoint] - tFacAdj[nIdLine][nIdEndPoint]
|
||||
vtExtr:normalize()
|
||||
@@ -2023,7 +2015,7 @@ local function MakeSharpCleanCorner( Proc, nFacInd, dDiam)
|
||||
ptApPoint = ptLocP1
|
||||
end
|
||||
nAuxId = EgtLine( _nAddGrpId, tFacAdj[nIdLine][nIdEndPoint], ptApPoint, GDB_RT.GLOB)
|
||||
dLenTrimExt = dist( tFacAdj[nIdLine][nIdEndPoint], ptApPoint) - (( dDiam/2) + 2)
|
||||
dLenTrimExt = dist( tFacAdj[nIdLine][nIdEndPoint], ptApPoint) - (( dDiam / 2) + 2)
|
||||
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
|
||||
if dLenTrimExt > 10 * GEO.EPS_SMALL then
|
||||
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint , GDB_RT.GLOB)
|
||||
@@ -2046,7 +2038,7 @@ local function MakeSharpCleanCorner( Proc, nFacInd, dDiam)
|
||||
ptApPoint = ptLocP1
|
||||
end
|
||||
nAuxId = EgtLine( _nAddGrpId, tFacAdj[nIdLine][nIdEndPoint], ptApPoint, GDB_RT.GLOB)
|
||||
dLenTrimExt = dist( tFacAdj[nIdLine][nIdEndPoint], ptApPoint) - (( dDiam/2) + 2)
|
||||
dLenTrimExt = dist( tFacAdj[nIdLine][nIdEndPoint], ptApPoint) - (( dDiam / 2) + 2)
|
||||
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
|
||||
if dLenTrimExt > 10 * GEO.EPS_SMALL then
|
||||
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint , GDB_RT.GLOB)
|
||||
@@ -2140,17 +2132,7 @@ local function MakeDrillOnCorner( Proc, nFacInd, dDiam, bSpecialMach)
|
||||
end
|
||||
-- trovo il punto sulla superfice di riferimento
|
||||
local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( Proc.Id, nFacInd, tFacAdj[nIdLine][1], GDB_ID.ROOT)
|
||||
local nIdIniPoint
|
||||
local nIdEndPoint
|
||||
if ptLocP1 and ptLocP2 then
|
||||
if ( dist( ptLocP1, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL) then
|
||||
nIdEndPoint = 4
|
||||
nIdIniPoint = 5
|
||||
elseif ( dist( ptLocP1, tFacAdj[nIdLine][5]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[nIdLine][5]) < GEO.EPS_SMALL) then
|
||||
nIdEndPoint = 5
|
||||
nIdIniPoint = 4
|
||||
end
|
||||
end
|
||||
local nIdIniPoint, nIdEndPoint = GetIdIniEndPoints(ptLocP1, ptLocP2, tFacAdj[nIdLine])
|
||||
-- inserisco foro
|
||||
if nIdIniPoint and nIdEndPoint then
|
||||
local vtExtr
|
||||
@@ -2549,28 +2531,20 @@ end
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByMillAsSaw( Proc, nFacInd,
|
||||
rfFac, dH, dV, dElev,
|
||||
nBottomFace, dSawMaxDepth, sMillingOnSide,
|
||||
nBottomFace, sMillingOnSide,
|
||||
dSawDiam, dSawThick)
|
||||
local bOrthoFaces
|
||||
local sWarn
|
||||
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
|
||||
local dDistToNextPiece = EgtGetInfo( _nRawId, 'BDST', 'd') or 5.
|
||||
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
|
||||
local nFacInd1, dFacElev1, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, _nPartId, true)
|
||||
local nFacInd1, _, _, _ = BL.GetFaceWithMostAdj( Proc.Id, _nPartId, true)
|
||||
if not nFacInd1 or nFacInd1 < 0 then
|
||||
if nFacInd1 == -1 then
|
||||
bOrthoFaces = nFacInd2
|
||||
else
|
||||
if not nFacInd1 == -1 then
|
||||
local sErr = 'Error : MakeByMillAsSaw could not find reference face'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
|
||||
if bOrthoFaces then
|
||||
-- ottengo le dimensioni del tunnel
|
||||
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc)
|
||||
end
|
||||
-- Recupero le facce adiacenti alla principale (solo quelle esistenti)
|
||||
local vAdj = GetValidFacetAdjacencies( Proc.Id, nFacInd)
|
||||
if not vAdj or #vAdj == 0 then
|
||||
@@ -2604,7 +2578,6 @@ local function MakeByMillAsSaw( Proc, nFacInd,
|
||||
-- Determino se estremi aperti o chiusi
|
||||
local bOpenStart = false
|
||||
local bOpenEnd = false
|
||||
local vtNS, vtNE
|
||||
-- se non ho la faccia di fondo ( che comporta essere una fessura) verifico se ho lati aperti
|
||||
if not nBottomFace then
|
||||
local vAdj2 = EgtSurfTmFacetAdjacencies( Proc.Id, nFacAdj)[1]
|
||||
@@ -3129,7 +3102,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, nFacInd, bReduceDepth, bM
|
||||
sWarn = 'Warning : antisplint elevation is bigger than max tool depth'
|
||||
end
|
||||
end
|
||||
return bMadeASbyBld, sWarn, nIdMach, dSawThick, dMaxDepth, bAdj, dAng, dExtraOffs
|
||||
return bMadeASbyBld, sWarn, nIdMach, dSawThick, dMaxDepth, dAng
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -3417,7 +3390,7 @@ local function GetUShapeWidth( Proc, nFacInd)
|
||||
local dWidth = 0
|
||||
for i = 1, #vAdj do
|
||||
-- verifico l'angolo tra le facce ( esco se angolo compreso < 90)
|
||||
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT)
|
||||
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT)
|
||||
if bAdj and dAng < -90 - 20 * GEO.EPS_ANG_SMALL then return nil end
|
||||
-- larghezza della faccia ortogonalmente alla adiacente
|
||||
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, vAdj[i], GDB_ID.ROOT)
|
||||
@@ -3445,7 +3418,7 @@ local function MakeByPockets( Proc, sMchFindMaster, bIs3Faces, bOrthoFacesMaster
|
||||
end
|
||||
if bIs3Faces then
|
||||
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
|
||||
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, _nPartId, bIs3Faces)
|
||||
local nFacInd, _, nFacInd2, _ = BL.GetFaceWithMostAdj( Proc.Id, _nPartId, bIs3Faces)
|
||||
if not nFacInd or nFacInd < 0 then
|
||||
if nFacInd == -1 then
|
||||
bOrthoFaces = nFacInd2
|
||||
@@ -3475,9 +3448,9 @@ local function MakeByPockets( Proc, sMchFindMaster, bIs3Faces, bOrthoFacesMaster
|
||||
bMillDown = ( BD.DOWN_HEAD == true)
|
||||
-- verifico se può essere fatto con svuotatura
|
||||
local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind)
|
||||
local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn
|
||||
local bMakePocketDn, sPocketingDn, dMaxDepthDn
|
||||
if bMillDown then
|
||||
bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind..'_H2')
|
||||
bMakePocketDn, sPocketingDn, dMaxDepthDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind..'_H2')
|
||||
-- se è negativo inverto il versore e la faccia
|
||||
if vtOrtho:getZ() < 0 then
|
||||
vtOrtho = -vtOrtho
|
||||
@@ -3490,7 +3463,7 @@ local function MakeByPockets( Proc, sMchFindMaster, bIs3Faces, bOrthoFacesMaster
|
||||
-- e assegno l'estrusione
|
||||
nPathInt = EgtExtractSurfTmLoops( nSurfInt, _nAddGrpId)
|
||||
EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB)
|
||||
-- se ho 3 facce, ciclo sulle entià del percorso per segnare quelle che sono aperte
|
||||
-- se ho 3 facce, ciclo sulle entità del percorso per segnare quelle che sono aperte
|
||||
if bIs3Faces then
|
||||
SetOpenSide( nPathInt, vtOrtho)
|
||||
end
|
||||
@@ -3790,16 +3763,14 @@ local function ManageAntiSplintBySaw( Proc, bIsU, vtN, nFacInd, sWarn, bMillDown
|
||||
if nFacet ~= nFacInd then
|
||||
-- lavoro
|
||||
local dSawThick = 0
|
||||
local dMaxDepth = 200
|
||||
local bAdj, dAng, dExtraOffs, sWarn2, nIdMach
|
||||
bMadeASbyBld, sWarn2, nIdMach, dSawThick, dMaxDepth, bAdj, dAng, dExtraOffs = MakeAntiSplintBySaw( Proc, nFacet, vtN, nFacInd, bReduceDepth, bMillDown)
|
||||
local dAng, sWarn2, nIdMach
|
||||
bMadeASbyBld, sWarn2, nIdMach, dSawThick, dMaxDepth, dAng = MakeAntiSplintBySaw( Proc, nFacet, vtN, nFacInd, bReduceDepth, bMillDown)
|
||||
if not bMadeASbyBld then return bMadeASbyBld, false, sWarn2 end
|
||||
sWarn = FormatWarning(sWarn, sWarn2)
|
||||
-- se antischeggia veramente inserito perchè necessario
|
||||
if nIdMach then
|
||||
-- verifico se da invertire
|
||||
local bInvertMach = false
|
||||
local dDepth = 0
|
||||
if bIsU then
|
||||
if abs(vtN:getZ()) > 0.63 or abs(vtN:getY()) > 0.63 then
|
||||
-- if abs(vtN:getZ()) > 0.7 or abs(vtN:getY()) > 0.7 then
|
||||
@@ -4037,7 +4008,7 @@ local function MakeAntiSplintByMill( Proc, pPaths, nPathInt, vtN1,
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function ManageAntiSplintByMill( Proc, nFacInd, bMillDown, dDiam, bDoubleSide,
|
||||
local function ManageAntiSplintByMill( Proc, nFacInd, bMillDown, bDoubleSide,
|
||||
vtOrtho, nPathInt, nSurfInt, dDepth,
|
||||
bOneShot, nFirstMachId)
|
||||
|
||||
@@ -4068,7 +4039,6 @@ local function ManageAntiSplintByMill( Proc, nFacInd, bMillDown, dDiam, bDoubleS
|
||||
local dMaxElevMaster
|
||||
local dExtraDepth = 0
|
||||
local dCollSic
|
||||
local ptMidDist
|
||||
-- recupero i dati dell'utensile
|
||||
local dTDiam = 50
|
||||
local dMaxDepth = 0
|
||||
@@ -4522,15 +4492,14 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeSidePocketings( Proc, nFacInd, rfFac, dH, dV, vtN, dFacElev, bSpecialMillOnSide,
|
||||
nBottomFace, dMaxDepthOnSide, sMillingOnSide,
|
||||
dToolDiamOnSide, dThickMillOnSide, bSinglePart, bIsU, bIsL, dDiam, bMillDown, bMillUp, sMchFind, sMchFindBackUp)
|
||||
nBottomFace, sMillingOnSide, dToolDiamOnSide, dThickMillOnSide,
|
||||
bSinglePart, bIsU, bIsL, dDiam, bMillDown, bMillUp, sMchFind, sMchFindBackUp)
|
||||
local bTryWithBlades = true
|
||||
local nOk, bOk, sStat, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, bOrthoFaces, nSurfInt
|
||||
if bSpecialMillOnSide then
|
||||
-- eseguo
|
||||
bOk, sWarn = MakeByMillAsSaw( Proc, nFacInd,
|
||||
rfFac, dH, dV, dFacElev, bSpecialMillOnSide,
|
||||
nBottomFace, dMaxDepthOnSide, sMillingOnSide,
|
||||
bOk, sWarn = MakeByMillAsSaw( Proc, nFacInd, rfFac, dH, dV, dFacElev,
|
||||
nBottomFace, sMillingOnSide,
|
||||
dToolDiamOnSide, dThickMillOnSide)
|
||||
if bOk then
|
||||
return 1, true, sWarn
|
||||
@@ -4618,13 +4587,12 @@ local function MakeSidePocketings( Proc, nFacInd, rfFac, dH, dV, vtN, dFacElev,
|
||||
-- 2021.07.16 Per poter eseguire antischeggia di lama su feature che non sono passanti da faccia a faccia
|
||||
-- ma che sono su un angolo (coinvolgono 2 facce contigue) è stato modificato il confronto in:
|
||||
-- esegue antischeggia di lama se forma U o L con feature passante in Y o Z, oppure se feature a furma U e con 3 facce oppore a forma a L e con 2 facce
|
||||
local bMadeASbyBld = false
|
||||
local bPassThrou = ( Proc.Box:getDimY() > _b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > _b3Raw:getDimZ() - 1)
|
||||
local bPassEdge = ((( bIsU and Proc.Fct == 3) or ( bIsL and Proc.Fct == 2)) and bSinglePart and Proc.Box:getDimX() < 0.9 * _b3Raw:getDimX())
|
||||
if _nChamfer < 2 and Q_ANTISPLINT_TYPE == 1 and (( bIsU or bIsL) and ( bPassThrou or bPassEdge)) then
|
||||
local bOk
|
||||
local bSawDown = ( bMillDown and not bMillUp)
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, bIsU, vtN, nFacInd, sWarn, bSawDown, true)
|
||||
_, bOk, sWarn = ManageAntiSplintBySaw( Proc, bIsU, vtN, nFacInd, sWarn, bSawDown, true)
|
||||
if not bOk then return 1, false, sWarn end
|
||||
end
|
||||
-- in base al flag interno e al numero di facce e se ha forma ad U: provo prima la svuotatura sul fianco e
|
||||
@@ -4656,7 +4624,7 @@ local function MakeSidePocketings( Proc, nFacInd, rfFac, dH, dV, vtN, dFacElev,
|
||||
sWarn = sErr
|
||||
-- se ho antischeggia con fresa le inserisco
|
||||
if _nChamfer < 2 and Q_ANTISPLINT_TYPE == 2 then
|
||||
local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nFacInd, bMillDown, dDiamTool, bDoubleSide,
|
||||
local _, sWarn2 = ManageAntiSplintByMill( Proc, nFacInd, bMillDown, bDoubleSide,
|
||||
vtOrtho, nPathInt, nSurfInt, dDepth,
|
||||
bOneShot, nFirstMachId)
|
||||
sWarn = FormatWarning(sWarn, sWarn2)
|
||||
@@ -4687,9 +4655,9 @@ local function MakeSidePocketings( Proc, nFacInd, rfFac, dH, dV, vtN, dFacElev,
|
||||
end
|
||||
-- eseguo (non 3 faces)
|
||||
bOk, sWarn, sStat = MakeByChainOrSaw( Proc, nFacInd,
|
||||
rfFac, dH, dV, dFacElev,
|
||||
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace,
|
||||
bOrthoFaces, nBottomFace, nSurfInt)
|
||||
rfFac, dH, dV, dFacElev,
|
||||
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace,
|
||||
bOrthoFaces, nBottomFace, nSurfInt)
|
||||
if not bOk and sStat == 'MNF' then
|
||||
_, sPocketing = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, nil, sMchFind)
|
||||
if sPocketing then
|
||||
@@ -4954,9 +4922,8 @@ local function MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFa
|
||||
-- altrimenti, in base alla forma, provo con svuotature di fianco o con la sega a catena o lama
|
||||
else
|
||||
local stat, bOk, sWarn = MakeSidePocketings( Proc, nFacInd, rfFac, dH, dV, vtN, dFacElev, bSpecialMillOnSide,
|
||||
nBottomFace, dMaxDepthOnSide, sMillingOnSide,
|
||||
dToolDiamOnSide, dThickMillOnSide, bSinglePart, bIsU, bIsL, dDiam,
|
||||
bMillDown, bMillUp, sMchFind, sMchFindBackUp)
|
||||
nBottomFace, sMillingOnSide, dToolDiamOnSide, dThickMillOnSide, bSinglePart,
|
||||
bIsU, bIsL, dDiam, bMillDown, bMillUp, sMchFind, sMchFindBackUp)
|
||||
if stat == 1 then
|
||||
return bOk, sWarn
|
||||
end
|
||||
@@ -5011,7 +4978,6 @@ local function MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFa
|
||||
return false, sErr
|
||||
end
|
||||
-- Cerco una faccia adiacente alla principale con angolo > 90
|
||||
local nFacAdj
|
||||
local tDimAndRef = {}
|
||||
tvtNx = {}
|
||||
tvtNx[1] = vtN
|
||||
@@ -5064,7 +5030,7 @@ local function MakeTwoFaces( Proc, bSinglePart, bPrevBhSideMill)
|
||||
end
|
||||
|
||||
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
|
||||
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
|
||||
local nFacInd, dFacElev, nFacInd2, _ = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
|
||||
if not nFacInd or nFacInd < 0 then
|
||||
local sErr = 'Error : MakeTwoFaces could not find reference face'
|
||||
EgtOutLog( sErr)
|
||||
@@ -5072,9 +5038,9 @@ local function MakeTwoFaces( Proc, bSinglePart, bPrevBhSideMill)
|
||||
end
|
||||
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local _, dH, _ = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
-- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia
|
||||
local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
|
||||
local bMakeBySideMill, _, bHeadDir, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
|
||||
if bPrevBhSideMill == nil then
|
||||
bPrevBhSideMill = bMakeBySideMill
|
||||
end
|
||||
@@ -5095,23 +5061,24 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeThreeFaces( Proc, bSinglePart, bPrevBhSideMill)
|
||||
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
|
||||
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
|
||||
if not nFacInd or nFacInd < 0 then
|
||||
local sErr = 'Error : MakeMoreFaces could not find reference face'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se non posso lavorare la feature perché condizionata dall'esecuzione del solo chamfer
|
||||
-- genero errore e non faccio nulla
|
||||
if _nChamfer < 0 then
|
||||
return false, _sErrCham
|
||||
end
|
||||
|
||||
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
|
||||
local nFacInd, dFacElev, nFacInd2, _ = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
|
||||
if not nFacInd or nFacInd < 0 then
|
||||
local sErr = 'Error : MakeThreeFaces could not find reference face'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
-- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia
|
||||
local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
|
||||
local bMakeBySideMill, _, bHeadDir, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
|
||||
if bPrevBhSideMill == nil then
|
||||
bPrevBhSideMill = bMakeBySideMill
|
||||
end
|
||||
@@ -5131,8 +5098,7 @@ local function MakeThreeFaces( Proc, bSinglePart, bPrevBhSideMill)
|
||||
bSpecial3faces = true
|
||||
end
|
||||
|
||||
-- se riconosciuta gestione 3 facce
|
||||
-- e limitata per ora alla feature 20
|
||||
-- se riconosciuta gestione special (limitata per ora alla feature 20)
|
||||
if bSpecial3faces and Proc.Prc == 20 and nFacInd2 then
|
||||
-- se smusso non è esclusivo
|
||||
if _nChamfer < 2 then
|
||||
@@ -5154,7 +5120,7 @@ local function MakeMoreFaces( Proc, bSinglePart, bPrevBhSideMill)
|
||||
local bClosedOrthoFaces
|
||||
local nBottomFace
|
||||
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
|
||||
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
|
||||
local nFacInd, dFacElev, nFacInd2, _ = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
|
||||
if not nFacInd or nFacInd < 0 then
|
||||
if nFacInd == -1 then
|
||||
bClosedOrthoFaces = nFacInd2
|
||||
@@ -5173,7 +5139,7 @@ local function MakeMoreFaces( Proc, bSinglePart, bPrevBhSideMill)
|
||||
nBottomFace = i - 1
|
||||
if EgtSurfTmRemoveFacet( nNewProc, nBottomFace) then
|
||||
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
|
||||
nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( nNewProc, _nPartId)
|
||||
nFacInd, dFacElev, nFacInd2, _ = BL.GetFaceWithMostAdj( nNewProc, _nPartId)
|
||||
if not nFacInd or nFacInd < 0 then
|
||||
if nFacInd == -1 then
|
||||
bClosedOrthoFaces = nFacInd2
|
||||
@@ -5227,8 +5193,6 @@ local function MakeMoreFaces( Proc, bSinglePart, bPrevBhSideMill)
|
||||
end
|
||||
-- altrimenti non è una fessura
|
||||
else
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local bOk, sErr = MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFacElev)
|
||||
return bOk, sErr, bPrevBhSideMill
|
||||
end
|
||||
@@ -5385,7 +5349,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
else
|
||||
return MakeLongFaces( Proc, MakeThreeFaces)
|
||||
end
|
||||
-- più facce
|
||||
-- 4 o 5 facce
|
||||
else
|
||||
return MakeLongFaces( Proc, MakeMoreFaces)
|
||||
end
|
||||
@@ -5410,10 +5374,9 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- verifico se da lavorare con testa da sotto
|
||||
local bDownHead = false
|
||||
if BD.DOWN_HEAD then
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
_, vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
_, vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize()
|
||||
bDownHead = ( vtNm:getZ() < -0.5)
|
||||
end
|
||||
@@ -5439,10 +5402,10 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return Fbs.MakeTwo( Proc, _nPhase, _nRawId, _nPartId, _dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead)
|
||||
end
|
||||
end
|
||||
-- tre
|
||||
-- tre facce
|
||||
elseif Proc.Fct == 3 then
|
||||
return MakeThreeFaces( Proc, true)
|
||||
-- o più facce
|
||||
-- 4 o 5 facce
|
||||
else
|
||||
return MakeMoreFaces( Proc, true)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user