Files
Essetre-FAST/Essetre-FAST.mlde
T
2026-04-22 16:29:17 +02:00

894 lines
32 KiB
Plaintext

-- Descrizione macchina Essetre-FAST by EgalTech s.r.l. 2024/12/23
-- 2021/12/29 DS ver 2.3l4 Per NUM non va considerato MillOffs negli offset in Z.
-- 2022/01/27 DS ver 2.4a2 Modifiche per tagli testa/coda su pezzi alti.
-- 2022/02/10 DS ver 2.4a3 Ridotto di 10mm pinzaggio con pezzi alti ma sottili.
-- 2022/02/26 DS ver 2.4b1 Aggiunta verifica collisioni spalle per sega a catena.
-- 2022/03/19 DS ver 2.4c1 Unificazione con BH.
-- 2022/05/24 DS ver 2.4e1 Corretto carico utensile punta lunga su T111.
-- 2022/05/24 DS ver 2.4e2 Corretto scarico utensile punta lunga su T111.
-- 2022/06/16 DS ver 2.4f1 Per Rinvio Angolare SecondSupport >= 3, se 2 è Mortiser. Aggiunta gestione Dist per seghe a catena e mortasatrici.
-- 2022/07/22 DS ver.2.4g2 Modifiche per ribaltamento pezzo con molto scarto iniziale.
-- 2022/07/29 DS ver.2.4g3 Migliorata modellazione testa con solidi per collisione.
-- 2022/08/17 DS ver 2.4h1 Correzione nuova gestione distanza di sega a catena.
-- 2022/08/24 DS ver 2.4h2 Correzioni per rinvio angolare (Angular Transmission).
-- 2022/09/20 DS ver 2.4i1 Aggiunta gestione NUM FlexiumPlus (NUM_PLUS).
-- 2022/10/22 DS ver 2.4j3 Ottimizzazioni per NUM FlexiumPlus.
-- 2022/11/09 DS ver 2.4k1 Per Num e NumPlus ora E30033 è ST (dim. verticale) e E30036 è HT (dim. orizzontale).
-- 2022/12/05 DS ver 2.4l1 In OnLinear di genera CN per Num e NumPlus eliminato recupero sovramateriale di testa EMT.X_OFF dopo riutilizzo EMT.L1o.
-- 2023/01/23 DS Ver.2.5a2 In simulazione corretta visualizzazione Sega a catena.
-- 2023/02/09 DS Ver.2.5b1 Correzioni NumPlus per parametri G115 e EG2/EG3 al cambio orientazione sega a catena.
-------------------------------------
-- NOTE VERSIONI SUCCESSIVE IN GIT --
-------------------------------------
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '3.1d2'
PP_NVER = '3.1.4.2'
MIN_MACH_VER = '2.7j1'
MACH_NAME = EgtGetCurrMachineName()
-- Carico i dati globali
local sMachDir = EgtGetCurrMachineDir()
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
EgtAddToPackagePath( sMachDir .. '\\?.lua')
local BD = require( 'BeamData')
local INFO_STD_PP = require( 'Version')
-- prendo la versione kernel minima necessaria più nuova tra macchina e script comuni
if INFO_STD_PP.MIN_MACH_VER_PP_COMMON > MIN_MACH_VER then
MIN_MACH_VER = INFO_STD_PP.MIN_MACH_VER_PP_COMMON
end
EgtOutLog ( '** ' .. MACH_NAME..' '..PP_VER..' ** ( '..INFO_STD_PP.NAME..': '..INFO_STD_PP.VERSION..' - MinMach: '.. MIN_MACH_VER ..') **', 1)
-- Parametri macchina
NumericalControl = 'TPA' -- NUM o TPA o NUM_PLUS
MinX = 0
MaxX = 1350
MinZ = -1350
MaxZ = 0
MinB = -180
MaxB = 360
MinC = -360
MaxC = 360
MinY = 110.0
MaxY = 3760.0
ParkY = 480.0
MinV = -3760.0
MaxV = -110.0
ParkV = -480.0
LoadT = 1454.2
UnloadT = -1700
MaxOpen = 305
MillOffs = 177.35
DistRotCenterBToTopC = 403 -- distanza tra il centro di rotazione del mandrino B e la mensola C
SawOffs = -242.68
SawBOffs = 0
SawCOffs = 0
ChSawLen = 90.0
AngTr1Offs = 170
AngTr1Len = 150
AngTrBHOffs = 154.5
AngTrBHLen = 90
TurnerOffs = 200.0
DeltaTabY = 898.0
DeltaTabZ = -1017.8 + MillOffs -- per TPA : -1013.3 + MillOffs -- per NUM : -838.4
DimTabY = 400
DimTabX = 34000
LenToPress = 900
StartRotation = true
AutomaticRotation = true
AutoRotMinLen = 2600
DefTcPos = 'T2'
SecondSupport = 0
SpecialBH = false
MaxUnloadLen = 0
BeamHeightForFixRot = 9999 -- per abilitare assegnare 500
NewTopC = true
SafeXRotAxes = 150
AggreBlockHaus = false
SecondToolChanger = false
EstimationRapidMultiplier = 1
DistZClampToTable = 5 -- distanza tra la tavola e il punto più basso della morsa
ClampingCoeffMin = nil -- coefficiente di fissaggio, se 0 o nil non fa controllo, per il momento da inizializzare da Ts3Data
MinJoinVV = 75
MinJoinSS = 100
MinJoinLS = 290
MinJoinSL = 100
MinJoinLL = 400
DistHeadToCabinUnload = nil -- distanza tra la paratia al carico e la testa macchina (Y) in valore assoluto
DistHeadToCabinLoad = nil -- distanza tra la paratia allo scarico e la testa macchina (Y) in valore assoluto
-- costanti dimensioni utensili
LONG_TOOL_MINLEN = 218.5
BIG_TOOL_DIAM = 300
-- leggo e aggiorno con parametri da BeamData
if BD then
BeamHeightForFixRot = BD.MAX_HEIGHT_ROT_B_ABOVE or BeamHeightForFixRot
end
-- Aggiornamento con dati da TechnoEssetre7
local sTs3Data = EgtGetStringFromIni( 'Beam', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-Fast.data"
local sData = sMachDir .. "\\Beam\\Ts3Data.lua"
if EgtExistsFile( sTs3Data) then
EgtCopyFile( sTs3Data, sData)
local sTs3DataOld = sTs3Data..'.old'
EgtEraseFile( sTs3DataOld)
EgtRenameFile( sTs3Data, sTs3DataOld)
end
if EgtExistsFile( sData) then
local Machine = dofile( sData)
if Machine then
if Machine.Offsets then
if Machine.Offsets.TIPO_CN == 0 then
NumericalControl = 'NUM'
elseif Machine.Offsets.TIPO_CN == 2 then
NumericalControl = 'NUM_PLUS'
else
NumericalControl = 'TPA'
end
if Machine.Offsets.MAX_X then MinX = - Machine.Offsets.MAX_X end
if Machine.Offsets.MIN_X then MaxX = - Machine.Offsets.MIN_X end
if Machine.Offsets.MIN_Z then MinZ = Machine.Offsets.MIN_Z end
if Machine.Offsets.MAX_Z then MaxZ = Machine.Offsets.MAX_Z end
if Machine.Offsets.MIN_B then MinB = Machine.Offsets.MIN_B end
if Machine.Offsets.MAX_B then MaxB = Machine.Offsets.MAX_B end
if Machine.Offsets.MIN_C then MinC = Machine.Offsets.MIN_C end
if Machine.Offsets.MAX_C then MaxC = Machine.Offsets.MAX_C end
MinY = Machine.Offsets.MIN_Y or Machine.Offsets.MINY or MinY
MaxY = Machine.Offsets.MAX_Y or Machine.Offsets.MAXY or MaxY
ParkY = Machine.Offsets.PARKYY or ParkY
MinV = Machine.Offsets.MIN_V or Machine.Offsets.MINV or MinV
MaxV = Machine.Offsets.MAX_V or Machine.Offsets.MAXV or MaxV
ParkV = Machine.Offsets.PARKVV or ParkV
if Machine.Offsets.YCARICO then LoadT = - Machine.Offsets.YCARICO end
if Machine.Offsets.YSCARICO then UnloadT = - Machine.Offsets.YSCARICO end
if Machine.Offsets.PIVOTFRESA then MillOffs = - Machine.Offsets.PIVOTFRESA end
if Machine.Offsets.PIVOTLAMA then SawOffs = - Machine.Offsets.PIVOTLAMA end
if Machine.Offsets.OFFSETBLAMA then SawBOffs = Machine.Offsets.OFFSETBLAMA end
if Machine.Offsets.OFFSETCLAMA then SawCOffs = Machine.Offsets.OFFSETCLAMA end
if Machine.Offsets.OFFSETZ_RINV_1 then AngTr1Offs = Machine.Offsets.OFFSETZ_RINV_1 - EgtIf( NumericalControl == 'TPA', MillOffs, 0) end
AngTr1Len = Machine.Offsets.OFFSETX_RINV_1 or AngTr1Len
--if Machine.Offsets.OFFSETZ_RINV_2 then AngTr2Offs = Machine.Offsets.OFFSETZ_RINV_2 - EgtIf( NumericalControl == 'TPA', MillOffs, 0) end
--AngTr2Len = Machine.Offsets.OFFSETX_RINV_2 or AngTr2Len
if Machine.Offsets.OFFSETZ_RINV_BH then AngTrBHOffs = Machine.Offsets.OFFSETZ_RINV_BH - EgtIf( NumericalControl == 'TPA', MillOffs, 0) end
AngTrBHLen = Machine.Offsets.OFFSETX_RINV_BH or AngTrBHLen
TurnerOffs = Machine.Offsets.OFFSETRIB or TurnerOffs
if Machine.Offsets.OFFSETX then DeltaTabY = - Machine.Offsets.OFFSETX end
if Machine.Offsets.OFFSETZ then DeltaTabZ = Machine.Offsets.OFFSETZ + EgtIf( NumericalControl == 'TPA', MillOffs, 0) end
if Machine.Offsets.SECSUP then SecondSupport = Machine.Offsets.SECSUP end
if Machine.Offsets.BLOCKHAUS then SpecialBH = ( Machine.Offsets.BLOCKHAUS == 1) end
if Machine.Offsets.RIB_AUTO then AutomaticRotation = ( Machine.Offsets.RIB_AUTO == 1) end
if Machine.Offsets.NOULOAD then MaxUnloadLen = Machine.Offsets.NOULOAD end
if Machine.Offsets.DEFTCPOS then DefTcPos = ( 'T' .. Machine.Offsets.DEFTCPOS) end
if Machine.Offsets.WOOD_DENSITY then WoodDensity = Machine.Offsets.WOOD_DENSITY end
if Machine.Offsets.MIN_JOIN_VV then MinJoinVV = EgtClamp( Machine.Offsets.MIN_JOIN_VV, 60, 150) end
if Machine.Offsets.MIN_JOIN_SS then MinJoinSS = EgtClamp( Machine.Offsets.MIN_JOIN_SS, 80, 275) end
if Machine.Offsets.MIN_JOIN_LS then MinJoinLS = EgtClamp( Machine.Offsets.MIN_JOIN_LS, 250, 400) end
if Machine.Offsets.MIN_JOIN_SL then MinJoinSL = EgtClamp( Machine.Offsets.MIN_JOIN_SL, 80, 400) end
if Machine.Offsets.MIN_JOIN_LL then MinJoinLL = EgtClamp( Machine.Offsets.MIN_JOIN_LL, 300, 600) end
if Machine.Offsets.MAXFEEDPINZE then MaxFeedPinze = Machine.Offsets.MAXFEEDPINZE end
if Machine.Offsets.MAXACC then MaxAcc = Machine.Offsets.MAXACC end
if Machine.Offsets.MINACC then MinAcc = Machine.Offsets.MINACC end
if Machine.Offsets.NEWTOPC then NewTopC = ( Machine.Offsets.NEWTOPC == 1) end
if Machine.Offsets.AGGRE_BH then AggreBlockHaus = ( Machine.Offsets.AGGRE_BH == 1) end
if Machine.Offsets.SEC_TC then SecondToolChanger = ( Machine.Offsets.SEC_TC == 1) end
if Machine.Offsets.COEFF_STIMATEMPI and Machine.Offsets.COEFF_STIMATEMPI > 0 then EstimationRapidMultiplier = Machine.Offsets.COEFF_STIMATEMPI end
if Machine.Offsets.MAX_HEIGHT_ROT_B_ABOVE then BeamHeightForFixRot = Machine.Offsets.MAX_HEIGHT_ROT_B_ABOVE end
if Machine.Offsets.COEFF_CLAMP_CHECK then ClampingCoeffMin = Machine.Offsets.COEFF_CLAMP_CHECK end
if Machine.Offsets.DIST_ROT_CENTER_B_TO_TOP_C then DistRotCenterBToTopC = EgtClamp( Machine.Offsets.DIST_ROT_CENTER_B_TO_TOP_C, 395, 410) end
if Machine.Offsets.LONG_TOOL_MINLEN then LONG_TOOL_MINLEN = EgtClamp( Machine.Offsets.LONG_TOOL_MINLEN, 216, 226.1) end
if Machine.Offsets.DIST_HEAD_TO_CABIN_UNLOAD then DistHeadToCabinUnload = Machine.Offsets.DIST_HEAD_TO_CABIN_UNLOAD end
if Machine.Offsets.DIST_HEAD_TO_CABIN_LOAD then DistHeadToCabinLoad = Machine.Offsets.DIST_HEAD_TO_CABIN_LOAD end
end
end
end
if SpecialBH then SecondSupport = 0 end
-- Aggiorno valori MinJoin
MinJoin = MinJoinSS
MinOther = abs( MinY) + abs( MaxV) + MinJoin
DeltaTol = 210
-- compongo i gruppi appartenenti alla base
local sBaseAux = {'BASE/SOLID', 'BASE/TC', 'BASE/SIGN', 'BASE/COLLISION'}
if SecondToolChanger then table.insert( sBaseAux, 5, 'BASE/TC2') end
EmtGeneral {
File='Essetre-FAST.nge',
Offset = Vector3d( 0, 1150.16, -1500.0),
AxisMaxAdjust = 30,
AxisMaxRotAdj = 0.5,
ExitMaxAdjust = 30,
ExitMaxRotAdj = 0.5,
AngDeltaMinForHome = 165,
Special = 'Common_FAST.mlse',
Processor = 'Common_FAST.mlpe'}
local BaseId = EmtBase {
Name = 'Base',
Geo='BASE/GEO',
Aux = sBaseAux}
-- Sposta la faccia interna alla cabina dei solidi di collisione se sono impostati nel TS3Data, valori positivi
if DistHeadToCabinLoad then
local nSide1Id = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( BaseId, 'COLLISION'), 'SIDE1')
local b3Collision = EgtGetBBox( nSide1Id, GDB_BB.STANDARD)
local vtMove = Vector3d( -abs( DistHeadToCabinLoad) - b3Collision:getMax()[1], 0, 0)
EgtSurfTmMoveFacet( nSide1Id, 3, vtMove, GDB_RT.GLOB)
end
if DistHeadToCabinUnload then
local nSide2Id = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( BaseId, 'COLLISION'), 'SIDE2')
local b3Collision = EgtGetBBox( nSide2Id, GDB_BB.STANDARD)
local vtMove = Vector3d( abs( DistHeadToCabinUnload) - b3Collision:getMin()[1], 0, 0)
EgtSurfTmMoveFacet( nSide2Id, 3, vtMove, GDB_RT.GLOB)
end
local XId = EmtAxis {
Name = 'X',
Parent = 'Base',
Invert = true,
Type = MCH_AT.LINEAR,
Dir = Y_AX(),
Pos = Point3d( -639.5, 372.66, 945.7),
Stroke = {MinX, MaxX},
Home = 0,
Geo = 'X_AXIS/GEO',
Aux = 'X_AXIS/SOLID'}
EmtAxis {
Name = 'Z',
Parent = 'X',
Type = MCH_AT.LINEAR,
Dir = Z_AX(),
Pos = Point3d( -19.25, -113.54, 790.0),
Stroke = {MinZ, MaxZ},
Home = MaxZ,
Geo = 'Z_AXIS/GEO',
Aux = {'Z_AXIS/SOLID', 'Z_AXIS/COLLISION'}}
local CId = EmtAxis {
Name = 'C',
Parent = 'Z',
Type = MCH_AT.ROTARY,
Dir = Z_AX(),
Pos = Point3d( 0, 0, 0),
Stroke = {MinC, MaxC},
Home = 0,
Geo = 'C_AXIS/GEO',
Aux = {'C_AXIS/SOLID', 'C_AXIS/COLLISION', 'C_AXIS/COLLISION2'}}
-- Imposto i vettori di movimento separatamente se sono presenti le variabili di riferimento
local vtXMove = Vector3d( EgtIf( NewTopC, 65, 0), 0, 0)
-- si prende la minima distanza tra DistRotCenterBToTopC e LONG_TOOL_MINLEN + pivot (comunque distanza minima 403)
local dZMove = max( 403, min( ( MillOffs + LONG_TOOL_MINLEN + 5), DistRotCenterBToTopC)) - 400
local vtZMove = Vector3d( 0, 0, dZMove)
-- Muove le facce in X e Z del solido principale
local SolidArmId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( CId, 'SOLID'), 'ARM')
EgtSurfTmMoveFacet( SolidArmId, 14, vtZMove, GDB_RT.GLOB)
EgtSurfTmMoveFacet( SolidArmId, 11, vtXMove, GDB_RT.GLOB)
-- Muove il solido di collisione denominato "TOP" in X e muove la sua faccia inferiore per portarla al pari del solido principale
local CollTopId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( CId, 'COLLISION'), 'TOP')
EgtMove( CollTopId, vtXMove, GDB_RT.GLOB)
EgtSurfTmMoveFacet( CollTopId, 4, vtZMove, GDB_RT.GLOB)
EgtSetName( CollTopId, 'BOX')
-- Imposta nel Frame di riferimento l'info "CollSkip"
local RefId = CollTopId + EgtGetInfo( CollTopId, 'Frame', 'i')
EgtSetInfo( RefId, 'CollSkip', 'C_TOP')
-- Muove il solido di collisione C_TOP
local CollUtTopId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( CId, 'COLLISION2'), 'C_TOP')
EgtMove( CollUtTopId, vtZMove, GDB_RT.GLOB)
EmtAxis {
Name = 'B',
Parent = 'C',
Type = MCH_AT.ROTARY,
Dir = X_AX(),
Pos = Point3d( 0, 0, MillOffs),
Stroke = {MinB, MaxB},
Home = 0,
Geo = 'B_AXIS/GEO',
Aux = {'B_AXIS/SOLID', 'B_AXIS/COLLISION'}}
-- Frese
local H1Id = EmtHead {
Name = 'H1',
Parent = 'B',
HSet = 'H1',
Type = MCH_HT.STD,
Pos = Point3d( 0, 0, 0),
TDir = Z_AX(),
ADir = X_AX(),
Rot1W = 2,
OthColl = {'H2', 'B/SOLID', 'C/SOLID'},
Geo = 'H1_HEAD/GEO'}
EgtSetInfo( H1Id, 'ZMAXONROT', '1,60')
if BeamHeightForFixRot < 1000 then
EgtSetInfo( H1Id, 'ROTATZMAX', '1')
end
-- Lama
local H2Id = EmtHead {
Name = 'H2',
Parent = 'B',
HSet = 'H2',
Type = MCH_HT.STD,
Pos = Point3d( 0, 0, ( MillOffs - SawOffs)),
TDir = VectorFromRotated( -Z_AX(), X_AX(), -SawBOffs),
ADir = X_AX(),
Rot1W = 0.2,
OthColl = {'H1', 'H3', 'B/SOLID', 'C/SOLID'},
Geo = 'H2_HEAD/GEO'}
EgtSetInfo( H2Id, 'ZMAXONROT', '1,5')
if BeamHeightForFixRot < 1000 then
EgtSetInfo( H2Id, 'ROTATZMAX', '1')
end
-- Sega a catena
EmtAxis {
Name = 'A',
Parent = 'B',
Token = '**',
Type = MCH_AT.ROTARY,
Dir = Z_AX(),
Pos = Point3d( 0, 0, 0),
Stroke = { 0, 270},
Home = 0,
Geo = 'A_AXIS/GEO'}
local H3Id = EmtHead {
Name = 'H3',
Parent = 'A',
HSet = 'H1',
Type = MCH_HT.STD,
Pos = Point3d( 0, 0, -ChSawLen),
TDir = X_AX(),
ADir = Z_AX(),
Rot1W = 0.2,
SolCh = MCH_SCC.ADIR_NEAR,
OthColl = {'H2', 'B/SOLID', 'C/SOLID'},
Geo = 'H3_HEAD/GEO'}
EgtSetInfo( H3Id, 'ZMAXONROT', '1,5')
if BeamHeightForFixRot < 1000 then
EgtSetInfo( H3Id, 'ROTATZMAX', '1')
end
-- Eventuale rinvio angolare
if SecondSupport >= 3 then
local H5Id = EmtHead {
Name = 'H5',
Parent = 'B',
HSet = 'H1',
Type = MCH_HT.MULTI,
ExitNbr = 2,
Pos1 = Point3d( 0, -AngTr1Len, -AngTr1Offs),
TDir1 = Y_AX(),
Pos2 = Point3d( 0, AngTr1Len, -AngTr1Offs),
TDir2 = -Y_AX(),
ADir = Z_AX(),
Rot1W = 0.2,
Rot2Stroke = { -120, 120},
OthColl = { 'H2', 'B/SOLID', 'C/SOLID'},
Geo = 'H5_HEAD/GEO',
Aux = {'H5_HEAD/SOLID', 'H5_HEAD/COLLISION'}}
EgtSetInfo( H5Id, 'AGB_TYPE', 2)
EgtSetInfo( H5Id, 'AGB_DMAX', 240)
EgtSetInfo( H5Id, 'AGB_ENCH', 44)
EgtSetInfo( H5Id, 'AGB_ENCV', 380)
EgtSetInfo( H5Id, 'AGB_MDIR', X_AX())
EgtSetInfo( H5Id, 'ZMAXONROT', '1,15')
end
-- Eventuale aggregato per lavorazioni BlockHaus
if AggreBlockHaus then
local H7Id = EmtHead {
Name = 'H7',
Parent = 'B',
HSet = 'H1',
Type = MCH_HT.STD,
Pos = Point3d( AngTrBHLen, 0, -AngTrBHOffs),
TDir = -X_AX(),
ADir = X_AX(),
Rot1W = 0.2,
SolCh = MCH_SCC.ADIR_NEAR,
OthColl = {'H2', 'B/SOLID', 'C/SOLID'},
Geo = 'H7_HEAD/GEO',
Aux = {'H7_HEAD/SOLID', 'H7_HEAD/COLLISION'}}
end
-- Morse
local YId = EmtAxis {
Name = 'Y',
Parent = 'Base',
Type = MCH_AT.LINEAR,
Dir = -X_AX(),
Pos = Point3d( -953.0, 111.75, 1450.0),
Stroke = { MinY, MaxY},
Home = ParkY,
Geo = 'Y_AXIS/GEO',
Aux = {'Y_AXIS/SOLID', 'Y_AXIS/COLLISION'}}
local PYId = EmtAxis {
Name = 'PY',
Parent = 'Y',
Type = MCH_AT.LINEAR,
Dir = -Y_AX(),
Pos = Point3d( -904.0, -276.5, 1449.0),
Stroke = { 0, MaxOpen},
Home = MaxOpen,
Geo = 'PY_AXIS/GEO',
Aux = {'PY_AXIS/SOLID', 'PY_AXIS/COLLISION', 'PY_AXIS/CLAMP_CHECK'}}
local VId = EmtAxis {
Name = 'V',
Parent = 'Base',
Type = MCH_AT.LINEAR,
Dir = -X_AX(),
Pos = Point3d( 953.0, 111.75, 1450.0),
Stroke = { MinV, MaxV},
Home = ParkV,
Geo = 'V_AXIS/GEO',
Aux = {'V_AXIS/SOLID', 'V_AXIS/COLLISION'}}
local PVId = EmtAxis {
Name = 'PV',
Parent = 'V',
Type = MCH_AT.LINEAR,
Dir = -Y_AX(),
Pos = Point3d( 904.0, -276.5, 1449.0),
Stroke = { 0, MaxOpen},
Home = MaxOpen,
Geo = 'PV_AXIS/GEO',
Aux = {'PV_AXIS/SOLID', 'PV_AXIS/COLLISION', 'PV_AXIS/CLAMP_CHECK'}}
EmtAxis {
Name = 'T',
Parent = 'Base',
--Token = '**',
Type = MCH_AT.LINEAR,
Dir = - X_AX(),
Pos = Point3d( 0, 613.16, -830.037),
Stroke = { -30000, 30000},
Home = LoadT,
Geo = 'T_AXIS/GEO'}
EmtTable {
Name = 'Tab',
Parent = 'T',
Type = MCH_TT.FLAT,
Ref1 = Point3d( -DimTabX, DeltaTabY - DimTabY, DeltaTabZ),
Scale = { DimTabX / 20000, DimTabY / 400, 1},
Geo = 'TABLE/GEO',
Aux = 'TABLE/SOLID'}
-- ToolChanger
EmtTcPos {
Name = 'T1',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, 172.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T1'}
EmtTcPos {
Name = 'T2',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, 67.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T2'}
EmtTcPos {
Name = 'T3',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -37.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T3'}
EmtTcPos {
Name = 'T4',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -142.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T4'}
EmtTcPos {
Name = 'T5',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -247.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T5'}
EmtTcPos {
Name = 'T6',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -352.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T6'}
EmtTcPos {
Name = 'T7',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -457.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T7'}
EmtTcPos {
Name = 'T8',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -562.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T8'}
EmtTcPos {
Name = 'T9',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -667.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T9'}
EmtTcPos {
Name = 'T10',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -772.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T10'}
if AggreBlockHaus then
local TcpSsId = EmtTcPos {
Name = 'T11',
Parent = 'Base',
Pos = Point3d( 678.3, -1.963, -877.5),
TDir = Y_AX(),
ADir = -X_AX(),
Geo = 'BASE/T121',
Aux = 'BASE/T121_HS'}
else
EmtTcPos {
Name = 'T11',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -877.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T11'}
end
-- ToolChanger 2
if SecondToolChanger then
EmtTcPos {
Name = 'T21',
Parent = 'Base',
Pos = Point3d( -503.2, 88.0, 172.5),
TDir = X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T21'}
EmtTcPos {
Name = 'T22',
Parent = 'Base',
Pos = Point3d( -503.2, 88.0, 67.5),
TDir = X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T22'}
EmtTcPos {
Name = 'T23',
Parent = 'Base',
Pos = Point3d( -503.2, 88.0, -37.5),
TDir = X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T23'}
EmtTcPos {
Name = 'T24',
Parent = 'Base',
Pos = Point3d( -503.2, 88.0, -142.5),
TDir = X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T24'}
EmtTcPos {
Name = 'T25',
Parent = 'Base',
Pos = Point3d( -503.2, 88.0, -247.5),
TDir = X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T25'}
EmtTcPos {
Name = 'T26',
Parent = 'Base',
Pos = Point3d( -503.2, 88.0, -352.5),
TDir = X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T26'}
EmtTcPos {
Name = 'T27',
Parent = 'Base',
Pos = Point3d( -503.2, 88.0, -457.5),
TDir = X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T27'}
EmtTcPos {
Name = 'T28',
Parent = 'Base',
Pos = Point3d( -503.2, 88.0, -562.5),
TDir = X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T28'}
else
if not SpecialBH then
EmtTcPos {
Name = 'T101',
Parent = 'Base',
Pos = Point3d( -510.4, 113.2, -160.8),
TDir = X_AX(),
ADir = Z_AX(),
Geo = 'BASE/T101'}
end
if SecondSupport == 1 then
-- supporto per punta
EmtTcPos {
Name = 'T111',
Parent = 'Base',
Pos = Point3d( -510.4, 113.2, -329.8),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'BASE/T111'}
elseif SecondSupport == 2 then
-- supporto per mortasatrice
local TcpSsId = EmtTcPos {
Name = 'T111',
Parent = 'Base',
Pos = Point3d( -510.4, 113.2, -430.8),
TDir = X_AX(),
ADir = Z_AX(),
Geo = 'BASE/T111M'}
EgtSetInfo( TcpSsId, 'Mortiser', true)
end
if SpecialBH then
EmtTcPos {
Name = 'T111',
Parent = 'Base',
Pos = Point3d( -810.4, 113.2, -329.8),
TDir = Y_AX(),
ADir = X_AX(),
Geo = 'BASE/T111S'}
end
end
-- motosega in caso di magazzino 2 o SpecialBH
if SpecialBH or SecondToolChanger then
local TcpSsId = EmtTcPos {
Name = 'T101',
Parent = 'Base',
Pos = Point3d( -510.4, 113.2, -1160.8),
TDir = X_AX(),
ADir = Z_AX(),
Geo = 'BASE/T101S'}
-- spostamento in caso di magazzino 2
if SecondToolChanger then
EgtMove( TcpSsId, Vector3d( 0, 0, 140), GDB_RT.GLOB)
end
end
if SecondSupport == 3 then
-- supporto per rinvio angolare
local TcpSsId = EmtTcPos {
Name = 'T91',
Parent = 'Base',
ExitNbr = 2,
Pos1 = Point3d( -710.4-150, 113.2, -329.8-170),
TDir1 = X_AX(),
Pos2 = Point3d( -710.4+150, 113.2, -329.8-170),
TDir2 = -X_AX(),
ADir = Z_AX(),
Geo = 'BASE/T91',
Aux = 'BASE/T91_HS'}
if SecondToolChanger then
EgtMove( TcpSsId, Vector3d( 0, 0, -900), GDB_RT.GLOB)
end
end
-- Aggiusto posizioni geometriche
local vtMove = Vector3d( 0, ( DeltaTabY - 913.16), ( DeltaTabZ + 830.037))
local vtMoveX = Vector3d( 0, 0, ( DeltaTabZ + 830.037))
EgtMove( EgtGetFirstNameInGroup( BaseId, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( BaseId, 'SIGN'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( BaseId, 'COLLISION'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( YId, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( YId, 'COLLISION'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PYId, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PYId, 'COLLISION'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PYId, 'CLAMP_CHECK'), vtMove + Vector3d(0,0,DistZClampToTable), GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( VId, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( VId, 'COLLISION'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PVId, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PVId, 'COLLISION'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PVId, 'CLAMP_CHECK'), vtMove + Vector3d(0,0,DistZClampToTable), GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( XId, 'SOLID'), vtMoveX, GDB_RT.GLOB)
-- Assegno identificativi alle spie delle morse
PYLightId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PYId, 'SOLID') or GDB_ID.NULL, 'Light')
PVLightId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PVId, 'SOLID') or GDB_ID.NULL, 'Light')
---------------------------------------------------------------------
-- Funzioni richiamate per modificare i dati macchina in casi particolari
--function OnSetTable()
--end
---------------------------------------------------------------------
function OnSetHead()
-- se testa lama
if EMC.HEAD == 'H1' then
if EMC.TOTLEN and EMC.TOTLEN < LONG_TOOL_MINLEN then
EmtModifyAxisStroke( 'B', {MinB, MaxB})
else
EmtModifyAxisStroke( 'B', {-140, 140})
end
else
EmtModifyAxisStroke( 'B', {MinB, MaxB})
if EMC.HEAD == 'H2' then
EmtModifyAxisDirection( 'B', VectorFromRotated( X_AX(), Z_AX(), -SawCOffs))
-- altrimenti
else
EmtModifyAxisDirection( 'B', X_AX())
if EMC.HEAD == 'H3' then
local dDist = EgtIf( EMC.DIST and abs( EMC.DIST) > 1, EMC.DIST, ChSawLen)
EmtModifyExitPosition( EMC.HEAD, EMC.EXIT, Point3d( 0, 0, -dDist))
if not EMC.VER or EMC.VER < '2.5h2' then
local vtMove = Point3d( 0, 0, -dDist) - Point3d( EMC.EXITPOS)
local ExitId = EgtGetFirstNameInGroup( EgtGetHeadId( EMC.HEAD), 'T'..tostring( EMC.EXIT))
EgtMove( ExitId, vtMove)
end
end
end
end
end
---------------------------------------------------------------------
-- Funzione che calcola l'angolo Home di C per la sega a catena dal valore dell'asse virtuale
function GetChainSawCHomeFromVirtualAxis( dPosA)
-- se A=0 -> T111 -> HomeC = 0
if abs( dPosA) < 0.1 then
return EgtIf( BD.RIGHT_LOAD, -180, 0)
-- altrimenti A=90 -> T114 -> HomeC = -90
else
return EgtIf( BD.RIGHT_LOAD, 90, 270)
end
end
---------------------------------------------------------------------
-- Funzione per impostare spia stato morsa carrello Y
function SetPYLight( bClosed)
if not PYLightId then return end
EgtSetColor( PYLightId, EgtIf( bClosed, 'RED', 'LIME'))
if bClosed then
EgtSetInfo( PYLightId, 'On', '1')
else
EgtRemoveInfo( PYLightId, 'On')
end
end
---------------------------------------------------------------------
-- Funzione per leggere lo stato della morsa carrello Y
function GetPYLight()
if not PYLightId then return false end
return ( EgtGetInfo( PYLightId, 'On') == '1')
end
---------------------------------------------------------------------
-- Funzione per impostare spia stato morsa carrello V
function SetPVLight( bClosed)
if not PVLightId then return end
EgtSetColor( PVLightId, EgtIf( bClosed, 'RED', 'LIME'))
if bClosed then
EgtSetInfo( PVLightId, 'On', '1')
else
EgtRemoveInfo( PVLightId, 'On')
end
end
---------------------------------------------------------------------
-- Funzione per leggere lo stato della morsa carrello V
function GetPVLight()
if not PVLightId then return false end
return ( EgtGetInfo( PVLightId, 'On') == '1')
end
---------------------------------------------------------------------
---------------------------- Cambio Utensile ------------------------
function GetTCSet( sTcPos)
-- TC 1
if sTcPos == 'T1' or sTcPos == 'T2' or sTcPos == 'T3' or sTcPos == 'T4' or sTcPos == 'T5' or
sTcPos == 'T6' or sTcPos == 'T7' or sTcPos == 'T8' or sTcPos == 'T9' or sTcPos == 'T10' or sTcPos == 'T11' then
return 1
-- TC 2
elseif sTcPos == 'T21' or sTcPos == 'T22' or sTcPos == 'T23' or sTcPos == 'T24' or
sTcPos == 'T25' or sTcPos == 'T26' or sTcPos == 'T27' or sTcPos == 'T28' then
return 2
end
end
---------------------------------------------------------------------
-- Funzione per impostare la posizione del rinvio flottante
function SetFloatPos( sHead, dPos)
-- recupero Id testa
local nHeadId = EgtGetHeadId( sHead)
if not nHeadId then return false end
-- se ci sono entità flottanti nel ToolHolder
local nRefId = EgtGetFirstNameInGroup( nHeadId, '_T1')
local vtTool = EgtFR( nRefId, GDB_ID.ROOT):getVersZ()
local nObjId = EgtGetFirstGroupInGroup( EgtGetFirstNameInGroup( nHeadId, 'T1'))
local FloatEntities = EgtGetInfoInGroup( nObjId, 'Float')
if FloatEntities and #FloatEntities > 0 then
-- il porta-utensile flottante non può comprimersi più di 10mm
if dPos > 10 then
local sErr = 'Floating Ring compressed more than 10mm'
EmtSetLastError( 1222, sErr)
EgtOutLog( 'Error : ' .. sErr, 1)
end
local dFloat = EgtGetInfo( FloatEntities[1], 'Float', 'd')
if abs( dPos - dFloat) > 10 * GEO.EPS_SMALL then
local vtMove = ( dPos - dFloat) * vtTool
-- sposto tutte le entità flottanti
for i = 1, #FloatEntities do
EgtMove( FloatEntities[i], vtMove, GDB_RT.GLOB)
EgtSetInfo( FloatEntities[i], 'Float', dPos)
end
end
return true
end
return false
end
---------------------------------------------------------------------
-- Funzione per resettare tutte le attivazioni della macchina
function OnResetMachine()
EmtUnlinkAllRawPartsFromGroups()
EmtUnlinkAllFixturesFromGroups()
SetPYLight( false)
SetPVLight( false)
SetFloatPos( 'H1', 0)
-- nascondo Vmill
local nRawId = EgtGetFirstRawPart()
while nRawId do
local nVmId = EgtGetFirstNameInGroup( nRawId, 'VMill')
local nId = EgtGetFirstInGroup( nRawId)
while nId do
EgtSetStatus( nId, EgtIf( nId ~= nVmId, GDB_ST.ON, GDB_ST.OFF))
nId = EgtGetNext( nId)
end
nRawId = EgtGetNextRawPart( nRawId)
end
EgtSetStatus( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'VMill') or GDB_ID.NULL, GDB_ST.OFF)
end
---------------------------------------------------------------------
function UpdateMinJoinDeltaTol( SB, HB, LB)
local L_SMALL = 800
local H_V = 90
local H_S = 200
local H_L = 400
local W_V = 90
local W_S = 150
local W_L = 250
local DELTA_TOL_S = 210
local DELTA_TOL_V = 110
local DELTA_TOL_L = 410
if SB <= W_V and HB <= H_V then
MinJoin = MinJoinVV
DeltaTol = DELTA_TOL_V
elseif LB <= L_SMALL then
MinJoin = MinJoinSS
DeltaTol = DELTA_TOL_S
else
local dMinJoinS
local dMinJoinL
if SB <= W_S then
dMinJoinS = MinJoinSS
dMinJoinL = MinJoinLS
elseif SB <= W_L then
local Coeff = ( SB - W_S) / ( W_L - W_S)
dMinJoinS = ( 1 - Coeff) * MinJoinSS + Coeff * MinJoinSL
dMinJoinL = ( 1 - Coeff) * MinJoinLS + Coeff * MinJoinLL
else
dMinJoinS = MinJoinSL
dMinJoinL = MinJoinLL
end
if HB <= H_S then
MinJoin = dMinJoinS
DeltaTol = DELTA_TOL_S
elseif HB <= H_L then
local Coeff = ( HB - H_S) / ( H_L - H_S)
MinJoin = ( 1 - Coeff) * dMinJoinS + Coeff * dMinJoinL
DeltaTol = ( 1 - Coeff) * DELTA_TOL_S + Coeff * DELTA_TOL_L
else
MinJoin = dMinJoinL
DeltaTol = DELTA_TOL_L
end
if SB < W_V then
DeltaTol = DELTA_TOL_V
end
end
MinOther = abs( MinY) + abs( MaxV) + MinJoin
end