DataBeam :
- migliorie e correzioni varie.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
-- ProcessProfConcave.lua by Egaltech s.r.l. 2020/10/14
|
||||
-- ProcessProfConcave.lua by Egaltech s.r.l. 2020/11/19
|
||||
-- Gestione calcolo profilo concavo per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -75,7 +75,8 @@ local function GetSawCutData( AuxId, vtN)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLeadPar)
|
||||
local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLeadPar, dLenIni,
|
||||
dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
||||
|
||||
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
||||
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
||||
@@ -99,6 +100,15 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, (dToolDiam/2)+0.5)
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 0)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2))
|
||||
elseif dLenIni and dLenLst then
|
||||
-- se entità agi estremi sono inferiori del raggio utensile ed è abilitata la ripresa della faccia,
|
||||
-- allungo attacco e/o uscita
|
||||
if dLenIni < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bFirstTrim then
|
||||
EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.STARTADDLEN, MCH_MP.ENDADDLEN), (dToolDiam/2)-dLenIni+dOffsetPar+1)
|
||||
end
|
||||
if dLenLst < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bLastTrim then
|
||||
EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.ENDADDLEN, MCH_MP.STARTADDLEN), (dToolDiam/2)-dLenLst+dOffsetPar+1)
|
||||
end
|
||||
end
|
||||
-- riapplico la lavorazione
|
||||
EgtApplyMachining( true, false)
|
||||
@@ -111,6 +121,15 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2))
|
||||
-- riapplico la lavorazione
|
||||
EgtApplyMachining( true, false)
|
||||
elseif dLenIni and dLenLst then
|
||||
-- se entità agi estremi sono inferiori del raggio utensile ed è abilitata la ripresa della faccia,
|
||||
-- allungo attacco e/o uscita
|
||||
if dLenIni < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bFirstTrim then
|
||||
EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.ENDADDLEN, MCH_MP.STARTADDLEN), (dToolDiam/2)-dLenIni+dOffsetPar+1)
|
||||
end
|
||||
if dLenLst < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bLastTrim then
|
||||
EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.STARTADDLEN, MCH_MP.ENDADDLEN), (dToolDiam/2)-dLenLst+dOffsetPar+1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -196,6 +215,11 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local nLastFacet = EgtSurfTmFacetCount( Proc.Id) - 1 -- faccia finale
|
||||
local nMidFacet = ( nLastFacet + 1) // 2 -- faccia a metà circa
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nMidFacet, GDB_ID.ROOT)
|
||||
-- acquisisco informazioni sulle facce estreme
|
||||
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
|
||||
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
|
||||
-- flag percorso invertito
|
||||
local bFlagInvert = false
|
||||
-- verifico se in testa o coda
|
||||
local bHead = ( vtN:getX() > 0)
|
||||
EgtOutLog( 'vtN=' .. tostring( vtN), 3)
|
||||
@@ -245,6 +269,14 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if nChamfer > 0 then
|
||||
local bDoubleCham = false
|
||||
local dExtra = 2
|
||||
-- Recupero i dati dell'utensile
|
||||
local dToolDiam = 0
|
||||
if EgtMdbSetCurrMachining( sChamfer) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sNameCh, sChamfer)
|
||||
@@ -263,6 +295,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
( not bHead and vtExtr:getY() > 0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
-- altrimenti lavorazione dal davanti o dal dietro
|
||||
else
|
||||
@@ -270,20 +303,21 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if vtExtr:getZ() < 0 then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
||||
if ( bHead and vtNF:getY() > 0.1) or
|
||||
( not bHead and vtNF:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
end
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- allungo inizio e fine attacco
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10)
|
||||
-- cambio il tipo di attacco in tangente
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, 2)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- eseguo
|
||||
@@ -294,7 +328,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione
|
||||
ModifySideAndInvertAndLead( Proc, bHead, dMillDiam, true)
|
||||
ModifySideAndInvertAndLead( Proc, bHead, dToolDiam + ( 2 * dExtra), true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
|
||||
end
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
if bDoubleCham then
|
||||
@@ -308,19 +342,21 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- resetto il flag inversione percorso
|
||||
bFlagInvert = false
|
||||
-- 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)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- allungo inizio e fine attacco
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10)
|
||||
-- cambio il tipo di attacco in tangente
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, 2)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- eseguo
|
||||
@@ -331,7 +367,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione
|
||||
ModifySideAndInvertAndLead( Proc, bHead, dMillDiam, true)
|
||||
ModifySideAndInvertAndLead( Proc, bHead, dToolDiam + ( 2 * dExtra), true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -367,6 +403,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- resetto il flag inversione percorso
|
||||
bFlagInvert = false
|
||||
-- se lavorazione da sopra o da sotto
|
||||
if nSide ~= 0 then
|
||||
if not bDouble and nSide == -1 then
|
||||
@@ -375,6 +413,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
else
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
@@ -382,6 +421,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
( not bHead and vtExtr:getY() > 0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
end
|
||||
-- altrimenti lavorazione dal davanti o dal dietro
|
||||
@@ -390,12 +430,14 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if vtExtr:getZ() < 0 then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
||||
if ( bHead and vtN:getY() > 0.1) or
|
||||
( not bHead and vtN:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
end
|
||||
-- se in doppio, imposto l'affondamento
|
||||
@@ -423,7 +465,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true)
|
||||
ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
@@ -458,12 +500,15 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- resetto il flag inversione percorso
|
||||
bFlagInvert = false
|
||||
-- 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)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
@@ -482,7 +527,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true)
|
||||
ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
|
||||
Reference in New Issue
Block a user