- ottimizzazioni

This commit is contained in:
luca.bacis
2022-01-10 17:12:30 +01:00
parent f022405749
commit ef8be31a53
+80 -92
View File
@@ -182,61 +182,6 @@ local function EvaluateQParam( Proc)
return nChamfer, dDepth, sErr, bForceUseBlade
end
---------------------------------------------------------------------
local function InitGlob( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not Proc then
return false, 'Error : Proc is missing'
end
-- setto a nil la variabile smussi
_bMadeChamfer = nil
_nPhase = nPhase
_nRawId = nRawId
_nPartId = nPartId
_dOvmHead = dOvmHead
if _nRawId then
-- recupero l'ingombro del grezzo di appartenenza
_b3Raw = EgtGetRawPartBBox( _nRawId)
end
if not _nPartId then
_nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
end
if _nPartId then
-- recupero gruppo per geometria addizionale
_nAddGrpId = BL.GetAddGroup( _nPartId)
-- recupero l'ingombro della trave
_b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( _nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
else
local sErr = 'Error : part ID not found'
EgtOutLog( sErr)
return false, sErr
end
if not _b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
if not _nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- leggo i valori dei parametri Q
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)
return true, ''
end
---------------------------------------------------------------------
local function GetValidFacetAdjacencies( nSurfId, nFacet)
local vValidAdj
@@ -256,9 +201,9 @@ end
---------------------------------------------------------------------
local function TestElleShape3( Proc, bNotProc)
-- se non passat il Proc vero e proprio
local nNumFacet
local nProcId
-- se non passato il Proc vero e proprio
if bNotProc then
nProcId = Proc
nNumFacet = EgtSurfTmFacetCount( nProcId)
@@ -310,6 +255,70 @@ local function TestElleShape4( Proc)
end
end
---------------------------------------------------------------------
local function InitGlob( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not Proc then
return false, 'Error : Proc is missing'
end
-- setto a nil la variabile smussi
_bMadeChamfer = nil
_nPhase = nPhase
_nRawId = nRawId
_nPartId = nPartId
_dOvmHead = dOvmHead
if _nRawId then
-- recupero l'ingombro del grezzo di appartenenza
_b3Raw = EgtGetRawPartBBox( _nRawId)
end
if not _nPartId then
_nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
end
if _nPartId then
-- recupero gruppo per geometria addizionale
_nAddGrpId = BL.GetAddGroup( _nPartId)
-- recupero l'ingombro della trave
_b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( _nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
else
local sErr = 'Error : part ID not found'
EgtOutLog( sErr)
return false, sErr
end
if not _b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
if not _nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- leggo i valori dei parametri Q
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)
return true, ''
end
---------------------------------------------------------------------
local function TestUL( Proc)
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)
return bIsU, bIsL
end
---------------------------------------------------------------------
local function GetChainSawBlockedAxis( nInd)
if BD.GetChainSawBlockedAxis then
@@ -408,7 +417,7 @@ local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster)
end
---------------------------------------------------------------------
local function VerifyBHSideMill( Proc, bMasterIsU, bMasterIsL, bSinglePart, bPrevBhSideMill)
local function VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
local bUseBHSideMill = false
local bHead = true
@@ -426,21 +435,8 @@ local function VerifyBHSideMill( Proc, bMasterIsU, bMasterIsL, bSinglePart, bPre
if Proc.Prc ~= 37 and Q_SIDE_ROUGH_TOOL == 0 and not BD.BH_MACHINE then
return false
end
-- verifico se U
local bIsU
local bIsL
if bMasterIsU ~= nil then
bIsU = bMasterIsU
else
bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
end
if bMasterIsL ~= nil then
bIsL = bMasterIsL
else
-- verifico se due facce o L con una o due facce di terminazione
bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2)
end
-- verifico se U o L
local bIsU, bIsL = TestUL( Proc)
-- verifico se la funzione è lanciata da IsTailFeature o Classify
if bSinglePart == nil then
-- se lunghezza non richiede spezzatura setto la variabile bSinglePart per non fare con fresa BH
@@ -813,7 +809,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
local ptC, 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 = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2)
local _, bIsL = TestUL( Proc)
-- verifico se è lavorabile solo dal basso
local bDown = ( vtN:getZ() < BD.NZ_MINA and not BD.DOWN_HEAD)
-- se verso il basso, verifico se utilizzabile seconda faccia
@@ -3117,7 +3113,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, nFacInd, bReduceDepth, bM
end
-- valuto l'angolo tra le due facce
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nFacet, GDB_ID.ROOT)
local ptPm = (ptP1+ptP2)/2
local ptPm = (ptP1 + ptP2) / 2
-- ottengo il boundingBox e prendo le dimensioni lungo la normale (Z locale) che rappresenta l'elevazione della faccia
-- laterale sul punto medio della linea in comune
local frFc = Frame3d( ptPm, vtN) ;
@@ -4082,7 +4078,6 @@ local function MakeAntiSplintByMill( Proc, pPaths, nPathInt, vtN1,
return sMyWarn
end
---------------------------------------------------------------------
local function ManageAntiSplintByMill( Proc, nFacInd, bMillDown, dDiam, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, dDepth,
@@ -4366,7 +4361,7 @@ local function MakeBySideMill( Proc, ptC, vtN, nFacInd, dMaxMat, dFacElev, dTool
end
---------------------------------------------------------------------
local function MakeSpecialThreeFaces( Proc, bIsL)
local function MakeSpecialThreeFaces( Proc)
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, _nPartId)
-- entrambe le facce non devono essere orientate verso il basso
@@ -4432,6 +4427,8 @@ local function MakeSpecialThreeFaces( Proc, bIsL)
-- provo con contornatura
local dDiamTool = 20
-- verifico se forma ad L
local _, bIsL = TestUL( Proc)
if bIsL then
local bOk, sWarn
bOk, sWarn, _ = MakeByMill( Proc, nFacInd, rfFac, dH, dV, dFacElev, dCollSic, true, sMilling, nFacInd2, dFacElev2)
@@ -4773,10 +4770,8 @@ local function MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFa
-- dati della faccia
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)
-- verifico se forma ad U o L
local bIsU, bIsL = TestUL( Proc)
local bUseOtherFace
-- se orientata verso il basso e non c'è testa da sotto, verifico l'alternativa
if vtN:getZ() < BD.NZ_MINA and not BD.DOWN_HEAD and nFacInd2 then
@@ -5126,7 +5121,7 @@ local function MakeTwoFaces( Proc, bSinglePart, bPrevBhSideMill)
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)
local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
if bPrevBhSideMill == nil then
bPrevBhSideMill = bMakeBySideMill
end
@@ -5162,12 +5157,8 @@ local function MakeThreeFaces( Proc, bSinglePart, bPrevBhSideMill)
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)
local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
if bPrevBhSideMill == nil then
bPrevBhSideMill = bMakeBySideMill
end
@@ -5192,7 +5183,7 @@ local function MakeThreeFaces( Proc, bSinglePart, bPrevBhSideMill)
if bSpecial3faces and Proc.Prc == 20 and nFacInd2 then
-- se smusso non è esclusivo
if _nChamfer < 2 then
local bOk, sErr = MakeSpecialThreeFaces( Proc, bIsL)
local bOk, sErr = MakeSpecialThreeFaces( Proc)
return bOk, sErr
end
-- altrimenti lavorazione di svuotatura o contornatura
@@ -5267,8 +5258,7 @@ local function MakeMoreFaces( Proc, bSinglePart, bPrevBhSideMill)
local bTryWithBlades = true
-- lavoro fessura con svuotature (singola o doppia contrapposta)
local sMyMchFind = 'Pocket'
local nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace =
MakeByPockets( Proc, sMyMchFind, false, bClosedOrthoFaces)
local nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace = MakeByPockets( Proc, sMyMchFind, false, bClosedOrthoFaces)
if nOk < 0 then
return false, sErr
elseif nOk > 0 then
@@ -5286,7 +5276,6 @@ 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)
local bOk, sErr = MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFacElev)
return bOk, sErr, bPrevBhSideMill
end
@@ -5490,8 +5479,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti, con lama
else
-- 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)
local _, bIsL = TestUL( Proc)
if Proc.Fct == 2 and bIsL and _nChamfer > 0 then
local _, _, _, vtOrtho, _, nSurfInt = GetTunnelDimension( Proc)
local nOk, sErr = MakeChamfer( Proc, true, vtOrtho, _b3Solid, nSurfInt)