Files
Carlo Baronchelli 741791a0e4 Copia locale Iniziale
2022-05-19 16:04:07 +02:00

540 lines
17 KiB
Plaintext

-- Descrizione macchina Essetre-FAST by EgalTech s.r.l. 2022/04/07
-- 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.
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '2.4d1'
-- Parametri macchina
NumericalControl = 'TPA' -- NUM o TPA
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
SawOffs = -242.68
SawBOffs = 0
SawCOffs = 0
ChSawLen = 90.0
AngTr1Offs = 170
AngTr1Len = 150
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
CoeffVM = 0.5
NewTopC = true
-- Aggiornamento con dati da BeamData.lua
local sBeamData = EgtGetSourceDir().."\\Beam\\BeamData.lua"
if EgtExistsFile( sBeamData) then
local BD = dofile( sBeamData)
if BD then
BeamHeightForFixRot = BD.MAX_HEIGHT_ROT_B_ABOVE or BeamHeightForFixRot
end
end
-- Aggiornamento con dati da TechnoEssetre7
local sTs3Data = EgtGetStringFromIni( 'Beam', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-Fast.data"
local sData = EgtGetSourceDir().."\\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
NumericalControl = EgtIf( Machine.Offsets.TIPO_CN == 0, 'NUM', 'TPA')
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
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.RIB_AUTO then AutomaticRotation = ( Machine.Offsets.RIB_AUTO == 1) end
if Machine.Offsets.NOULOAD then MaxUnloadLen = Machine.Offsets.NOULOAD end
end
end
end
if SpecialBH then SecondSupport = 0 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 = 'Essetre-FAST.mlse',
Processor = 'Essetre-FAST.mlpe'}
local BaseId = EmtBase {
Name = 'Base',
Geo='BASE/GEO',
Aux={'BASE/SOLID', 'BASE/TC', 'BASE/SIGN', 'BASE/COLLISION'}}
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'}}
if NewTopC then
local SolidTopId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( CId, 'SOLID'), 'TOP')
local CollTopId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( CId, 'COLLISION'), 'TOP')
EgtMove( { SolidTopId, CollTopId}, Vector3d( 65,0,0), GDB_RT.GLOB)
EgtSetName( CollTopId, 'BOX')
else
local CollTopId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( CId, 'COLLISION'), 'TOP')
EgtSetName( CollTopId, 'BOX')
end
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 = Vector3d( 0, -sin( SawBOffs), -cos( 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
-- Dummy
EmtHead {
Name = 'H4',
Parent = 'B',
HSet = 'H4',
Type = MCH_HT.STD,
Pos = Point3d( 0, 0, 0),
TDir = Z_AX(),
ADir = X_AX(),
Rot1W = 0.2,
Geo = 'H4_HEAD/GEO'}
-- Eventuale rinvio angolare
if SecondSupport >= 2 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', '220')
EgtSetInfo( H5Id, 'AGB_ENCH', '44')
EgtSetInfo( H5Id, 'AGB_ENCV', '380')
EgtSetInfo( H5Id, 'ZMAXONROT', '1,15')
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'}}
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'}}
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'}
EmtTcPos {
Name = 'T11',
Parent = 'Base',
Pos = Point3d( 523.8, 88.0, -877.5),
TDir = -X_AX(),
ADir = -Y_AX(),
Geo = 'BASE/T11'}
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'}
else
EmtTcPos {
Name = 'T101',
Parent = 'Base',
Pos = Point3d( -510.4, 113.2, -1160.8),
TDir = X_AX(),
ADir = Z_AX(),
Geo = 'BASE/T101S'}
end
if SecondSupport == 1 then
EmtTcPos {
Name = 'T111',
Parent = 'Base',
Pos = Point3d( -510.4, 113.2, -329.8),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'BASE/T111'}
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
-- 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( 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( 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 == 'H2' then
EmtModifyAxisDirection( 'B', Vector3d( cos( SawCOffs), -sin( SawCOffs), 0))
-- altrimenti
else
EmtModifyAxisDirection( 'B', X_AX())
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
---------------------------------------------------------------------
-- Funzione per resettare tutte le attivazioni della macchina
function OnResetMachine()
EmtUnlinkAllRawPartsFromGroups()
EmtUnlinkAllFixturesFromGroups()
SetPYLight( false)
SetPVLight( false)
-- 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