DataBeam :

- migliorie e correzioni varie.
This commit is contained in:
Dario Sassi
2020-12-01 11:10:24 +00:00
parent 7c6961985c
commit e0698bb00d
8 changed files with 235 additions and 53 deletions
+61 -12
View File
@@ -1,4 +1,4 @@
-- ProcessProfHead.lua by Egaltech s.r.l. 2020/10/24
-- ProcessProfHead.lua by Egaltech s.r.l. 2020/11/19
-- Gestione calcolo profilo di testa per Travi
-- Tabella per definizione modulo
@@ -67,7 +67,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
@@ -91,6 +92,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)
@@ -103,6 +113,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
@@ -197,6 +216,11 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
vtN = vtN1 + vtN2
vtN:normalize()
end
-- 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)
@@ -249,6 +273,14 @@ function ProcessProfHead.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)
@@ -267,6 +299,7 @@ function ProcessProfHead.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
@@ -274,20 +307,21 @@ function ProcessProfHead.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
@@ -298,7 +332,8 @@ function ProcessProfHead.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, EgtIf( #vAngs > 0 and vAngs[1] == 0, true, false), EgtIf( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2), true, false), bFlagInvert, dExtra)
end
-- se lavorazione da due parti, aggiungo la seconda
if bDoubleCham then
@@ -312,19 +347,21 @@ function ProcessProfHead.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
@@ -335,7 +372,8 @@ function ProcessProfHead.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, EgtIf( #vAngs > 0 and vAngs[1] == 0, true, false), EgtIf( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2), true, false), bFlagInvert, dExtra)
end
end
end
@@ -371,6 +409,8 @@ function ProcessProfHead.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
@@ -379,6 +419,7 @@ function ProcessProfHead.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
@@ -386,6 +427,7 @@ function ProcessProfHead.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
@@ -394,12 +436,14 @@ function ProcessProfHead.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
@@ -427,7 +471,8 @@ function ProcessProfHead.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, EgtIf( #vAngs > 0 and vAngs[1] == 0, true, false), EgtIf( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2), true, false), bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
@@ -462,12 +507,15 @@ function ProcessProfHead.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)
@@ -486,7 +534,8 @@ function ProcessProfHead.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, EgtIf( #vAngs > 0 and vAngs[1] == 0, true, false), EgtIf( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2), true, false), bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then