DataBeam :
- aggiunta gestione tagli longitudinali limitati e molto corti.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
-- ProcessLongCut.lua by Egaltech s.r.l. 2020/01/13
|
||||
-- ProcessLongCut.lua by Egaltech s.r.l. 2020/01/28
|
||||
-- Gestione calcolo taglio longitudinale per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -73,6 +73,65 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
|
||||
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
|
||||
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
|
||||
-- cerco la svuotatura opportuna
|
||||
local sPocketing = ML.FindPocketing( 'OpenPocket', Proc.Box:getDimX())
|
||||
if not sPocketing then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sPocketing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth)
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
|
||||
-- imposto attacco per tasca aperta
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
||||
local sWarn
|
||||
if dFacElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxDepth - dFacElev)
|
||||
dFacElev = dMaxDepth
|
||||
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dFacElev, 1) .. ';'
|
||||
sNotes = sNotes .. 'VMRS=0;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
-- provo ad allargare leggermente la tasca
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
@@ -219,6 +278,10 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
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)
|
||||
end
|
||||
-- determino la massima elevazione
|
||||
local dElev = 0
|
||||
local ptT1 = b3Raw:getMax()
|
||||
|
||||
Reference in New Issue
Block a user