DataBeam :

- migliorato ordinamento features
- in LapJoint gestione ElleShape con 4 lati
- in LongCut gestione taglio con lama.
This commit is contained in:
Dario Sassi
2019-11-08 07:21:42 +00:00
parent 37c3496bae
commit 9be8d4b1b7
4 changed files with 155 additions and 23 deletions
+104 -5
View File
@@ -1,4 +1,4 @@
-- ProcessLongCut.lua by Egaltech s.r.l. 2019/10/06
-- ProcessLongCut.lua by Egaltech s.r.l. 2019/11/07
-- Gestione calcolo taglio longitudinale per Travi
-- Tabella per definizione modulo
@@ -80,8 +80,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
local b3Raw = EgtGetRawPartBBox( nRawId)
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
local dLen = Proc.Box:getDimX()
local dWidth = sqrt( Proc.Box:getDimY() * Proc.Box:getDimY() + Proc.Box:getDimZ() * Proc.Box:getDimZ())
local _, dLen, dWidth = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT)
-- limitazioni su inizio e fine derivanti da altre facce
local bLimXmin = false
local bLimXmax = false
@@ -107,8 +106,108 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
end
local sWarn
-- Se non è sotto : lavorazione Long2Cut
if nSide ~= - 1 then
-- 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') == 2 then
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dToolDiam = 0
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0)
-- determino numero di parti
local dStartAccDist = BD.LONGCUT_ENDLEN
local dEndAccDist = BD.LONGCUT_ENDLEN
local nC = ceil( ( dLen - dStartAccDist - dEndAccDist) / BD.LONGCUT_MAXLEN)
local dC = 0
if nC > 0 then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
nC = nC + 2
else
if dLen > min( dStartAccDist, dEndAccDist) then
nC = 2
dStartAccDist = dLen/2
dEndAccDist = dStartAccDist
else
nC = 1
dStartAccDist = 0
dEndAccDist = 0
end
end
-- determino l'utilizzo della faccia
local nFaceUse = EgtIf( abs( vtN:getY()) > 0.01, MCH_MILL_FU.ORTHO_TOP, EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT))
local nFaceUse2 = EgtIf( abs( vtN:getY()) > 0.01, MCH_MILL_FU.ORTHO_DOWN, EgtIf( bFront, MCH_MILL_FU.ORTHO_FRONT, MCH_MILL_FU.ORTHO_BACK))
-- si percorrono i lati alto e basso della faccia
local nM = 0
for i = 1, nC do
-- Posizione braccio portatesta
local nSCC
--if bFront then
nSCC = EgtIf( ( i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
--else
-- nSCC = EgtIf( ( i == 1 or i == nC - 1), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
--end
-- ciclo sulle passate
local d
local dOffset = ( dWidth + BD.DIM_STRIP) / 2 ;
local dLioTang = 0
local dLioPerp = ( dWidth - BD.DIM_STRIP) / 2 + BD.CUT_SIC ;
for k = 1, 2 do
-- inserisco le parti di lavorazione
nM = nM + 1
local sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
local nMchFId = EgtAddMachining( sNameF, sCutting)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCutting
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- limito opportunamente la lavorazione
local dSal = EgtIf( i == nC, 0, - dEndAccDist - ( nC - i - 1) * dC)
local dEal = EgtIf( i == 1, 0, - dStartAccDist - ( i - 2) * dC)
if ( not bFront and k == 1) or ( bFront and k == 2) then
dSal, dEal = dEal, dSal
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
-- imposto offset radiale
EgtSetMachiningParam( MCH_MP.OFFSR, dOffset)
-- imposto attacco/uscita
EgtSetMachiningParam( MCH_MP.LITANG, dLioTang)
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp)
EgtSetMachiningParam( MCH_MP.LOTANG, dLioTang)
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()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
end
-- se altrimenti non è sotto : lavorazione Long2Cut
elseif nSide ~= - 1 then
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Long2Cut')
if not sMilling then