Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 449f03fb09 | |||
| 7c91df35fc | |||
| 0d99310258 |
+5
-13
@@ -27,7 +27,7 @@ function OnStart()
|
||||
--EMT.LINEINC = 1 -- incremento numerazione linee
|
||||
--EMT.Ft = 'F' -- token per feed
|
||||
--EMT.St = 'S' -- token per speed
|
||||
EMT.FMAXPINZE = EgtClamp( MaxFeedPinze or 102000, 20000, 102000) -- feed massima pinze
|
||||
EMT.FMAXPINZE = EgtClamp( MaxFeedPinze or 102000, 60000, 155000) -- feed massima pinze
|
||||
EMT.MAXACC = MaxAcc or ( EMT.FMAXPINZE / ( 60 * 0.3)) -- accelerazione massima pinze
|
||||
EMT.MINACC = MinAcc or ( EMT.FMAXPINZE / ( 60 * 4)) -- accelerazione minima pinze
|
||||
|
||||
@@ -865,13 +865,13 @@ function OnRapid()
|
||||
local bChanged = true
|
||||
if bIsFirstHead then
|
||||
-- se prossimo utensile compatibile, lo prelevo
|
||||
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H1) then
|
||||
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H1, EMT.TOOL) then
|
||||
EMT.TCPOS = EMT.PROBENEXTTCPOS_H1
|
||||
EMT.HEAD = EMT.PROBENEXTHEAD_H1
|
||||
EMT.TOOL = EMT.PROBENEXTTOOL_H1
|
||||
else
|
||||
-- se vecchio utensile compatibile, tengo quello caricato
|
||||
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H1) then
|
||||
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H1, EMT.TOOL) then
|
||||
bChanged = false
|
||||
EMT.TCPOS = EMT.PREVTCPOS_H1
|
||||
EMT.HEAD = EMT.PREVHEAD_H1
|
||||
@@ -892,13 +892,13 @@ function OnRapid()
|
||||
end
|
||||
else
|
||||
-- se prossimo utensile compatibile, lo prelevo
|
||||
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H2) then
|
||||
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H2, EMT.TOOL) then
|
||||
EMT.TCPOS = EMT.PROBENEXTTCPOS_H2
|
||||
EMT.HEAD = EMT.PROBENEXTHEAD_H2
|
||||
EMT.TOOL = EMT.PROBENEXTTOOL_H2
|
||||
else
|
||||
-- se vecchio utensile compatibile, tengo quello caricato
|
||||
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H2) then
|
||||
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H2, EMT.TOOL) then
|
||||
bChanged = false
|
||||
EMT.TCPOS = EMT.PREVTCPOS_H2
|
||||
EMT.HEAD = EMT.PREVHEAD_H2
|
||||
@@ -1754,14 +1754,6 @@ function OnLinear()
|
||||
end
|
||||
local sProbeHead = ' ET' .. GetHeadSet( EMT.HEAD)
|
||||
EmtOutput( 'G145 Z-'.. EgtNumToString( dProbingDist).. ' EF'..sFace..sProbeHead)
|
||||
|
||||
-- ci si riporta in posizione fuori ingombro pezzo
|
||||
if AreSameVectorApprox( vtE, Y_AX()) or AreSameVectorApprox( vtE, -Y_AX()) then
|
||||
ProbePosZ = EMT.TABORI1[3] + EMT.SB
|
||||
EmitMoveDataHead( GetHeadSet( EMT.HEAD), { X=-EMT.L2p, Z=ProbePosZ, B=EMT.R2p, C=EMT.R1p})
|
||||
EmitMoveStartHead( GetHeadSet( EMT.HEAD))
|
||||
EmitMoveWaitHead( GetHeadSet( EMT.HEAD))
|
||||
end
|
||||
|
||||
-- tastatura attivata
|
||||
EMT.PROBE = true
|
||||
|
||||
+6
-48
@@ -555,7 +555,7 @@ function OnSimulToolSelect( dPosA)
|
||||
local bChanged = true
|
||||
if bIsFirstHead then
|
||||
-- se prossimo utensile compatibile, lo prelevo
|
||||
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H1) then
|
||||
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H1, EMT.TOOL) then
|
||||
ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
|
||||
EgtLoadTool( EMT.PROBENEXTHEAD_H1, 1, EMT.PROBENEXTTOOL_H1)
|
||||
EMT.TCPOS = EMT.PROBENEXTTCPOS_H1
|
||||
@@ -563,7 +563,7 @@ function OnSimulToolSelect( dPosA)
|
||||
EMT.TOOL = EMT.PROBENEXTTOOL_H1
|
||||
else
|
||||
-- se vecchio utensile compatibile, tengo quello caricato
|
||||
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H1) then
|
||||
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H1, EMT.TOOL) then
|
||||
bChanged = false
|
||||
EMT.TCPOS = EMT.PREVTCPOS_H1
|
||||
EMT.TOOL = EMT.PREVTOOL_H1
|
||||
@@ -586,7 +586,7 @@ function OnSimulToolSelect( dPosA)
|
||||
end
|
||||
else
|
||||
-- se prossimo utensile compatibile, lo prelevo
|
||||
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H2) then
|
||||
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H2, EMT.TOOL) then
|
||||
ShowToolInTcPos( EMT.PREVTCPOS_H2, true)
|
||||
EgtLoadTool( EMT.PROBENEXTHEAD_H2, 1, EMT.PROBENEXTTOOL_H2)
|
||||
EMT.TCPOS = EMT.PROBENEXTTCPOS_H2
|
||||
@@ -594,7 +594,7 @@ function OnSimulToolSelect( dPosA)
|
||||
EMT.TOOL = EMT.PROBENEXTTOOL_H2
|
||||
else
|
||||
-- se vecchio utensile compatibile, tengo quello caricato
|
||||
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H2) then
|
||||
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H2, EMT.TOOL) then
|
||||
bChanged = false
|
||||
EMT.TCPOS = EMT.PREVTCPOS_H2
|
||||
EMT.TOOL = EMT.PREVTOOL_H2
|
||||
@@ -724,9 +724,9 @@ function OnSimulToolDeselect( dPrevA)
|
||||
-- ripristino lavorazione corrente
|
||||
EgtSetCurrMachining( EMT.MCHID)
|
||||
|
||||
if nProbeHead == 11 and not( IsToolCompatibleWithProbe( EMT.PREVTOOL_H1)) then
|
||||
if nProbeHead == 11 and not( IsToolCompatibleWithProbe( EMT.PREVTOOL_H1, EMT.TOOL)) then
|
||||
;
|
||||
elseif nProbeHead == 21 and not( IsToolCompatibleWithProbe( EMT.PREVTOOL_H2)) then
|
||||
elseif nProbeHead == 21 and not( IsToolCompatibleWithProbe( EMT.PREVTOOL_H2, EMT.TOOL)) then
|
||||
;
|
||||
else
|
||||
bSkipToolChange = true
|
||||
@@ -2439,48 +2439,6 @@ function LoadNextTool( nHSet, sTcPosDef, bFirst)
|
||||
return sTool
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function IsToolCompatibleWithProbe( sToolName)
|
||||
local bToolIsCompatible = false
|
||||
if sToolName then
|
||||
EgtTdbSetCurrTool( sToolName)
|
||||
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM)
|
||||
local dToolLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||
if dToolDiam < 100 and dToolLen < 160 then
|
||||
bToolIsCompatible = true
|
||||
end
|
||||
EgtTdbSetCurrTool( EMT.TOOL)
|
||||
end
|
||||
return bToolIsCompatible
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function GetToolNameFromTcPos( sTcPos)
|
||||
local sToolName
|
||||
-- Carico gli utensili sulle barre portautensili
|
||||
local vTcPos = EgtGetAllTcPosNames()
|
||||
if vTcPos then
|
||||
for i = 1, #vTcPos do
|
||||
if vTcPos[i] == sTcPos then
|
||||
local sToolsName = EgtGetToolsInCurrSetupPos( vTcPos[i])
|
||||
sToolName = sToolsName[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
return sToolName
|
||||
end
|
||||
---------------------------------------------------------------------
|
||||
function GetToolHead( sToolName)
|
||||
local sHead
|
||||
local sCurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
|
||||
EgtTdbSetCurrTool( sToolName)
|
||||
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
|
||||
EgtTdbSetCurrTool( sCurrTool)
|
||||
return sHead, sTcPos
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function DeactivateProbeTool()
|
||||
if Probe then
|
||||
|
||||
+53
-4
@@ -665,9 +665,49 @@ function OnPostApplyMachining()
|
||||
|
||||
-- Inizializzo codice di errore
|
||||
EMC.ERR = 0
|
||||
|
||||
-- Recupero la precedente operazione
|
||||
local nPrevOpeId = EgtGetPrevActiveOperation( EMC.MCHID)
|
||||
|
||||
-- Se esiste lavorazione precedente ed è una tastatura
|
||||
if nPrevOpeId and EgtGetOperationType( nPrevOpeId) == MCH_OY.PROBING then
|
||||
-- se stessa testa e montato già utensile corretto
|
||||
-- recupero valori assi alla fine della lavorazione precedente e all'inizio della corrente
|
||||
local vPrevAxes = EmtGetFinalAxesPos( nPrevOpeId, true)
|
||||
local vCurrAxes = EmtGetInitialAxesPos( EMC.MCHID, true)
|
||||
-- info lavorazione precedente
|
||||
EgtSetCurrMachining( nPrevOpeId)
|
||||
local sPrevTool = EgtGetMachiningParam( MCH_MP.TOOL)
|
||||
local sPrevHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
local nSetHead = GetHeadSet( sPrevHead)
|
||||
local bPrevIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
|
||||
-- info lavorazione corrente
|
||||
EgtSetCurrMachining( EMC.MCHID)
|
||||
local sCurrTool = EgtGetMachiningParam( MCH_MP.TOOL)
|
||||
local sCurrHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
nSetHead = GetHeadSet( sCurrHead)
|
||||
local bCurrIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
|
||||
|
||||
-- se utensile corrente è compatibile (significa che è già stato precaricato) se stessa testa e con stessa configurazioen assi rotanti, annullo risalita
|
||||
if IsToolCompatibleWithProbe( sCurrTool, sPrevTool) and bPrevIsFirstHead == bCurrIsFirstHead and abs( vCurrAxes[4] - vPrevAxes[4]) < 1 and abs( vCurrAxes[5] - vPrevAxes[5]) < 1 then
|
||||
-- in lavorazione precedente elimino eventuale retrazione a Zmax
|
||||
EmtRemoveRise( nPrevOpeId)
|
||||
-- in lavorazione corrente elimino eventuale approccio da Zmax
|
||||
EmtRemoveClimb( EMC.MCHID)
|
||||
-- prendo sempre la Z massima tra le due
|
||||
local vClimbPoint
|
||||
if vCurrAxes[3] - 1.0 < vPrevAxes[3] then
|
||||
vClimbPoint = vCurrAxes
|
||||
vCurrAxes[3] = vPrevAxes[3]
|
||||
elseif vPrevAxes[3] - 1.0 < vCurrAxes[3] then
|
||||
vClimbPoint = vPrevAxes
|
||||
vPrevAxes[3] = vCurrAxes[3]
|
||||
end
|
||||
EmtAddClimb( EMC.MCHID, vClimbPoint, 4, 1, 0)
|
||||
end
|
||||
end
|
||||
|
||||
-- Recupero la posizione della trave e dei carrelli al termine della precedente operazione
|
||||
local nPrevOpeId = EgtGetPrevActiveOperation( EMC.MCHID)
|
||||
-- se precedente operazione non esiste, errore
|
||||
if not nPrevOpeId then
|
||||
EMC.ERR = 1
|
||||
@@ -825,7 +865,6 @@ function OnPostApplyMachining()
|
||||
local vAxes = EmtGetAxesPos( nLastEntId)
|
||||
if #vAxes > 0 then EMC.TPOS = vAxes[1] end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -1103,6 +1142,17 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
|
||||
end
|
||||
-- Recupero testa
|
||||
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
local sToolName = EgtTdbGetCurrToolParam( MCH_TP.NAME)
|
||||
local nSetHead = GetHeadSet( sHead)
|
||||
local bIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
|
||||
|
||||
-- se lavorazione di tastatura, si considera montato utensile di default
|
||||
if HeadIsProbe( sHead) then
|
||||
local sOtherToolName = GetToolNameFromTcPos( EgtIf( bIsFirstHead, DefTcPos1, DefTcPos2))
|
||||
local sOtherHeadTool, _ = GetToolHead( sOtherToolName)
|
||||
EgtLoadTool( sOtherHeadTool, 1, sOtherToolName)
|
||||
end
|
||||
|
||||
-- Recupero valore assi macchina
|
||||
local nSecId = EgtGetNext( EgtGetFirstInGroup( nPathId))
|
||||
local vAxes = EmtGetAxesPos( nSecId)
|
||||
@@ -1113,8 +1163,6 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
|
||||
end
|
||||
-- Calcolo dell'ingombro della testa rispetto allo Zero Macchina
|
||||
local b3Enc
|
||||
local nSetHead = GetHeadSet( sHead)
|
||||
local bIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
|
||||
|
||||
if bIsFirstHead then
|
||||
EgtSetAxisPos( 'C1', vAxes[4])
|
||||
@@ -1150,6 +1198,7 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
|
||||
local dDistFront = - ptMax:getX() - LoadT - dHeadFront
|
||||
local dDistBack = ptMin:getX() + LoadT + EMC.LB - dHeadBack
|
||||
EgtOutLog( ' DistFront = ' .. EgtNumToString( dDistFront, 1) .. ' DistBack = ' .. EgtNumToString( dDistBack, 1), 3)
|
||||
|
||||
return dDistFront, dDistBack, dRollFront, dRollBack
|
||||
end
|
||||
|
||||
|
||||
+45
-4
@@ -42,11 +42,11 @@
|
||||
|
||||
-- Intestazioni
|
||||
require( 'EmtGenerator')
|
||||
EgtEnableDebug( false)
|
||||
EgtEnableDebug( true)
|
||||
|
||||
PP_VER = '2.7f1_DEV14'
|
||||
PP_VER = '2.7f1_DEV16'
|
||||
PP_NVER = '2.7.6.1'
|
||||
MIN_MACH_VER = '2.5k1'
|
||||
MIN_MACH_VER = '2.7f3'
|
||||
MACH_NAME = string.match( EgtGetCurrMachineDir(), "[^\\]+$") -- si ricava il nome della macchina dal direttorio
|
||||
|
||||
-- Carico i dati globali
|
||||
@@ -1007,6 +1007,48 @@ function HeadIsProbe( sHead)
|
||||
return ( sHead == 'H19' or sHead == 'H29')
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function IsToolCompatibleWithProbe( sToolName, sCurrTool)
|
||||
local bToolIsCompatible = false
|
||||
if sToolName then
|
||||
EgtTdbSetCurrTool( sToolName)
|
||||
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM)
|
||||
local dToolLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||
if dToolDiam < 100 and dToolLen < 160 then
|
||||
bToolIsCompatible = true
|
||||
end
|
||||
EgtTdbSetCurrTool( sCurrTool)
|
||||
end
|
||||
return bToolIsCompatible
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function GetToolNameFromTcPos( sTcPos)
|
||||
local sToolName
|
||||
-- Carico gli utensili sulle barre portautensili
|
||||
local vTcPos = EgtGetAllTcPosNames()
|
||||
if vTcPos then
|
||||
for i = 1, #vTcPos do
|
||||
if vTcPos[i] == sTcPos then
|
||||
local sToolsName = EgtGetToolsInCurrSetupPos( vTcPos[i])
|
||||
sToolName = sToolsName[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
return sToolName
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function GetToolHead( sToolName)
|
||||
local sHead
|
||||
local sCurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
|
||||
EgtTdbSetCurrTool( sToolName)
|
||||
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
|
||||
EgtTdbSetCurrTool( sCurrTool)
|
||||
return sHead, sTcPos
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Funzione che calcola la posizione Home di Z per la sega a catena dal valore dell'asse virtuale
|
||||
function GetChainSawZHomeFromVirtualAxis( dPosA)
|
||||
@@ -1102,7 +1144,6 @@ function GetPY2Light()
|
||||
return ( EgtGetInfo( PY2LightId, 'On') == '1')
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Funzione per resettare tutte le attivazioni della macchina
|
||||
function OnResetMachine()
|
||||
|
||||
Reference in New Issue
Block a user