Merge branch 'develop'

This commit is contained in:
andrea.villa
2025-04-30 14:30:50 +02:00
25 changed files with 2644 additions and 93 deletions
+17
View File
@@ -0,0 +1,17 @@
/Tools
/Machinings
/SetUp
/Beam/Ts3Data.bak
/Beam/CutData.lua
/Beam/DrillData.lua
/Beam/MillingData.lua
/Beam/PocketingData.lua
/Beam/SawingData.lua
/Beam/Ts3Data.lua
/Wall/Ts3Data.bak
/Wall/CutData.lua
/Wall/DrillData.lua
/Wall/MillingData.lua
/Wall/PocketingData.lua
/Wall/SawingData.lua
/Wall/Ts3Data.lua
Binary file not shown.
Binary file not shown.
Binary file not shown.
+48
View File
@@ -0,0 +1,48 @@
; Commento per evitare BOM con UTF-8
;Index = Type, Description, Default Value
; Type : b=boolean, d=double, l=lenght, s=string
[Drilling]
[Sawing]
[Milling]
0=d,MaxElev,0
1=d,OutRaw,0
2=d,SideElev,0
3=d,TrimExt,0
4=sr,VtFaceUse,0,0,0
[Pocketing]
0=d,MaxElev,0
1=b,Open,0
2=d,OpenMinSave,0
3=d,OpenOutRaw,0
4=d,MaxOptSize,0
[Mortising]
0=d,MaxElev,0
[Chiseling]
[GenMachining]
[SurfRoughing]
[SurfFinishing]
0=b,SkipMaxDown,1
[5AxMilling]
0=l,LinTol,0.01
1=l,MaxLen,10
2=s,Type,ZigZag
3=d,SideAng,90
4=l,Step,10
5=l,OffsProj,0
6=l,LiTang,0
7=l,LiOrth,0
8=l,LiElev,0
9=l,LoTang,0
10=l,LoOrth,0
11=l,LoElev,0
12=b,DirFromGuide,1
+659
View File
@@ -0,0 +1,659 @@
-- Processore macchina Masterwood Project265 2025/01/09
-- by EgalWare s.r.l.
--
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
-- Variabili di modulo
local MLE_INFO = 'Project265.TECNOS.mlpe ver.2.7a1 by EgalWare s.r.l.'
-- ******************************************************************
-- ************************ GENERATION *************************
-- ******************************************************************
function OnStart()
EMT.USETO1 = true -- abilitazione uso origine tavola
EMT.MODAL = true -- abilitazione emissione modale
EMT.INCHES = not EgtUiUnitsAreMM() -- unità di misura mm/inches
EMT.DECNUM = EgtIf( EMT.INCHES, 4, 3) -- numero di decimali dopo la virgola
EMT.NUM = false -- abilitazione numerazione linee
end
---------------------------------------------------------------------
function OnEnd()
-- Chiusura file altri processi (qui si passa sempre, anche in caso di errore)
local sNewPath = EgtChangePathExtension( EMT.FILE, '.prg')
EgtEraseFile( sNewPath)
EgtRenameFile( EMT.FILE, sNewPath)
end
---------------------------------------------------------------------
function OnProgramStart()
-- Intestazione processo 1
-- EmtOutput( EgtIf( EMT.INFO, '( '..EMT.INFO, ';Program Start'))
-- EmtOutput( '( '.. MLE_INFO)
end
---------------------------------------------------------------------
function OnProgramEnd()
EmtOutput( '( --- PARK HEAD')
EmtOutput( 'G170 W0.00')
EmtOutput( '( --- END PROGRAM')
EmtOutput( '%')
end
---------------------------------------------------------------------
function OnToolData()
end
---------------------------------------------------------------------
function OnDispositionStart()
-- inizialiozzo lista disposizione
EMT.DISP = {}
end
---------------------------------------------------------------------
function OnDispositionEnd()
-- in prima fase, scrivo header
if EMT.PHASE == 1 then
EmtOutput( '% ')
local sDateFile = string.sub( EMT.INFO, -20)
EmtOutput( '|1' .. sDateFile)
EmtOutput( '|2 0')
-- acquisizione nome attrezzaggio
local sSetupName = EgtGetInfo( EgtGetCurrSetup() or GDB_ID.NULL, 'Name') or '01'
EmtOutput( '|3 ' .. sSetupName)
EmtOutput( '|4 ' .. tostring( EMT.LP)) -- dim x pezzo
EmtOutput( '|5 ' .. tostring( EMT.TP)) -- dim z pezzo
EmtOutput( '|6 ' .. tostring( EMT.HP)) -- dim y pezzo
EmtOutput( '|7 0 0 0 0')
EmtOutput( '|8 0')
EmtOutput( '|9 ')
EmtOutput( '|10 ')
EmtOutput( '|11 ')
EmtOutput( '|12 ')
EmtOutput( '|13 ')
EmtOutput( '|14 ')
-- scrittura info piani di lavoro e sottopezzi
WriteDispositionInfo()
end
end
---------------------------------------------------------------------
function OnTableData()
end
---------------------------------------------------------------------
function OnTableAxisData()
-- EmtOutput( '( TabAxis '..EgtNumToString( EMT.TAIND)..' : Name='..EMT.TANAME..
-- ' Pos='..EgtNumToString( EMT.TAPOS)..' Moved='..EgtIf( EMT.TAMOVED, 'true', 'false'))
local PLx = {}
PLx.sName = EMT.TANAME
PLx.dPosX = EMT.TAPOS
PLx.Fixture = {}
table.insert( EMT.DISP, PLx)
end
---------------------------------------------------------------------
function OnFixtureData()
-- EmtOutput( '( Fixture '..EgtNumToString( EMT.FIXIND)..' : Name='..EMT.FIXNAME..
-- ' Pos=('..EmtNum3ToString( EMT.FIXPOS)..') Ang='..EgtNumToString( EMT.FIXANG)..' Mob='..EgtNumToString( EMT.FIXMOB))
local SubPiece = {}
SubPiece.sPLName = EMT.FIXTAL
SubPiece.sName = EMT.FIXNAME
SubPiece.ptPos = EMT.FIXPOS
SubPiece.dAngle = EMT.FIXANG
-- metto il sottopezzo sulla barra opportuna
for i = 1, #EMT.DISP do
-- cerco il piano sul quale è montato il sottopezzo
if EMT.DISP[i].sName == SubPiece.sPLName and EgtStartsWith( SubPiece.sName, 'Vac') then
table.insert( EMT.DISP[i].Fixture, SubPiece)
end
end
end
---------------------------------------------------------------------
function OnRawMoveData()
-- EmtOutput( '( RawMove '..EMT.RAWIND..' : Id='..EMT.RAWID..' Type='..EMT.RAWTYPE..
-- ' Pos=('..EmtNum3ToString( EMT.RAWPOS)..') Flag='..EMT.RAWFLAG)
-- Determino dimensioni del grezzo
local b3Sol = EgtGetBBoxGlob( EMT.RAWID, GDB_BB.STANDARD)
EMT.LP = 0 -- lunghezza
EMT.HP = 0 -- altezza
EMT.TP = 0 -- spessore
if b3Sol then
EMT.LP = b3Sol:getDimX()
EMT.HP = b3Sol:getDimY()
EMT.TP = b3Sol:getDimZ()
end
-- riqualifico il punto zero sempre in basso a sinistra. Se arriva da B&W potrebbe essere in un altro punto, in base a come è girato il pezzo
EMT.RAWPOS[1] = b3Sol:getMin():getX() - EMT.TABORI1[1]
EMT.RAWPOS[2] = b3Sol:getMin():getY() - EMT.TABORI1[2]
end
---------------------------------------------------------------------
function OnToolSelect()
EMT.TOOLTYPE = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
EMT.TDIAM = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
EMT.TTOTDIAM = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM)
EMT.TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN)
EMT.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
end
---------------------------------------------------------------------
function OnToolDeselect()
end
---------------------------------------------------------------------
function OnMachiningStart()
EMT.MCHNAME = EgtGetOperationName( EMT.MCHID)
EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE)
EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES)
EMT.MCHFIRST = true
-- inizio lavorazione
EmtOutput( '( === '.. EMT.MCHNAME .. ' - ' .. EMT.TOOL .. ' ===')
-- impostazione cuffia ( 0-alta, 1-bassa, 2-medio-bassa, 3-medio-alta)
local nHoodPos = EgtGetValInNotes( EMT.MCHUSERNOTES, 'HOODPOS', d) or 0
EmtOutput( '( --- Hood position' )
EmtOutput( 'M61 K' .. tostring( nHoodPos) .. ' D0')
end
---------------------------------------------------------------------
function OnMachiningEnd()
-- reset eventuali macro
EMT.MACROLAMA = nil
EMT.MACROFORO = nil
EMT.PTMACRO = nil
end
---------------------------------------------------------------------
function OnPathStart()
-- reset valori precedenti (per forzare emissione di tutti gli assi del 1° movimento)
EmtResetPrev()
-- EmtOutput( '( DRACEX='..table.concat( EMT.DRACEX, ','))
EMT.IPLGL = false
end
---------------------------------------------------------------------
function OnPathEnd()
end
---------------------------------------------------------------------
function OnRapid()
-- se standard
if EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then
-- se foratura, si scrive macro alla fine del foro
if EMT.HEAD == 'H21' then
-- movimenti rapidi gestiti da macro macchina
EMT.MACROFORO = true
-- inizializzo lista contenente punti di lavorazione
EMT.PTMACRO = {}
-- se punto successivo lineare, salvo questo punto
if EMT.MOVESUCC == 1 then
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
-- emissione piano di interpolazione
EmitInterpPlane( true)
local p3FirstPoint = Point3d( EMT.L1, EMT.L2, EMT.L3)
table.insert( EMT.PTMACRO, p3FirstPoint)
EMT.MCHFIRSTLIN = true
end
-- se utensile lama, si scrive macro con punto finale
elseif EMT.TOOLTYPE == MCH_TY.SAW_STD or EMT.TOOLTYPE == MCH_TY.SAW_FLAT then
EMT.MACROLAMA = true
-- inizializzo lista contenente primo punto di lavorazione
EMT.PTMACRO = {}
-- se punto successivo lineare, salvo questo punto
if EMT.MOVESUCC == 1 then
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
-- emissione piano di interpolazione
EmitInterpPlane( true)
local p3FirstPoint = { EmtLenToString(EMT.L1), EmtLenToString(EMT.L2), EmtLenToString(EMT.L3)}
AdjustBladeZeroPoint( p3FirstPoint, EMT.CDIR)
table.insert( EMT.PTMACRO, p3FirstPoint)
EMT.MCHFIRSTLIN = true
end
-- altrimenti testa 5 assi
else
-- se primo movimento della lavorazione, gestione speciale
if EMT.MCHFIRST then
--if EMT.MOVESUCC == 1 then
-- emissione piano di interpolazione
EmitInterpPlane( false)
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
-- emissione primo punto della lavorazione
local sLinearAxes = EmtGetRapidAxis('L1') .. EmtGetRapidAxis('L2')
if not EMT.IPLGL then
sLinearAxes = sLinearAxes .. ' ' .. EMT.L3t .. EmtLenToString( - EgtMdbGetGeneralParam( MCH_GP.SAFEZ), EMT.DECNUM)
else
sLinearAxes = sLinearAxes .. EmtGetAxis('L3')
end
local sSpeed = ' S' .. EmtLenToString( EMT.S / 1000)
local sFeed = ' E5' -- feed entrata
local sToolSelection = GetToolSelectionString( EMT.HEAD, EMT.TCPOS)
local sVertAngle = ' J' .. EmtLenToString( EMT.R2)
EmtOutput( 'G172' .. sLinearAxes .. sSpeed .. sFeed .. sToolSelection .. sVertAngle)
EMT.MCHFIRST = false
--end
else
-- su primo rapido dopo G172, scrivo asse C
if EMT.FLAG == 1 then
EMT.R1p = nil
end
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
local sAxes = EmtGetRapidAxis('L1')..EmtGetRapidAxis('L2')..EmtGetRapidAxis('L3')..
EmtGetRapidAxis( 'R1')..EmtGetRapidAxis('R2')
if #sAxes > 0 then
EmtOutput( 'G101'..sAxes..' F50')
end
end
end
-- se altrimenti risalita a Z max a fine lavorazione
elseif EMT.FLAG == 3 then
EMT.IPLGL = false
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
-- se altrimenti movimento in Home
elseif EMT.FLAG == 4 then
-- da gestire ???
-- altrimenti errore
else
error( "Unknown Rapid flag")
end
-- aggiorno valori come precedenti
EmtUpdatePrev()
end
---------------------------------------------------------------------
function OnLinear()
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
-- controllo feed che sia espressa in metri
local dFeed
if EMT.F < 10 then
sFeed = ' F' .. EMT.F
elseif EMT.F > 1000 then
sFeed = ' F' .. (EMT.F/1000)
else
EmtSetLastError( 1210, 'Feed TOO HIGH!! Machining: ' .. EMT.MCHNAME)
end
-- macro foratura
if EMT.MACROFORO then
-- se inversione movimento al fondo di un foro, scrivo macro
if EMT.FLAG == 101 then
-- se testa 5 assi
if EMT.HEAD == 'H21' then
local p3SecondPoint = Point3d( EMT.L1, EMT.L2, EMT.L3)
table.insert( EMT.PTMACRO, p3SecondPoint)
local sLinearAxes = EMT.L1t .. EmtLenToString(EMT.PTMACRO[2][1]) .. ' ' ..
EMT.L2t .. EmtLenToString(EMT.PTMACRO[2][2]) .. ' ' ..
EMT.L3t .. EmtLenToString(EMT.PTMACRO[2][3])
local sToolSelection = GetToolSelectionString( EMT.HEAD, EMT.DRACEX)
EmtOutput( '( --- Tool selection for MultiDrill')
EmtOutput( sToolSelection)
-- FACCIA SOPRA
local v3TDir = Vector3d( EMT.TDIR)
if AreSameVectorApprox( v3TDir, Z_AX()) then
EmtOutput( 'G100 ' .. sLinearAxes .. sFeed .. ' T81')
-- FACCIA DESTRA
elseif AreSameVectorApprox( v3TDir, X_AX()) then
EmtOutput( 'G183 ' .. sLinearAxes .. sFeed .. ' T81')
-- FACCIA SINISTRA
elseif AreSameVectorApprox( v3TDir, -X_AX()) then
EmtOutput( 'G182 ' .. sLinearAxes .. sFeed .. ' T81')
-- FACCIA RETRO
elseif AreSameVectorApprox( v3TDir, Y_AX()) then
EmtOutput( 'G184 ' .. sLinearAxes .. sFeed .. ' T81')
-- FACCIA FRONTE
elseif AreSameVectorApprox( v3TDir, -Y_AX()) then
EmtOutput( 'G185 ' .. sLinearAxes .. sFeed .. ' T81')
end
end
end
elseif EMT.MACROLAMA then
-- se primo movimento lineare, aggiusto la Z del primo punto
if EMT.MCHFIRSTLIN then
local p3FirstLinear = { EmtLenToString(EMT.L1), EmtLenToString(EMT.L2), EmtLenToString(EMT.L3)}
AdjustBladeZeroPoint( p3FirstLinear, EMT.CDIR)
-- se taglio inclinato, prendo tutto il punto e correggo in direzione
if abs( EMT.TDIR[3]) > GEO.EPS_SMALL * 10 then
EMT.PTMACRO[1][1] = p3FirstLinear[1] - p3FirstLinear[3] * tan( asin( EMT.CDIR[1]))
EMT.PTMACRO[1][2] = p3FirstLinear[2] - p3FirstLinear[3] * tan( asin( EMT.CDIR[2]))
EMT.PTMACRO[1][3] = p3FirstLinear[3]
-- altrimenti prendo solo la Z
else
EMT.PTMACRO[1][3] = p3FirstLinear[3]
end
-- se primo punto già emesso, recupero il secondo punto
else
-- se movimento successivo è un rapido, si scrive il secondo punto
if EMT.MOVESUCC == 0 then
local p3SecondPoint
-- se taglio inclinato, prendo il punto precedente e correggo in direzione
if abs( EMT.TDIR[3]) > GEO.EPS_SMALL * 10 then
p3SecondPoint = { EmtLenToString(EMT.L1p), EmtLenToString(EMT.L2p), EmtLenToString(EMT.L3p)}
else
p3SecondPoint = { EmtLenToString(EMT.L1), EmtLenToString(EMT.L2), EmtLenToString(EMT.L3)}
end
AdjustBladeZeroPoint( p3SecondPoint, EMT.CDIR)
-- forzo la stessa Z in entrambi i punti. !! Non è possibile fare lavorazioni di lama con variazioni in Z
p3SecondPoint[3] = EMT.PTMACRO[1][3]
-- se inclinato, prendo punto prcedente
if abs( EMT.TDIR[3]) > GEO.EPS_SMALL * 10 then
p3SecondPoint[1] = p3SecondPoint[1] - p3SecondPoint[3] * tan( asin( EMT.CDIR[1]))
p3SecondPoint[2] = p3SecondPoint[2] - p3SecondPoint[3] * tan( asin( EMT.CDIR[2]))
p3SecondPoint[3] = p3SecondPoint[3]
end
table.insert( EMT.PTMACRO, p3SecondPoint)
local bClimbCut = true
local bInvertPoints = false
if EgtGetMachiningParam( MCH_MP.TYPE) == MCH_MY.SAWING then
local nHeadSide = EgtGetMachiningParam( MCH_MP.HEADSIDE)
-- se rotazione oraria e lato testa destro, lavorazione concorde
if EMT.S > 0 and nHeadSide == MCH_SAW_HS.RIGHT then
bClimbCut = true
else
bClimbCut = false
end
elseif EgtGetMachiningParam( MCH_MP.TYPE) == MCH_MY.MILLING then
local nWorkSide = EgtGetMachiningParam( MCH_MP.WORKSIDE)
-- se rotazione oraria e lato di lavoro sinistro, lavorazione concorde
if EMT.S > 0 and nWorkSide == MCH_MILL_WS.LEFT then
bClimbCut = true
else
bClimbCut = false
end
end
local sDiscordanza = EgtIf( bClimbCut, ' D0', ' D1')
local sSpeed = ' S' .. EmtLenToString( EMT.S / 1000)
local sToolSelection = GetToolSelectionString( EMT.HEAD, EMT.TCPOS)
local sVertAngle = ' J' .. EmtLenToString( EMT.R2)
-- se taglio in discordanza, si invertono i punti start/end per mantenere direzione testa
if bClimbCut then
bInvertPoints = true
end
local sLinearAxes
if bInvertPoints then
sLinearAxes = EMT.L1t .. EmtLenToString(EMT.PTMACRO[2][1]) .. ' ' ..
EMT.L2t .. EmtLenToString(EMT.PTMACRO[2][2]) .. ' ' ..
EMT.L3t .. EmtLenToString(EMT.PTMACRO[2][3])
else
sLinearAxes = EMT.L1t .. EmtLenToString(EMT.PTMACRO[1][1]) .. ' ' ..
EMT.L2t .. EmtLenToString(EMT.PTMACRO[1][2]) .. ' ' ..
EMT.L3t .. EmtLenToString(EMT.PTMACRO[1][3])
end
local sFeedOnMacro = sFeed:gsub( 'F', 'E')
EmtOutput( 'G172 ' .. sLinearAxes .. sSpeed .. sFeedOnMacro .. sToolSelection .. sVertAngle)
if bInvertPoints then
sLinearAxes = EMT.L1t .. EmtLenToString(EMT.PTMACRO[1][1]) .. ' ' ..
EMT.L2t .. EmtLenToString(EMT.PTMACRO[1][2]) .. ' ' ..
EMT.L3t .. EmtLenToString(EMT.PTMACRO[1][3])
else
sLinearAxes = EMT.L1t .. EmtLenToString(EMT.PTMACRO[2][1]) .. ' ' ..
EMT.L2t .. EmtLenToString(EMT.PTMACRO[2][2]) .. ' ' ..
EMT.L3t .. EmtLenToString(EMT.PTMACRO[2][3])
end
local sBladeAngle = ' K' .. EmtLenToString( EMT.R2)
EmtOutput( 'G189 ' .. sLinearAxes .. sFeed .. sBladeAngle .. sDiscordanza)
end
end
-- lavorazione standard
else
-- valori degli assi
local sAxes = EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis( 'R1')..EmtGetAxis('R2')
-- se nulla da emettere, esco
if #sAxes == 0 then
return
end
-- emetto linea
EmtOutput( 'G101' .. sAxes .. sFeed)
end
-- aggiorno valori come precedenti
EmtUpdatePrev()
-- reset info primo lineare
EMT.MCHFIRSTLIN = nil
end
---------------------------------------------------------------------
function OnArc()
-- non modale su archi
EmtResetPrevLinear()
-- valori degli assi
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
local sAxes = EmtGetAxis( 'L1')..EmtGetAxis( 'L2')..EmtGetAxis( 'L3')..
EmtGetAxis( 'R1')..EmtGetAxis( 'R2')
-- se nulla da emettere, esco
if #sAxes == 0 then
return
end
-- valori delle coordinate del centro
EmtAdjustCenterAxes()
-- coordinate centro (per ora solo archi nel piano XY)
--local sCen = ' ' .. EMT.C1t .. EmtLenToString(EMT.C1,3) ..
-- ' ' .. EMT.C2t .. EmtLenToString(EMT.C2,3)
-- raggio
local sRad = ' ' .. EMT.RRt .. EmtLenToString(EMT.RR,4)
-- controllo feed che sia espressa in metri
local dFeed
if EMT.F < 10 then
sFeed = ' F' .. EMT.F
elseif EMT.F > 1000 then
sFeed = ' F' .. (EMT.F/1000)
else
EmtSetLastError( 1210, 'Feed TOO HIGH!! Machining: ' .. EMT.MCHNAME)
end
-- tipo arco
local nMove = EmtGetArcType( EMT.MOVE, EMT.IPLSX)
local sArc = 'G10' .. EgtNumToString( nMove,0)
-- emetto arco
EmtOutput( sArc .. sAxes .. sRad .. sFeed)
-- aggiorno valori come precedenti
EmtUpdatePrev()
end
---------------------------------------------------------------------
---------------------------------------------------------------------
function EmitInterpPlane( bForceTopPlane)
-- Reset piano globale di interpolazione
EMT.IPLGL = false
EMT.IPLGLFR = nil
-- Imposto piano di interpolazione
EMT.IPLSX = false
local vtE = Vector3d( EMT.TDIR) -- si costruisce il piano in base alla direzione utensile
local nPlaneNumber = 1
-- piano TOP
if bForceTopPlane or vtE:isSmall() or AreSameVectorApprox( vtE, Z_AX()) or EMT.HEAD == 'H21' then
EmtOutput( '( --- Plane TOP')
EMT.IPLGLSTR = 'G120 K' .. tostring( nPlaneNumber)
EmtOutput( EMT.IPLGLSTR)
nPlaneNumber = 1
-- piano generico
else
-- indice piano generico
if EMT.INDEXGENPLANE then
EMT.INDEXGENPLANE = EMT.INDEXGENPLANE + 1
else
EMT.INDEXGENPLANE = 11
end
local ptS = Point3d( EMT.START)
if EMT.USETO1 then
ptS[1] = ptS[1] - EMT.TABORI1[1] - EMT.RAWPOS[1]
ptS[2] = ptS[2] - EMT.TABORI1[2] - EMT.RAWPOS[2] - EMT.HP
ptS[3] = ptS[3] - EMT.TABORI1[3] - EMT.RAWPOS[3]
end
-- calcolo per piano generico da emettere a vero inizio lavorazione
EMT.IPLGLFR = Frame3d( ptS, vtE)
local _, dAngV, dAngO = SphericalFromVector( vtE)
dAngV = - dAngV
dAngO = -( dAngO + 90)
while dAngO < -359.9 do
dAngO = dAngO + 360
end
while dAngO > 359.9 do
dAngO = dAngO - 360
end
EmtOutput( '( --- Plane GEN') -- EmtLenToString EgtNumToString
local sOriPlane = ' U' .. EmtLenToString( ptS:getX()) .. ' V' .. EmtLenToString( -ptS:getY()) .. ' W' .. EmtLenToString( ptS:getZ())
local sDirPlane = ' A' .. EmtLenToString( dAngV) .. ' B' .. EmtLenToString( dAngO)
EmtOutput( 'G121 K'..EmtLenToString( EMT.INDEXGENPLANE)..sOriPlane..sDirPlane)
EmtOutput( 'G120 K' .. EmtLenToString( EMT.INDEXGENPLANE))
EMT.IPLGL = true
end
-- emissione piano
end
---------------------------------------------------------------------
function GetToolSelectionString( sHead, sToolPos)
local sToolSelString
-- se testa 1, la selezione si scrive in questo modo
if sHead == 'H11' then
sToolSelString = ' T41/' .. sToolPos:sub(2)
-- selezione sul gruppo a forare
else
-- gestire nomi uscite non corrette
local sToolPosList = ''
for i = 1, #sToolPos do
sToolPosList = sToolPosList .. EmtLenToString( MDRILL[sToolPos[i]].Token or MDRILL[sToolPos[i]].Ex)
if i < #sToolPos then
sToolPosList = sToolPosList .. ','
end
end
sToolSelString = '#T81=' .. sToolPosList
end
return sToolSelString
end
---------------------------------------------------------------------
function WriteDispositionInfo()
-- se lavoro con tavola intera 0, altrimenti a 1
local bUseCompleteTable = false
local nUseCompleteTableIndex = EgtIf( bUseCompleteTable, 0, 1)
-- se lavoro con la meta' tavola di sinistra o con tavola intera 98, altrimenti 99
local bUseTableDX = false
local nUseTableDXIndex = EgtIf( bUseTableDX, 99, 98)
EmtOutput( '|30 ' .. tostring( nUseCompleteTableIndex) .. ' ' .. tostring( nUseTableDXIndex) .. ' 1')
-- scrittura piani e sottopezzi
for i = 1, #EMT.DISP do
local nIndexPL = 30 + i
local sInfoPL = ''
for j = 1, #EMT.DISP[i].Fixture do
EMT.DISP[i].Fixture[j].ptPos[2] = EMT.RAWPOS[2] + EMT.HP - EMT.DISP[i].Fixture[j].ptPos[2]
sInfoPL = sInfoPL .. ' ' .. EMT.DISP[i].Fixture[j].ptPos[2] .. ' ' .. EMT.DISP[i].Fixture[j].dAngle
end
EmtOutput( '|' .. tostring( nIndexPL) .. ' ' .. tostring( EMT.DISP[i].dPosX) .. tostring( sInfoPL))
end
EmtOutput( ':')
end
---------------------------------------------------------------------
function MyAdjustLinearAxes()
local MyL1o = EMT.L1
local MyL2o = EMT.L2
local MyL3o = EMT.L3
-- se testa a 5 assi
if EMT.HEAD == 'H11' then
local Len = EMT.TLEN + PIVOT
local LenRef = PIVOT
local vtE = Vector3d( EMT.TDIR) * Len + X_AX() * LenRef
-- si compensa utensile
EMT.L1 = EMT.L1 - vtE:getX()
EMT.L2 = EMT.L2 - vtE:getY()
EMT.L3 = EMT.L3 - vtE:getZ()
if not EMT.IPLGL then
-- compensazione punto zero pezzo
EMT.L1 = EMT.L1 - EMT.RAWPOS[1]
EMT.L2 = EMT.L2 - EMT.RAWPOS[2] - EMT.HP
EMT.L3 = EMT.L3 - EMT.RAWPOS[3] - EMT.TP
else
EMT.L1 = EMT.L1 - EMT.RAWPOS[1]
EMT.L2 = EMT.L2 - EMT.RAWPOS[2] - EMT.HP
EMT.L3 = EMT.L3 - EMT.RAWPOS[3]
end
EmtAdjustLinearAxes()
EMT.L1o = MyL1o
EMT.L2o = MyL2o
EMT.L3o = MyL3o
-- Y e Z sono invertiti
EMT.L2 = -EMT.L2
EMT.L3 = -EMT.L3
-- altrimenti foratore
else
local Len = EMT.TLEN
local vtE = Vector3d( EMT.TDIR) * Len
-- si compensa utensile
EMT.L1 = EMT.L1 - vtE:getX()
EMT.L2 = EMT.L2 - vtE:getY()
EMT.L3 = EMT.L3 - vtE:getZ()
local nExit = EMT.DRACEX[1]
EMT.L1 = EMT.L1 + MDRILL[nExit].Pos[1]
EMT.L2 = EMT.L2 + MDRILL[nExit].Pos[2] - EMT.RAWPOS[2] - EMT.HP
EMT.L3 = EMT.L3 + MDRILL[nExit].Pos[3] - EMT.RAWPOS[3] - EMT.TP
EmtAdjustLinearAxes()
-- Y e Z sono invertiti
EMT.L2 = -EMT.L2
EMT.L3 = -EMT.L3
-- per foratore, il riferimento è la faccia di lavoro, quindi si corregge la dimensione del pezzo
local v3TDir = Vector3d( EMT.TDIR)
if AreSameVectorApprox( v3TDir, X_AX()) then
EMT.L1 = - ( EMT.L1 - EMT.LP)
elseif AreSameVectorApprox( v3TDir, -Y_AX()) then
EMT.L2 = - ( EMT.L2 - EMT.HP)
end
end
end
---------------------------------------------------------------------
function AdjustBladeZeroPoint( p3FirstPoint, vCorrDirr)
p3FirstPoint[1] = p3FirstPoint[1] + ( vCorrDirr[1] * EMT.TDIAM/2)
p3FirstPoint[2] = p3FirstPoint[2] + ( vCorrDirr[2] * EMT.TDIAM/2)
p3FirstPoint[3] = p3FirstPoint[3] + ( vCorrDirr[3] * EMT.TDIAM/2)
end
---------------------------------------------------------------------
+58
View File
@@ -0,0 +1,58 @@
; Commento per evitare BOM con UTF-8
[General]
Material=Beam
[Tools]
Drillbit=1
Sawblade=1
Mill=1
Mortise=0
Chisel=0
DrillMaker=MakeWoodDrill.lua
SawbladeMaker=MakeSawblade.lua
MillMaker=MakeWoodCylMill.lua
ChiselMaker=MakeChisel.lua
[ToolHolder]
H11.1=HSK-F63_MillWeld12.nge
[Machinings]
Drilling=1
Sawing=1
Milling=1
Pocketing=1
Mortising=0
Chiseling=0
GenMachining=0
SurfRoughing=0
SurfFinishing=0
5AxMilling=0
[5AxMilling]
5AxScript1=5AxProject
5AxScript2=5AxPocketProject
[Disposition]
InitScript=InitDisp.lua
[Fixtures]
HookTolerance = 100
Vac1=Vac75x125H125,12
Vac2=Vac140x115H125,12
Ref1=RefD20,20
[Heads]
; 5 axis head
H11=6608
; Gang drill
H21=6612
[SetUp]
Default=Std
[VMill]
Enable=1
[Estimations]
Enable=1
WinPlace=0,1051,187,516,778
+507
View File
@@ -0,0 +1,507 @@
-- Descrizione macchina Masterwood Project265 2025/01/09
-- by EgalWare s.r.l.
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '2.7d1'
PP_NVER = '2.7.4.1'
MIN_MACH_VER = '2.5k1'
MACH_NAME = 'MW_Project265'
-- DATI MACCHINA --
NumericalControl = 'TECNOS'
PIVOT = 135
-- DATI TAVOLA --
TabX = 247.0064
TabY = -1914.5486
TabZ = -591.0497
----------------------------------------------------
-------------------- CORSE ASSI --------------------
----------------------------------------------------
XAxisStroke = {-9999, 9999}
YAxisStroke = {-9999, 9999}
ZAxisStroke = {-9999, 9999}
CAxisStroke = {-270, 270}
AAxisStroke = {-110, 110}
----------------------------------------------------
-------------------- DATI TESTE --------------------
----------------------------------------------------
-- testa 5 assi
H11Pos = Vector3d( 0, 0, 0)
-- gruppo forare
H21PosX = -249.005
H21PosY = 522.001
H21PosZ = 255.95
H21Pos = H11Pos + Vector3d( H21PosX, H21PosY, H21PosZ)
-- teste gruppo forare
MDRILL = { { Pos = H21Pos + Vector3d( 0, 0, 0), Ex=1, St=61}, -- uscita 1
{ Pos = H21Pos + Vector3d( 32, 0, 0), Ex=2, St=61}, -- uscita 2
{ Pos = H21Pos + Vector3d( 64, 0, 0), Ex=3, St=61}, -- uscita 3
{ Pos = H21Pos + Vector3d( 96, 0, 0), Ex=4, St=61}, -- uscita 4
{ Pos = H21Pos + Vector3d( 128, 0, 0), Ex=5, St=61}, -- uscita 5
{ Pos = H21Pos + Vector3d( 160, 0, 0), Ex=6, St=61}, -- uscita 6
{ Pos = H21Pos + Vector3d( 192, 0, 0), Ex=7, St=61}, -- uscita 7
{ Pos = H21Pos + Vector3d( 0, 64, 0), Ex=8, St=61}, -- uscita 8
{ Pos = H21Pos + Vector3d( 0, 96, 0), Ex=9, St=61}, -- uscita 9
{ Pos = H21Pos + Vector3d( 0, 128, 0), Ex=10, St=61}, -- uscita 10
{ Pos = H21Pos + Vector3d( 0, 160, 0), Ex=11, St=61}, -- uscita 11
{ Pos = H21Pos + Vector3d( -32, 32, -51.2), Ex=12, Token=31, Tw=13,St=76}, -- uscita 12
{ Pos = H21Pos + Vector3d( -32, -32, -51.2), Ex=13, Token=33, Tw=12,St=76}, -- uscita 13
{ Pos = H21Pos + Vector3d( 224, 64, -51.2), Ex=14, Token=35, Tw=16,St=76}, -- uscita 14
{ Pos = H21Pos + Vector3d( 224, 96, -51.2), Ex=15, Token=36, Tw=17,St=76}, -- uscita 15
{ Pos = H21Pos + Vector3d( 160, 64, -51.2),Ex=16, Token=37, Tw=14,St=76}, -- uscita 16
{ Pos = H21Pos + Vector3d( 160, 96, -51.2), Ex=17, Token=38, Tw=15,St=76}, -- uscita 17
{ Pos = H21Pos + Vector3d( 192, 192.5, -8.2), Ex=18, Token=50, St=76} -- uscita 18
}
----------------------------------------------------
----------------- DATI BANCALETTI ------------------
----------------------------------------------------
----------------------------------------------------
----------------- DATI SOTTOPEZZI-------------------
----------------------------------------------------
----------------------------------------------------------------------
EmtGeneral {
File='Masterwood-Project265.nge',
Offset = Vector3d( 3582.5064,-384.5486,-736.0497),
AxisMaxAdjust = 10,
ExitMaxAdjust = 20,
Special = 'Masterwood-Project265.mlse',
Processor = 'Masterwood-Project265.mlpe'}
EmtBase {
Name = 'Base',
Geo= 'BASE/GEO',
Aux= { 'BASE/SOLID', 'BASE/TC'}}
-- Testa e TC
EmtAxis {
Name = 'X',
Parent = 'Base',
Token = 'X',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = XAxisStroke,
Home = 0,
Geo = 'X_AXIS/GEO',
Aux = { 'X_AXIS/SOLID', 'X_AXIS/TCR'}}
EmtAxis {
Name = 'Y',
Parent = 'X',
Token = 'Y',
Type = MCH_AT.LINEAR,
Dir = Y_AX(),
Pos = Point3d(0, 0, 0),
Stroke = YAxisStroke,
Home = 0,
Geo = 'Y_AXIS/GEO',
Aux = 'Y_AXIS/SOLID'}
EmtAxis {
Name = 'Z1',
Parent = 'Y',
Token = 'Z',
Type = MCH_AT.LINEAR,
Dir = Z_AX(),
Pos = Point3d(0, 0, 0),
Stroke = ZAxisStroke,
Home = 0,
Geo = 'Z1_AXIS/GEO',
Aux = 'Z1_AXIS/SOLID'}
EmtAxis {
Name = 'C',
Parent = 'Z1',
Token = 'C',
Type = MCH_AT.ROTARY,
Dir = -Z_AX(),
Pos = Point3d(-135, 0, 244),
Stroke = CAxisStroke,
Home = 0,
Geo = 'C_AXIS/GEO',
Aux = {'C_AXIS/SOLID', 'C_AXIS/COLLISION'}}
EmtAxis {
Name = 'A',
Parent = 'C',
Token = 'A',
Type = MCH_AT.ROTARY,
Dir = Y_AX(),
Pos = Point3d( -135, 86.5, 0),
Stroke = AAxisStroke,
Home = 90,
Geo = 'A_AXIS/GEO',
Aux = {'A_AXIS/SOLID', 'A_AXIS/COLLISION'}}
EmtHead {
Name = 'H11',
Parent = 'A',
HSet = 'H11',
Type = MCH_HT.STD,
Pos = H11Pos,
TDir = -X_AX(),
ADir = Y_AX(),
OthColl = {'C/SOLID','A/SOLID'},
Geo = 'H11_HEAD/GEO'}
EmtAxis {
Name = 'Z2',
Parent = 'Y',
Token = 'Z',
Type = MCH_AT.LINEAR,
Dir = Z_AX(),
Pos = Point3d( 0, 0, 0),
Stroke = {-850.9, 200},
Home = 0,
Geo = 'Z2_AXIS/GEO',
Aux = 'Z2_AXIS/SOLID'}
EmtHead {
Name = 'H21',
Parent = 'Z2',
HSet = 'H21',
Type = MCH_HT.MULTI,
SelType = MCH_SLT.MULTIEXITS,
ExitNbr = 18,
Pos1 = MDRILL[1].Pos,
TDir1 = Z_AX(),
Pos2 = MDRILL[2].Pos,
TDir2 = Z_AX(),
Pos3 = MDRILL[3].Pos,
TDir3 = Z_AX(),
Pos4 = MDRILL[4].Pos,
TDir4 = Z_AX(),
Pos5 = MDRILL[5].Pos,
TDir5 = Z_AX(),
Pos6 = MDRILL[6].Pos,
TDir6 = Z_AX(),
Pos7 = MDRILL[7].Pos,
TDir7 = Z_AX(),
Pos8 = MDRILL[8].Pos,
TDir8 = Z_AX(),
Pos9 = MDRILL[9].Pos,
TDir9 = Z_AX(),
Pos10 = MDRILL[10].Pos,
TDir10 = Z_AX(),
Pos11 = MDRILL[11].Pos,
TDir11 = Z_AX(),
Pos12 = MDRILL[12].Pos,
TDir12 = -Y_AX(),
Pos13 = MDRILL[13].Pos,
TDir13 = Y_AX(),
Pos14 = MDRILL[14].Pos,
TDir14 = -X_AX(),
Pos15 = MDRILL[15].Pos,
TDir15 = -X_AX(),
Pos16 = MDRILL[16].Pos,
TDir16 = X_AX(),
Pos17 = MDRILL[17].Pos,
TDir17 = X_AX(),
Pos18 = MDRILL[18].Pos,
TDir18 = -Y_AX(),
ADir = VectorFromPolar( 1, 45),
Geo = 'H21_HEAD/GEO',
Aux = {'H21_HEAD/SOLID', 'H21_HEAD/SOL_T1', 'H21_HEAD/SOL_T2', 'H21_HEAD/SOL_T3', 'H21_HEAD/SOL_T4', 'H21_HEAD/SOL_T5',
'H21_HEAD/SOL_T6', 'H21_HEAD/SOL_T7', 'H21_HEAD/SOL_T8', 'H21_HEAD/SOL_T9', 'H21_HEAD/SOL_T10', 'H21_HEAD/SOL_T11',
'H21_HEAD/SOL_T12', 'H21_HEAD/SOL_T14', 'H21_HEAD/SOL_T15', 'H21_HEAD/SOL_T18'}}
-- Posizioni utensili speciali
EmtTcPos {
Name = 'T17',
Parent = 'Base',
Pos = Point3d( 3807.48, -578.72, -656.55),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'BASE/T17'}
EmtTcPos {
Name = 'T18',
Parent = 'Base',
Pos = Point3d( 3807.48, -843.72, -656.55),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'BASE/T18'}
-- Tool Changer
local ptTcR = Point3d( -60, 434.95, -558)
EmtTcPos {
Name = 'T1',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, 22.5 * 4),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T1'}
EmtTcPos {
Name = 'T2',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, 22.5 * 3),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T2'}
EmtTcPos {
Name = 'T3',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, 22.5 * 2),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T3'}
EmtTcPos {
Name = 'T4',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, 22.5 * 1),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T4'}
EmtTcPos {
Name = 'T5',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, 0),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T5'}
EmtTcPos {
Name = 'T6',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 1),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T6'}
EmtTcPos {
Name = 'T7',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 2),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T7'}
EmtTcPos {
Name = 'T8',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 3),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T8'}
EmtTcPos {
Name = 'T9',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 4),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T9'}
EmtTcPos {
Name = 'T10',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 5),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T10'}
EmtTcPos {
Name = 'T11',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 6),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T11'}
EmtTcPos {
Name = 'T12',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 7),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T12'}
EmtTcPos {
Name = 'T13',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 8),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T13'}
EmtTcPos {
Name = 'T14',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 9),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T14'}
EmtTcPos {
Name = 'T15',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 10),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T15'}
EmtTcPos {
Name = 'T16',
Parent = 'X',
Pos = ptTcR + VectorFromSpherical( 266, 90, -22.5 * 11),
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'X_AXIS/T16'}
-- Tavola
EmtTable {
Name = 'Tab',
Parent = 'Base',
Type = MCH_TT.FLAT,
Ref1 = {TabX, TabY, TabZ},
Geo = 'TABLE/GEO',
Aux = 'TABLE/SOLID'}
-- bancaletti
local PL1Id = EmtAxis {
Name = 'PL1',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {50, 2000},
Home = 80,
Geo = 'PL1_AXIS/GEO',
Aux = {'PL1_AXIS/SOLID', 'PL1_AXIS/COLLISION'}}
EgtSetInfo( PL1Id, 'MDist', 100)
EgtSetInfo( PL1Id, 'PDist', 110)
EgtSetInfo( PL1Id, 'Next', 'PL2')
EgtMove( PL1Id, Vector3d( -80, 0, 0), GDB_RT.GLOB)
local PL2Id = EmtAxis {
Name = 'PL2',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {200, 2100},
Home = 280,
Geo = 'PL2_AXIS/GEO',
Aux = {'PL2_AXIS/SOLID', 'PL2_AXIS/COLLISION'}}
EgtSetInfo( PL2Id, 'MDist', 100)
EgtSetInfo( PL2Id, 'PDist', 110)
EgtSetInfo( PL2Id, 'Prev', 'PL1')
EgtSetInfo( PL2Id, 'Next', 'PL3')
EgtMove( PL2Id, Vector3d( -280, 0, 0), GDB_RT.GLOB)
local PL3Id = EmtAxis {
Name = 'PL3',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {400, 2200},
Home = 480,
Geo = 'PL3_AXIS/GEO',
Aux = {'PL3_AXIS/SOLID', 'PL3_AXIS/COLLISION'}}
EgtSetInfo( PL3Id, 'MDist', 100)
EgtSetInfo( PL3Id, 'PDist', 110)
EgtSetInfo( PL3Id, 'Prev', 'PL2')
EgtSetInfo( PL3Id, 'Next', 'PL4')
EgtMove( PL3Id, Vector3d( -480, 0, 0), GDB_RT.GLOB)
local PL4Id = EmtAxis {
Name = 'PL4',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {800, 2900},
Home = 2730,
Geo = 'PL4_AXIS/GEO',
Aux = {'PL4_AXIS/SOLID', 'PL4_AXIS/COLLISION'}}
EgtSetInfo( PL4Id, 'MDist', 100)
EgtSetInfo( PL4Id, 'PDist', 110)
EgtSetInfo( PL4Id, 'Prev', 'PL3')
EgtSetInfo( PL4Id, 'Next', 'PL5')
EgtMove( PL4Id, Vector3d( -2730, 0, 0), GDB_RT.GLOB)
local PL5Id = EmtAxis {
Name = 'PL5',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {900, 3100},
Home = 2930,
Geo = 'PL5_AXIS/GEO',
Aux = {'PL5_AXIS/SOLID', 'PL5_AXIS/COLLISION'}}
EgtSetInfo( PL5Id, 'MDist', 100)
EgtSetInfo( PL5Id, 'PDist', 110)
EgtSetInfo( PL5Id, 'Prev', 'PL4')
EgtSetInfo( PL5Id, 'Next', 'PL6')
EgtMove( PL5Id, Vector3d( -2930, 0, 0), GDB_RT.GLOB)
local PL6Id = EmtAxis {
Name = 'PL6',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {1000, 3300},
Home = 3130,
Geo = 'PL6_AXIS/GEO',
Aux = {'PL6_AXIS/SOLID', 'PL6_AXIS/COLLISION'}}
EgtSetInfo( PL6Id, 'MDist', 100)
EgtSetInfo( PL6Id, 'PDist', 110)
EgtSetInfo( PL6Id, 'Prev', 'PL5')
EgtMove( PL6Id, Vector3d( -3130, 0, 0), GDB_RT.GLOB)
---------------------------------------------------------------------
-- Funzioni richiamate per modificare i dati macchina in casi particolari
---------------------------------------------------------------------
function OnSetTable()
EgtSetTableAreaOffset( 100, 100, 100, 100)
end
---------------------------------------------------------------------
local function MoveGroup( nGrpId, vtVers, dPos, bLoc)
local dVal = EgtGetInfo( nGrpId, 'Val')
if not dVal then return end
if abs( dPos - dVal) > GEO.EPS_SMALL then
local nRT = EgtIf( bLoc, GDB_RT.LOC, GDB_RT.GLOB)
EgtMove( nGrpId, ( dPos - dVal) * vtVers, nRT)
EgtSetInfo( nGrpId, 'Val', dPos)
end
end
---------------------------------------------------------------------
function OnActivateDrillingUnit()
-- assegno dati testa
local nHeadId = EMC.HEADID
-- sistemo dati uscite attive
local vbExit = {}
for i = 1, #( EMC.DRACEX or {}) do
vbExit[EMC.DRACEX[i]] = true
end
-- ciclo su tutte le uscite della testa
for nExit = 1, #MDRILL do
-- eventuale gemello
local nTwin = MDRILL[nExit].Tw or 0
-- nome e identificativo della geometria dell'uscita
local sExit = 'T' .. EgtNumToString( nExit, 0)
local nExitId = EgtGetFirstNameInGroup( nHeadId, sExit)
-- recupero la geometria associata all'uscita
local sStem = 'SOL_' .. sExit
local nStemId = EgtGetFirstNameInGroup( nHeadId, sStem)
-- determino la posizione
local dPos = EgtIf( vbExit[nExit] or vbExit[nTwin], 0, MDRILL[nExit].St)
-- eseguo posizionamento
if nStemId then
MoveGroup( nStemId, Z_AX(), dPos)
end
MoveGroup( nExitId, Z_AX(), dPos)
end
end
---------------------------------------------------------------------
function OnSetHead()
EMC.HEADID = EgtGetHeadId( 'H21')
EMC.DRACEX = nil
OnActivateDrillingUnit()
end
---------------------------------------------------------------------
-- Funzione per resettare tutte le attivazioni della macchina
function OnResetMachine()
EmtUnlinkAllRawPartsFromGroups()
EmtUnlinkAllFixturesFromGroups()
-- 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
+759
View File
@@ -0,0 +1,759 @@
-- Processore macchina Masterwood Project265 2025/01/09
-- by EgalWare s.r.l.
--
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
---------------------------------------------------------------------
-- *** GENERATION ***
---------------------------------------------------------------------
local sBaseDir = EgtGetCurrMachineDir()
if NumericalControl == 'TECNOS' then
dofile( sBaseDir .. '\\Masterwood-Project265.TECNOS.mlpe')
else
EmtSetLastError( 1201, 'Numerical Control error : unkwnown type')
end
---------------------------------------------------------------------
-- *** SIMULATION ***
---------------------------------------------------------------------
---------------------------------------------------------------------
function OnSimulStart()
-- controllo versione programma
if not EMT.VER or EMT.VER < MIN_MACH_VER then
EmtSetLastError( 1200, 'A newer version of the program is required (minimum EgtMachKernel '..MIN_MACH_VER..')')
end
-- Carico gli utensili sulle barre portautensili
local vTcPos = EgtGetAllTcPosNames()
if vTcPos then
for i = 1, #vTcPos do
local vTools = EgtGetToolsInCurrSetupPos( vTcPos[i])
for j = 1, #( vTools or {}) do
if vTools[j] ~= '' then
EgtLoadTool( vTcPos[i], j, vTools[j])
end
end
ShowToolInTcPos( vTcPos[i], true)
end
end
-- Se reset o home, esco
if EMT.SIM1ST then return end
-- Creo o svuoto gruppo per copia finale degli oggetti virtual milling
local nVmGrpId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'VMill')
if nVmGrpId then
EgtSetStatus( nVmGrpId, GDB_ST.ON)
EgtEmptyGroup( nVmGrpId)
else
nVmGrpId = EgtGroup( GDB_ID.ROOT)
EgtSetName( nVmGrpId, 'VMill')
EgtSetLevel( nVmGrpId, GDB_LV.TEMP)
end
-- Preparo lista oggetti da verificare per collisioni
EMT.COLLOBJ = {}
AddToCollisionCheck( 'C', 'COLLISION', EMT.COLLOBJ)
AddToCollisionCheck( 'A', 'COLLISION', EMT.COLLOBJ)
DumpCollisionCheck( EMT.COLLOBJ, 'Collision Objects :', 4)
-- Preparo lista solidi macchina con cui possono collidere gli oggetti sopra riportati (in aggiunta a VMill)
EMT.MCODET = {}
local McdData = { { Grp = 'PL1', Sub = 'COLLISION', Name = 'STM'},
{ Grp = 'PL2', Sub = 'COLLISION', Name = 'STM'},
{ Grp = 'PL3', Sub = 'COLLISION', Name = 'STM'},
{ Grp = 'PL4', Sub = 'COLLISION', Name = 'STM'},
{ Grp = 'PL5', Sub = 'COLLISION', Name = 'STM'},
{ Grp = 'PL6', Sub = 'COLLISION', Name = 'STM'}}
EgtOutLog( 'MCODET Objects :', 4)
local nMcdNullCnt = 0
for i = 1, #McdData do
local nGrpId
if McdData[i].Grp == 'Base' then
nGrpId = EgtGetBaseId( 'Base')
else
nGrpId = EgtGetAxisId( McdData[i].Grp)
end
local nId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( nGrpId or GDB_ID.NULL, McdData[i].Sub) or GDB_ID.NULL, McdData[i].Name)
if nId then
table.insert( EMT.MCODET, nId)
EgtOutLog( 'Element ' .. McdData[i].Grp .. '/' .. McdData[i].Sub .. '/' .. McdData[i].Name .. ' (' .. tostring( nId) .. ') is ok', 4)
else
nMcdNullCnt = nMcdNullCnt + 1
EgtOutLog( 'Element ' .. McdData[i].Grp .. '/' .. McdData[i].Sub .. '/' .. McdData[i].Name .. ' is null', 4)
end
end
if nMcdNullCnt > 0 then
EgtOutLog( 'Warning : MCODET with one or more null Element(s) ')
end
-- Preparo lista collisioni vuota
EMT.COLLIDE = {}
end
---------------------------------------------------------------------
function OnSimulEnd()
-- posizioni home degli assi testa
local HomeX = EgtGetAxisHomePos( 'X')
local HomeY = EgtGetAxisHomePos( 'Y')
local HomeZ1 = EgtGetAxisHomePos( 'Z1')
local HomeC = EgtGetAxisHomePos( 'C')
local HomeA = EgtGetAxisHomePos( 'A')
SimulMoveAxes( 'X', HomeX, MCH_SIM_STEP.RAPID, 'Y', HomeY, MCH_SIM_STEP.RAPID,'Z1', HomeZ1, MCH_SIM_STEP.RAPID, 'A', HomeA, MCH_SIM_STEP.COLLROT, 'C', HomeC, MCH_SIM_STEP.COLLROT)
end
---------------------------------------------------------------------
function OnSimulDispositionStart()
EMT.OPEISDISP = true
-- se non esiste la lista con le info dei pezzi, la creo
if not EMT.PIECES or EMT.PHASE > 1 then
EMT.PIECES = {}
end
-- recupero tutte le info dei pezzi, dimensioni e posizione
local nPartRawId = EgtGetFirstRawPart()
while nPartRawId do
local vPiece = {}
-- recupero il solido
local nSolId = EgtGetFirstNameInGroup( nPartRawId, 'RawSolid')
local b3Raw = EgtGetBBoxGlob( nSolId, GDB_BB.STANDARD)
vPiece.Id = nPartRawId
vPiece.IdPiece = EgtGetFirstPartInRawPart( nPartRawId)
vPiece.SolId = nSolId
vPiece.Len = b3Raw:getDimX()
vPiece.Wid = b3Raw:getDimY()
vPiece.Thk = b3Raw:getDimZ()
vPiece.Offs = b3Raw:getMin() -- offset rispetto a zero
vPiece.Area = vPiece.Len * vPiece.Wid + vPiece.Len * vPiece.Thk + vPiece.Wid * vPiece.Thk
table.insert( EMT.PIECES, vPiece)
nPartRawId = EgtGetNextRawPart( nPartRawId)
end
-- Se prima disposizione
if EMT.PHASE == 1 then
-- Determino dimensioni del grezzo
local nSolId = EgtGetFirstNameInGroup( EgtGetFirstRawPart() or GDB_ID.NULL, 'RawSolid') or GDB_ID.NULL
local b3Sol = EgtGetBBoxGlob( nSolId, GDB_BB.STANDARD)
EMT.LB = 0
EMT.SB = 0
EMT.HB = 0
if b3Sol then
EMT.LB = b3Sol:getDimX()
EMT.SB = b3Sol:getDimY()
EMT.HB = b3Sol:getDimZ()
end
-- Carico primo utensile sulla testa 1
local sTool, nTlen = FindFirstToolOnHead( 'H11')
if sTool then
EMT.TOOL_1 = sTool
else
EMT.TOOL_1 = GetDefaultToolName()
end
EgtLoadTool( 'H11', 1, EMT.TOOL_1)
EMT.TCPOS_1 = GetToolTcPos( EMT.TOOL_1)
ShowToolInTcPos( EMT.TCPOS_1, false)
EMT.LOAD = true
-- Se vero inizio e abilitato creo gli Zmap
EMT.VMILL = {}
if not EMT.SIM1ST and EgtGetInfo( EgtGetCurrMachGroup(), 'Vm', 'b') then
for i = 1, #EMT.PIECES do
-- elimino eventuale vecchio Zmap
EgtErase( EgtGetFirstNameInGroup( EMT.PIECES[i].Id, 'VMill') or GDB_ID.NULL)
-- recupero il solido
local nPartSolId = EgtGetFirstNameInGroup( EMT.PIECES[i].Id, 'RawSolid')
local b3PartSol = EgtGetBBoxGlob( nPartSolId, GDB_BB.STANDARD)
-- determino la risoluzione dello Zmap
local dTol = 4.71
if EmtGetVMillStep then
dTol = EmtGetVMillStep( b3PartSol:getDimX(), b3PartSol:getDimY(), b3PartSol:getDimZ(), 4.71)
else
local dArea = b3PartSol:getDimX() * b3PartSol:getDimY() + b3PartSol:getDimX() * b3PartSol:getDimZ() + b3PartSol:getDimY() * b3PartSol:getDimZ()
if dArea < 0.075e6 then
dTol = 0.71
elseif dArea < 0.15e6 then
dTol = 1.01
elseif dArea < 0.3e6 then
dTol = 1.51
elseif dArea < 0.6e6 then
dTol = 1.97
elseif dArea < 1.2e6 then
dTol = 2.81
elseif dArea < 2.4e6 then
dTol = 3.77
end
end
-- creo lo Zmap
local VMillId = EgtVolZmapBox( EMT.PIECES[i].Id, EMT.PIECES[i].Offs, EMT.PIECES[i].Len, EMT.PIECES[i].Wid, EMT.PIECES[i].Thk, dTol, true, GDB_RT.GLOB)
if VMillId then
EgtSetName( VMillId, 'VMill')
EgtSetLevel( VMillId, GDB_LV.TEMP)
EgtSetColor( VMillId, EgtGetColor( nSolId), false)
-- nascondo le altre geometrie
local nId = EgtGetFirstInGroup( EMT.PIECES[i].Id)
while nId do
if nId ~= VMillId then
EgtSetStatus( nId, GDB_ST.OFF)
end
nId = EgtGetNext( nId)
end
table.insert( EMT.VMILL, VMillId)
end
end
-- se vero inizio, assegno solidi per verifica collisione
if not EMT.SIM1ST then
EMT.CODET = {}
for i = 1, #( EMT.MCODET or {}) do
EMT.CODET[i] = EMT.MCODET[i]
end
for i = 1, #( EMT.VMILL or {}) do
table.insert( EMT.CODET, EMT.VMILL[i])
end
end
end
-- fasi successive
else
EMT.LOAD = false
end
-- nascondo lavorazioni che risulterebbero in posizione diversa dai pezzi
local nMchId = EgtGetNextOperation( EgtGetPhaseDisposition( EMT.PHASE))
while nMchId do
if EgtGetOperationPhase( nMchId) ~= EMT.PHASE then break end
EgtSetOperationStatus( nMchId, false)
nMchId = EgtGetNextOperation( nMchId)
end
end
---------------------------------------------------------------------
function OnSimulDispositionEnd()
-- Se prima disposizione
if EMT.PHASE == 1 then
-- Se vero inizio e abilitato creo gli Zmap
EMT.VMILL = {}
if not EMT.SIM1ST and EgtGetInfo( EgtGetCurrMachGroup(), 'Vm', 'b') then
local nRawId = EgtGetFirstRawPart()
while nRawId do
if EgtVerifyRawPartPhase( nRawId, 1) then
-- elimino eventuale vecchio Zmap
EgtErase( EgtGetFirstNameInGroup( nRawId, 'VMill') or GDB_ID.NULL)
-- recupero il solido
local nSolId = EgtGetFirstNameInGroup( nRawId, 'RawSolid')
-- determino la risoluzione dello Zmap
local b3Sol = EgtGetBBoxGlob( nSolId, GDB_BB.STANDARD)
local dTol = EmtGetVMillStep( b3Sol:getDimX(), b3Sol:getDimY(), b3Sol:getDimZ(), 2.01)
-- creo lo Zmap
local VMillId = EgtVolZmapFromSurfTm( nRawId, nSolId, dTol, true)
if VMillId then
EgtSetName( VMillId, 'VMill')
EgtSetLevel( VMillId, GDB_LV.TEMP)
EgtSetColor( VMillId, EgtGetColor( nSolId), false)
-- nascondo le altre geometrie
local nId = EgtGetFirstInGroup( nRawId)
while nId do
if nId ~= VMillId then
EgtSetStatus( nId, GDB_ST.OFF)
end
nId = EgtGetNext( nId)
end
table.insert( EMT.VMILL, VMillId)
end
end
nRawId = EgtGetNextRawPart( nRawId)
end
end
end
EMT.OPEISDISP = false
end
---------------------------------------------------------------------
function OnSimulToolSelect()
-- carico utensile, con breve pausa
EgtPause( 100)
EgtOutText( '')
-- lo nascondo sul portautensili
ShowToolInTcPos( EMT.TCPOS, false)
-- se attivo Vmill
if EMT.VMILL then
EmtSetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL)
end
-- se attivo Collision Check
EMT.SAFEDIST = COLL_SAFE_DIST
if EMT.COLLOBJ then
for i, Coll in ipairs( EMT.COLLOBJ) do
EmtAddCollisionObjEx( i, Coll.Fr, Coll.Ty, Coll.Mv, Coll.P1, Coll.P2, Coll.P3)
end
if EMT.HEAD ~= 'H2' then
AddToolToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, 1001)
AddToolHolderToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, 1002)
else
AddToolToCollisionObj( nil, 'H1', 1, 1001)
AddToolHolderToCollisionObj( nil, 'H1', 1, 1002)
end
end
end
---------------------------------------------------------------------
function OnSimulToolDeselect()
-- se utensile non cambia e non è sega a catena, esco
if EMT.NEXTTOOL == EMT.PREVTOOL then return end
-- deposito utensile
EgtOutText( 'Tool change in progress...')
if EMT.HEAD == 'H11' then
SimulMoveAxis( 'Z1', 0, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'Y', 0, MCH_SIM_STEP.RAPID, 'A', 0, MCH_SIM_STEP.RAPROT, 'C', 0, MCH_SIM_STEP.RAPROT)
else
SimulMoveAxis( 'Z2', 0, MCH_SIM_STEP.RAPID)
end
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS, true)
-- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.PREVHEAD or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
end
---------------------------------------------------------------------
function OnSimulMachiningStart()
EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE)
EMT.MCHNAME = EgtGetMachiningParam(MCH_MP.NAME)
EMT.NOTES = EgtGetMachiningParam( MCH_MP.USERNOTES)
EMT.VMRS = ( EMT.MCHTYPE ~= MCH_MY.DRILLING and EgtGetValInNotes( EMT.NOTES or '', 'VMRS', 'i') ~= 0)
end
---------------------------------------------------------------------
function OnSimulMachiningEnd()
EMT.PREVTOOL = EMT.TOOL
EMT.PREVHEAD = EMT.HEAD
EMT.PREVTCPOS = EMT.TCPOS
end
---------------------------------------------------------------------
function OnSimulPathStart()
if EMT.HEAD == 'H21' then
-- attivazione uscite
EMC = { HEADID = EgtGetHeadId( 'H21'), DRACEX = EMT.DRACEX}
OnActivateDrillingUnit()
EMC = nil
-- impostazione utensili aggiuntivi per Vmill
if EMT.VMILL then
for i = 1, #( EMT.DRACEX or {}) do
local nExit = EMT.DRACEX[i]
local sTool = EgtGetLoadedTool( EMT.HEAD, nExit)
if i == 1 then
EmtSetToolForVmill( sTool, EMT.HEAD, nExit, EMT.VMILL)
else
EmtAddToolForVmill( sTool, EMT.HEAD, nExit, EMT.VMILL)
end
end
end
end
end
---------------------------------------------------------------------
function OnSimulPathEnd()
if EMT.VMILL and #EMT.VMILL > 0 and not EMT.OPEISDISP and EMT.VMRS then
-- elimino eventuali sfridi
for j = 1, #EMT.VMILL do
local vMillId = EMT.VMILL[j]
local nPart = EgtVolZmapPartCount( vMillId)
if nPart > 1 then
-- ricerca del pezzo con massimo volume
local nPartMax = 0
local dVolMax = 0
for i = 1, nPart do
local dVol = EgtVolZmapPartVolume( vMillId, i - 1)
if dVol > dVolMax then
dVolMax = dVol
nPartMax = i
end
end
-- eliminazione di tutti i pezzi piccoli
for i = nPart, 1, -1 do
if i ~= nPartMax then
EgtRemoveVolZmapPart( vMillId, i - 1)
end
end
end
end
EgtDraw()
end
end
---------------------------------------------------------------------
function OnSimulMoveStart()
end
---------------------------------------------------------------------
function OnSimulMoveEnd()
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'
elseif EMT.SIMCOBIND == 1002 then
Class = 'TH_H1'
else
Class = EMT.COLLOBJ[EMT.SIMCOBIND].Cl
end
table.insert( EMT.COLLIDE, { Mc = EMT.MCHNAME, Cl = Class, Vm = EMT.SIMVMID})
EMT.LAST_MCHNAME_COLLIDE = EMT.MCHNAME
EMT.ERR = 1
local sErr = 'CUTID='..tostring( EMT.CUTID)..'; TASKID='..tostring( EMT.TASKID)..'; Mach='..EMT.MCHNAME..'; Class='..Class..'; VMill='..EMT.SIMVMID
EmtSetLastError( 1221, sErr, true)
EgtOutLog( 'Collision : ' .. sErr, 1)
end
end
---------------------------------------------------------------------
-- *** GENERAL ***
---------------------------------------------------------------------
function FindFirstToolOnHead( sH1)
-- salvo stato iniziale
local CurrMachId = EgtGetCurrMachining()
local CurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
-- cerco lavorazione con utensile su testa indicata
local sTool, nTlen
local OpId = EgtGetFirstActiveOperation()
while OpId do
local nType = EgtGetOperationType( OpId)
if nType ~= MCH_OY.NONE and nType ~= MCH_OY.DISP then
if EgtSetCurrMachining( OpId) then
local sTest = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sTest) then
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if sHead and ( sHead == sH1) then
sTool = sTest
nTlen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
break
end
end
end
end
OpId = EgtGetNextActiveOperation( OpId)
end
-- ripristino stato iniziale
if CurrMachId then
EgtSetCurrMachining( CurrMachId)
else
EgtResetCurrMachining()
end
if CurrTool then
EgtTdbSetCurrTool( CurrTool)
else
EgtTdbSetCurrTool( '')
end
-- restituisco risultato
return sTool, nTlen
end
---------------------------------------------------------------------
function ShowToolInTcPos( sTcPos, bShow)
-- recupero identificativo della posizione sul TC
local TcPosId = EgtGetTcPosId( sTcPos or '')
if not TcPosId then return end
-- ciclo sulle possibili uscite
for i = 1, 100 do
-- recupero il gruppo dell'utensile
local TcExitId = EgtGetFirstNameInGroup( TcPosId, 'T'..tostring( i))
if not TcExitId then break end
-- imposto lo stato di visualizzazione
EgtSetStatus( TcExitId, EgtIf( bShow, GDB_ST.ON, GDB_ST.OFF))
end
-- recupero eventuale gruppo ausiliario da visualizzare/nascondere
local TcHSId = EgtGetFirstNameInGroup( TcPosId, sTcPos..'_HS')
if TcHSId then EgtSetStatus( TcHSId, EgtIf( bShow, GDB_ST.ON, GDB_ST.OFF)) end
end
---------------------------------------------------------------------
function GetDefaultToolName()
local DefTcPos = 'T1'
local vTools = EgtGetToolsInCurrSetupPos( DefTcPos)
if vTools and vTools[1] and #vTools[1] > 0 then
return vTools[1]
else
-- local sErr = 'Missing tool in Default Position ' .. DefTcPos
-- EgtOutLog( 'Error : ' .. sErr)
-- EgtOutBox( sErr, 'ERROR', 'ERROR')
return ''
end
end
---------------------------------------------------------------------
function GetToolTcPos( sTool)
-- salvo stato iniziale
local CurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
-- recupero la posizione di cambio utensile dell'utensile indicato
local sTcPos
if EgtTdbSetCurrTool( sTool) then
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
end
-- ripristino stato iniziale
if CurrTool then
EgtTdbSetCurrTool( CurrTool)
else
EgtTdbSetCurrTool( '')
end
-- restituisco risultato
return sTcPos
end
---------------------------------------------------------------------
function MoveHead( nGrpId, vtVers, dPos, bLoc)
local dVal = EgtGetInfo( nGrpId or GDB_ID.NULL, 'Val')
if not dVal then return end
if abs( dPos - dVal) > GEO.EPS_SMALL then
local nRT = EgtIf( bLoc, GDB_RT.LOC, GDB_RT.GLOB)
EgtMove( nGrpId, ( dPos - dVal) * vtVers, nRT)
EgtSetInfo( nGrpId, 'Val', dPos)
end
end
---------------------------------------------------------------------
function ExecUnloading()
if EMT.VMILL then
local vMillId = EMT.VMILL
-- gruppo dei Vmill
local nVmGrpId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'VMill')
-- creo un nuovo layer e vi inserisco il nuovo pezzo
local nLayId = EgtGroup( nVmGrpId, EgtGetGlobFrame( vMillId))
EgtRelocate( vMillId, nLayId)
EgtSetLevel( vMillId, GDB_LV.USER)
-- aggiungo gli spigoli
if EgtVolZmapSetShowEdges then
EgtVolZmapSetShowEdges( vMillId, true)
else
local nFirstId, nCount = EgtVolZmapGetEdges( vMillId, nLayId)
if nFirstId then
for nId = nFirstId, nFirstId + nCount - 1 do
EgtSetColor( nId, Color3d( 96, 96, 96))
end
end
end
-- rilascio Vmill
EMT.VMILL = nil
-- aggiorno la visualizzazione
EgtDraw()
-- se impostato di salvare i Vmill, lo faccio
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
if EgtGetStringFromIni( 'VMill', 'Save', '', sMachIni) == '1' then
local sFile = EgtGetCurrFilePath()
if sFile then
local sDir, sName, sExt = EgtSplitPath( sFile)
if sExt and sExt:lower() == ".nge" then
sName = sName .. '_VM_' .. EgtGetMachGroupName( EgtGetCurrMachGroup())
EgtSetLevel( nVmGrpId, GDB_LV.USER)
EgtSaveObjToFile( nVmGrpId, sDir .. sName .. '.Nge')
EgtSetLevel( nVmGrpId, GDB_LV.TEMP)
end
end
end
end
end
---------------------------------------------------------------------
-- *** STIMA T&L ***
---------------------------------------------------------------------
local RAPID_X_FEED = 20000 -- mm/min
local RAPID_Y_FEED = 20000 -- mm/min
local RAPID_Z_FEED = 10000 -- mm/min
local RAPID_C_FEED = 3600 -- deg/min
local RAPID_B_FEED = 3600 -- deg/min
local RAPID_MIN_T = 1.0 -- s
local UNLOAD_RAW_T = 60 -- s
---------------------------------------------------------------------
function OnEstimStart()
EMT.INCHES = not EgtUiUnitsAreMM() -- unità di misura mm/inches
end
---------------------------------------------------------------------
function OnEstimEnd()
end
---------------------------------------------------------------------
function OnEstimProgramStart()
-- imposto inizio movimenti da Home
EMT.L1 = EgtGetAxisHomePos( 'X')
EMT.L2 = EgtGetAxisHomePos( 'Y')
EMT.L3 = EgtGetAxisHomePos( 'Z1')
EMT.R1 = EgtGetAxisHomePos( 'C')
EMT.R2 = EgtGetAxisHomePos( 'A')
-- aggiorno valori come precedenti
EmtUpdatePrev()
-- totalizzatori tempi e lunghezze
EMT.TOTCUTLEN = 0
EMT.TOTCUTTIME = 0
EMT.TOTEXTLEN = 0
EMT.TOTEXTTIME = 0
-- variabile per lunghezza taglio utensili
EMT.TOOLCUTLEN = {}
-- intestazioni
EmtTleStart( EMT.INFO)
end
---------------------------------------------------------------------
function OnEstimProgramEnd()
-- stampa dei totali delle lavorazioni
EmtTleAddTotal( EmtSecToHMS( EMT.TOTCUTTIME + EMT.TOTEXTTIME), EmtLenToMF( EMT.TOTCUTLEN))
-- stampa dei totali degli utensili
for i = 1, #EMT.TOOLCUTLEN do
local TCL = EMT.TOOLCUTLEN[i]
EmtTleAddTool( TCL.Name, EmtLenToMF( TCL.Len))
end
-- completo il file
local _, _, sExt = EgtSplitPath( EMT.FILE)
EmtTleEnd( sExt:sub( 2))
-- salvo i dati principali nel progetto
EgtSetInfo( EgtGetCurrMachGroup(), 'Ttot', EgtNumToString( EMT.TOTCUTTIME + EMT.TOTEXTTIME, 0))
EgtSetInfo( EgtGetCurrMachGroup(), 'Ltot', EgtNumToString( EMT.TOTCUTLEN, 0))
end
---------------------------------------------------------------------
function OnEstimDispositionStart()
-- inizioe disposizione
EMT.OPEISDISP = true
-- non va fatto alcunché
end
---------------------------------------------------------------------
function OnEstimDispositionEnd()
-- termine disposizione
EMT.OPEISDISP = false
-- non va fatto alcunché
end
---------------------------------------------------------------------
function OnEstimToolSelect()
-- reset indice utensile in tabella lunghezze
EMT.TCLIND = 0
-- verifico che l'utensile sia definito
if #EMT.TOOL == 0 then return end
-- cerco l'utensile nella tabella
for i = 1, #EMT.TOOLCUTLEN do
if EMT.TOOLCUTLEN[i].Name == EMT.TOOL then
EMT.TCLIND = i
break
end
end
-- se non trovato, lo aggiungo
if EMT.TCLIND == 0 then
table.insert( EMT.TOOLCUTLEN, { Name = EMT.TOOL, Len = 0})
EMT.TCLIND = #EMT.TOOLCUTLEN
end
end
---------------------------------------------------------------------
function OnEstimToolDeselect()
end
---------------------------------------------------------------------
function OnEstimMachiningStart()
EMT.MCHNAME = EgtGetMachiningParam(MCH_MP.NAME)
EMT.MCHTYPE = EgtGetMachiningParam(MCH_MP.TYPE)
-- reset contatori di lavorazione
EMT.MCHCUTLEN = 0
EMT.MCHCUTTIME = 0
EMT.MCHEXTLEN = 0
EMT.MCHEXTTIME = 0
end
---------------------------------------------------------------------
function OnEstimMachiningEnd()
local sName = EgtGetName( EMT.MCHID) .. ' (' .. EMT.MCHNAME .. ')'
EmtTleAddMachining( sName, EmtSecToHMS( EMT.MCHCUTTIME + EMT.MCHEXTTIME), EmtLenToMF( EMT.MCHCUTLEN), EMT.TOOL)
-- aggiorno totali e utensili
EMT.TOTCUTLEN = EMT.TOTCUTLEN + EMT.MCHCUTLEN
EMT.TOTCUTTIME = EMT.TOTCUTTIME + EMT.MCHCUTTIME
EMT.TOTEXTLEN = EMT.TOTEXTLEN + EMT.MCHEXTLEN
EMT.TOTEXTTIME = EMT.TOTEXTTIME + EMT.MCHEXTTIME
EMT.TOOLCUTLEN[EMT.TCLIND].Len = EMT.TOOLCUTLEN[EMT.TCLIND].Len + EMT.MCHCUTLEN
end
---------------------------------------------------------------------
function OnEstimPathStart()
end
---------------------------------------------------------------------
function OnEstimPathEnd()
end
---------------------------------------------------------------------
function OnEstimRapid()
-- dati movimento
local dL1 = EMT.L1 - EMT.L1p
local dL2 = EMT.L2 - EMT.L2p
local dL3 = EMT.L3 - EMT.L3p
local dR1 = 0
if EMT.R1 and EMT.R1p then dR1 = EMT.R1 - EMT.R1p end
local dR2 = 0
if EMT.R2 and EMT.R2p then dR2 = EMT.R2 - EMT.R2p end
-- calcolo lunghezza
local dLen = sqrt( dL1 * dL1 + dL2 * dL2 + dL3 * dL3)
if not EMT.OPEISDISP then
EMT.MCHEXTLEN = EMT.MCHEXTLEN + dLen
else
EMT.DSPEXTLEN = EMT.DSPEXTLEN + dLen
end
-- calcolo tempo
local dTime = RAPID_MIN_T
local dT1 = abs( dL1) / RAPID_X_FEED * 60
if dT1 > dTime then dTime = dT1 end
local dT2 = abs( dL2) / RAPID_Y_FEED * 60
if dT2 > dTime then dTime = dT2 end
local dT3 = abs( dL3) / RAPID_Z_FEED * 60
if dT3 > dTime then dTime = dT3 end
local dT4 = abs( dR1) / RAPID_C_FEED * 60
if dT4 > dTime then dTime = dT4 end
local dT5 = abs( dR2) / RAPID_B_FEED * 60
if dT5 > dTime then dTime = dT5 end
EMT.MCHEXTTIME = EMT.MCHEXTTIME + dTime
-- aggiorno valori come precedenti
EmtUpdatePrev()
end
---------------------------------------------------------------------
function OnEstimLinear()
-- dati movimento
local dL1 = EMT.L1 - EMT.L1p
local dL2 = EMT.L2 - EMT.L2p
local dL3 = EMT.L3 - EMT.L3p
-- calcolo lunghezza
local dLen = sqrt( dL1 * dL1 + dL2 * dL2 + dL3 * dL3)
EMT.MCHCUTLEN = EMT.MCHCUTLEN + dLen
-- calcolo tempo
local dTime = dLen / EMT.F * 60
EMT.MCHCUTTIME = EMT.MCHCUTTIME + dTime
EgtOutLog( string.format( ' G1 Len=%.0f Time=%.2f', dLen, dTime), 5)
-- aggiorno valori come precedenti
EmtUpdatePrev()
end
---------------------------------------------------------------------
function OnEstimArc()
-- dati movimento
local dLxy = EMT.RR * abs( EMT.AC) * pi / 180
local dLz = abs( ( Point3d( EMT.L1, EMT.L2, EMT.L3) - Point3d( EMT.L1p, EMT.L2p, EMT.L3p)) * Vector3d( EMT.EXTR))
-- calcolo lunghezza
local dLen = sqrt( dLxy * dLxy + dLz * dLz)
EMT.MCHCUTLEN = EMT.MCHCUTLEN + dLen
-- calcolo tempo
local dTime = dLen / EMT.F * 60
EMT.MCHCUTTIME = EMT.MCHCUTTIME + dTime
EgtOutLog( string.format( ' G2 Len=%.0f Time=%.2f', dLen, dTime), 5)
-- aggiorno valori come precedenti
EmtUpdatePrev()
end
+21
View File
@@ -0,0 +1,21 @@
-- Processore macchina Masterwood Project265 2025/01/09
-- by EgalWare s.r.l.
--
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
---------------------------------------------------------------------
-- *** Generic Machinings ***
---------------------------------------------------------------------
Egm = require( 'EmtGenMachining')
---------------------------------------------------------------------
-- *** OnSpecialMoveZup ***
---------------------------------------------------------------------
---------------------------------------------------------------------
-- *** OnSpecialApplyDisposition & OnPostApplyMachining ***
---------------------------------------------------------------------
--function OnSpecialApplyDisposition()
--end
Binary file not shown.
-93
View File
@@ -1,93 +0,0 @@
# Masterwood-Project265
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.steamware.net/egalware-machines/masterwood/masterwood-project265.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.steamware.net/egalware-machines/masterwood/masterwood-project265/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
+151
View File
@@ -0,0 +1,151 @@
-- 2024/10/10 10:00:00
-- Disposition Init for Masterwood_Project265 machine
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
--------------------------------------------------------------------------------
-- Colore del grezzo
local ColA = Color3d( 255, 165, 0, 30)
--------------------------------------------------------------------------------
-- * Verifica esistenza MachGroup *
if not EgtGetCurrMachGroup() then
local sErr = 'InitDisp for Masterwood_Project265 : missing CurrMachGroup'
EgtOutLog( sErr)
EgtOutText( sErr)
DISP.ERR = 1
return
end
--------------------------------------------------------------------------------
-- *** Disposizione ***
-- Scelta della tavola
local sTab = 'Tab'
EgtSetTable( sTab)
local frTab = Frame3d( EgtGetTableRef())
-- Se pezzo non definito, esco senza errore (modalità test macchina)
local Pz = DISP.PARTID
if not Pz or Pz == GDB_ID.NULL then
DISP.ERR = 0
return
end
-- Recupero i dati del pezzo
local Ls = EgtGetFirstNameInGroup( Pz, 'SOLID')
local Er = EgtGetFirstNameInGroup( Ls or GDB_ID.NULL, 'RAW')
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.STANDARD)
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
-- Se pezzo vuoto, non devo fare alcunchè
if b3Part:isEmpty() then
local sErr = 'InitDisp for Masterwood_Project265 : empty part'
EgtOutLog( sErr)
EgtOutText( sErr)
DISP.ERR = 2
return
end
-- Recupero ingombro di grezzi già inseriti
local b3PrevRaw = BBox3d()
local nPrevRawId = EgtGetFirstRawPart()
while nPrevRawId do
local b3Raw = EgtGetRawPartBBox( nPrevRawId)
b3PrevRaw:Add( b3Raw)
nPrevRawId = EgtGetNextRawPart( nPrevRawId)
end
b3PrevRaw:toLoc( frTab)
-- Richiesta posizione rispetto allo Zero tavola
local dOverMatXY = 5
local sOverMatXY = EgtNumToString( EgtToUiUnits( dOverMatXY), 0)
local dOverMatZ = 0
local sOverMatZ = EgtNumToString( EgtToUiUnits( dOverMatZ), 0)
local dSafeDist = 20
local sSafeDist = EgtNumToString( EgtToUiUnits( dSafeDist), 0)
local vVal = EgtDialogBox( 'Dati di disposizione', {'Y Position', 'CB:Front,MediumFront,MediumBack,Back'},
{'X Position', 'CB:Left,Right'},
{'Safe Dist', sSafeDist},
{'Sovramateriale XY', sOverMatXY},
{'Sovramateriale Z', sOverMatZ})
if not vVal or #vVal < 5 then
DISP.ERR = 100
return
end
local sRefY = 'B'
local vYPos = { Front='B', MediumFront='M', MediumBack='N', Back='T'}
sRefY = vYPos[vVal[1]]
local sRefX = 'L'
local vXPos = { Left='L', Right='R'}
sRefX = vXPos[vVal[2]]
dSafeDist = EgtFromUiUnits( tonumber( vVal[3]))
dOverMatXY = EgtFromUiUnits( tonumber( vVal[4]))
dOverMatZ = EgtFromUiUnits( tonumber( vVal[5]))
-- Definizione e posizionamento del grezzo
local nRaw
if Er then
nRaw = EgtAddRawPartWithPart( Pz, Er, 0, ColA)
EgtSetStatus( Er, GDB_ST.ON)
else
nRaw = EgtAddRawPartWithPart( Pz, GDB_ID.NULL, dOverMatXY, ColA)
if nRaw and dOverMatZ > 10 * GEO.EPS_SMALL then
local b3Raw = EgtGetRawPartBBox( nRaw)
local dRawH = b3Raw:getDimZ() + dOverMatZ
EgtModifyRawPartHeight( nRaw, dRawH)
end
end
if not nRaw then
local sErr = 'InitDisp for Masterwood_Project265 : error defining raw part'
EgtOutLog( sErr)
EgtOutText( sErr)
DISP.ERR = 3
return
end
local b3Raw = EgtGetRawPartBBox( nRaw)
local bVac = ( b3Raw:getDimY() >= 120)
local vtOffs, nCorn
if sRefY == 'B' and sRefX == 'L' then
vtOffs = Vector3d( 0, 0, 0)
nCorn = MCH_CR.BL
elseif sRefY == 'B' and sRefX == 'R' then
vtOffs = Vector3d( 1700, 0, 0)
nCorn = MCH_CR.BR
elseif sRefY == 'M' and sRefX == 'L' then
vtOffs = Vector3d( 0, 675-10, 0)
nCorn = MCH_CR.TL
elseif sRefY == 'M' and sRefX == 'R' then
vtOffs = Vector3d( 1700, 675-10, 0)
nCorn = MCH_CR.TR
elseif sRefY == 'N' and sRefX == 'L' then
vtOffs = Vector3d( 0, 675+10, 0)
nCorn = MCH_CR.BL
elseif sRefY == 'N' and sRefX == 'R' then
vtOffs = Vector3d( 1700, 675+10, 0)
nCorn = MCH_CR.BR
elseif sRefY == 'T' and sRefX == 'L' then
vtOffs = Vector3d( 0, 1350, 0)
nCorn = MCH_CR.TL
elseif sRefY == 'T' and sRefX == 'R' then
vtOffs = Vector3d( 1700, 1350, 0)
nCorn = MCH_CR.TR
end
if not bVac then
if sRefY == 'B' or sRefY == 'N' then
vtOffs = vtOffs + 60 * Y_AX()
else
vtOffs = vtOffs - 60 * Y_AX()
end
end
if not EgtMoveToCornerRawPart( nRaw, vtOffs, nCorn) then
local sErr = 'InitDisp for Masterwood_Project265 : error positioning raw part on table'
EgtOutLog( sErr)
EgtOutText( sErr)
DISP.ERR = 4
return
end
DISP.ERR = 0
+218
View File
@@ -0,0 +1,218 @@
--
-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT
-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT
-- EEEE GGGG GGGG TTTT
-- EEEE GGGG TTTT
-- EEEEEEE GGGG GGGGGGG TTTT
-- EEEEEEE GGGG GGGGGGG TTTT
-- EEEE GGGG GGGG TTTT
-- EEEE GGGG GGGG TTTT
-- EEEEEEEEEE GGGGGGGGGG TTTT
-- EEEEEEEEEE GGGGGG TTTT
--
-- by EgalTech s.r.l. 2018/07/09 10:30:00
-- Gestione attrezzaggio
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Tavola di passaggio valori
local STU = {}
STU.TUUID = ""
STU.TCPOS = ""
STU.HEAD = ""
STU.GROUP = ""
STU.POS = ""
STU.EXIT = 0
STU.INDEX = 0
STU.HEAD1 = ""
STU.HEAD2 = ""
STU.ISVALID = false
STU.ERR = 0
_G.STU = STU
local INVALIDPOS = ""
local POS = "Pos"
-- Geom Set
local GS = {}
-- Configurazione posizioni
local PositionTable={{Pos = "Pos1", TcPos = "T1", Head = "H11", Group = "G1"},
{Pos = "Pos2", TcPos = "T2", Head = "H11", Group = "G1"},
{Pos = "Pos3", TcPos = "T3", Head = "H11", Group = "G1"},
{Pos = "Pos4", TcPos = "T4", Head = "H11", Group = "G1"},
{Pos = "Pos5", TcPos = "T5", Head = "H11", Group = "G1"},
{Pos = "Pos6", TcPos = "T6", Head = "H11", Group = "G1"},
{Pos = "Pos7", TcPos = "T7", Head = "H11", Group = "G1"},
{Pos = "Pos8", TcPos = "T8", Head = "H11", Group = "G1"},
{Pos = "Pos9", TcPos = "T9", Head = "H11", Group = "G1"},
{Pos = "Pos10", TcPos = "T10", Head = "H11", Group = "G1"},
{Pos = "Pos11", TcPos = "T11", Head = "H11", Group = "G1"},
{Pos = "Pos12", TcPos = "T12", Head = "H11", Group = "G1"},
{Pos = "Pos13", TcPos = "T13", Head = "H11", Group = "G1"},
{Pos = "Pos14", TcPos = "T14", Head = "H11", Group = "G1"},
{Pos = "Pos15", TcPos = "T15", Head = "H11", Group = "G1"},
{Pos = "Pos16", TcPos = "T16", Head = "H11", Group = "G1"},
{Pos = "Pos17", TcPos = "T17", Head = "H11", Group = "G2"},
{Pos = "Pos18", TcPos = "T81", Head = "H21", Group = "G3"}}
local UsePositionHead = false
local function IsInGeomSet( ToolHead, PosHead)
for GsIndex = 1, #GS do
local bToolHead = false
local bPosHead = false
for HIndex = 1, #GS[GsIndex] do
if GS[GsIndex][HIndex] == ToolHead then
bToolHead = true
elseif GS[GsIndex][HIndex] == PosHead then
bPosHead = true
end
if bToolHead and bPosHead then
return true
end
end
if bToolHead and bPosHead then
return true
end
end
return false
end
function STU.IsCompatibleHeads()
STU.ISVALID = false
if IsInGeomSet(STU.HEAD1, STU.HEAD2) then
STU.ISVALID = true
else
STU.ISVALID = false
end
end
function STU.GetValidHeadExitForPos()
-- se TUUID non valido restituisco errore
local ToolName = EgtTdbGetToolFromUUID( STU.TUUID)
if ToolName == nil then
STU.ERR = 1
return
end
EgtTdbSetCurrTool( ToolName)
local CurrToolHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
STU.EXIT = EgtTdbGetCurrToolParam( MCH_TP.EXIT)
-- recupero testa predefinita per la posizione corrente
local CurrPosHead
for i = 1, #PositionTable do
if PositionTable[i].TcPos == STU.TCPOS then
CurrPosHead = PositionTable[i].Head
break
end
end
-- verifico se la testa è quella della posizione predefinita
if CurrPosHead == CurrToolHead then
STU.HEAD = CurrToolHead
STU.ERR = 0
return
-- verifico se la testa è compatibile con quella della posizione predefinita
elseif IsInGeomSet( CurrToolHead, CurrPosHead) then
if UsePositionHead then
STU.HEAD = CurrPosHead
STU.ERR = 0
return
else
STU.HEAD = CurrToolHead
STU.ERR = 0
return
end
-- la testa non è compatibile con quella della posizione predefinita
else
STU.HEAD = INVALIDPOS
STU.ERR = 0
return
end
end
function STU.IsValidTcPosFromHead()
STU.ISVALID = false
for i = 1, #PositionTable do
if PositionTable[i].TcPos == STU.TCPOS then
if PositionTable[i].Head == STU.HEAD then
STU.ISVALID = true
STU.ERR = 0
return
elseif IsInGeomSet(PositionTable[i].Head, STU.HEAD) then
STU.ISVALID = true
STU.ERR = 0
return
end
STU.ISVALID = false
STU.ERR = 0
return
end
end
end
function STU.GetTcPosHeadGroupFromPos()
for i = 1, #PositionTable do
if PositionTable[i].Pos == (POS .. tostring(STU.INDEX)) then
STU.TCPOS = PositionTable[i].TcPos
STU.HEAD = PositionTable[i].Head
STU.GROUP = PositionTable[i].Group
STU.ERR = 0
return
end
end
STU.TCPOS = INVALIDPOS
STU.HEAD = INVALIDPOS
STU.GROUP = INVALIDPOS
STU.ERR = 1
end
function STU.GetPosFromTcPos()
for i = 1, #PositionTable do
if PositionTable[i].TcPos == STU.TCPOS then
STU.POS = PositionTable[i].Pos
STU.ERR = 0
return
end
end
STU.POS = INVALIDPOS
STU.ERR = 1
end
function STU.GetGroupFromTcPos()
for i = 1, #PositionTable do
if PositionTable[i].TcPos == STU.TCPOS then
STU.GROUP = PositionTable[i].Group
STU.ERR = 0
return
end
end
STU.GROUP = INVALIDPOS
STU.ERR = 1
end
function STU.GetHeadFromPos()
for i = 1, #PositionTable do
if PositionTable[i].Pos == (POS .. tostring(STU.INDEX)) then
STU.HEAD = PositionTable[i].Head
STU.ERR = 0
return
end
end
STU.HEAD = INVALIDPOS
STU.ERR = 1
end
function STU.GetTcPosFromPos()
for i = 1, #PositionTable do
if PositionTable[i].Pos == (POS .. tostring(STU.INDEX)) then
STU.TCPOS = PositionTable[i].TcPos
STU.ERR = 0
return
end
end
STU.TCPOS = INVALIDPOS
STU.ERR = 1
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+43
View File
@@ -0,0 +1,43 @@
; Commento per evitare BOM con UTF-8
; Index, Type, Description, Value
; Index = 0,1,..,n
; Type : d=double, l=lenght, s=string, b=boolean, dr=double recalc, sr= string recalc, lr=lenght recalc, br=boolean recalc, th=toolholder
; Description : STEP, SIDESTEP, ...
[DRILL_STD]
0=th,TH,
1=d,STEP
2=s,DOUBLE
[SAW_STD]
0=th,TH,
1=d,STEP
2=d,SIDESTEP
3=b,LONGCUT
[SAW_FLAT]
0=th,TH,
1=d,STEP
2=d,SIDESTEP
3=b,LONGCUT
[MILL_STD]
0=th,TH,
1=d,STEP
2=d,SIDESTEP
3=d,SIDEDEPTH
4=s,DOUBLE
5=dr,TOOL_OVERHANG
[MILL_NOTIP]
0=th,TH,
1=d,STEP
2=d,SIDESTEP
3=d,SIDEDEPTH
4=s,DOUBLE
5=dr,TOOL_OVERHANG
[MORTISE_STD]
0=b,MORTISE
1=d,STEP
2=d,SIDESTEP
+48
View File
@@ -0,0 +1,48 @@
; PIndex = Type, PName, Default, Description
; Type : d=double, l=length, s=string
[1]
Name=Offsets
1= l,MIN_X,-5310,MIN_X
2= l,MAX_X,0,MAX_X
3= l,MIN_Y,-20580,MIN_Y
4= l,MAX_Y,0,MAX_Y
5= l,MIN_Z,-1570,MIN_Z
6= l,MAX_Z,0,MAX_Z
7= d,MIN_B,-135,MIN_B
8= d,MAX_B,135,MAX_B
9= d,MIN_C,-275,MIN_C
10=d,MAX_C,275,MAX_C
11=l,MIN_U,-6075,MIN_U
12=l,MAX_U,-770,MAX_U
13=l,MIN_W,-1110,MIN_W
14=l,MAX_W,0,MAX_W
15=l,MIN_V,0,MIN_V
16=l,MAX_V,90,MAX_V
17=d,MIN_A,-275,MIN_A
18=d,MAX_A,275,MAX_A
19=l,ZERO_X_SAW,-1288.05,ZERO_X_SAW
20=l,ZERO_Y_SAW,-803.45,ZERO_Y_SAW
21=l,ZERO_Z_SAW,-909.55,ZERO_Z_SAW
22=l,PIVOT_SAW,163.15,PIVOT_SAW
23=l,ZERO_X_MILL,-1293.3,ZERO_X_MILL
24=l,ZERO_Y_MILL,-1152,ZERO_Y_MILL
25=l,ZERO_Z_MILL,-992.15,ZERO_Z_MILL
26=l,PIVOT_MILL,208.0,PIVOT_MILL
27=l,INTRULLI,1500,INTRULLI
28=d,TYPEWORK,1,TYPEWORK
29=l,ZERO_X_DRILL,-142.0,ZERO_X_DRILL
30=l,ZERO_Y_DRILL,-1454.33,ZERO_Y_DRILL
31=l,ZERO_Z_DRILL,31.69,ZERO_Z_DRILL
32=l,ZERO_X_DRILL2,3645,ZERO_X_DRILL2
33=l,ZERO_Y_DRILL2,-1454.33,ZERO_Y_DRILL2
34=l,ZERO_Z_DRILL2,31.69,ZERO_Z_DRILL2
[2]
Name=Trave
1=l,XMIN,20,XMIN
2=l,XMAX,3500,XMAX
3=l,YMIN,50,YMIN
4=l,YMAX,18000,YMAX
5=l,ZMIN,1,ZMIN
6=l,ZMAX,400,ZMAX
+26
View File
@@ -0,0 +1,26 @@
[Cut]
1=Standard
[Drill]
1=Drill
2=Pocket
3=MultiDrill
[Milling]
1=FreeContour
2=Side
3=SideGroove
4=DtMortise
5=Mark
6=Text
7=CleanCorner60
8=CleanCorner30
9=SideMill
10=Gorge
[Pocketing]
1=Pocket
2=Mortise
[Sawing]
1=Sawing
+4
View File
@@ -0,0 +1,4 @@
[WALL]
Offset=0
Kerf=0
Range1=30,400
+76
View File
@@ -0,0 +1,76 @@
-- WallData.lua by Egaltech s.r.l. 2022/02/03
-- Raccolta dati generali per Pareti
EgtOutLog( ' 90480027-WallData started', 1)
-- Tabella per definizione modulo
local WallData = {
MIN_LENGTH = 100, -- lunghezza minima del grezzo
MIN_WIDTH = 100, -- larghezza minima del grezzo
MIN_HEIGHT = 5, -- altezza minima del grezzo
MAX_LENGTH = 3200, -- lunghezza massima del grezzo
MAX_WIDTH = 1400, -- larghezza massima del grezzo
MAX_HEIGHT = 200, -- altezza massima del grezzo
STD_RAW_LENGTH = 3000, -- lunghezza standard del grezzo
STD_RAW_WIDTH = 1200, -- larghezza standard del grezzo
OVM_HEAD = 60, -- sovramateriale testa
OVM_MID = 50, -- sovramateriale intermedio
COLL_SIC = 5, -- distanza di sicurezza per collisioni
CUT_SIC = 20, -- distanza di sicurezza per tagli
CUT_EXTRA = 1, -- affondamento extra standard per tagli di lama e fresature
NZ_MINA = 0.5, -- componente limite in Z normale di una faccia (-30deg)
NZ_MINB = -0.4, -- componente limite in Z normale di un insieme di facce (-23deg)
SAWGORGE_INTERAX = 100, -- interasse tra i tagli sfrido del gorge
PREDRILL_DIAM = 26, -- diametro del preforo
PREDRILL_MINANGLE = 0.707, -- minimo angolo che richiede il preforo con fresa (-30deg)
DRILL_TOL = 0.5, -- tolleranza tra diametro foro e diametro punta
DRILL_VZ_MIN = 0.49, -- componente limite in Z del versore di un foro
DRILL_OVERLAP = 5, -- sovrapposizione tra due mezze forature
MILL_OVERLAP = 5, -- sovrapposizione tra due mezze fresature
MAX_CLEAN_CRN60 = 150, -- massimo spessore per pulitura angolo con fresa 60deg
MAX_CLEAN_CRN30 = 90, -- massimo spessore per pulitura angolo con fresa 30deg
MIN_DIM_ALLOW_CLEAN = 200, -- apertura minima per lavorazione pulitura spigolo
MILL_MAX_DEPTH_AS_MAT = false, -- massimo affondamento frese uguale ad altezza tagliente (max materiale)
CHECK_MIN_Z_SAW = true, -- controlla la quota minima della lama rispetto alla tavola (default true)
MIN_Z_SAW = -1, -- quota minima rispetto alla tavola (default 0)
SIDEMILL_DIAM_UP = 65, -- diametro fresa che lavora lap joint sopra
SIDEMILL_DIAM_DOWN = 350, -- diametro fresa che lavora lap joint sotto
SIDEMILL_BEFORE = true, -- mette le lavorazioni di fresatura di fianco tra le prime
INSIDE_RAW_TOL = 30, -- tolleranza utilizzata per definire quando area di lavorazione è lontana dai bordi del grezzo
NEST_HOLE_MIN_AREA = 200000, -- area minima per inserire gli outlines interni come holes nel nesting
RAWCOL = { 255, 160, 32, 30}, -- colore del grezzo
SIMUL_VIEW_DIR = 4, -- direzione di vista predefinita per la simulazione (1=NW, 2=SW, 3=NE, 4=SE)
ORIG_CORNER = 'TL', -- angolo tavola per origine di battuta (BR (defualt), TR, BL, TL)
NESTING_CORNER = 'TL', -- angolo di origine del grezzo per posizionamento pezzi (BR (defualt), TR, BL, TL)
INTRULLI = 1200, -- distanza fra assi su cui poggia il grezzo (per non far cadere il pezzo)
USE_MULTI_DRILL = true
}
local function GetChainSawBlockedAxis( nInd)
if nInd == 1 then
return 'A1=0'
else
return 'A1=90'
end
end
WallData.GetChainSawBlockedAxis = GetChainSawBlockedAxis
local function GetChainSawStartAngs( vtN2, vtN, ptC)
-- vtN2 : direzione perpendicolare al piano sega a catena (va in vtAux)
-- vtN : direzione utensile sega a catenta (va in vtTool)
-- ptC : centro della faccia
if not vtN or not ptC or not isVector3d( vtN) or not isPoint3d( ptC) then return end
if vtN:getZ() > 0.7 then
return ''
else
if ptC:getY() > -3000 then
return 'C=75;'
else
return 'C=120;'
end
end
end
WallData.GetChainSawStartAngs = GetChainSawStartAngs
---------------------------------------------------------------------
return WallData
+9
View File
@@ -0,0 +1,9 @@
-- %TABLE_NAME%.lua by Egaltech s.r.l. %DATE_TIME%
-- Gestione dati lavorazioni per Travi
-- Tabella per definizione modulo
local %TABLE_NAME% = {
}
---------------------------------------------------------------------
return %TABLE_NAME%