Aggiunta gestione per ToolHolder flottante

This commit is contained in:
andrea.villa
2025-02-20 16:44:21 +01:00
parent aa0d80735b
commit 7765c9c767
2 changed files with 66 additions and 6 deletions
+65 -6
View File
@@ -466,8 +466,10 @@ function OnSimulToolSelect( dPosA)
EMT.TOTDIAM = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM)
-- se non è chiamato da altro script (non c'è parametro)
if not dPosA then
-- se attivo Vmill
SetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL)
-- se utensile non flottante, abilito per Vmill
if not EMT.TFLOAT then
EmtSetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL)
end
-- se attivo Collision Check
EMT.SAFEDIST = COLL_SAFE_DIST
if EMT.COLLOBJ then
@@ -527,6 +529,14 @@ function OnSimulToolSelect( dPosA)
EgtSetAxisPos( 'B', 0)
end
end
-- se TC 1
if GetTCSet( EMT.TCPOS) == 1 then
EgtSetAxisPos( 'B', 90)
else
if EMT.HEAD ~= 'H3' then
EgtSetAxisPos( 'B', -90)
end
end
-- breve pausa
EgtPause( 100)
EgtOutText( '')
@@ -576,7 +586,11 @@ function OnSimulToolDeselect()
-- altrimenti posizioni standard rastrelliera
else
SimulMoveAxis( 'X', 0, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B', 90, MCH_SIM_STEP.COLLROT, 'C', -90, MCH_SIM_STEP.COLLROT)
if GetTCSet( EMT.TCPOS) == 1 then
SimulMoveAxes( 'B', 90, MCH_SIM_STEP.COLLROT, 'C', -90, MCH_SIM_STEP.COLLROT)
else
SimulMoveAxes( 'B', -90, MCH_SIM_STEP.COLLROT, 'C', -90, MCH_SIM_STEP.COLLROT)
end
end
-- movimento scarico utensile di grosso diametro (su T111)
else
@@ -590,18 +604,25 @@ function OnSimulToolDeselect()
-- nascondo utensile su testa e lo visualizzo su TcPos
EgtSetMode( EgtGetHeadId( EMT.HEAD), GDB_MD.HIDDEN)
ShowToolInTcPos( EMT.TCPOS_1, true)
-- movimento per carico utensile
if EMT.NEXTHEAD ~= 'H3' and EMT.NEXTHEAD ~= 'H5' and EMT.NEXTHEAD ~= 'H6' then
SimulMoveAxes( 'B', 90, MCH_SIM_STEP.RAPROT, 'C', EgtIf( BD.RIGHT_LOAD, 90, -90), MCH_SIM_STEP.RAPROT)
SimulMoveAxes( 'B', EgtIf( GetTCSet( EMT.TCPOS) == 1, 90, -90), MCH_SIM_STEP.RAPROT, 'C', EgtIf( BD.RIGHT_LOAD, 90, -90), MCH_SIM_STEP.RAPROT)
else
SimulMoveAxes( 'B', 0, MCH_SIM_STEP.RAPROT, 'C', EgtIf( BD.RIGHT_LOAD, 90, -90), MCH_SIM_STEP.RAPROT)
end
-- se segue lama, carico utensile di default
if EMT.NEXTHEAD == 'H2' then
local sDefTool = GetDefaultToolName()
EgtLoadTool( 'H1', 1, sDefTool)
EMT.TOOL_1 = sDefTool
EMT.TCPOS_1 = GetToolTcPos( EMT.TOOL_1)
-- se TC 1
if GetTCSet( EMT.TCPOS_1) == 1 then
EgtSetAxisPos( 'B', 90)
else
EgtSetAxisPos( 'B', -90)
end
EgtLoadTool( 'H1', 1, sDefTool)
-- lo nascondo sul portautensili
ShowToolInTcPos( EMT.TCPOS_1, false)
end
@@ -768,7 +789,6 @@ function OnSimulMoveStart()
EgtOutText( '')
EMT.MCHFIRST = false
local bZmax = ( EMT.TOOL ~= EMT.PREVTOOL or EMT.L3 > -1)
-- con pezzi alti aggiorno gli assi rotanti prima di muovermi sopra il pezzo
if not EMT.LOAD and EMT.MOVE == 0 and EMT.HB > BeamHeightForFixRot and EMT.FLAG2 == 1 then
-- se motosega mi muovo a X di sicurezza per ruotare
@@ -778,20 +798,59 @@ function OnSimulMoveStart()
end
EMT.POSTROT = nil
end
-- se aggregato flottante su inizio attacco va compresso
if EMT.TFLOAT and not EMT.TFLOAT_CMP and EMT.MOVE == 1 and EgtGetName( EMT.MOVEID) == 'LI' then
-- recupero lunghezza
local dOffsL = - EgtGetMachiningParam( MCH_MP.OFFSL)
-- imposto compressione della parte flottante
SetFloatPos( EMT.HEAD, dOffsL)
-- imposto dati utensile in posizione compressa
EmtSetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL, 2, -dOffsL)
-- dichiaro che è compresso (assegnando Id entità di movimento)
EMT.TFLOAT_CMP = EMT.MOVEID
end
end
---------------------------------------------------------------------
function OnSimulMoveEnd()
-- se termine di passata con lama
if EMT.FLAG == 301 then
-- rimozione eventuali sfridi
ExecRemoveScraps()
end
-- se utensile flottante e movimento di compressione
if EMT.TFLOAT and EMT.MOVEID == EMT.TFLOAT_CMP then
-- verifico ci sia stata collisione tra ghiera flottante (portautensile e pezzo)
if not EMT.TFLOAT_TH_COMPR_COLL then
local sErr = 'CUTID='..tostring( EMT.CUTID)..'; TASKID='..tostring( EMT.TASKID)..'; Mach='..EMT.MCHNAME..'; Floating Ring not compressed on approach'
EmtSetLastError( 1222, sErr)
EgtOutLog( 'Error : ' .. sErr, 1)
else
EgtOutLog( 'Floating Ring compressed on approach (MOVEID='..EgtNumToString( EMT.MOVEID)..')', 1)
end
EMT.TFLOAT_TH_COMPR_COLL = nil
end
-- se aggregato flottante su fine uscita va rilasciato
if EMT.TFLOAT and EMT.TFLOAT_CMP and EMT.MOVE == 1 and EgtGetName( EMT.MOVEID) == 'LO' and EgtGetName( EgtGetNext( EMT.MOVEID) or GDB_ID.NULL) ~= 'LO' then
-- reset compressione della parte flottante
SetFloatPos( EMT.HEAD, 0)
-- dichiaro che è rilasciato
EMT.TFLOAT_CMP = nil
end
end
---------------------------------------------------------------------
function OnSimulCollision()
-- se prima collisione della lavorazione, la segnalo
if EMT.MCHNAME ~= EMT.LAST_MCHNAME_COLLIDE then
-- speciale per utensile flottante (suo holder contro il grezzo)
if EMT.TFLOAT and EMT.TFLOAT_CMP and EMT.SIMCOBIND == 1002 and EMT.SIMVMID == EMT.VMILL[1] then
if EMT.MOVEID == EMT.TFLOAT_CMP then
EMT.TFLOAT_TH_COMPR_COLL = true
end
return
end
-- standard
local Class = ''
if EMT.SIMCOBIND == 1001 then
Class = 'T_H1'
+1
View File
@@ -5,6 +5,7 @@ Versione 2.7b1 (20/02/2024)
- (SIM-GEN) Piccola correzione calcolo posizione carrelli con nuova strategia di pinzaggio.
- (SIM-GEN) Caricamento libreria EmtGenMachining. Si fa una require con PCALL perchè la libreria è opzionale e non è detto che ci sia. In installazione CAM5 dalla 2.7a1
- (GEN) Per controllo TPA, modifica al numero di decimali.
- (SIM) Aggiunta gestione per ToolHolder flottante
Versione 2.7a3 (08/01/2024)
- (GEN) Dopo separazione, in NUM_PLUS, si srive EH1 solo se macro G101, perchè altrimenti non è prevista. Ticket#2239