DataBeam :

- modifiche per tagli longitudinali doppi con lama (anche con testa da sotto).
This commit is contained in:
DarioS
2021-10-04 14:51:27 +02:00
parent 66018dd4df
commit 49b428de15
+108 -48
View File
@@ -1,4 +1,4 @@
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2021/09/14
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2021/10/01
-- Gestione calcolo doppio taglio longitudinale per Travi
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
-- 2021/06/29 Corretta gestione caso equivalente a due smussi.
@@ -217,16 +217,16 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
-- se lama abilitata e non c'è testa da sotto
if bUseBlade and not bDown_Head then
if nSide >= 0 then
if nSide > 0 and ( ( vtN1 and vtN1:getZ() >= -0.0157) or ( vtN2 and vtN2:getZ() >= -0.0157)) then
if nSide > 0 and ( ( vtN1 and vtN1:getZ() >= -0.0175) or ( vtN2 and vtN2:getZ() >= -0.0175)) then
bCanUseBlade = true
elseif nSide == 0 then
if ( ( vtN1 and vtN1:getZ() >= -0.0157) or ( vtN2 and vtN2:getZ() >= -0.0157)) then
if ( ( vtN1 and vtN1:getZ() >= -0.0175) or ( vtN2 and vtN2:getZ() >= -0.0175)) then
bCanUseBlade = true
elseif not bConvex and nOrd and (( nOrd == 1 and bFront) or ( nOrd == 2 and not bFront)) and ( vtN1 and vtN1:getZ() >= -0.0157) then
elseif not bConvex and nOrd and (( nOrd == 1 and bFront) or ( nOrd == 2 and not bFront)) and ( vtN1 and vtN1:getZ() >= -0.0175) then
bCanUseBlade = true
elseif not bConvex and nOrd and (( nOrd == 2 and bFront) or ( nOrd == 1 and not bFront)) and ( vtN1 and vtN1:getZ() >= -0.5) then
bCanUseBlade = true
elseif bConvex and ( vtN1 and vtN1:getZ() >= -0.0157) then
elseif bConvex and ( vtN1 and vtN1:getZ() >= -0.0175) then
bCanUseBlade = true
end
end
@@ -238,7 +238,7 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
bCanUseBlade = true
end
else
if vtN2:getZ() >= -0.0157 then
if vtN2:getZ() >= -0.0175 then
bCanUseBlade = true
end
end
@@ -261,7 +261,7 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
bCanUseUnderBlade = true
end
-- se faccia da sotto o di lato ma con versore Z negativo abilito la lavorazione con lame mixate
if nSide <= 0 and ( ( vtN1 and vtN1:getZ() <= 0.0175) or ( vtN2 and vtN2:getZ() <= 0.0175)) then
if nSide <= 0 and ( ( vtN1 and vtN1:getZ() <= -0.0175) or ( vtN2 and vtN2:getZ() <= -0.0175)) then
bCanUseUnderBlade = true
end
-- se faccia da sopra o di lato ma con versore Z negativo verifico che abbia un angolo compatibile per non avere extracorsa
@@ -514,6 +514,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
nSCC = EgtIf( ( i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
end
local nCountToShift = 0
local bChangeBlade
local bMachDownGen
-- ciclo sulle due facce
for j = 1, #vOrd do
local nIdPrev
@@ -561,12 +563,89 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- ciclo sulle passate
for k = 1, 2 do
local dLioPerp = ( vWidth[vOrd[j]] - dDimStrip) / 2 + BD.CUT_SIC
-- inserisco le parti di lavorazione
nM = nM + 1
local sNameF
local nMchFId
local sCuttingName
local bMachDown
-- if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then
if bCanUseBlade and not bCanUseUnderBlade then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCutting)
sCuttingName = sCutting
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp
-- elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then
elseif bCanUseUnderBlade and not bCanUseBlade then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
sCuttingName = sCuttingDn
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistDn
dStartAccDist = dStartAccDistDn
bMachDown = true
-- entrambe le possibilità di lama
else
-- se di fronte e prima faccia o dietro e seconda faccia, sta lavorando quella più in basso in Z (posizione)
if ( ( bFront and j == 1) or ( not bFront and j == 2)) and k == 1 then
-- prediligo quella inferiore
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
sCuttingName = sCuttingDn
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistDn
dStartAccDist = dStartAccDistDn
bMachDown = true
-- se di fronte e prima faccia o dietro e seconda faccia, sta lavorando quella più in basso in Z (posizione)
elseif ( ( bFront and j == 1) or ( not bFront and j == 2)) and k == 2 then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
sCuttingName = sCuttingDn
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistDn
dStartAccDist = dStartAccDistDn
bMachDown = true
-- se di fronte e seconda faccia o dietro e prima faccia, sta lavorando la faccia più in alto in Z (posizione)
elseif ( ( bFront and j == 2) or ( not bFront and j == 1)) and k == 1 then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCutting)
sCuttingName = sCutting
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp
-- se di fronte e seconda faccia o dietro e prima faccia, sta lavorando la faccia più in alto in Z (posizione)
elseif ( ( bFront and j == 2) or ( not bFront and j == 1)) and k == 2 then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCutting)
sCuttingName = sCutting
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp
end
end
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCuttingName
EgtOutLog( sErr)
return false, sErr
end
if j == 1 and k == 1 then
bMachDownGen = bMachDown
else
if bMachDownGen ~= bMachDown then
bChangeBlade = true
end
end
local bAddOpposite = true
local dAddExtraPerp = 0
if ( nFaceSide == -1 and abs(vtN[vOrd[j]]:getY()) >= 0.2079) or ( nFaceSide == 0 and abs(vtN[vOrd[j]]:getZ()) >= 0.2588) then
if ( nFaceSide == -1 and abs(vtN[vOrd[j]]:getY()) >= 0.2079) then
bAddOpposite = false
end
if nFaceSide == 1 or ( nFaceSide == -1 and k == 1) then
if ( nFaceSide == 0 and abs(vtN[vOrd[j]]:getZ()) >= 0.2588) then
bAddOpposite = false
end
if ( nFaceSide == 1 and not bMachDown) or ( nFaceSide == -1 and bMachDown) or ( nFaceSide == -1 and k == 1) then
bAddOpposite = false
end
if bAddOpposite then
@@ -578,41 +657,14 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dAddExtraPerp = b3Solid:getMax():getY() - b3Fac:getMax():getY()
end
elseif nFaceSide == 0 then
if ( vtN[vOrd[j]]:getZ() >= 0 and k == 1) or ( vtN[vOrd[j]]:getZ() < 0 and k == 2) then
dAddExtraPerp = b3Fac:getMin():getZ() - b3Solid:getMin():getZ()
else
if ( ( bFront and j == 1) or ( not bFront and j == 2)) and vtN[vOrd[j]]:getZ() <= 0 and k == 2 then
dAddExtraPerp = b3Solid:getMax():getZ() - b3Fac:getMax():getZ()
elseif ( ( bFront and j == 2) or ( not bFront and j == 1)) and vtN[vOrd[j]]:getZ() >= 0 and k == 1 then
dAddExtraPerp = b3Fac:getMin():getZ() - b3Solid:getMin():getZ()
end
end
dLioPerp = dLioPerp + dAddExtraPerp
end
-- inserisco le parti di lavorazione
nM = nM + 1
local sNameF
local nMchFId
if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCutting)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCutting
EgtOutLog( sErr)
return false, sErr
end
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp
elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCuttingDn
EgtOutLog( sErr)
return false, sErr
end
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistDn
dStartAccDist = dStartAccDistDn
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, vOrd[j]-1}})
-- limito opportunamente la lavorazione
@@ -622,15 +674,25 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dSal, dEal = dEal, dSal
end
if bCanUseBlade and bCanUseUnderBlade then
-- if bCanUseBlade and nSide == -1 then
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- else
-- EgtSetMachiningParam( MCH_MP.INVERT, true)
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- dSal, dEal = dEal, dSal
-- end
-- -- imposto uso della faccia
-- EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
if bCanUseBlade and nSide == -1 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
else
EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
dSal, dEal = dEal, dSal
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
end
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
elseif bCanUseUnderBlade then
if nSide ~= 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
@@ -638,11 +700,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
else
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
if bCanUseBlade and nSide == -1 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
end
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
@@ -657,8 +719,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -673,8 +733,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
else
nIdNext = nMchFId
end
-- se alla fine della seconda porzione della seconda faccia sposta la prima dopo la econda
if nIdPrev and nIdNext and k == 2 then
-- alla fine della seconda porzione della seconda faccia se non ho cambiato utensile tra le facce sposta la prima dopo la seconda
if nIdPrev and nIdNext and k == 2 and not bChangeBlade then
EgtRelocateGlob( nIdPrev, nIdNext, GDB_IN.AFTER)
end
end