DataBeam :

- piccoli aggiustamenti e affinamenti.
This commit is contained in:
DarioS
2022-06-27 08:38:21 +02:00
parent 84f2d30869
commit cc22dbf589
12 changed files with 290 additions and 322 deletions
+28 -76
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/06/15
-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/06/25
-- Gestione calcolo mezzo-legno per Travi
-- 2019/10/08 Agg. gestione OpenPocket.
-- 2021/01/24 Con sega a catena ora sempre impostato asse A.
@@ -42,7 +42,6 @@
-- 2022/04/28 Lavorazione BH forzata sempre OneWay.
-- 2022/05/04 Corretta classificazione due facce sotto. Modificati criteri assegnazione due facce alla coda.
-- 2022/05/24 Miglioramenti vari per BH, compreso controlli per lavorazione da sotto.
-- 2022/05/31 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs per essere richiamate dalla ProcessSplit per taglio sega a catena in sezioni alte e larghe.
-- 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, MakeMoreFaces, Classify.
@@ -259,36 +258,6 @@ local function TestElleShape4( Proc)
end
end
---------------------------------------------------------------------
function ProcessLapJoint.GetChainSawBlockedAxis( nInd)
if BD.GetChainSawBlockedAxis then
return BD.GetChainSawBlockedAxis( nInd)
else
if nInd == 1 then
return EgtIf( BD.C_SIMM, 'A=90', 'A=90')
else
return EgtIf( BD.C_SIMM, 'A=0', 'A=0')
end
end
end
---------------------------------------------------------------------
function ProcessLapJoint.GetChainSawInitAngs( vtN, vtO, nInd)
if BD.GetChainSawInitAngs then
return BD.GetChainSawInitAngs( vtN, vtO, nInd)
else
if BD.C_SIMM then
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
else
if nInd == 1 then
return ''
else
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
end
end
end
end
---------------------------------------------------------------------
local function VerifyChainSaw( Proc, dMinDim, dMaxDim)
local bUseChainSaw = false
@@ -3062,8 +3031,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, 0, - dSawWidth / 2))
end
-- imposto angolo 3° asse rot e eventuale angolo suggerito per inizio
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 1))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 1))
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
@@ -3085,8 +3054,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
@@ -3130,8 +3099,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
-- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtNL, vtOrtho, 1))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtNL, vtOrtho, 1))
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
@@ -3161,8 +3130,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtNL, vtOrtho, 2))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtNL, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
@@ -4358,37 +4327,20 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
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
-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa.
local function FindFaceBestOrientedAsAxis( Proc, vtAx)
local nFaceIndMax = 0
local dMaxComp = 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
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
local dComp = abs( vtN * vtAx)
if dComp > dMaxComp then
nFaceIndMax = i -1
dMaxComp = dComp
end
end
return nFaceMaximumNormalComponentOnAxis, vtN[ nFaceMaximumNormalComponentOnAxis + 1], ptC[ nFaceMaximumNormalComponentOnAxis + 1]
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFaceIndMax, GDB_ID.ROOT)
return nFaceIndMax, ptC, vtN
end
---------------------------------------------------------------------
@@ -4521,8 +4473,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
end
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, vtOrtho, 1))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
@@ -4542,8 +4494,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, vtOrtho, 2))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
@@ -4588,8 +4540,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)
-- 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 parametro Q03=2 forzo la fresatura di lato
local bForceSideMill = 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
@@ -5165,14 +5117,14 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- o passare subito dalla lavorazione con lama/sega catena
if ( bTrySidePocketAtFirst and Proc.Fct == 3 and bIsU) or bForceSideMill then
-- lavoro con svuotature (singola o doppia contrapposta)
local sMyMchFind = 'Pocket'
local sMyMchFind = EgtIf( bForceSideMill, 'OpenPocket', 'Pocket')
local dDiamTool = 100
local nPathInt, nSurfInt, bOneShot, nFirstMachId
local bIs3Faces = true
local bOrthoFacesMaster = nil
local bSetOpenBorders = nil
-- trovo la faccia con normale più inclinata verso Y
local nFacApproxY, vtNFacApproxY, ptCFacApproxY = FindFaceBestOrientedAsAxis( Proc, 'Y')
local nFacApproxY, ptCFacApproxY, vtNFacApproxY = FindFaceBestOrientedAsAxis( Proc, Y_AX())
-- se Q03 = 2 e
-- 3 facce a L, oppure
-- 3 facce non a L ma con una faccia favorevole a Y, oppure