|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
|
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07
|
|
|
|
|
-- Gestione calcolo profilo libero per Travi
|
|
|
|
|
-- 2022/08/23 Aggiunta la funzione MakeByMark per la gestione del caso P13=10
|
|
|
|
|
|
|
|
|
|
-- Tabella per definizione modulo
|
|
|
|
|
local ProcessFreeContour = {}
|
|
|
|
@@ -233,14 +234,16 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
|
local dDepth = abs( EgtCurveThickness( AuxId))
|
|
|
|
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
|
|
|
|
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
|
|
|
|
|
local bToolInv = ( vtExtr:getZ() < -0.1)
|
|
|
|
|
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
|
|
|
|
local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5)
|
|
|
|
|
-- verifico se in testa o coda
|
|
|
|
|
local bHead = Proc.Head
|
|
|
|
|
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
|
|
|
|
|
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
|
|
|
|
|
-- recupero la lavorazione
|
|
|
|
|
local sMilling = ML.FindMilling( 'FreeContour')
|
|
|
|
|
-- recupero la lavorazione
|
|
|
|
|
local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1)
|
|
|
|
|
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
|
|
|
|
local sMilling = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, bTopHead, bDownHead)
|
|
|
|
|
if not sMilling then
|
|
|
|
|
local sErr = 'Error : FreeContour not found in library'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
@@ -688,6 +691,76 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
local function MakeByMark( Proc, nRawId, b3Raw, nPartId)
|
|
|
|
|
-- ingombro del pezzo
|
|
|
|
|
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
|
|
|
|
|
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
|
|
|
|
if not b3Solid then
|
|
|
|
|
local sErr = 'Error : part box not found'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
-- recupero e verifico l'entità curva
|
|
|
|
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
|
|
|
|
if AuxId then AuxId = AuxId + Proc.Id end
|
|
|
|
|
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
|
|
|
|
|
local sErr = 'Error : missing profile geometry'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
-- recupero i dati della curva e del profilo
|
|
|
|
|
local dDepth = abs( EgtCurveThickness( AuxId))
|
|
|
|
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
|
|
|
|
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
|
|
|
|
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
|
|
|
|
|
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
|
|
|
|
|
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
-- abilitazione lavorazione da sotto
|
|
|
|
|
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
|
|
|
|
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
|
|
|
|
|
-- recupero la lavorazione
|
|
|
|
|
local sMillType = 'Text'
|
|
|
|
|
--local sMchExt = EgtIf( bMillDown, '_H2', '')
|
|
|
|
|
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
|
|
|
|
|
if not sMilling then
|
|
|
|
|
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
-- inserisco la lavorazione
|
|
|
|
|
local sName = 'FreeMark_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
|
|
|
|
local nMchId = EgtAddMachining( sName, sMilling)
|
|
|
|
|
if not nMchId then
|
|
|
|
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
EgtSetInfo( nMchId, 'Part', Proc.PartId)
|
|
|
|
|
-- aggiungo geometria
|
|
|
|
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
|
|
|
|
-- se estrusione da sotto, inverto direzione fresa
|
|
|
|
|
if bToolInv then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
|
|
|
|
end
|
|
|
|
|
-- posizione braccio porta testa
|
|
|
|
|
local nSCC = MCH_SCC.ADIR_ZP
|
|
|
|
|
if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
|
|
|
|
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
|
|
|
|
-- eseguo
|
|
|
|
|
if not EgtApplyMachining( true, false) then
|
|
|
|
|
local _, sErr = EgtGetLastMachMgrError()
|
|
|
|
|
EgtSetOperationMode( nMchId, false)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
-- Applicazione della lavorazione
|
|
|
|
|
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
@@ -698,7 +771,15 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
|
return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
|
-- altrimenti contornatura
|
|
|
|
|
else
|
|
|
|
|
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
|
-- recupero il tipo di lavorazione
|
|
|
|
|
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
|
|
|
|
|
-- se marcatura
|
|
|
|
|
if nCntType == 10 then
|
|
|
|
|
return MakeByMark( Proc, nRawId, b3Raw, nPartId)
|
|
|
|
|
-- se fresatura
|
|
|
|
|
else
|
|
|
|
|
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|