DataBeam :
- sui profili aggiunta lavorazione con fresa da sotto per macchine con testa da sotto (riportata modifica ES in nuova gestione).
This commit is contained in:
+121
-83
@@ -1,4 +1,4 @@
|
||||
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/02/02
|
||||
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/05/24
|
||||
-- Gestione calcolo profilo caudato per Travi
|
||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||
@@ -6,6 +6,7 @@
|
||||
-- 2021/10/12 Portato a 30deg l'angolo limite per fare l'antischeggia.
|
||||
-- 2022/01/26 Migliorato controllo lavorazione con fresa su testa da sotto.
|
||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfCamb = {}
|
||||
@@ -204,6 +205,7 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local sWarn
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -443,9 +445,124 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se il chamfer non è esclusivo continuo con le altre lavorazioni
|
||||
if nChamfer < 2 then
|
||||
-- verifico se necessario lavorare in doppio
|
||||
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||
-- inserisco la lavorazione
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
local sMillingDown
|
||||
if bDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
sWarn = 'Warning : milling from bottom not found in library'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
else
|
||||
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se orizzontale o trovata lavorazione per doppio verticale
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName
|
||||
if bMakeAs then
|
||||
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
else
|
||||
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
end
|
||||
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- se lavorazione da sopra e da sotto
|
||||
if ( nSide == 0) then
|
||||
if vtExtr:getZ() > 0.1 then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- altrimenti lavorazione davanti e dietro
|
||||
else
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
bFinish = true
|
||||
end
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione
|
||||
ModifySideAndInvert( Proc, bHead)
|
||||
end
|
||||
-- se devo fare l'antischeggia in testa
|
||||
if bMakeAs then
|
||||
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
|
||||
EgtSetCurrMachining( nMchId)
|
||||
local dCrvLen = EgtCurveLength( AuxId)
|
||||
if dCrvLen > abs(dMakeAntiSplintOnHead) then
|
||||
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
|
||||
end
|
||||
-- rendo corrente la copia (cioè la lavorazione completa)
|
||||
EgtSetCurrMachining( nMch2Id)
|
||||
nMchId = nMch2Id
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la prima lavorazione
|
||||
local sName
|
||||
if bMakeAs then
|
||||
sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
@@ -553,85 +670,6 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName
|
||||
if bMakeAs then
|
||||
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
else
|
||||
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
end
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- sempre lavorazione da sopra o da sotto
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione
|
||||
ModifySideAndInvert( Proc, bHead)
|
||||
end
|
||||
-- se devo fare l'antischeggia in testa
|
||||
if bMakeAs then
|
||||
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
|
||||
EgtSetCurrMachining( nMchId)
|
||||
local dCrvLen = EgtCurveLength( AuxId)
|
||||
if dCrvLen > abs(dMakeAntiSplintOnHead) then
|
||||
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
|
||||
end
|
||||
-- rendo corrente la copia (cioè la lavorazione completa)
|
||||
EgtSetCurrMachining( nMch2Id)
|
||||
nMchId = nMch2Id
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se non da sotto e parametro Q abilitato, inserisco lavorazione finitura angolo
|
||||
if ( nSide ~= -1 or bMillDown) and EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') == 1 then
|
||||
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
@@ -684,7 +722,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
|
||||
end
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user