Prima bozza macchina (NON FUNZIONANTE):

- 3D completo
- tavola caricata correttamente
- ventosa e riferimento
This commit is contained in:
andrea.villa
2025-01-24 13:14:25 +01:00
parent 4199ab2a65
commit 6f41b04fce
49 changed files with 1701 additions and 93 deletions
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
Binary file not shown.
Binary file not shown.
+123
View File
@@ -0,0 +1,123 @@
-- 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.NUM = false -- abilitazione numerazione linee
end
---------------------------------------------------------------------
function OnEnd()
-- Chiusura file altri processi (qui si passa sempre, anche in caso di errore)
end
---------------------------------------------------------------------
function OnProgramStart()
-- acquisizione nome attrezzaggio
local sSetupName = EgtGetInfo( EgtGetCurrSetup() or GDB_ID.NULL, 'Name') or ' '
-- Intestazione processo 1
EmtOutput( EgtIf( EMT.INFO, '; '..EMT.INFO, ';Program Start'))
EmtOutput( ';'.. MLE_INFO)
EmtOutput( ';'.. 'ToolingSetUp:'..sSetupName)
end
---------------------------------------------------------------------
function OnProgramEnd()
end
---------------------------------------------------------------------
function OnToolData()
end
---------------------------------------------------------------------
function OnDispositionStart()
end
---------------------------------------------------------------------
function OnDispositionEnd()
end
---------------------------------------------------------------------
function OnTableData()
end
---------------------------------------------------------------------
function OnFixtureData()
end
---------------------------------------------------------------------
function OnRawMoveData()
end
---------------------------------------------------------------------
function OnToolSelect()
end
---------------------------------------------------------------------
function OnToolDeselect()
end
---------------------------------------------------------------------
function OnMachiningStart()
end
---------------------------------------------------------------------
function OnMachiningEnd()
end
---------------------------------------------------------------------
function OnPathStart()
-- reset valori precedenti (per forzare emissione di tutti gli assi del 1° movimento)
EmtResetPrev()
end
---------------------------------------------------------------------
function OnPathEnd()
end
---------------------------------------------------------------------
function OnRapid()
EmtAdjustLinearAxes()
EmtAdjustRotaryAxes()
-- se standard
if EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then
-- se altrimenti risalita a Z max a fine lavorazione
elseif EMT.FLAG == 3 then
-- se altrimenti movimento in Home
elseif EMT.FLAG == 4 then
-- altrimenti errore
else
error( "Unknown Rapid flag")
end
-- aggiorno valori come precedenti
EmtUpdatePrev()
end
---------------------------------------------------------------------
function OnLinear()
-- aggiorno valori come precedenti
EmtUpdatePrev()
end
---------------------------------------------------------------------
function OnArc()
-- aggiorno valori come precedenti
EmtUpdatePrev()
end
---------------------------------------------------------------------
---------------------------------------------------------------------
+59
View File
@@ -0,0 +1,59 @@
; 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=Sk30.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=Vac40x140H125,12
Ref1=RefD20,20
[Heads]
; 5 axis head
H11=6608
; Horizontal Blade
H21=6614
; Gang drill
H22=6612
[SetUp]
Default=Std
[VMill]
Enable=1
[Estimations]
Enable=1
WinPlace=0,1051,187,516,778
+230
View File
@@ -0,0 +1,230 @@
-- Descrizione macchina Masterwood Project265 2025/01/09
-- by EgalWare s.r.l.
require( 'EmtGenerator')
EgtEnableDebug( false)
-- DATI MACCHINA --
NumericalControl = 'TECNOS'
-- DATI TAVOLA --
TabX = 362.0064
TabY = -1734.5386
TabZ = -456.0497
-- DATI TESTE --
-- DATI BANCALETTI --
-- DATI SOTTOPEZZI --
----------------------------------------------------------------------
EmtGeneral {
File='Masterwood-Project265.nge',
Offset = Vector3d( 3717.5064,-384.5486,-601.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 = {-3600, 0},
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 = {-1660, 70},
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 = {-850.9, 200},
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(0, 0, 379),
Stroke = {-321, 321},
Home = 0,
Geo = 'C_AXIS/GEO',
Aux = 'C_AXIS/SOLID'}
EmtAxis {
Name = 'A',
Parent = 'C',
Token = 'A',
Type = MCH_AT.ROTARY,
Dir = -X_AX(),
Pos = Point3d( -86.5, 0, 135),
Stroke = {-110, 110},
Home = 0,
Geo = 'A_AXIS/GEO',
Aux = 'A_AXIS/SOLID'}
EmtHead {
Name = 'H11',
Parent = 'A',
HSet = 'H11',
Type = MCH_HT.STD,
Pos = Point3d( 0, 0, 0),
TDir = Z_AX(),
ADir = -X_AX(),
SolCh = MCH_SCC.ADIR_ZP,
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'}
-- Tavola
EmtTable {
Name = 'Tab',
Parent = 'Base',
Type = MCH_TT.FLAT,
Ref1 = {TabX, TabY, TabZ},
Geo = 'TABLE/GEO',
Aux = 'TABLE/SOLID'}
-- bancaletti
local T1Id = EmtAxis {
Name = 'T1',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {0, 2000},
Home = 0,
Geo = 'T1_AXIS/GEO',
Aux = 'T1_AXIS/SOLID'}
EgtSetInfo( T1Id, 'MDist', 10)
EgtSetInfo( T1Id, 'PDist', 130)
EgtSetInfo( T1Id, 'Next', 'T2')
EgtMove( T1Id, Vector3d( 0, 0, 0), GDB_RT.GLOB)
local T2Id = EmtAxis {
Name = 'T2',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {200, 2100},
Home = 200,
Geo = 'T2_AXIS/GEO',
Aux = 'T2_AXIS/SOLID'}
EgtSetInfo( T2Id, 'MDist', 10)
EgtSetInfo( T2Id, 'PDist', 130)
EgtSetInfo( T2Id, 'Prev', 'T1')
EgtSetInfo( T2Id, 'Next', 'T3')
EgtMove( T2Id, Vector3d( -200, 0, 0), GDB_RT.GLOB)
local T3Id = EmtAxis {
Name = 'T3',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {400, 2200},
Home = 400,
Geo = 'T3_AXIS/GEO',
Aux = 'T3_AXIS/SOLID'}
EgtSetInfo( T3Id, 'MDist', 10)
EgtSetInfo( T3Id, 'PDist', 130)
EgtSetInfo( T3Id, 'Prev', 'T2')
EgtSetInfo( T3Id, 'Next', 'T4')
EgtMove( T3Id, Vector3d( -400, 0, 0), GDB_RT.GLOB)
local T4Id = EmtAxis {
Name = 'T4',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {800, 2600},
Home = 2600,
Geo = 'T4_AXIS/GEO',
Aux = 'T4_AXIS/SOLID'}
EgtSetInfo( T4Id, 'MDist', 10)
EgtSetInfo( T4Id, 'PDist', 130)
EgtSetInfo( T4Id, 'Prev', 'T3')
EgtSetInfo( T4Id, 'Next', 'T5')
EgtMove( T4Id, Vector3d( -2600, 0, 0), GDB_RT.GLOB)
local T5Id = EmtAxis {
Name = 'T5',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {900, 2800},
Home = 2800,
Geo = 'T5_AXIS/GEO',
Aux = 'T5_AXIS/SOLID'}
EgtSetInfo( T5Id, 'MDist', 10)
EgtSetInfo( T5Id, 'PDist', 130)
EgtSetInfo( T5Id, 'Prev', 'T4')
EgtSetInfo( T5Id, 'Next', 'T6')
EgtMove( T5Id, Vector3d( -2800, 0, 0), GDB_RT.GLOB)
local T6Id = EmtAxis {
Name = 'T6',
Parent = 'Tab',
Type = MCH_AT.LINEAR,
Dir = X_AX(),
Pos = Point3d(0, 0, 0),
Stroke = {1000, 3000},
Home = 3000,
Geo = 'T6_AXIS/GEO',
Aux = 'T6_AXIS/SOLID'}
EgtSetInfo( T6Id, 'MDist', 10)
EgtSetInfo( T6Id, 'PDist', 130)
EgtSetInfo( T6Id, 'Prev', 'T5')
EgtMove( T6Id, Vector3d( -3000, 0, 0), GDB_RT.GLOB)
---------------------------------------------------------------------
-- Funzioni richiamate per modificare i dati macchina in casi particolari
--------------------------------------------------------------------------------
function OnSetTable()
EgtSetTableAreaOffset( 100, 100, 100, 100)
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
+624
View File
@@ -0,0 +1,624 @@
-- 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 ***
---------------------------------------------------------------------
local bSimuToolChange = false
local nUnloadTool
local nCountChangeT = 0
local TChangePos = {}
local nTmaxCone = 8
---------------------------------------------------------------------
function OnSimulStart()
-- 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
end
---------------------------------------------------------------------
function OnSimulEnd()
ExecUnloading()
end
---------------------------------------------------------------------
function OnSimulDispositionStart()
EMT.OPEISDISP = true
nTmaxCone = 8
if EMT.SIM1ST then
TChangePos[1] = 1
TChangePos[2] = 0
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
if EMT.SIM1ST then
-- visualizzo tutti i coni del magazzino
ShowHideCone( 1, nTmaxCone, true)
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()
-- se cambia testa va al cambio utensile
if ( EMT.TCPOS ~= EMT.PREVTCPOS) then
-- se ho scaricato il mandrino principale o ancora non carico
if nUnloadTool ~= 2 or not EMT.PREVTCPOS then
-- nascondo la testa attuale per non farla visualizzare nel movimento di cambio
EgtSetMode( EgtGetHeadId( EMT.HEAD), GDB_MD.HIDDEN)
end
SimuToolChange( EgtGetHeadId( EMT.HEAD), 1, EMT.TCPOS, nTmaxCone) -- carico l'utensile
else -- se stesse posizioni
if nUnloadTool == 0 then -- se ho scaricato il madrino per lunghezza eccessiva
EgtSetMode( EgtGetHeadId( EMT.HEAD), GDB_MD.HIDDEN) -- nascondo la testa
SimuToolChange( EgtGetHeadId( EMT.HEAD), 1, EMT.TCPOS, nTmaxCone) -- carico l'utensile
else
-- se la testa non è stata scaricata la mostro
local nHeadId = EgtGetHeadId( EMT.HEAD)
EgtSetMode( nHeadId, GDB_MD.STD)
end
end
-- aquisisco lunghezza utensile
if EMT.TOOL ~= '' then
EMT.TOTLENGTH = EgtTdbGetCurrToolParam(MCH_TP.TOTLEN)
end
-- se attivo Vmill
if EMT.VMILL then
SetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL)
end
end
---------------------------------------------------------------------
function OnSimulToolDeselect()
-- se testa utilizzata non è gruppo a forare
if EMT.HEAD ~= 'H43' and EMT.HEAD ~= 'H45' then
-- se cambia posizione attivo il cambio utensile
if EMT.TCPOS ~= EMT.NEXTTCPOS then -- se cambio utensile
local nHeadId = EgtGetHeadId( EMT.HEAD)
-- se prossima testa è a forare o tastatore verifico se scaricare o no l'utensile
if EMT.NEXTHEAD == 'H43' or EMT.NEXTHEAD == 'H45' then
-- se teste rinvio le scarico comunque
if EMT.HEAD == 'H12' or EMT.HEAD == 'H13' or EMT.HEAD == 'H14' or EMT.HEAD == 'H15' then
SimuToolChange( nHeadId, 2, EMT.TCPOS, nTmaxCone)
else
-- ricavo la lunghezza utensile
EMT.TOTLENGTH = EgtTdbGetCurrToolParam(MCH_TP.TOTLEN)
-- se maggiore della lunghezza consentita scarico la testa
if (EMT.TOTLENGTH and EMT.TOTLENGTH > nMaxLenTool) or EMT.NEXTHEAD == 'H45' then -- ori 156
nUnloadTool = 2
SimuToolChange( nHeadId, 2, EMT.TCPOS, nTmaxCone)
else -- altrimenti mantengo l'utensile sul mandrino
nUnloadTool = 2
-- in questo caso almeno un caricamento utensile è stato fatto
if nCountChangeT == 0 then nCountChangeT = 1 end
EMT.UNHIDEHEAD = EMT.HEAD
end
end
else -- atrimenti prossima testa non gruppo a forare
SimuToolChange( nHeadId, 0, EMT.TCPOS, nTmaxCone) -- scarico utensile
end
end
EMT.PREVTCPOS = EMT.TCPOS
-- altrimenti testa a forare
else
-- se testa succesiva non è gruppo a forare e posizioni differenti scarico utensile
if EMT.NEXTTCPOS ~= 'T43' and EMT.PREVTCPOS and EMT.PREVTCPOS ~= EMT.NEXTTCPOS then
if nUnloadTool and nUnloadTool ~= 0 then
-- rialzo slitta della testa H43
MoveHead( EgtGetHeadId( EMT.HEAD), Z_AX(), 200)
if nUnloadTool == 2 then
SimuToolChange( EgtGetHeadId( EMT.UNHIDEHEAD), 0, EMT.PREVTCPOS, nTmaxCone)
else
SimuToolChange( EgtGetHeadId( EMT.PREVHEAD), 0, EMT.PREVTCPOS, nTmaxCone)
end
end
end
end
EMT.PREVHEAD = EMT.HEAD
end
---------------------------------------------------------------------
function OnSimulMachiningStart()
EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE)
EMT.NOTES = EgtGetMachiningParam( MCH_MP.USERNOTES)
EMT.VMRS = ( EMT.MCHTYPE ~= MCH_MY.DRILLING and EgtGetValInNotes( EMT.NOTES or '', 'VMRS', 'i') ~= 0)
end
---------------------------------------------------------------------
function OnSimulMachiningEnd()
end
---------------------------------------------------------------------
function OnSimulPathStart()
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 SimuToolChange( nHeadId, nShowHead, sPos, nMaxCone)
if not bSimuToolChange then
SimulMoveAxes( 'Y', 0.0, 100, 'C', 0, 100, 'B', 0, 100)
if nShowHead == 0 or nShowHead == 2 then
if nHeadId then EgtSetMode( nHeadId, GDB_MD.HIDDEN) end
elseif nShowHead == 1 then
if nHeadId then EgtSetMode( nHeadId, GDB_MD.STD) end
end
else
if nShowHead == 0 or nShowHead == 2 then
if nUnloadTool ~= 0 then -- scarico utensile
SimulMoveAxes( 'Y', 0.0, 100, 'C', 0.0, 100, 'B', 0.0, 100)
SimulMoveAxis( 'Z', -100.000, 10)
SimulMoveCharger( sPos, (nMaxCone-1), 90)
SimulMoveAxis( 'Z', 0.0, 10)
if nHeadId then EgtSetMode( nHeadId, GDB_MD.HIDDEN) end
SimulChangeCone( sPos, true)
SimulMoveAxis( 'Z', -100, 10)
else
SimulMoveAxis( 'Z', 0, 10)
end
nUnloadTool = 0
elseif nShowHead == 1 then -- carico utensile
SimulMoveAxes( 'Y', 0.0, 100, 'C', 0.0, 100, 'B', 0.0, 100)
SimulMoveAxis( 'Z', 0.0, 10)
SimulMoveCharger( sPos, (nMaxCone-1), 0)
SimulMoveAxis( 'Z', -100, 10)
if nHeadId then EgtSetMode( nHeadId, GDB_MD.STD) end
SimulChangeCone( sPos, false)
SimulMoveAxis( 'B', 0.0, 10)
nUnloadTool = 1
else
SimulMoveAxes( 'Y', 0.0, 100, 'C', 0.0, 100, 'B', 0.0, 100)
nUnloadTool = 2
end
if nShowHead ~= 0 then
SimulMoveAxis( 'Y', 0.0, 10)
SimulMoveAxis( 'Z', 0, 10)
end
end
nCountChangeT = nCountChangeT + 1
end
---------------------------------------------------------------------
function HideAllmainHeads()
EgtSetMode( EgtGetHeadId( 'H11'), GDB_MD.HIDDEN) -- nascondo la testa
EgtSetMode( EgtGetHeadId( 'H12'), GDB_MD.HIDDEN) -- nascondo la testa
EgtSetMode( EgtGetHeadId( 'H13'), GDB_MD.HIDDEN) -- nascondo la testa
EgtSetMode( EgtGetHeadId( 'H14'), GDB_MD.HIDDEN) -- nascondo la testa
EgtSetMode( EgtGetHeadId( 'H15'), GDB_MD.HIDDEN) -- nascondo la testa
nCountChangeT = 1
end
---------------------------------------------------------------------
function ShowHideCone( nPosIni, nPosEnd, bShowCone)
if nPosIni and nPosEnd then
-- imposto flag visualizzazione
local nMode = EgtIf( bShowCone, GDB_MD.STD, GDB_MD.HIDDEN)
-- trovo Id cartella solid
local nIdSolidTc = EgtGetFirstNameInGroup( EgtGetAxisId( 'TC'), 'SOLID')
-- ciclo sui coni
for nPos = nPosIni, nPosEnd do
-- trovo Id cono
local sConeName = 'CONE_'.. EgtNumToString( ( nPos + 100), 0)
local nIdCone = EgtGetFirstNameInGroup( nIdSolidTc, sConeName)
if nIdCone then
EgtSetMode( nIdCone, nMode)
end
end
end
end
---------------------------------------------------------------------
function SimulChangeCone( sPos, bShowCone)
if sPos then
local sPosT = sPos:sub(2)
local nPosT = tonumber(sPosT)
ShowHideCone( nPosT, nPosT, bShowCone)
end
end
---------------------------------------------------------------------
function SimulMoveCharger( sPos, nMaxPos, nOldvalue)
if sPos then
local sPosT = sPos:sub(2)
local nPosT = tonumber(sPosT)
local nVer = 1
local nMovStep = 0
nStep = nPosT - TChangePos[1]
if abs(nStep) <= 0 then -- se numero di passi è a ritornare
nVer = -1
nMovStep = abs(nStep) * ( 595 / nMaxPos) * nVer
else -- altrimenti numero passi è oltre la metà giro
nVer = 1
nMovStep = abs(nStep) * ( 595 / nMaxPos) * nVer
end
TChangePos[1] = nPosT
TChangePos[2] = TChangePos[2] + nMovStep
if abs(nMovStep) > 0 then
SimulMoveAxis( 'Y', TChangePos[2], 10)
SimulMoveAxis( 'B', 90.0, 10)
SimulMoveAxes( 'TC', 100, 7)
end
else
SimulMoveAxis( 'Y', nOldvalue, 10)
SimulMoveAxes( 'TC', 0, 7)
end
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( 'Z')
EMT.R1 = EgtGetAxisHomePos( 'C')
EMT.R2 = EgtGetAxisHomePos( 'B')
-- 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
if not EMT.OPEISDISP then
EMT.MCHEXTTIME = EMT.MCHEXTTIME + dTime
else
EMT.DSPEXTTIME = EMT.DSPEXTTIME + dTime
end
-- 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)
if not EMT.OPEISDISP and
( EMT.MCHTYPE ~= MCH_MY.DRILLING or EMT.L3 < EMT.L3p) then
EMT.MCHCUTLEN = EMT.MCHCUTLEN + dLen
else
EMT.DSPEXTLEN = EMT.DSPEXTLEN + dLen
end
-- calcolo tempo
local dTime = dLen / EMT.F * 60
if not EMT.OPEISDISP then
EMT.MCHCUTTIME = EMT.MCHCUTTIME + dTime
else
EMT.DSPEXTTIME = EMT.DSPEXTTIME + dTime
end
-- 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)
if not EMT.OPEISDISP then
EMT.MCHCUTLEN = EMT.MCHCUTLEN + dLen
else
EMT.DSPEXTLEN = EMT.DSPEXTLEN + dLen
end
-- calcolo tempo
local dTime = dLen / EMT.F * 60
if not EMT.OPEISDISP then
EMT.MCHCUTTIME = EMT.MCHCUTTIME + dTime
else
EMT.DSPEXTTIME = EMT.DSPEXTTIME + dTime
end
-- aggiorno valori come precedenti
EmtUpdatePrev()
end
+47
View File
@@ -0,0 +1,47 @@
-- Processore macchina Masterwood Project265 2025/01/09
-- by EgalWare s.r.l.
--
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
---------------------------------------------------------------------
-- *** Generic Machinings ***
---------------------------------------------------------------------
Egm = require( 'EmtGenMachining')
---------------------------------------------------------------------
-- *** OnSpecialMoveZup ***
---------------------------------------------------------------------
function OnSpecialMoveZup()
--EgtOutLog( 'OnSpecialMoveZup : ' .. EMC.HEAD .. '.' .. tostring( EMC.EXIT))
-- Inizializzo codice di errore
EMC.ERR = 1
-- recupero Z1 home
local dZmax = EgtGetAxisHomePos( 'Z')
-- se testa 5 assi e utensile sdraiato molto alto
if EMC.R2 and EMC.TDIR[3] < 0.79 and EMC.L3 > dZmax - 200 then
-- sistemo asse rotante
EMC.R2 = EgtIf( ( EMC.R2 > 0), 37.5, - 37.5)
-- ricalcolo versore utensile
EMC.TDIR = EgtGetCalcToolDirFromAngles( EMC.R1, EMC.R2)
-- dichiaro modificato
EMC.MODIF = true
else
EMC.MODIF = false
end
EMC.ERR = 0
end
---------------------------------------------------------------------
-- *** 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.
+296
View File
@@ -0,0 +1,296 @@
-- 2024/10/10 10:00:00
-- Disposition Init for Cms-PK_PL 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 Cms-PK_PL : 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 Cms-PK_PL : 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 Cms-PK_PL : 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, 30)
nCorn = MCH_CR.BL
elseif sRefY == 'B' and sRefX == 'R' then
vtOffs = Vector3d( 1700, 0, 30)
nCorn = MCH_CR.BR
elseif sRefY == 'M' and sRefX == 'L' then
vtOffs = Vector3d( 0, 675-10, 30)
nCorn = MCH_CR.TL
elseif sRefY == 'M' and sRefX == 'R' then
vtOffs = Vector3d( 1700, 675-10, 30)
nCorn = MCH_CR.TR
elseif sRefY == 'N' and sRefX == 'L' then
vtOffs = Vector3d( 0, 675+10, 30)
nCorn = MCH_CR.BL
elseif sRefY == 'N' and sRefX == 'R' then
vtOffs = Vector3d( 1700, 675+10, 30)
nCorn = MCH_CR.BR
elseif sRefY == 'T' and sRefX == 'L' then
vtOffs = Vector3d( 0, 1350, 30)
nCorn = MCH_CR.TL
elseif sRefY == 'T' and sRefX == 'R' then
vtOffs = Vector3d( 1700, 1350, 30)
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 Cms-PK_PL : error positioning raw part on table'
EgtOutLog( sErr)
EgtOutText( sErr)
DISP.ERR = 4
return
end
-- Posizionamento dei piani di lavoro, carrelli e ventose
local DIMT_X = 120
local OFFS_MIN_T = 200
local DIMV_Y = 100
local OFFS_MIN_V = 120
local SAFE_DIST = dSafeDist + dOverMatXY
b3Raw = EgtGetRawPartBBox( nRaw)
b3Raw:toLoc( frTab)
-- barre (4)
local vbT = { false, false, false, false}
local vsNamT = { 'T1', 'T2', 'T3', 'T4'}
local vdPosT = { EgtGetAxisHomePos( 'T1'), EgtGetAxisHomePos( 'T2'), EgtGetAxisHomePos( 'T3'), EgtGetAxisHomePos( 'T4')}
if b3Raw:getDimX() < 300 then
if sRefX == 'L' then
vbT[1] = true
vdPosT[1] = b3Raw:getCenter():getX() - DIMT_X / 2
else
vbT[4] = true
vdPosT[2] = vdPosT[1] + OFFS_MIN_T
vdPosT[3] = vdPosT[2] + OFFS_MIN_T
vdPosT[4] = b3Raw:getCenter():getX() - DIMT_X / 2
end
elseif b3Raw:getDimX() < 650 then
if sRefX == 'L' then
vbT[1] = true ; vbT[2] = true
vdPosT[1] = b3Raw:getMin():getX() + SAFE_DIST
vdPosT[2] = b3Raw:getMax():getX() - SAFE_DIST - DIMT_X
else
vbT[3] = true ; vbT[4] = true
vdPosT[2] = vdPosT[1] + OFFS_MIN_T
vdPosT[3] = b3Raw:getMin():getX() + SAFE_DIST
vdPosT[4] = b3Raw:getMax():getX() - SAFE_DIST - DIMT_X
end
elseif b3Raw:getDimX() < 1000 then
if sRefX == 'L' then
vbT[1] = true ; vbT[2] = true ; vbT[3] = true
vdPosT[1] = b3Raw:getMin():getX() + SAFE_DIST
vdPosT[3] = b3Raw:getMax():getX() - SAFE_DIST - DIMT_X
vdPosT[2] = ( vdPosT[1] + vdPosT[3]) / 2
else
vbT[2] = true ; vbT[3] = true ; vbT[4] = true
vdPosT[2] = b3Raw:getMin():getX() + SAFE_DIST
vdPosT[4] = b3Raw:getMax():getX() - SAFE_DIST - DIMT_X
vdPosT[3] = ( vdPosT[2] + vdPosT[4]) / 2
end
else
vbT[1] = true ; vbT[2] = true ; vbT[3] = true ; vbT[4] = true
vdPosT[1] = b3Raw:getMin():getX() + SAFE_DIST
vdPosT[4] = b3Raw:getMax():getX() - SAFE_DIST - DIMT_X
vdPosT[2] = 0.666 * vdPosT[1] + 0.334 * vdPosT[4]
vdPosT[3] = 0.334 * vdPosT[1] + 0.666 * vdPosT[4]
end
for i = 1, #vbT do
EgtMoveDispAxis( vsNamT[i], vdPosT[i])
end
-- carrelli per ventose o morse (3)
local vbV = { false, false, false}
local vdPosV = { EgtGetAxisHomePos( 'T11'), EgtGetAxisHomePos( 'T12'), EgtGetAxisHomePos( 'T13')}
if not bVac then
if sRefY == 'B' then
vbV[1] = true
vdPosV[1] = b3Raw:getMin():getY() - DIMV_Y / 2 - 10
elseif sRefY == 'M' then
vbV[2] = true
vdPosV[2] = b3Raw:getMax():getY() - DIMV_Y / 2 + 10
elseif sRefY == 'N' then
vbV[2] = true
vdPosV[2] = b3Raw:getMin():getY() - DIMV_Y / 2 - 10
elseif sRefY == 'T' then
vbV[3] = true
vdPosV[2] = vdPosV[1] + OFFS_MIN_V
vdPosV[3] = b3Raw:getMax():getY() - DIMV_Y / 2 + 10
end
elseif b3Raw:getDimY() < 260 then
if b3Raw:getMin():getY() < 675 then
vbV[1] = true
vdPosV[1] = b3Raw:getCenter():getY() - DIMV_Y / 2
else
vbV[3] = true
vdPosV[2] = vdPosV[1] + OFFS_MIN_V
vdPosV[3] = b3Raw:getCenter():getY() - DIMV_Y / 2
end
elseif b3Raw:getDimY() < 450 then
if b3Raw:getMin():getY() < 675 then
vbV[1] = true ; vbV[2] = true
vdPosV[1] = b3Raw:getMin():getY() + SAFE_DIST
vdPosV[2] = b3Raw:getMax():getY() - SAFE_DIST - DIMV_Y
else
vbV[2] = true ; vbV[3] = true
vdPosV[2] = b3Raw:getMin():getY() + SAFE_DIST
vdPosV[3] = b3Raw:getMax():getY() - SAFE_DIST - DIMV_Y
end
else
vbV[1] = true ; vbV[2] = true ; vbV[3] = true
vdPosV[1] = b3Raw:getMin():getY() + SAFE_DIST
vdPosV[3] = b3Raw:getMax():getY() - SAFE_DIST - DIMV_Y
vdPosV[2] = ( vdPosV[1] + vdPosV[3]) / 2
end
for i = 1, #vbT do
if vbT[i] then
for j = 1, #vbV do
local sVac = vsNamT[ i] .. tostring( j)
EgtMoveDispAxis( sVac, vdPosV[j])
end
end
end
-- ventose o morse
for i = 1, #vbT do
if vbT[i] then
local dPosX = vdPosT[i] + DIMT_X / 2
for j = 1, #vbV do
if vbV[j] then
if bVac then
EgtAddFixture( 'Vac120x100H30', Point3d( dPosX, vdPosV[j] + DIMV_Y / 2, 0))
else
EgtAddFixture( 'ViseH30', Point3d( dPosX, vdPosV[j] + DIMV_Y / 2, 0), 0, b3Raw:getDimZ())
end
end
end
end
end
-- riferimenti
local dRefX = EgtIf( sRefX == 'L', -10, 1710)
if sRefY == 'B' then
EgtAddFixture( 'RefD20', Point3d( dRefX, 100, 0))
for i = 1, #vbT do
if bVac and vbT[i] then EgtAddFixture( 'RefD20', Point3d( vdPosT[i] + DIMT_X / 2, -10, 0)) end
end
elseif sRefY == 'M' then
EgtAddFixture( 'RefD20', Point3d( dRefX, 675-110, 0))
for i = 1, #vbT do
if bVac and vbT[i] then EgtAddFixture( 'RefD20', Point3d( vdPosT[i] + DIMT_X / 2, 675, 0)) end
end
elseif sRefY == 'N' then
EgtAddFixture( 'RefD20', Point3d( dRefX, 675+110, 0))
for i = 1, #vbT do
if bVac and vbT[i] then EgtAddFixture( 'RefD20', Point3d( vdPosT[i] + DIMT_X / 2, 675, 0)) end
end
elseif sRefY == 'T' then
EgtAddFixture( 'RefD20', Point3d( dRefX, 1350-100, 0))
for i = 1, #vbT do
if bVac and vbT[i] then EgtAddFixture( 'RefD20', Point3d( vdPosT[i] + DIMT_X / 2, 1350+10, 0)) end
end
end
DISP.ERR = 0
+209
View File
@@ -0,0 +1,209 @@
--
-- 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 = {{'H11','H12','H13','H14','H15'}}
-- Configurazione posizioni
local PositionTable={{Pos = "Pos1", TcPos = "T01", Head = "H11", Group = "G1"},
{Pos = "Pos2", TcPos = "T02", Head = "H11", Group = "G1"},
{Pos = "Pos3", TcPos = "T03", Head = "H11", Group = "G1"},
{Pos = "Pos4", TcPos = "T04", Head = "H11", Group = "G1"},
{Pos = "Pos5", TcPos = "T05", Head = "H11", Group = "G1"},
{Pos = "Pos6", TcPos = "T06", Head = "H11", Group = "G1"},
{Pos = "Pos7", TcPos = "T07", Head = "H11", Group = "G1"},
{Pos = "Pos8", TcPos = "T08", Head = "H11", Group = "G1"},
{Pos = "Pos9", TcPos = "T17", Head = "H11", Group = "G2"}}
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
+11
View File
@@ -0,0 +1,11 @@
; Commento per evitare BOM con UTF-8
[General]
Pos1=T01
Pos2=T02
Pos3=T03
Pos4=T04
Pos5=T05
Pos6=T06
Pos7=T07
Pos8=T08
Pos9=T17
+11
View File
@@ -0,0 +1,11 @@
; Commento per evitare BOM con UTF-8
[General]
Pos1=T01;H11;1/1D7C8C06-1D80-4526-8AA1-02A7F58ACEB6/Sphe40
Pos2=T02;H11;1/7B10587A-A4C9-496C-914B-B85B9B723654/Cyl12
Pos3=T03;H11;1/20438631-56B9-4612-8677-5B80B8AD20BA/Cyl20
Pos4=T04;H11;1/10DEACB1-0B59-47F1-9B68-B4AE8D0C8144/Sphe14
Pos5=T05;H11;1/B6DDABCA-0851-41D3-9172-BEC8EB015FF4/EngSphe
Pos6=T06;H11;1/D18C0A7F-6B42-462B-A469-DFAF40C9DD5A/BullNose16_4
Pos7=T07;H11;1/7DC6555A-921E-44A1-85E5-0202FCB8CCB5/EngV
Pos8=T08;H11;1/C23FABE3-4FAE-4A9F-B736-102386BC77BB/Cyl60
Pos9=T17;H11;1/C100EA35-ECD4-4996-800F-D6D7A8C15BB7/Cyl30
BIN
View File
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.