DataBeam: - per lavorazioni con fresatura di lato per L30 (Q03=2) aggiunte feature non passanti. Modificate funzioni MakeByPockets, Classify.

This commit is contained in:
luca.mazzoleni
2022-06-21 09:33:19 +02:00
parent 282fe97978
commit 9e2a9ebc7a
+113 -48
View File
@@ -45,6 +45,7 @@
-- 2022/06/13 Modifiche per feature lunga con due facce non equivalenti a taglio long. doppio o singolo con faccia terminale.
-- 2022/06/15 Correzione calcolo normale alla faccia per sega catena di fianco.
-- 2022/06/16 Implemento lavorazioni con fresatura di lato per L30 (al momento solo passanti) se parametro Q03=2. Modificate funzioni Make, MakeByPockets, Classify.
-- 2022/06/21 Implemento di lavorazioni non passanti con fresatura di lato per L30 se parametro Q03=2. Modificate funzioni MakeByPockets, Classify.
-- Tabella per definizione modulo
local ProcessLapJoint = {}
@@ -824,7 +825,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
if bDown then
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
-- per lapjoint proc 30, se forzata la lavorazione con fresa di lato da parametro Q03=2 non devo ruotare
local bForceSideMill = ( Proc.Prc == 30 and EgtGetInfo( Proc.Id, 'Q03', 'd') == 2 and Proc.Fct == 3 and bIsU)
local bForceSideMill = ( Proc.Prc == 30 and EgtGetInfo( Proc.Id, 'Q03', 'd') == 2 and ( Proc.Fct == 3 or Proc.Fct == 4))
if bForceSideMill then
bDown = false
elseif nFacInd2 and dElev2 < 2 * dElev then
@@ -4355,6 +4356,40 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
return true, sMyWarn
end
---------------------------------------------------------------------
-- Trova il numero (0 based) della faccia meglio orientata come l'asse 'sAxis'. Restituisce anche vtN e ptC della faccia stessa.
-- sAxis: 'X' o 'Y' o 'Z'
local function FindFaceBestOrientedAsAxis( Proc, sAxis)
local ptC = {}
local vtN = {}
local nFaceMaximumNormalComponentOnAxis = 0
local dFaceMaximumNormalComponentOnAxisValue = 0
for i = 1, Proc.Fct do
ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
if sAxis == 'X' then
if abs(vtN[i]:getX()) > dFaceMaximumNormalComponentOnAxisValue then
nFaceMaximumNormalComponentOnAxis = i - 1
dFaceMaximumNormalComponentOnAxisValue = abs(vtN[i]:getX())
end
elseif sAxis == 'Y' then
if abs(vtN[i]:getY()) > dFaceMaximumNormalComponentOnAxisValue then
nFaceMaximumNormalComponentOnAxis = i - 1
dFaceMaximumNormalComponentOnAxisValue = abs(vtN[i]:getY())
end
elseif sAxis == 'Z' then
if abs(vtN[i]:getZ()) > dFaceMaximumNormalComponentOnAxisValue then
nFaceMaximumNormalComponentOnAxis = i - 1
dFaceMaximumNormalComponentOnAxisValue = abs(vtN[i]:getZ())
end
else
local sErr = 'Error : FindFaceBestOrientedAsAxis - unknown axis name'
EgtOutLog( sErr)
return false, sErr
end
end
return nFaceMaximumNormalComponentOnAxis, vtN[ nFaceMaximumNormalComponentOnAxis + 1], ptC[ nFaceMaximumNormalComponentOnAxis + 1]
end
---------------------------------------------------------------------
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap)
local sWarn
@@ -4552,7 +4587,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
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)
local bForceSideMill = Proc.Prc == 30 and EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 and ( ( Proc.Fct == 3 and bIsU) or ( Proc.Fct == 2))
-- se L30 e paramtetro Q03=2 forzo la fresatura di lato
local bForceSideMill = Proc.Prc == 30 and EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 and ( Proc.Fct == 4 or Proc.Fct == 3 or Proc.Fct == 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
@@ -5134,57 +5170,86 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local bIs3Faces = true
local bOrthoFacesMaster = nil
local bSetOpenBorders = nil
if Proc.Fct == 2 or bForceSideMill then
bIs3Faces = false
bOrthoFacesMaster = true
bSetOpenBorders = true
end
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId,
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders)
if nOk == -2 then
if not sMchFind then
sMchFind = sMchFindBackUp
end
sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown)
if not sPocketing then
local sErr2 = 'Error : '..sMchFind..' not found in library'
EgtOutLog( sErr2)
return false, sErr2
-- trovo la faccia con normale più inclinata verso Y
local nFacApproxY, vtNFacApproxY, ptCFacApproxY = FindFaceBestOrientedAsAxis( Proc, 'Y')
-- se Q03 = 2 e
-- 3 facce a L, oppure
-- 3 facce non a L ma con una faccia favorevole a Y, oppure
-- 4 facce
-- lancio la MakePocket ( lavorazione solo da un lato, fondo della tasca la faccia più favorevole a Y)
if bForceSideMill and (( Proc.Fct == 3 and bIsL) or ( Proc.Fct == 3 and abs( vtNFacApproxY:getY()) >= 0.707 ) or Proc.Fct == 4) then
nFacInd, vtN, ptC = nFacApproxY, vtNFacApproxY, ptCFacApproxY
local tvtNx = {}
tvtNx[2] = vtN
local ptPs = ptC
dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd)
dCollSic = CalcCollisionSafety( tvtNx[2])
local dMachDepth = dFacElev + dCollSic
-- valuto la massima profondità di lavorazione dell'utensile. Se non arriva emetto warning e lavoro fino a dove è possibile.
local _, _, dDimMin = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
local _, sPocketing = VerifyPocket( Proc, dDimMin, dFacElev, nil, sMyMchFind)
bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap)
if not bOk then return false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
bTryWithBlades = false
sWarn = sErr
elseif nOk < 0 then
return false, sErr
elseif nOk > 0 then
bTryWithBlades = false
sWarn = sErr
-- se ho antischeggia con fresa le inserisco
-- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then
if nChamfer < 2 and nQAntisplintResult == 2 then
local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, bMillDown, dDiamTool, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
bOneShot, nFirstMachId)
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
end
-- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0
if nContourSmallTool > 0 then
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown,
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
dDepth, bOneShotm)
if not bOk then return false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
-- in tutti gli altri casi lancio la MakeByPockets (lavorazione singola o doppia contrapposta, fondo della tasca una faccia fittizia perpendicolare al lato lungo)
else
-- se 2 facce setto i parametri corretti per la MakeByPockets
if bForceSideMill and Proc.Fct == 2 then
bIs3Faces = false
bOrthoFacesMaster = true
bSetOpenBorders = true
end
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId,
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders)
if nOk == -2 then
if not sMchFind then
sMchFind = sMchFindBackUp
end
sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown)
if not sPocketing then
local sErr2 = 'Error : '..sMchFind..' not found in library'
EgtOutLog( sErr2)
return false, sErr2
end
bTryWithBlades = false
sWarn = sErr
elseif nOk < 0 then
return false, sErr
elseif nOk > 0 then
bTryWithBlades = false
sWarn = sErr
-- se ho antischeggia con fresa le inserisco
-- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then
if nChamfer < 2 and nQAntisplintResult == 2 then
local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, bMillDown, dDiamTool, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
bOneShot, nFirstMachId)
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
end
-- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0
if nContourSmallTool > 0 then
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown,
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
dDepth, bOneShotm)
if not bOk then return false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
end
end
bOk = true
end
bOk = true
end
-- 03/09/2020 da conferma di Fabio Squaratti: Per ora solo sulla feature 016:
-- se ha fallito la fresatura (qua sopra) allora di defalut ( anche se il flag Q della lama è disattivato) prima provo la lama