- Inizio divisione lavorazioni per numero di facce

This commit is contained in:
luca.bacis
2022-01-10 12:41:43 +01:00
parent 62ca34a757
commit f022405749
+115 -52
View File
@@ -3848,7 +3848,7 @@ local function ManageAntiSplintBySaw( Proc, bIsU, vtN, nFacInd, sWarn, bMillDown
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
-- if abs(vtN:getZ()) > 0.7 or abs(vtN:getY()) > 0.7 then
-- prendo il vettore normale alla faccia
local _, vtNFc = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
-- se superficie principale parallela al piano XZ
@@ -5107,12 +5107,108 @@ local function MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFa
return true, ''
end
---------------------------------------------------------------------
local function MakeTwoFaces( Proc, bSinglePart, bPrevBhSideMill)
-- 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, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
if not nFacInd or nFacInd < 0 then
local sErr = 'Error : MakeTwoFaces 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, false, true, bSinglePart, bPrevBhSideMill)
if bPrevBhSideMill == nil then
bPrevBhSideMill = bMakeBySideMill
end
if bMakeBySideMill and ( dMaxMat <= dH + 15 * GEO.EPS_SMALL) then
-- se smusso non è esclusivo
if _nChamfer < 2 then
local bOk, sErr = MakeBySideMill(Proc, ptC, vtN, nFacInd, dMaxMat, dFacElev, dToolDiam, bHeadDir)
return bOk, sErr
end
-- altrimenti lavoro con svuotatura
else
local bOk, sErr = MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFacElev)
return bOk, sErr
end
return true, '', bPrevBhSideMill
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
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
-- verifico se U
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
-- verifico se L
local bIsL = ( TestElleShape3( Proc) or TestElleShape4( Proc) == 2)
-- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia
local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
if bPrevBhSideMill == nil then
bPrevBhSideMill = bMakeBySideMill
end
--if bMakeBySideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then
if bMakeBySideMill and ( dMaxMat <= dH + 15 * GEO.EPS_SMALL) then
-- se smusso non è esclusivo
if _nChamfer < 2 then
local bOk, sErr = MakeBySideMill(Proc, ptC, vtN, nFacInd, dMaxMat, dFacElev, dToolDiam, bHeadDir)
return bOk, sErr
end
-- altrimenti lavoro con svuotatura
else
local bSpecial3faces = false
local bBoxF = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfFac)
if dH * dV < 0.9 * ( bBoxF:getDimX() * bBoxF:getDimY()) then
bSpecial3faces = true
end
-- se riconosciuta gestione 3 facce
-- e limitata per ora alla feature 20
if bSpecial3faces and Proc.Prc == 20 and nFacInd2 then
-- se smusso non è esclusivo
if _nChamfer < 2 then
local bOk, sErr = MakeSpecialThreeFaces( Proc, bIsL)
return bOk, sErr
end
-- altrimenti lavorazione di svuotatura o contornatura
else
local bOk, sErr = MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFacElev)
return bOk, sErr
end
end
return true, '', bPrevBhSideMill
end
---------------------------------------------------------------------
local function MakeMoreFaces( Proc, bSinglePart, bPrevBhSideMill)
local sWarn
local bClosedOrthoFaces
local nBottomFace
local sMchFindBackUp
-- 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
@@ -5190,52 +5286,16 @@ local function MakeMoreFaces( Proc, bSinglePart, bPrevBhSideMill)
else
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
-- verifico se U
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
-- verifico se due facce o L con una o due facce di terminazione
local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2)
-- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia
local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
if bPrevBhSideMill == nil then
bPrevBhSideMill = bMakeBySideMill
end
--if bMakeBySideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then
if bMakeBySideMill and ( dMaxMat <= dH + 15 * GEO.EPS_SMALL) then
-- se smusso non è esclusivo
if _nChamfer < 2 then
local bOk, sErr = MakeBySideMill(Proc, ptC, vtN, nFacInd, dMaxMat, dFacElev, dToolDiam, bHeadDir)
return bOk, sErr
end
-- altrimenti lavoro con svuotatura
else
local bSpecial3faces = false
local bBoxF = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfFac)
if dH * dV < 0.9 * ( bBoxF:getDimX() * bBoxF:getDimY()) then
bSpecial3faces = true
end
-- se riconosciuta gestione 3 facce
-- e limitata per ora alla feature 20
if bSpecial3faces and Proc.Prc == 20 and nFacInd2 then
-- se smusso non è esclusivo
if _nChamfer < 2 then
local bOk, sErr = MakeSpecialThreeFaces( Proc, bIsL)
return bOk, sErr
end
-- altrimenti lavorazione di svuotatura o contornatura
else
local bOk, sErr = MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFacElev)
return bOk, sErr
end
end
local bOk, sErr = MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFacElev)
return bOk, sErr, bPrevBhSideMill
end
return true, sWarn, bPrevBhSideMill
return true, '', bPrevBhSideMill
end
---------------------------------------------------------------------
local function MakeLongMoreFaces( Proc)
local function MakeLongFaces( Proc, Func)
-- divido in parti lungo la X
local vAddId = {}
@@ -5264,9 +5324,9 @@ local function MakeLongMoreFaces( Proc)
local b3Box = EgtGetBBoxGlob( vAddId[i], GDB_BB.STANDARD)
local nFct = EgtSurfTmFacetCount( vAddId[i])
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, false, bPrevBhSideMill)
-- richiamo la funzione necessaria (passata come parametro)
bOk, sMyWarn, bPrevBhSideMill = Func( AddProc, false, bPrevBhSideMill)
if not sWarn then sWarn = sMyWarn end
if not bOk then return bOk, sWarn end
end
@@ -5357,7 +5417,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if bUseBlade then
return Fbs.MakeTwo( Proc, _nPhase, _nRawId, _nPartId, _dOvmHead, 'HeadSide')
else
return MakeLongMoreFaces( Proc)
return MakeLongFaces( Proc, MakeTwoFaces)
end
end
-- tre facce
@@ -5383,11 +5443,11 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if bApplyBladeOnLongNotContinueFace and bUseBlade and nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then
return LongCut.Make( Proc, _nPhase, _nRawId, _nPartId, bUseBlade, nForceUseBladeOnNotContinueFace)
else
return MakeLongMoreFaces( Proc)
return MakeLongFaces( Proc, MakeThreeFaces)
end
-- più facce
else
return MakeLongMoreFaces( Proc)
return MakeLongFaces( Proc, MakeMoreFaces)
end
-- altrimenti lavorazione unica
else
@@ -5425,7 +5485,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN) then
return MakeTwoFacesByMill( Proc, bDownHead)
else
return MakeMoreFaces( Proc, true)
return MakeTwoFaces( Proc, true)
end
-- altrimenti, con lama
else
@@ -5440,8 +5500,11 @@ 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 o più facce
else
-- tre
elseif Proc.Fct == 3 then
return MakeThreeFaces( Proc, true)
-- o più facce
else
return MakeMoreFaces( Proc, true)
end
end