DataBeam :

- migliorie ai tagli longitudinali singoli
- alcune correzioni e migliorie ai tagli singoli.
This commit is contained in:
Dario Sassi
2020-09-24 10:18:44 +00:00
parent 162d3870f2
commit 56e5cfc517
3 changed files with 174 additions and 43 deletions
+10 -2
View File
@@ -276,7 +276,11 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
if bHorizCut then
vtOrthoO = Z_AX()
elseif vtN:getY() > -0.02 then
vtOrthoO = Y_AX()
if not Proc.Head then
vtOrthoO = -Y_AX()
else
vtOrthoO = Y_AX()
end
else
vtOrthoO = -Y_AX()
end
@@ -335,7 +339,11 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
elseif Proc.Tail and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
vtOrthoO = -X_AX()
elseif vtN:getY() > -0.02 then
vtOrthoO = Y_AX()
if not Proc.Head then
vtOrthoO = -Y_AX()
else
vtOrthoO = Y_AX()
end
else
vtOrthoO = -Y_AX()
end
+161 -38
View File
@@ -1,4 +1,4 @@
-- ProcessLongCut.lua by Egaltech s.r.l. 2020/06/11
-- ProcessLongCut.lua by Egaltech s.r.l. 2020/09/17
-- Gestione calcolo taglio longitudinale per Travi
-- Tabella per definizione modulo
@@ -14,6 +14,7 @@ EgtOutLog( ' ProcessLongCut started', 1)
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
local dLimMinPiece = BD.LEN_SHORT_PART or 1000
---------------------------------------------------------------------
-- Riconoscimento della feature
function ProcessLongCut.Identify( Proc)
@@ -36,7 +37,7 @@ function ProcessLongCut.Classify( Proc)
end
---------------------------------------------------------------------
local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam)
local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim)
-- inserisco la lavorazione
local sNameF = 'L2C_' .. ( EgtGetName( nId) or tostring( nId)) .. '_' .. tostring( nFac)
local nMchFId = EgtAddMachining( sNameF, sMilling)
@@ -47,15 +48,23 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam)
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nId, nFac}})
-- lato di lavoro e inversione
EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- uso della faccia
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
if nSide == -2 then
nFaceUse = MCH_MILL_FU.PARAL_BACK
elseif nSide == 2 then
nFaceUse = MCH_MILL_FU.PARAL_FRONT
local nFaceUse
if bForcedLim then
nFaceUse = MCH_MILL_FU.ORTHO_LEFT
-- lato di lavoro e inversione
EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
else
nFaceUse = MCH_MILL_FU.PARAL_DOWN
if nSide == -2 then
nFaceUse = MCH_MILL_FU.PARAL_BACK
elseif nSide == 2 then
nFaceUse = MCH_MILL_FU.PARAL_FRONT
end
-- lato di lavoro e inversione
EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
end
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- annullo offset radiale
@@ -137,6 +146,7 @@ end
function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
local _, dLen, dWidth = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT)
@@ -162,11 +172,30 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
nSide = -2
elseif vtN:getY() > 0.7071 then
nSide = 2
end
end
-- determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0)
-- per Dario:
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = 5 or 100000 -- qua deve ricevere la distanza dal pezzo successivo, nil in caso non c'è il pezzo
local bForcedLim
local sWarn
-- Se non limitato e da sopra e richiesto con doppio taglio di lama
if not bLimXmin and not bLimXmax and nSide == 1 and EgtGetInfo( Proc.Id, 'Q05', 'i') == 1 then
----------------------------------------------------------------------------------------------------------------------------------------
-- 2020/09/15 Fabio Squaratti: se sono attivi entrambe i Q05 (lavorare con lama) e Q07 (lavorare con fresa di fianco anche da sopra)
-- allora vince il Q7, cioè si utilizza la fresa di fianco ( per i tagli da sopra)
-- 2020/09/17 Fabio Squaratti: se lavorazione con fresa di fianco e se ci sono delle facce laterali, l'utensile deve arrivare
-- fino al punto più vicino della faccia laterale (prima l'arretramento era sempre del rggio utensile).
-- Questo viene fatto se Q07=1 o fresa da sotto
----------------------------------------------------------------------------------------------------------------------------------------
local bUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i') == 1
local nUseMillOnSide = EgtGetInfo( Proc.Id, 'Q07', 'i') or 0
-- se entrambe i Q sono attivi, disabilito lama
if nUseMillOnSide > 0 then bUseBlade = false end
-- Se non limitato e da sopra e richiesto con doppio taglio di lama e superiore al limite minimo
if not bLimXmin and not bLimXmax and nSide == 1 and bUseBlade and b3Solid:getDimX() > dLimMinPiece - 1 then
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then
@@ -184,8 +213,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0)
-- se la distanza dal pezzo successivo è inferiore della metà lama, dò un warning
if dDistToNextPiece < dToolDiam/2 then
sWarn = 'Warning on saw cut : Cut machining can damage next piece'
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end
-- determino numero di parti
local dStartAccDist = BD.LONGCUT_ENDLEN
local dEndAccDist = BD.LONGCUT_ENDLEN
@@ -258,9 +290,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
end
end
end
-- se altrimenti non è sotto : lavorazione Long2Cut
elseif nSide ~= - 1 then
elseif nSide ~= - 1 and nUseMillOnSide == 0 then
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Long2Cut')
if not sMilling then
@@ -278,6 +309,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se la fine non è limitata e ho un pezzo successivo più distante da metà raggio. setto la fine come limitata
if dDistToNextPiece < dToolDiam/2 and not bLimXmin then
bForcedLim = true
bLimXmin = true
end
-- se chiuso e corto, applico svuotatura con fresa opportuna
if bLimXmin and bLimXmax and Proc.Box:getDimX() < 2 * dToolDiam then
return MakeByPocketing( Proc, nPhase, nRawId, nPartId)
@@ -290,8 +326,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
local ptT2 = ptT1 - Y_AX() * b3Raw:getDimY()
local dDist2 = ( ptT2 - ptC) * vtN
dElev = max( dElev, dDist2)
-- determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0)
-- determino gli estremi
local dStartDist = 0
local dStartAccDist = BD.LONGCUT_ENDLEN
@@ -350,6 +384,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
local nFaceUse = EgtIf( abs( vtN:getY()) > 0.01, MCH_MILL_FU.ORTHO_DOWN, EgtIf( bFront, MCH_MILL_FU.ORTHO_FRONT, MCH_MILL_FU.ORTHO_BACK))
-- si percorre il lato basso della faccia
local nM = 0
local nCountMilHead = 0
for i = 1, nC do
-- Posizione braccio portatesta
local nSCC
@@ -370,7 +405,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
for k = nO, 1, -1 do
-- inserisco le parti di lavorazione
nM = nM + 1
local sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
local sNameF = 'L2CH_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
@@ -406,30 +441,64 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
-- eventuale lavorazione della faccia limitante l'inizio
if i == 1 and not bStartFixed then
local vtIni = EgtIf( bFront, X_AX(), -X_AX())
for i = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i, GDB_ID.ROOT)
if vtIni * vtN > 0 then
MakeSideFace( Proc.Id, i, nSide, sMilling, dToolDiam)
for j = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
if vtIni * vtN > 0 and nCountMilHead < 2 then
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam)
nCountMilHead = nCountMilHead + 1
end
end
if bForcedLim and nCountMilHead < 1 then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim)
nCountMilHead = nCountMilHead + 1
end
end
end
-- eventuale lavorazione della faccia limitante la fine
if not bEndFixed then
local vtFin = EgtIf( bFront, -X_AX(), X_AX())
for i = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i, GDB_ID.ROOT)
if vtFin * vtN > 0 then
MakeSideFace( Proc.Id, i, nSide, sMilling, dToolDiam)
for j = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
if vtFin * vtN > 0 and nCountMilHead < 2 then
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam)
nCountMilHead = nCountMilHead + 1
end
end
if bForcedLim and nCountMilHead < 2 then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim)
nCountMilHead = nCountMilHead + 1
end
end
-- altrimenti è sotto : lavorazione Long2CutDown
-- altrimenti è sotto ( lavorazione Long2CutDown) o da sopra ma con fresa di fianco ( lavorazione Long2CutSide)
else
-- da Analisi con Fabio Squaratti 15/09/2020
-- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco
local bRemoveToolRadius
-- se nExtendMach = 0 la lavorazione rimane arretrata dalla fine della faccia del raggio utensile
-- se nExtendMach = 1 la lavorazione arriva fino alla fine faccia (se non ha facce limite) ignorando il pezzo successivo
-- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite)
local nExtendMach
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Long2CutDown')
local sMilling
local sPrefix
if nSide ~= - 1 then
sMilling = ML.FindMilling( 'Long2CutSide')
sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then
bRemoveToolRadius = true
-- nExtendMach = 0 -- arretro la lavorazione del raggio utensile (se non ha facce limite)
end
-- lavorazione da sotto
else
sMilling = ML.FindMilling( 'Long2CutDown')
sPrefix = 'L2CD_'
nExtendMach = 1
if nUseMillOnSide ~= 1 then
nExtendMach = 2 -- arretro il minimo indispensabile per non segnare il pezzo successivo (se non ha facce limite)
end
end
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
@@ -447,18 +516,36 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
dThDiam = EgtTdbGetCurrToolThDiam() or dThDiam
end
end
local dDistToEnd = dToolDiam / 2
-- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino al limite se l'elevazione della faccia è minore del raggio utensile
if nUseMillOnSide <= 1 or nSide == -1 then
-- calcolo l'elevazione della faccia principale
local dFacElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
if dFacElev < dDistToEnd then
dDistToEnd = sqrt( ( ( dToolDiam / 2) * ( dToolDiam / 2)) - ( ( dToolDiam / 2 - dFacElev) * (dToolDiam / 2 - dFacElev)))
end
end
-- se la fine è già limitata allora setto per arretrare del raggio utensile
if bLimXmin then
nExtendMach = 0
-- se la fine non è limitata e ho un pezzo successivo distante meno di metà raggio. setto la fine come limitata
elseif dDistToNextPiece < dDistToEnd and nExtendMach ~= 1 then
bLimXmin = true
end
-- larghezza faccia
local _, _, dWidth = BL.GetFaceHvRefDim( Proc.Id, 0)
-- aggiuntivo sull'affondamento
local dAgg = BD.CUT_EXTRA
-- determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0)
-- determino gli estremi
local dStartDist = 0
local dStartAccDist = BD.LONGCUT_ENDLEN
local bStartFixed = true
if ( bLimXmin and bFront) or ( bLimXmax and not bFront) then
dStartDist = dToolDiam / 2
if ( bLimXmin and bFront) then
dStartDist = EgtIf( nExtendMach == 2, dDistToEnd - dDistToNextPiece + 0.5, dDistToEnd)
else
dStartDist = dDistToEnd
end
dStartAccDist = BD.LONGCUT_MAXLEN
bStartFixed = false
end
@@ -466,7 +553,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
local dEndAccDist = BD.LONGCUT_ENDLEN
local bEndFixed = true
if ( bLimXmin and not bFront) or ( bLimXmax and bFront) then
dEndDist = dToolDiam / 2
if ( bLimXmin and not bFront) then
dEndDist = EgtIf( nExtendMach == 2, dDistToEnd - dDistToNextPiece + 0.5, dDistToEnd)
else
dEndDist = dDistToEnd
end
dEndAccDist = BD.LONGCUT_MAXLEN
bEndFixed = false
end
@@ -509,6 +600,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
end
-- ciclo sulle parti
local nM = 0
local bMakeMillHeadEnd
local bMakeMillHeadStart
for j = 1, nC do
-- Limitazioni della lavorazione
local nPos = EgtIf( bFront, j, nC - j + 1)
@@ -523,7 +616,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
end
-- inserisco le parti di lavorazione
nM = nM + 1
local sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
local sNameF = sPrefix .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
@@ -543,7 +636,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
local dCollSic = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( vtN:getY() / vtN:getZ()) - 3)
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
-- local dCollSic = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( vtN:getY() / vtN:getZ()) - 3)
local dCollSic = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( vtN:getY() / vtN:getZ()))
if dWidth + dAgg > dMaxDepth - dCollSic then
sWarn = 'Warning in LongCut : depth (' .. EgtNumToString( dWidth + dAgg, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth - dCollSic, 1) .. ')'
end
@@ -555,6 +650,34 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- eventuale lavorazione della faccia limitante la fine
if j == EgtIf( bFront , 1, nC) and not bEndFixed and bRemoveToolRadius then
local vtFin = EgtIf( bFront, -X_AX(), X_AX())
for i = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i, GDB_ID.ROOT)
if vtFin * vtN > 0 and not bMakeMillHeadEnd then
MakeSideFace( Proc.Id, i, nSide, sMilling, dToolDiam)
bMakeMillHeadEnd = true
end
end
if bRemoveToolRadius and not bMakeMillHeadEnd then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bRemoveToolRadius)
end
end
-- eventuale lavorazione della faccia limitante l'inizio
if j == EgtIf( bFront , nC, 1) and not bStartFixed and bRemoveToolRadius then
local vtIni = EgtIf( bFront, X_AX(), -X_AX())
for i = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i, GDB_ID.ROOT)
if vtIni * vtN > 0 and not bMakeMillHeadStart then
MakeSideFace( Proc.Id, i, nSide, sMilling, dToolDiam)
bMakeMillHeadStart = true
end
end
if bRemoveToolRadius and not bMakeMillHeadStart then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bRemoveToolRadius)
end
end
end
end
+3 -3
View File
@@ -1,4 +1,4 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2020/06/16
-- ProcessSplit.lua by Egaltech s.r.l. 2020/09/22
-- Gestione calcolo tagli di separazione per Travi
-- Tabella per definizione modulo
@@ -174,7 +174,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- flag di lavorazione faccia
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_BACK)
-- separazione solo se esiste grezzo successivo con pezzi o scaricabile
local nNextRawId = EgtGetNextRawPart( nRawId)
local bSplit = ( nNextRawId and ( EgtGetPartInRawPartCount( nNextRawId) > 0 or EgtGetRawPartBBox( nNextRawId):getDimX() > BD.MinRaw))
@@ -209,7 +209,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, sNotes, b3Raw)
local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, sNotes, b3Raw)
if not bOk then return false, true, sErr end
end
end