diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c262dce --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +/Tools +/Machinings +/SetUp +/Beam/CutData.lua +/Beam/DrillData.lua +/Beam/MillingData.lua +/Beam/PocketingData.lua +/Beam/SawingData.lua +/Beam/Ts3Data.lua +/Wall/CutData.lua +/Wall/DrillData.lua +/Wall/MillingData.lua +/Wall/PocketingData.lua +/Wall/SawingData.lua +/Wall/Ts3Data.lua + +# ignoro file bak nella cartella principale e nelle sottocartelle al primo livello +*.bak +/*/*.bak diff --git a/Essetre-90580011.ini b/Essetre-90580011.ini new file mode 100644 index 0000000..4d28a7d --- /dev/null +++ b/Essetre-90580011.ini @@ -0,0 +1,60 @@ +; Commento per evitare BOM con UTF-8 +[General] +Material=Beam + +[Tools] +Drillbit=1 +Sawblade=1 +Mill=1 +Mortise=1 +Chisel=0 +DrillMaker=MakeWoodDrill.lua +SawbladeMaker=MakeSawblade.lua +MillMaker=MakeWoodCylMill.lua +MortiseMaker=MakeMortise.lua +ChiselMaker=MakeChisel.lua +Active=1 + +[ToolHolder] +H1.1=Standard.nge +H1.1:MILL_NOTIP=MillNoTip.nge +H2.1=SawOnH2.nge +H3.1=ChainSaw.nge + +[Machinings] +Drilling=1 +Sawing=1 +Milling=1 +Pocketing=1 +Mortising=1 +Chiseling=0 +SawRoughing=0 +SawFinishing=0 + +[Machining] +InitScript=InitMach.lua +ExitScript=ExitMach.lua + +[Disposition] +;InitScript=InitDisp.lua + +[Heads] +; 5 axis head +H1=6608 +; 5 axis saw +H2=6615 +; Chainsaw +H3=6616 +; Horizontal drill +H5=6621 + +[SetUp] +Default=Standard + +[Estimations] +Enable=1 +WinPlace=0,514,138,628,810 + +[VMill] +Enable=1 +Save=0 diff --git a/Essetre-90580011.mlde b/Essetre-90580011.mlde new file mode 100644 index 0000000..8071567 --- /dev/null +++ b/Essetre-90580011.mlde @@ -0,0 +1,574 @@ +-- Descrizione macchina Essetre-90580011 by EgalWare s.r.l. 2024/09/10 +-- Macchina Progress (parte Wall). +-- 2023/09/11 ver 2.6i1 Prima versione macchina, partendo da 90580012. + + +require( 'EmtGenerator') +EgtEnableDebug( false) + +PP_VER = '2.6i1' + +-- Parametri macchina +NumericalControl = 'NUM' -- NUM o TPA +MinY = 7600.0 +MaxY = 26000.0 +MinY2 = 0.0 +MaxY2 = 19000.0 +MinX1 = -5440.0 +MaxX1 = -690.0 +MinZ1 = -1345.0 +MaxZ1 = 0.0 +SafeZ1 = -800.0 +MinB1 = -127.0 +MaxB1 = 127.0 +MinC1 = -275.0 +MaxC1 = 275.0 +MillOffs = 170.0 +ChSawLen = 91.0 +ParkChSawX1 = ( MinX1 + MaxX1) / 2 +ParkChSawZ1 = -250 +ParkChSawC1 = 90 +MinX2 = -4750.0 +MaxX2 = 0.0 +MinZ2 = -1155.0 +MaxZ2 = 0.0 +MinB2 = 0.0 +MaxB2 = 90.0 +MinC2 = -275.0 +MaxC2 = 275.0 +SawDeltaX = 347.65 +SawDeltaY = 0.0 +SawDeltaZ = -52.5 +SawOffs = 154.0 +DimTabX = 7230.0 +DimTabY = 3500.0 +DeltaTabX = 8737.658 +DeltaTabY = -4539.3 +DeltaTabZ = -819.0 +DimTab2X = 7230.0 +DimTab2Y = 3500.0 +DeltaTab2X = 8737.658 +DeltaTab2Y = -4539.3 +DeltaTab2Z = -819.0 +GantryTabs = 8000.0 +OffsetTabs = 345 +CoeffVM = 0.75 + +-- Aggiornamento con dati da TechnoEssetre7 +local sTs3Data = EgtGetStringFromIni( 'Wall', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-90580011.data" +local sData = EgtGetSourceDir().."\\Wall\\Ts3Data.lua" +if EgtExistsFile( sTs3Data) then + EgtCopyFile( sTs3Data, sData) + local sTs3DataOld = sTs3Data..'.old' + EgtEraseFile( sTs3DataOld) + EgtRenameFile( sTs3Data, sTs3DataOld) +end + +if EgtExistsFile( sData) then + local Machine = dofile( sData) + if Machine and Machine.Offsets then + local MchOffs = Machine.Offsets + NumericalControl = EgtIf( MchOffs.TIPO_CN ~= 1, 'NUM', 'TPA') + if MchOffs.MAX_Y then MinY = -MchOffs.MAX_Y end + if MchOffs.MIN_Y then MaxY = -MchOffs.MIN_Y end + if MchOffs.MAX_Y2 then MinY2 = -MchOffs.MAX_Y2 end + if MchOffs.MIN_Y2 then MaxY2 = -MchOffs.MIN_Y2 end + MinX1 = MchOffs.MIN_X or MinX1 + MaxX1 = MchOffs.MAX_X or MaxX1 + MinZ1 = MchOffs.MIN_Z or MinZ1 + MaxZ1 = MchOffs.MAX_Z or MaxZ1 + MinB1 = MchOffs.MIN_B or MinB1 + MaxB1 = MchOffs.MAX_B or MaxB1 + MinC1 = MchOffs.MIN_C or MinC1 + MaxC1 = MchOffs.MAX_C or MaxC1 + MinX2 = MchOffs.MIN_U or MinX2 + MaxX2 = MchOffs.MAX_U or MaxX2 + MinZ2 = MchOffs.MIN_W or MinZ2 + MaxZ2 = MchOffs.MAX_W or MaxZ2 + MinB2 = MchOffs.MIN_V or MinB2 + MaxB2 = MchOffs.MAX_V or MaxB2 + MinC2 = MchOffs.MIN_A or MinC2 + MaxC2 = MchOffs.MAX_A or MaxC2 + MillOffs = MchOffs.PIVOT_MILL or MillOffs + SawOffs = MchOffs.PIVOT_SAW or SawOffs + if MchOffs.ZERO_Y_MILL and MchOffs.OFFSET_ZERO2_Y then DeltaTabX = -MchOffs.ZERO_Y_MILL - MchOffs.OFFSET_ZERO2_Y end + if MchOffs.ZERO_X_MILL and MchOffs.OFFSET_ZERO2_X then DeltaTabY = MchOffs.ZERO_X_MILL + MchOffs.OFFSET_ZERO2_X end + DeltaTabZ = MchOffs.ZERO_Z_MILL or DeltaTabZ + DeltaTab2X = DeltaTabX + DeltaTab2Y = DeltaTabY + DeltaTab2Z = DeltaTabZ + if MchOffs.ZERO_Y_MILL and MchOffs.ZERO_Y_SAW then SawDeltaX = - ( MchOffs.ZERO_Y_MILL - MchOffs.ZERO_Y_SAW) end + if MchOffs.ZERO_X_MILL and MchOffs.ZERO_X_SAW then SawDeltaY = ( MchOffs.ZERO_X_MILL - MchOffs.ZERO_X_SAW) end + if MchOffs.ZERO_Z_MILL and MchOffs.ZERO_Z_SAW then SawDeltaZ = ( MchOffs.ZERO_Z_MILL - MchOffs.ZERO_Z_SAW) end + GantryTabs = MchOffs.GANTRY_TABLES or GantryTabs + end +end + +-- Spostamenti della lama rispetto al disegno +local SawOffsX = SawDeltaX - 347.65 +local SawOffsY = SawDeltaY - 0 +local SawOffsZ = SawDeltaZ + 52.5 + +EmtGeneral { + File='Essetre-90580011.nge', + Offset = Vector3d( -540.35, -5820.00, -1447.0), + AxisMaxAdjust = 300, + ExitMaxAdjust = 300, + Special = 'Essetre-WALL.mlse', + Processor = 'Essetre-WALL.mlpe'} +local BaseId = EmtBase { + Name = 'Base', + Geo='BASE/GEO', + Aux={'BASE/TRAVERSA', 'BASE/SUBTABLE', 'BASE/COLLISION', 'BASE/TC', 'BASE/TCR'}} + local vtMove = Vector3d( DeltaTabX - 8737.658, DeltaTabY + 4539.3, DeltaTabZ + 819.0) + EgtMove( EgtGetFirstNameInGroup( BaseId, 'SUBTABLE'), vtMove, GDB_RT.GLOB) +-- Tavola 1 +local YId = EmtAxis { + Name = 'Y', + Parent = 'Base', + Invert = true, + Type = MCH_AT.LINEAR, + Dir = -X_AX(), + Pos = Point3d( 0, 0, 0), + Stroke = {MinY, MaxY}, + Home = MaxY, + Geo = 'Y_AXIS/GEO', + Aux = {'Y_AXIS/SOLID'}} + EgtMove( YId, vtMove, GDB_RT.GLOB) +local TabId = EmtTable { + Name = 'Tab', + Parent = 'Y', + Type = MCH_TT.FLAT, + Ref1 = Point3d( DeltaTabX, DeltaTabY, DeltaTabZ), + Geo = 'TABLE/GEO', + Aux = {'TABLE/GEO2', 'TABLE/SOLID', 'TABLE/COLLISION'}} +-- Tavola 2 +local Y2Id = EmtAxis { + Name = 'Y2', + Parent = 'Base', + Invert = true, + Type = MCH_AT.LINEAR, + Dir = -X_AX(), + Pos = Point3d( 0, 0, 0), + Stroke = {MinY2, MaxY2}, + Home = MinY2, + Geo = 'Y2_AXIS/GEO', + Aux = {'Y2_AXIS/SOLID'}} + EgtMove( Y2Id, vtMove, GDB_RT.GLOB) +EmtTable { + Name = 'Tab2', + Parent = 'Y2', + Type = MCH_TT.FLAT, + Ref1 = Point3d( DeltaTab2X, DeltaTab2Y, DeltaTab2Z), + Geo = 'TABLE2/GEO', + Aux = {'TABLE2/SOLID', 'TABLE2/COLLISION'}} +-- Testa per frese +EmtAxis { + Name = 'X1', + Parent = 'Base', + Token = 'X', + Type = MCH_AT.LINEAR, + Dir = Y_AX(), + Pos = Point3d( 0, 0, 0), + Stroke = {MinX1, MaxX1}, + Home = MinX1, + Geo = 'X1_AXIS/GEO', + Aux = {'X1_AXIS/SOLID'}} +EmtAxis { + Name = 'Z1', + Parent = 'X1', + Token = 'Z', + Type = MCH_AT.LINEAR, + Dir = Z_AX(), + Pos = Point3d( 0, 0, 0), + Stroke = {MinZ1, MaxZ1}, + Home = 0, + Geo = 'Z1_AXIS/GEO', + Aux = {'Z1_AXIS/SOLID'}} +EmtAxis { + Name = 'C1', + Parent = 'Z1', + Token = 'C', + Type = MCH_AT.ROTARY, + Dir = Z_AX(), + Pos = Point3d( 0, 0, 0), + Stroke = {MinC1, MaxC1}, + Home = 0, + Geo = 'C1_AXIS/GEO', + Aux = {'C1_AXIS/SOLID', 'C1_AXIS/COLLISION'}} +EmtAxis { + Name = 'B1', + Parent = 'C1', + Token = 'B', + Type = MCH_AT.ROTARY, + Dir = -X_AX(), + Pos = Point3d( 0, 0, MillOffs), + Stroke = {MinB1, MaxB1}, + Home = 0, + Geo = 'B1_AXIS/GEO', + Aux = {'B1_AXIS/SOLID', 'B1_AXIS/COLLISION'}} +EmtHead { + Name = 'H1', + Parent = 'B1', + HSet = 'H1', + Type = MCH_HT.STD, + Pos = Point3d( 0, 0, 0), + TDir = Z_AX(), + ADir = Y_AX(), + Rot1W = 0.1, + OthColl = {'B1/SOLID', 'C1/SOLID'}, + Geo = 'H1_HEAD/GEO'} +-- Sega a catena +EmtAxis { + Name = 'A1', + Parent = 'B1', + Token = '**', + Type = MCH_AT.ROTARY, + Dir = Z_AX(), + Pos = Point3d( 0, 0, 0), + Stroke = { -90, 180}, + Home = 0, + Geo = 'A1_AXIS/GEO'} +local H3Id = EmtHead { + Name = 'H3', + Parent = 'A1', + HSet = 'H1', + Type = MCH_HT.STD, + Pos = Point3d( 0, 0, -ChSawLen), + TDir = -Y_AX(), + ADir = Z_AX(), + Rot1W = 0.1, + SolCh = MCH_SCC.ADIR_NEAR, + OthColl = {'B1/SOLID', 'C1/SOLID'}, + Geo = 'H3_HEAD/GEO'} + EgtSetInfo( H3Id, 'ZSAFEDELTA', 60) +-- Testa per Lama +local X2Id = EmtAxis { + Name = 'X2', + Parent = 'Base', + Token = 'X', + Type = MCH_AT.LINEAR, + Dir = Y_AX(), + Pos = Point3d( 0, 0, 0), + Stroke = {MinX2, MaxX2}, + Home = MaxX2, + Geo = 'X2_AXIS/GEO', + Aux = {'X2_AXIS/SOLID'}} + EgtMove( EgtGetFirstNameInGroup( X2Id, 'SOLID'), Vector3d( SawOffsX, SawOffsY, 0), GDB_RT.GLOB) +local Z2Id = EmtAxis { + Name = 'Z2', + Parent = 'X2', + Token = 'Z', + Type = MCH_AT.LINEAR, + Dir = Z_AX(), + Pos = Point3d( 0, 0, 0), + Stroke = {MinZ2, MaxZ2}, + Home = 0, + Geo = 'Z2_AXIS/GEO', + Aux = {'Z2_AXIS/SOLID'}} + EgtMove( EgtGetFirstNameInGroup( Z2Id, 'SOLID'), Vector3d( SawOffsX, SawOffsY, SawOffsZ), GDB_RT.GLOB) +local C2Id = EmtAxis { + Name = 'C2', + Parent = 'Z2', + Token = 'C', + Type = MCH_AT.ROTARY, + Dir = Z_AX(), + Pos = Point3d( SawDeltaX, SawDeltaY, 866.99), + Stroke = {MinC2, MaxC2}, + Home = 0, + Geo = 'C2_AXIS/GEO', + Aux = {'C2_AXIS/SOLID', 'C2_AXIS/COLLISION'}} + EgtMove( EgtGetFirstNameInGroup( C2Id, 'SOLID'), Vector3d( SawOffsX, SawOffsY, SawOffsZ), GDB_RT.GLOB) + EgtMove( EgtGetFirstNameInGroup( C2Id, 'COLLISION'), Vector3d( SawOffsX, SawOffsY, SawOffsZ), GDB_RT.GLOB) +local B2Id = EmtAxis { + Name = 'B2', + Parent = 'C2', + Token = 'B', + Type = MCH_AT.ROTARY, + Dir = -X_AX(), + Pos = Point3d( SawDeltaX, SawDeltaY, SawDeltaZ + SawOffs), + Stroke = {MinB2, MaxB2}, + Home = 90, + Geo = 'B2_AXIS/GEO', + Aux = {'B2_AXIS/SOLID', 'B2_AXIS/COLLISION'}} + EgtMove( EgtGetFirstNameInGroup( B2Id, 'SOLID'), Vector3d( SawOffsX, SawOffsY, SawOffsZ), GDB_RT.GLOB) + EgtMove( EgtGetFirstNameInGroup( B2Id, 'COLLISION'), Vector3d( SawOffsX, SawOffsY, SawOffsZ), GDB_RT.GLOB) +local H2Id = EmtHead { + Name = 'H2', + Parent = 'B2', + HSet = 'H2', + Type = MCH_HT.STD, + Pos = Point3d( SawDeltaX, SawDeltaY, SawDeltaZ), + TDir = Z_AX(), + ADir = -Y_AX(), + Rot1W = 0.2, + OthColl = {'B2/SOLID', 'C2/SOLID'}, + Geo = 'H2_HEAD/GEO'} +-- ToolChanger +local ptTCF = Point3d( 2337.8,-5177.8,-950.5) +EmtTcPos { + Name = 'T1', + Parent = 'Base', + Pos = ptTCF, + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T1'} +EmtTcPos { + Name = 'T2', + Parent = 'Base', + Pos = ptTCF - 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T2'} +EmtTcPos { + Name = 'T3', + Parent = 'Base', + Pos = ptTCF - 2 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T3'} +EmtTcPos { + Name = 'T4', + Parent = 'Base', + Pos = ptTCF - 3 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T4'} +EmtTcPos { + Name = 'T5', + Parent = 'Base', + Pos = ptTCF - 4 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T5'} +EmtTcPos { + Name = 'T6', + Parent = 'Base', + Pos = ptTCF - 5 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T6'} +EmtTcPos { + Name = 'T7', + Parent = 'Base', + Pos = ptTCF - 6 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T7'} +EmtTcPos { + Name = 'T8', + Parent = 'Base', + Pos = ptTCF - 7 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T8'} +EmtTcPos { + Name = 'T9', + Parent = 'Base', + Pos = ptTCF - 8 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T9'} +EmtTcPos { + Name = 'T10', + Parent = 'Base', + Pos = ptTCF - 9 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T10'} +EmtTcPos { + Name = 'T11', + Parent = 'Base', + Pos = ptTCF - 10 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T11'} +EmtTcPos { + Name = 'T12', + Parent = 'Base', + Pos = ptTCF - 11 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T12'} +EmtTcPos { + Name = 'T13', + Parent = 'Base', + Pos = ptTCF - 12 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T13'} +EmtTcPos { + Name = 'T14', + Parent = 'Base', + Pos = ptTCF - 13 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T14'} +EmtTcPos { + Name = 'T15', + Parent = 'Base', + Pos = ptTCF - 14 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T15'} +local ptTCB = Point3d( 2337.8,-5610.8,-950.5) +EmtTcPos { + Name = 'T16', + Parent = 'Base', + Pos = ptTCB, + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T16'} +EmtTcPos { + Name = 'T17', + Parent = 'Base', + Pos = ptTCB - 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T17'} +EmtTcPos { + Name = 'T18', + Parent = 'Base', + Pos = ptTCB - 2 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T18'} +EmtTcPos { + Name = 'T19', + Parent = 'Base', + Pos = ptTCB - 3 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T19'} +EmtTcPos { + Name = 'T20', + Parent = 'Base', + Pos = ptTCB - 4 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T20'} +EmtTcPos { + Name = 'T21', + Parent = 'Base', + Pos = ptTCB - 5 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T21'} +EmtTcPos { + Name = 'T22', + Parent = 'Base', + Pos = ptTCB - 6 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T22'} +EmtTcPos { + Name = 'T23', + Parent = 'Base', + Pos = ptTCB - 7 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T23'} +EmtTcPos { + Name = 'T24', + Parent = 'Base', + Pos = ptTCB - 8 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T24'} +EmtTcPos { + Name = 'T25', + Parent = 'Base', + Pos = ptTCB - 9 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T25'} +EmtTcPos { + Name = 'T26', + Parent = 'Base', + Pos = ptTCB - 10 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T26'} +EmtTcPos { + Name = 'T27', + Parent = 'Base', + Pos = ptTCB - 11 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T27'} +EmtTcPos { + Name = 'T28', + Parent = 'Base', + Pos = ptTCB - 12 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T28'} +EmtTcPos { + Name = 'T29', + Parent = 'Base', + Pos = ptTCB - 13 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T29'} +EmtTcPos { + Name = 'T30', + Parent = 'Base', + Pos = ptTCB - 14 * 180 * X_AX(), + TDir = Z_AX(), + ADir = X_AX(), + Geo = 'BASE/T30'} + +local ptTCR = Point3d( -350.9,-5033.7,-270) +EmtTcPos { + Name = 'T101', + Parent = 'Base', + Pos = ptTCR - ChSawLen * Z_AX(), + TDir = X_AX(), + ADir = Z_AX(), + Geo = 'BASE/T101'} + +--------------------------------------------------------------------- +-- Funzioni richiamate per modificare i dati macchina in casi particolari +--function OnSetTable() +--end + +--------------------------------------------------------------------- +function OnSetHead() + if EMC.HEAD == 'H1' then + EmtModifyAxisHome( 'X1', MinX1) + EmtModifyAxisHome( 'Z1', MaxZ1) + EmtModifyAxisHome( 'C1', 0) + elseif EMC.HEAD == 'H3' then + EmtModifyAxisHome( 'X1', ParkChSawX1) + EmtModifyAxisHome( 'Z1', ParkChSawZ1) + EmtModifyAxisHome( 'C1', ParkChSawC1) + local dDist = EgtIf( EMC.DIST and abs( EMC.DIST) > 1, EMC.DIST, ChSawLen) + EmtModifyExitPosition( EMC.HEAD, EMC.EXIT, Point3d( 0, 0, -dDist)) + if not EMC.VER or EMC.VER < '2.5h2' then + local vtMove = Point3d( 0, 0, -dDist) - Point3d( EMC.EXITPOS) + local ExitId = EgtGetFirstNameInGroup( EgtGetHeadId( EMC.HEAD), 'T'..tostring( EMC.EXIT)) + EgtMove( ExitId, vtMove) + end + end +end + +--------------------------------------------------------------------- +-- 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) + -- visualizzo geometria ausiliaria tavola + EgtSetStatus( EgtGetFirstNameInGroup( TabId, 'GEO2') or GDB_ID.NULL, GDB_ST.ON) +end diff --git a/Essetre-90580011.nge b/Essetre-90580011.nge new file mode 100644 index 0000000..e3ab529 Binary files /dev/null and b/Essetre-90580011.nge differ diff --git a/Essetre-90580011_GLOBAL.txt b/Essetre-90580011_GLOBAL.txt new file mode 100644 index 0000000..149f479 --- /dev/null +++ b/Essetre-90580011_GLOBAL.txt @@ -0,0 +1,49 @@ +Origins are defined in respect to GLOBAL + + ♫ Y_AXIS +X:14425.2344, Y:-1647.2289, Z:-6530.7 + + ♫ TABLE_R1 +X:9278.008, Y:1280.7, Z:628.0 + + ♫ Y2_AXIS +X:14425.2344, Y:-1647.2289, Z:-6530.7 + + ♫ TABLE2_R1 +X:9278.008, Y:1280.7, Z:628.0 + + ♫ X1_AXIS +X:5250.0, Y:120.0, Z:0 + + ♫ Z1_AXIS +X:4820.0, Y:-250.0, Z:-100.0 + + ♫ C1_AXIS +X:540.35, Y:5820.0006, Z:1949.9998 + + ♫ B1_AXIS +X:431.9466, Y:5820.0006, Z:1616.9998 + + ♫ H1_HEAD_T1 +X:540.35, Y:5820.0, Z:1447.0 + + ♫ A1_AXIS +X:540.35, Y:5820.0, Z:1310.0 + + ♫ H3_HEAD_T1 +X:540.35, Y:5820.0, Z:1356.0 + + ♫ X2_AXIS +X:7270.0, Y:350.0, Z:0 + + ♫ Z2_AXIS +X:6820.0, Y:-210.5, Z:-99.85 + + ♫ C2_AXIS +X:-99.85, Y:6820.0, Z:-210.5 + + ♫ B2_AXIS +X:888.0006, Y:5820.0, Z:1548.5 + + ♫ H2_HEAD_T1 +X:888.0006, Y:5820.0, Z:1394.5 diff --git a/Essetre-90580011_H1_HEAD_T1.txt b/Essetre-90580011_H1_HEAD_T1.txt new file mode 100644 index 0000000..2637d85 --- /dev/null +++ b/Essetre-90580011_H1_HEAD_T1.txt @@ -0,0 +1,49 @@ +Origins are defined in respect to H1_HEAD_T1 + + ♫ Y_AXIS +X:13884.8844, Y:-7467.2289, Z:-7977.7 + + ♫ TABLE_R1 +X:8737.658, Y:-4539.3, Z:-819.0 + + ♫ Y2_AXIS +X:13884.8844, Y:-7467.2289, Z:-7977.7 + + ♫ TABLE2_R1 +X:8737.658, Y:-4539.3, Z:-819.0 + + ♫ X1_AXIS +X:4709.65, Y:-5700.0, Z:-1447.0 + + ♫ Z1_AXIS +X:4279.65, Y:-6070.0, Z:-1547.0 + + ♫ C1_AXIS +X:0, Y:0.0006, Z:502.9998 + + ♫ B1_AXIS +X:-108.4034, Y:0.0006, Z:169.9998 + + ♫ H1_HEAD_T1 (ORIGIN) +X:0, Y:0, Z:0 + + ♫ A1_AXIS +X:0, Y:0, Z:-137.0 + + ♫ H3_HEAD_T1 +X:0, Y:0, Z:-91.0 + + ♫ X2_AXIS +X:6729.65, Y:-5470.0, Z:-1447.0 + + ♫ Z2_AXIS +X:6279.65, Y:-6030.5, Z:-1546.85 + + ♫ C2_AXIS +X:-640.2, Y:1000.0, Z:-1657.5 + + ♫ B2_AXIS +X:347.6506, Y:0, Z:101.5 + + ♫ H2_HEAD_T1 +X:347.6506, Y:0, Z:-52.5 diff --git a/Essetre-90580011_b.nge b/Essetre-90580011_b.nge new file mode 100644 index 0000000..db30678 Binary files /dev/null and b/Essetre-90580011_b.nge differ diff --git a/Essetre-WALL.NUM.mlpe b/Essetre-WALL.NUM.mlpe new file mode 100644 index 0000000..6cdc231 --- /dev/null +++ b/Essetre-WALL.NUM.mlpe @@ -0,0 +1,589 @@ +-- Processore macchina Essetre-WALL by EgalTech s.r.l. 2023/09/18 +-- Con controllo numerico NUM + +-- Variabili di modulo +local MLE_INFO = 'Essetre-WALL.NUM.mlpe ver.'..PP_VER..' by EgalTech s.r.l.' +local TEST_USE = false + +--------------------------------------------------------------------- +-- *** GENERATION *** +--------------------------------------------------------------------- +function OnStart() + EMT.USETO1 = false -- abilitazione uso origine tavola + EMT.MODAL = true -- abilitazione emissione modale + EMT.INCHES = false -- unità di misura mm/inches + EMT.NUM = false -- abilitazione numerazione linee + --EMT.Nt = 'N' -- token per la numerazione di linea + --EMT.LINENBR = 0 -- numero di linea + --EMT.LINEINC = 1 -- incremento numerazione linee + --EMT.Ft = 'F' -- token per feed + --EMT.St = 'S' -- token per speed + EMT.FMAXPINZE = 154000 -- feed massima pinze +end + +--------------------------------------------------------------------- +function OnEnd() + -- Ripristino fase iniziale come corrente + EgtSetCurrPhase( 1) +end + +--------------------------------------------------------------------- +function OnProgramStart() + -- Flag + local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL + EMT.LOAD90 = EgtGetInfo( BtlInfoId, 'LOAD90', 'i') or 0 + -- Imposto uso origine 1 + EMT.ORIG = 1 + -- Intestazioni + if not TEST_USE then + EMT.PRODID = EgtGetInfo( BtlInfoId, 'PRODID', 'i') or 0 + EMT.PATTID = EgtGetInfo( BtlInfoId, 'PATTID', 'i') or 0 + EmtOutput( '%' .. tostring( EMT.PATTID) .. '.0') + else + EmtOutput( '%40.0') + end + if EMT.INFO then + EmtOutput( '('..EMT.INFO..')') + else + EmtOutput( '(Program Start)') + end + EmtOutput( '('.. MLE_INFO..')') + -- Parametri macchina + local sOut = 'G114'..' EA'..EgtNumToString( DeltaTabY - SawDeltaY + DimTabY, -2)..' EB'..EgtNumToString( -DeltaTabX + SawDeltaX, -2).. + ' EC'..EgtNumToString( DeltaTabZ - SawDeltaZ, -2)..' ED'..EgtNumToString( SawOffs, -2)..' EE'..EgtNumToString( 0, -2).. + ' EF'..EgtNumToString( DeltaTabY + DimTabY, -2)..' EG'..EgtNumToString( -DeltaTabX, -2).. + ' EH'..EgtNumToString( DeltaTabZ, -2)..' EI'..EgtNumToString( MillOffs, -2)..' EL'..EgtNumToString( GantryTabs, -2) + EmtOutput( sOut) + -- Indice lavorazione + EMT.CNT = 0 + -- Non effettuate lavorazioni con sega a catena sul fianco + EMT.CSAWFIRST = true + -- Non effettuata pausa per rimozione sfridi + EMT.SCRAPFIRST = true + -- Cerco primo utensile su testa 1 + EMT.TOOL_1, EMT.TLEN_1 = FindFirstToolOnHead( 'H1') +end + +--------------------------------------------------------------------- +function OnProgramEnd() + EmtOutput( '( *** Program End *** )') + EmitCount() + -- Dichiarazione conclusione pezzi + if EMT.PRODID then + local PartId = EgtGetFirstPartInRawPart( EMT.RAWID) + while PartId do + local CutId = EgtGetInfo( PartId, 'CUTID', 'i') or 0 + local sOut = 'G126 EA'..tostring( EMT.PRODID)..' EB'..tostring( EMT.PATTID)..' EC'..tostring( CutId)..' ED2' + EmtOutput( sOut) + PartId = EgtGetNextPartInRawPart( PartId) + end + end + -- Arresto mandrino + EmtOutput( 'M05 E80000=1') + -- Tipo di scarico + if not TEST_USE then + EmtOutput( 'M27') + else + EmtOutput( 'M27') + end + -- Se modalità test, termino il programma + if TEST_USE then + EmtOutput( 'M02') + end +end + +--------------------------------------------------------------------- +function OnToolData() + -- emissione dati utensile (esclusa lama e sega a catena) + if EMT.HEAD == 'H1' then + -- cerco posizione di attrezzaggio del primo utensile di lavorazione + if EMT.TOOL == EMT.TOOL_1 and EMT.TLEN_1 < 215.5 then + EMT.TCPOS_1 = EMT.TCPOS + end + -- emissione dati sega a catena + elseif EMT.HEAD == 'H3' then + ; + end +end + +--------------------------------------------------------------------- +function OnDispositionStart() + --EmtOutput( '(Disposition '..EMT.DISPIND..' = '..EMT.DISPID..')') + EMT.OPEISDISP = true +end + +--------------------------------------------------------------------- +function OnDispositionEnd() + -- Se prima disposizione + if EMT.PHASE == 1 then + -- Dimensioni grezzo + local b3Raw = EgtGetRawPartBBox( EMT.RAWID) + EmtOutput( 'E30050='..EgtNumToString( 1000 * b3Raw:getDimY(), 0).. + ' E30051='..EgtNumToString( 1000 * b3Raw:getDimX(), 0).. + ' E30052='..EgtNumToString( 1000 * b3Raw:getDimZ(), 0)) + -- Eventuale salto a lavorazione in corso + EmtOutput( 'G79 NE80000') + -- Lancio del carico + EmitCount() + EmtOutput( 'M26 L0='..EgtNumToString( EMT.ORIG, 0)) + -- Dichiarazione inizio lavorazione pezzi + if EMT.PRODID then + EmitCount() + local PartId = EgtGetFirstPartInRawPart( EMT.RAWID) + while PartId do + local CutId = EgtGetInfo( PartId, 'CUTID', 'i') or 0 + local sOut = 'G126 EA'..tostring( EMT.PRODID)..' EB'..tostring( EMT.PATTID)..' EC'..tostring( CutId)..' ED1' + EmtOutput( sOut) + PartId = EgtGetNextPartInRawPart( PartId) + end + end + end + EMT.OPEISDISP = false +end + +--------------------------------------------------------------------- +function OnTableData() +end + +--------------------------------------------------------------------- +function OnFixtureData() +end + +--------------------------------------------------------------------- +function OnRawMoveData() +end + +--------------------------------------------------------------------- +function OnToolSelect() + -- se utensile definito (non definito per disposizioni con movimento) + if EMT.TOOL ~= '' then + -- verifiche su utensile + local sTool = EgtTdbGetToolFromUUID( EgtGetMachiningParam( MCH_MP.TUUID) or "") + if sTool ~= EMT.TOOL then error( "Tool name mismatch") end + -- predefinite EMT.TCPOS EMT.HEAD EMT.EXIT + EMT.TOOLTYPE = EgtTdbGetCurrToolParam( MCH_TP.TYPE) + EMT.TOOLSEL = EMT.TCPOS..' M06' + EMT.TDIAM = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + EMT.TTOTDIAM = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM) + EMT.TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN) + EMT.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + if MCH_TP.DIST then EMT.TDIST = EgtTdbGetCurrToolParam( MCH_TP.DIST) end + if EMT.TDIST and abs( EMT.TDIST) < 0.1 then EMT.TDIST = nil end + end +end + +--------------------------------------------------------------------- +function OnToolDeselect() +end + +--------------------------------------------------------------------- +function OnMachiningStart() + --EMT.MCHLIBNAME = EgtGetMachiningParam( MCH_MP.NAME) + EMT.MCHNAME = EgtGetOperationName( EMT.MCHID) + EMT.MCHTYPE = EgtGetMachiningParam(MCH_MP.TYPE) + -- non ancora iniziata la lavorazione + EMT.MCHFIRST = true + -- primo posizionamento sempre in globale + EMT.REFLOC = nil + EMT.IPLGL = false +end + +--------------------------------------------------------------------- +function OnMachiningEnd() + EMT.PREVTOOL = EMT.TOOL +end + +--------------------------------------------------------------------- +function OnPathStart() + -- reset valori precedenti (per forzare emissione di tutti gli assi del 1° movimento) + EmtResetPrev() +end + +--------------------------------------------------------------------- +function OnPathEnd() + if not EMT.ZMAX then + EmtOutput( 'G103'..GetET()..' E80000='..tostring( EMT.CNT + 1)) + end +end + +--------------------------------------------------------------------- +function OnRapid() + -- se primo movimento della lavorazione, gestione speciale + if EMT.MCHFIRST and not EMT.OPEISDISP then + MyAdjustLinearAxes() + EmtAdjustRotaryAxes() + EmtOutput( '( *** '..EMT.MCHNAME..'/'..EMT.TOOL..' *** )') + EmitCount() + -- se lavorazione con sega a catena + if EMT.HEAD == 'H3' then + -- se prima lavorazione sui fianchi con sega a catena + if EMT.CSAWFIRST and string.sub( EMT.MCHNAME, 1, 5) == 'Csaw_' then + EMT.CSAWFIRST = false + -- pausa per rimozione sfridi + local b3Raw = EgtGetRawPartBBox( EMT.RAWID) + local ParkY = max( -( MaxY + b3Raw:getMin():getX() + b3Raw:getDimX() + 3000), -MaxY) + EmtOutput( 'G104 Y' .. EmtLenToString( ParkY, 3) .. ' ET1' .. GetEF()) + -- pre-posizionamento + EmitCount() + EmtResetPrev() + local sET = GetET() + local sEU = GetEU() + local sEE = GetEE() + local sEF = GetEF() + local sEM = ' EM'..EgtIf( EMT.S > 0, '3', '4') + local sES = ' ES'..EgtNumToString( abs( EMT.S), 0) + local sEL = ' EL' .. EmtLenToString( ( EMT.TDIST or ChSawLen), 3) + local sER = ' ER' .. EmtLenToString( EMT.TLEN, 3) + local sOut = 'G101' .. EmtGetAxis( 'L3') + sOut = sOut .. sET .. sEU .. sEE .. sEF .. sEM .. sES .. sEL .. sER + EmtOutput( sOut) + end + -- altrimenti verifico se necessaria pausa + else + if EMT.SCRAPFIRST and EgtExistsInfo( EMT.MCHID, 'MOVE_AFTER') then + EMT.SCRAPFIRST = false + -- pausa per rimozione sfridi + local b3Raw = EgtGetRawPartBBox( EMT.RAWID) + local ParkY = max( -( MaxY + b3Raw:getMin():getX() + b3Raw:getDimX() + 3000), -MaxY) + EmtOutput( 'G104 Y' .. EmtLenToString( ParkY, 3) .. ' ET1' .. GetEF()) + end + end + -- primo posizionamento + EmtResetPrev() + local sOut = 'G101' .. EmtGetAxis( 'L1') .. EmtGetAxis( 'L2') .. EmtGetAxis( 'L3') .. + EmtGetAxis( 'R2') .. EmtGetAxis( 'R1') + if EMT.HEAD == 'H1' then + sOut = sOut .. ' U' .. EmtLenToString( MaxX2, 3) .. ' W0 V90 A0' + elseif EMT.HEAD == 'H2' then + sOut = sOut .. ' U' .. EmtLenToString( MinX1, 3) .. ' W0 V0 A0' + elseif EMT.HEAD == 'H3' then + sOut = sOut .. ' U' .. EmtLenToString( MaxX2, 3) .. ' W0 V90 A0' + else + EmtSetLastError( 1211, "Unknown Head : " .. EMT.HEAD) + end + local sET = GetET() + local sEU = GetEU() + local sEE = GetEE() + local sEF = GetEF() + local sEM = ' EM'..EgtIf( EMT.S > 0, '3', '4') + local sES = ' ES'..EgtNumToString( abs( EMT.S), 0) + local sEL = ' EL' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TLEN, ( EMT.TDIST or ChSawLen)), 3) + local sER = ' ER' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TDIAM / 2, EMT.TLEN), 3) + sOut = sOut .. sET .. sEU .. sEE .. sEF .. sEM .. sES .. sEL .. sER + EmtOutput( sOut) + EMT.REFLOC = 0 + EMT.MCHFIRST = false + EMT.ZMAX = false + -- se standard + elseif EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then + -- se necessario, impostazione riferimento locale + if EMT.REFLOC == 0 then + -- calcolo per piano generico + CalcInterpPlane() + EMT.REFLOC = 1 + -- trasformo i punti nel piano + MyAdjustLinearAxes() + EmtAdjustRotaryAxes() + EMT.L1p = nil + EMT.L2p = nil + EMT.L3p = nil + EMT.R1p = nil + EMT.R2p = nil + local sET = GetET() + local sEU = GetEU() + local sEE = GetEE() + local sEF = ' EF20000' + local sEM = ' EM'..EgtIf( EMT.S > 0, '3', '4') + local sES = ' ES'..EgtNumToString( abs( EMT.S), 0) + local sEL = ' EL' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TLEN, ( EMT.TDIST or ChSawLen)), 3) + local sER = ' ER' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TDIAM / 2, EMT.TLEN), 3) + EmtOutput( 'G102'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..EmtGetAxis('R2')..EmtGetAxis('R1')..EMT.IPLGLSTR..sET..sEU..sEE..sEF..sEM..sES..sEL..sER) + -- emissione movimento + local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. + EmtGetAxis('R2')..EmtGetAxis('R1') + EmtOutput( sOut) + else + MyAdjustLinearAxes() + EmtAdjustRotaryAxes() + -- emissione movimento + local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. + EmtGetAxis('R2')..EmtGetAxis('R1') + EmtOutput( sOut) + end + -- se altrimenti risalita a Z max a fine lavorazione + elseif EMT.FLAG == 3 then + if EMT.REFLOC then + EMT.REFLOC = nil + EMT.IPLGL = false + local PrevL3op = EMT.L3op + EmtResetPrev() + -- dichiarazione fine lavorazione + EmtOutput( 'G103'..GetET()..' E80000='..tostring( EMT.CNT + 1)) + MyAdjustLinearAxes() + EmtAdjustRotaryAxes() + if EMT.HEAD == 'H1' and PrevL3op < SafeZ1 then + local sOut = 'G101 ' .. EMT.L3t .. EmtLenToString( SafeZ1, 3) .. GetET() .. GetEU() .. GetEE() .. GetEF() + EmtOutput( sOut) + end + local sOut = 'G101' .. EmtGetAxis( 'L3') .. EmtGetAxis( 'R2') .. EmtGetAxis( 'R1') .. GetET() .. GetEU() .. GetEE() .. GetEF() + EmtOutput( sOut) + EMT.ZMAX = true + end + -- se altrimenti movimento in Home + elseif EMT.FLAG == 4 then + -- non previsto + -- altrimenti errore + else + error( "Unknown Rapid flag") + end + -- aggiorno valori come precedenti + EmtUpdatePrev() +end + +--------------------------------------------------------------------- +function OnLinear() + -- se necessario, impostazione riferimento locale + if EMT.REFLOC == 0 then + -- calcolo per piano generico + CalcInterpPlane() + EMT.REFLOC = 1 + -- salvo posizione attuale + local OldL1 = EMT.L1 + local OldL2 = EMT.L2 + local OldL3 = EMT.L3 + local OldR1p = EMT.R1p + local OldR2p = EMT.R2p + -- imposto posizione precedente + EMT.L1 = EMT.L1o + EMT.L2 = EMT.L2o + EMT.L3 = EMT.L3o + EMT.R1p = nil + EMT.R2p = nil + -- trasformo i punti nel piano + MyAdjustLinearAxes() + EmtAdjustRotaryAxes() + local sET = GetET() + local sEU = GetEU() + local sEE = GetEE() + local sEF = ' EF20000' + local sEM = ' EM'..EgtIf( EMT.S > 0, '3', '4') + local sES = ' ES'..EgtNumToString( abs( EMT.S), 0) + local sEL = ' EL' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TLEN, ( EMT.TDIST or ChSawLen)), 3) + local sER = ' ER' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TDIAM / 2, EMT.TLEN), 3) + EmtOutput( 'G102'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..EmtGetAxis('R2')..EmtGetAxis('R1')..EMT.IPLGLSTR..sET..sEU..sEE..sEF..sEM..sES..sEL..sER) + -- emissione movimento + local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. + EmtGetAxis('R2')..EmtGetAxis('R1') + EmtOutput( sOut) + -- ripristino posizione attuale + EMT.L1 = OldL1 + EMT.L2 = OldL2 + EMT.L3 = OldL3 + EMT.R1p = OldR1p + EMT.R2p = OldR2p + end + + -- aggiustamento valori + MyAdjustLinearAxes() + EmtAdjustRotaryAxes() + + -- valori degli assi + local sAxes = EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. + EmtGetAxis('R2')..EmtGetAxis('R1') + -- se nulla da emettere, esco + if string.len( sAxes) == 0 then + return + end + -- aggiungo feed + local sFeed = EmtGetFeed() + -- emetto linea + EmtOutput( "G1"..sAxes..sFeed) + -- aggiorno valori come precedenti + EmtUpdatePrev() +end + +--------------------------------------------------------------------- +function OnArc() + -- non modale su archi + local dPrevZ = EMT.L3p + EmtResetPrevLinear() + -- aggiustamento valori + MyAdjustLinearAxes() + EmtAdjustRotaryAxes() + + -- valori degli assi + local sAxes = EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. + EmtGetAxis('R2')..EmtGetAxis('R1') + -- se nulla da emettere, esco + if string.len( 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,3) + -- aggiungo feed + local sFeed = EmtGetFeed() + -- tipo arco + local sArc = 'G' .. EgtNumToString(EMT.MOVE,0) + -- se elica, aggiungo il pitch + local sPitch = '' + local dDeltaZ = EMT.L3 - dPrevZ + if abs( dDeltaZ) > GEO.EPS_SMALL then + local dPitch = dDeltaZ * 360.0 / abs( EMT.AC) + sPitch = ' K' .. EmtLenToString( dPitch, 3) + end + -- emetto arco + EmtOutput( sArc..sAxes..sRad..sPitch..sFeed) + + -- aggiorno valori come precedenti + EmtUpdatePrev() +end + +--------------------------------------------------------------------- +function MyAdjustLinearAxes() + local MyL1o = EMT.L1 + local MyL2o = EMT.L2 + local MyL3o = EMT.L3 + if EMT.REFLOC then + local vtDelta = V_NULL() + local vtE = V_NULL() + if EMT.HEAD == 'H1' then + local Len = EMT.TLEN + MillOffs + local LenRef = MillOffs + local vtTool = EgtGetCalcToolDirFromAngles( EMT.R1, EMT.R2, EMT.R3) + vtE = vtTool * Len - Z_AX() * LenRef + elseif EMT.HEAD == 'H2' then + vtDelta = -Vector3d( SawDeltaX, SawDeltaY, SawDeltaZ) + local Len = EMT.TLEN + SawOffs + local LenRef = SawOffs + local vtTool = EgtGetCalcToolDirFromAngles( EMT.R1, EMT.R2, EMT.R3) + vtE = vtTool * Len - Z_AX() * LenRef + elseif EMT.HEAD == 'H3' then + local Len = ( EMT.TDIST or ChSawLen) + MillOffs + local LenRef = MillOffs + local vtAux = EgtGetCalcAuxDirFromAngles( EMT.R1, EMT.R2, EMT.R3) + vtE = vtAux * Len - Z_AX() * LenRef + end + EMT.L1 = EMT.L1 - vtDelta:getX() - vtE:getX() + EMT.L2 = EMT.L2 - vtDelta:getY() - vtE:getY() + EMT.L3 = EMT.L3 - vtDelta:getZ() - vtE:getZ() + end + + EmtAdjustLinearAxes() + + EMT.L1o = MyL1o + EMT.L2o = MyL2o + EMT.L3o = MyL3o + + if not EMT.REFLOC then + EMT.L1 = - EMT.L1 + EMT.L1t = 'Y' + EMT.L2t = 'X' + else + EMT.L1t = 'X' + EMT.L2t = 'Y' + end +end + +--------------------------------------------------------------------- +function CalcInterpPlane() + -- origine del piano + local xS = EMT.START[1] + EgtGetAxisHomePos( 'Y') + local yS = EMT.START[2] + local zS = DeltaTabZ + local ptS = Point3d( xS, yS, zS) + -- calcolo per piano generico + local vtE + if EMT.HEAD ~= 'H3' then + vtE = EgtGetCalcToolDirFromAngles( EMT.R1, EMT.R2, EMT.R3) + else + vtE = EgtGetCalcAuxDirFromAngles( EMT.R1, EMT.R2, EMT.R3) + end + EMT.IPLGLFR = Frame3d( ptS, vtE) + --EmtOutput( 'IPLGLFR='..tostring(EMT.IPLGLFR)) + local _, dAngV, dAngO = SphericalFromVector( vtE) + local dAngO2 = EmtGetAngO2( EMT.IPLGLFR:getVersZ(), EMT.IPLGLFR:getVersX(), dAngV, dAngO) + dAngO = dAngO - 90 + while dAngO < 0 do + dAngO = dAngO + 360 + end + -- se rotazione solo attorno alla C allora si mette come rotazione finale + if abs( dAngV) < GEO.EPS_ANG_SMALL then + dAngO2 = dAngO2 + dAngO + while dAngO2 >= 360 do + dAngO2 = dAngO2 - 360 + end + dAngO = 0 + end + + local xOut = yS - DeltaTabY - DimTabY + local yOut = - ( xS - DeltaTabX) + local zOut = zS - DeltaTabZ + if EMT.ORIG == 2 then + xOut = yS - DeltaTabY + yOut = - ( xS - DeltaTabX) + elseif EMT.ORIG == 3 then + xOut = yS - DeltaTabY - DimTabY + yOut = - ( xS - DeltaTabX - DimTabX) + elseif EMT.ORIG == 4 then + xOut = yS - DeltaTabY + yOut = - ( xS - DeltaTabX - DimTabX) + end + EMT.IPLGLSTR = ' EX'..EmtLenToString( xOut)..' EY'..EmtLenToString( yOut)..' EZ'..EmtLenToString( zOut).. + ' EA0'..' EB'..EgtNumToString( dAngV)..' EC'..EgtNumToString( dAngO)..' ED'..EgtNumToString( dAngO2) + EMT.IPLGL = true +end + +--------------------------------------------------------------------- +function GetET() + if EMT.HEAD == 'H1' or EMT.HEAD == 'H3' then + return ' ET2' + elseif EMT.HEAD == 'H2' then + return ' ET1' + end +end + +--------------------------------------------------------------------- +function GetEU() + local sEU + if EMT.HEAD == 'H1' then + sEU = ' EU'..string.sub( EMT.TCPOS, 2) + elseif EMT.HEAD == 'H2' then + sEU = ' EU0' + elseif EMT.HEAD == 'H3' then + if abs( EMT.R3 - 0) < 0.1 then + sEU = ' EU101' + --elseif abs( EMT.R3 - 90) < 0.1 then + -- sEU = ' EU104' + else + EmtSetLastError( 1210, 'Chain saw orientation not allowed') + end + else + sEU = '' + end + return sEU +end + +--------------------------------------------------------------------- +function GetEE() + return ' EE' .. EgtNumToString( EMT.ORIG, 0) +end + +--------------------------------------------------------------------- +function GetEF() + return ' EF60000' +end + +--------------------------------------------------------------------- +function EmitCount() + EMT.CNT = EMT.CNT + 1 + EmtOutput( 'N'..tostring( EMT.CNT)..' E80000='..tostring( EMT.CNT)) +end + +--------------------------------------------------------------------- +-- *** END GENERATION *** +--------------------------------------------------------------------- diff --git a/Essetre-WALL.mlpe b/Essetre-WALL.mlpe new file mode 100644 index 0000000..60c2f48 --- /dev/null +++ b/Essetre-WALL.mlpe @@ -0,0 +1,893 @@ +-- Processore macchina Essetre-WALL by EgalTech s.r.l. 2023/09/01 +-- Funzioni generiche indipendenti dal controllo + +-- Intestazioni +require( 'EmtGenerator') +EgtEnableDebug( false) + + +--------------------------------------------------------------------- +-- *** GENERATION *** +--------------------------------------------------------------------- +local sBaseDir = EgtGetSourceDir() +if NumericalControl == 'NUM' then + dofile( sBaseDir .. 'Essetre-WALL.NUM.mlpe') +elseif NumericalControl == 'TPA' then + error( 'Numerical Control error : TPA not yet managed') + --dofile( sBaseDir .. 'Essetre-WALL.TPA.mlpe') +else + error( 'Numerical Control error : unkwnown type') +end + +--------------------------------------------------------------------- +-- *** SIMULATION *** +--------------------------------------------------------------------- +local COLL_SAFE_DIST = 2 + +--------------------------------------------------------------------- +function OnSimulStart() + -- Carico gli utensili sulle barre portautensili + local vTcPos = EgtGetAllTcPosNames() + if vTcPos then + for i = 1, #vTcPos do + local vTools = EgtGetToolsInCurrSetupPos( vTcPos[i]) + if vTools and vTools[1] then + EgtLoadTool( vTcPos[i], 1, vTools[1]) + ShowToolInTcPos( vTcPos[i], true) + end + end + end + EgtSetStatus( EgtGetFirstNameInGroup( EgtGetTableId( 'Tab') or GDB_ID.NULL, 'GEO2') or GDB_ID.NULL, GDB_ST.OFF) + -- Se reset o home, esco + if EMT.SIM1ST then return end + -- Non effettuate lavorazioni con sega a catena sul fianco + EMT.CSAWFIRST = true + -- Non effettuata pausa per rimozione sfridi + EMT.SCRAPFIRST = true + -- 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( 'B1', 'COLLISION', EMT.COLLOBJ) + AddToCollisionCheck( 'C1', 'COLLISION', EMT.COLLOBJ) + AddToCollisionCheck( 'B2', 'COLLISION', EMT.COLLOBJ) + AddToCollisionCheck( 'C2', '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 = 'Tab', Sub = 'COLLISION', Name = 'STM'}, + { Grp = 'Tab2', Sub = 'COLLISION', Name = 'STM'}, + { Grp = 'Base', Sub = 'COLLISION', Name = 'TRAV'}, + { Grp = 'Base', Sub = 'COLLISION', Name = 'COL1'}, + { Grp = 'Base', Sub = 'COLLISION', Name = 'COL2'}, + { Grp = 'Base', Sub = 'COLLISION', Name = 'TC'}, + { Grp = 'Base', Sub = 'COLLISION', Name = 'CSAW'}, + { Grp = 'Base', Sub = 'COLLISION', Name = 'TRUC'}} + 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) or EgtGetTableId( McdData[i].Grp) + end + local nId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( nGrpId, McdData[i].Sub), 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() + if EMT.SCRAPFIRST then + EMT.SCRAPFIRST = false + ExecScrapRemove() + end + ExecUnloading() +end + +--------------------------------------------------------------------- +--function OnSimulDispositionStarting() +--end + +--------------------------------------------------------------------- +function OnSimulDispositionStart() + + EMT.OPEISDISP = true + + -- Se prima disposizione (dovrebbe essere l'unica) + 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 + -- se lunghezza pezzo oltre il limite imposto le due tavole + EMT.TAB2 = nil + if EMT.LB > GantryTabs then + EMT.TAB2 = true + EgtSetAxisPos( 'Y2', EgtGetAxisPos( 'Y') - DimTabX - OffsetTabs) + end + -- Carico primo utensile sulla testa 1 + local sTool = FindFirstToolOnHead( 'H1') + if sTool then + EMT.TOOL_1 = sTool + EgtLoadTool( 'H1', 1, EMT.TOOL_1) + EMT.TCPOS_1 = GetToolTcPos( EMT.TOOL_1) + ShowToolInTcPos( EMT.TCPOS_1, false) + else + EgtUnloadTool( 'H1', 1) + end + -- Imposto la corretta posizione Home della Testa 1 (dipende se attivo utensile o sega a catena) + local nH1Mod = EgtGetMode( EgtGetHeadId( 'H1')) + if nH1Mod == GDB_MD.STD then + EgtSetAxisPos( 'X1', MinX1) + EgtSetAxisPos( 'Z1', MaxZ1) + else + EgtSetAxisPos( 'X1', ParkChSawX1) + EgtSetAxisPos( 'Z1', ParkChSawZ1) + end + end + + -- Nascondo tutte le lavorazioni + local nMchId = EgtGetFirstOperation() + while nMchId do + if EgtGetOperationType( nMchId) ~= MCH_OY.DISP then + EgtSetOperationStatus( nMchId, false) + end + nMchId = EgtGetNextOperation( nMchId) + end + + -- dati del grezzo e suo aggancio alla tavola + EMT.RAWID = EgtGetFirstRawPart() + local b3Raw = EgtGetRawPartBBox( EMT.RAWID or GDB_ID.NULL) + EmtLinkRawPartToGroup( EMT.RAWID or GDB_ID.NULL, 'Tab') + + -- Se abilitato e trovato grezzo, creazione Zmap + if EgtGetInfo( EgtGetCurrMachGroup(), 'Vm', 'b') and EMT.RAWID then + -- Se vero inizio, creo Zmap + if not EMT.SIM1ST then + -- elimino eventuale vecchio Zmap + EgtErase( EgtGetFirstNameInGroup( EMT.RAWID, 'VMill') or GDB_ID.NULL) + -- recupero il solido + local nSolId = EgtGetFirstNameInGroup( EMT.RAWID, 'RawSolid') + -- determino la risoluzione dello Zmap + local b3Sol = EgtGetBBoxGlob( nSolId, GDB_BB.STANDARD) + local dArea = b3Sol:getDimX() * b3Sol:getDimY() + b3Sol:getDimX() * b3Sol:getDimZ() + b3Sol:getDimY() * b3Sol:getDimZ() + local dTol = 6.13 + if dArea < CoeffVM * 6.0e6 then + dTol = 2.81 + elseif dArea < CoeffVM * 12.0e6 then + dTol = 3.77 + elseif dArea < CoeffVM * 24.0e6 then + dTol = 5.03 + end + -- creo lo Zmap + EMT.VMILL = EgtVolZmapBox( EMT.RAWID, b3Raw:getMin(), b3Raw:getDimX(), b3Raw:getDimY(), b3Raw:getDimZ(), dTol, true, GDB_RT.GLOB) + if EMT.VMILL then + EgtSetName( EMT.VMILL, 'VMill') + EgtSetLevel( EMT.VMILL, GDB_LV.TEMP) + EgtSetColor( EMT.VMILL, EgtGetColor( nSolId), false) + -- nascondo le altre geometrie + local nId = EgtGetFirstInGroup( EMT.RAWID) + while nId do + if nId ~= EMT.VMILL then + EgtSetStatus( nId, GDB_ST.OFF) + end + nId = EgtGetNext( nId) + end + EgtSetStatus( EMT.SCRAP or GDB_ID.NULL, GDB_ST.OFF) + -- imposto eventuale utensile corrente + SetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL) + end + end + end + -- se vero inizio, assegno solidi per verifica collisione + if not EMT.SIM1ST then + EMT.CODET = {} + for i = 1, #EMT.MCODET do + EMT.CODET[i] = EMT.MCODET[i] + end + if EMT.VMILL then + table.insert( EMT.CODET, EMT.VMILL) + end + end +end + +--------------------------------------------------------------------- +function OnSimulDispositionEnd() + if EMT.UNLOADING or EMT.FALL then + EMT.UNLOADING = false + EMT.FALL = false + end + EMT.OPEISDISP = false +end + +--------------------------------------------------------------------- +function OnSimulToolSelect() + -- se utensile non definito, è disposizione ed esco + if EMT.TOOL == '' then return end + -- recupero dati utensile + EMT.TOOLTYPE = EgtTdbGetCurrToolParam( MCH_TP.TYPE) + -- se lama su sua testa, verifico che l'altra sia dalla parte opposta + if EMT.HEAD == 'H2' then + EgtSetAxisPos( 'X1', MinX1) + -- altrimenti carico utensile + else + -- se sega a catena, imposto subito angolo scelto per asse virtuale A + if EMT.HEAD == 'H3' then + -- recupero la lavorazione successiva + local NextMchId + if EMT.MCHID then + NextMchId = EgtGetNextActiveOperation( EMT.MCHID) + else + NextMchId = EgtGetFirstActiveOperation() + end + if EgtGetOperationType( NextMchId) == MCH_OY.DISP then + NextMchId = EgtGetNextActiveOperation( NextMchId) + end + EgtSetCurrMachining( NextMchId) + -- leggo e imposto il valore di A1 + local sVal = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS) + local dPosA = EgtGetVal( sVal, 'A1', 'd') or 0 + EmtModifyAxisHome( 'A1', dPosA) + EgtResetAxisPos( 'A1') + EmtModifyAxisHome( 'C1', -dPosA) + EgtResetAxisPos( 'C1') + EgtSetAxisPos( 'X1', ParkChSawX1) + EgtSetAxisPos( 'Z1', ParkChSawZ1) + end + -- breve pausa + EgtPause( 100) + EgtOutText( '') + EMT.TOOL_1 = EMT.TOOL + EMT.TCPOS_1 = EMT.TCPOS + -- lo nascondo sul portautensili + ShowToolInTcPos( EMT.TCPOS, false) + end + -- se attivo Vmill + SetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL) + -- se attivo Collision Check + EMT.SAFEDIST = COLL_SAFE_DIST + if EMT.COLLOBJ then + AddToolToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, 1001) + AddToolHolderToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, 1002) + for i, Coll in ipairs( EMT.COLLOBJ) do + EmtAddCollisionObjEx( i, Coll.Fr, Coll.Ty, Coll.Mv, Coll.P1, Coll.P2, Coll.P3) + end + end +end + +--------------------------------------------------------------------- +function OnSimulToolDeselect() + -- porto la testa in home + if EMT.HEAD == 'H2' then + SimulMoveAxes( 'X2', MaxX2, MCH_SIM_STEP.RAPID, 'C2', EgtGetAxisHomePos( 'C2'), MCH_SIM_STEP.COLLROT, 'B2', EgtGetAxisHomePos( 'B2'), MCH_SIM_STEP.COLLROT) + elseif EMT.NEXTHEAD == 'H2' then + SimulMoveAxes( 'X1', MinX1, MCH_SIM_STEP.RAPID, 'C1', EgtGetAxisHomePos( 'C1'), MCH_SIM_STEP.COLLROT, 'B1', EgtGetAxisHomePos( 'B1'), MCH_SIM_STEP.COLLROT) + end + -- deposito utensile se non lama su sua testa + if EMT.NEXTHEAD ~= 'H2' then + if EMT.NEXTTOOL ~= EMT.TOOL_1 then + EgtOutText( 'Tool change in progress...') + -- simulo movimento + SimulMoveAxes( 'B1', 0, MCH_SIM_STEP.COLLROT, 'C1', 0, MCH_SIM_STEP.COLLROT) + SimulMoveAxis( 'X1', MinX1, MCH_SIM_STEP.RAPID) + -- breve pausa + EgtPause( 100) + ShowToolInTcPos( EMT.TCPOS_1, true) + -- se segue sega a catena + if EMT.NEXTHEAD == 'H3' then + -- nascondo l'utensile corrente + EgtSetStatus( EgtGetHeadId( 'H1'), GDB_ST.OFF) + -- eseguo movimenti opportuni + SimulMoveAxis( 'X1', ParkChSawX1, MCH_SIM_STEP.RAPID) + SimulMoveAxis( 'Z1', ParkChSawZ1, MCH_SIM_STEP.RAPID) + end + else + EMT.TOOL_1 = nil + EMT.TCPOS_1 = nil + end + end +end + +--------------------------------------------------------------------- +function OnSimulMachiningStart() + -- recupero alcuni dati della lavorazione + EMT.MCHNAME = EgtGetOperationName( EMT.MCHID) + EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE) + local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) + EMT.VMRS = false + -- recupero CUTID e TASKID della feature lavorata + local vId = EgtGetMachiningGeometry() + if vId and #vId > 0 and #vId[1] > 0 then + local nPartId = EgtGetParent( EgtGetParent( vId[1][1]) or GDB_ID.NULL) + EMT.CUTID = EgtGetInfo( nPartId or GDB_ID.NULL, 'CUTID', 'i') or 0 + EMT.TASKID = EgtGetInfo( vId[1][1], 'TASKID', 'i') or 0 ; + else + EMT.CUTID = 0 + EMT.TASKID = 0 + end + -- eventuale pausa per rimozione sfridi + if EMT.SCRAPFIRST then + if ( EMT.HEAD == 'H3' and string.sub( EMT.MCHNAME, 1, 5) == 'Csaw_') or EgtExistsInfo( EMT.MCHID, 'MOVE_AFTER') then + EMT.SCRAPFIRST = false + EgtOutText( 'Pause for Scrap Remove') + ParkForScrapRemove() + ExecScrapRemove() + EgtPause( 500) + EgtOutText( '') + end + end + -- non ancora iniziata la lavorazione + EMT.MCHFIRST = true +end + +--------------------------------------------------------------------- +function OnSimulMachiningEnd() + if EMT.UNLOADING or EMT.FALL then + EMT.UNLOADING = false + EMT.FALL = false + end +end + +--------------------------------------------------------------------- +--function OnSimulPathStart() +--end + +--------------------------------------------------------------------- +function OnSimulPathEnd() + -- se attivo VMILL, lavorazione ed è richiesto di eliminare gli sfridi + if EMT.VMILL and not EMT.OPEISDISP and EMT.VMRS then + EgtOutLog( 'OnSimulPathEnd', 5) + local nPart = EgtVolZmapPartCount( EMT.VMILL) + if nPart > 1 then + -- ricerca del pezzo con massimo volume + local nPartMax = 0 + local dVolMax = 0 + for i = 1, nPart do + local dVol = EgtVolZmapPartVolume( EMT.VMILL, 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 + local b3Vmill = EgtVolZmapGetPartBBoxGlob( EMT.VMILL, i - 1, GDB_BB.STANDARD) + if b3Vmill:getDimX() < 1200 then + EgtRemoveVolZmapPart( EMT.VMILL, i - 1) + end + end + end + -- aggiorno visualizzazione + EgtDraw() + end + end +end + +--------------------------------------------------------------------- +function OnSimulPathStartAux() + --EgtOutLog( 'OnSimulPathStartAux - ' .. EgtNumToString( EMT.AUXIND, 0) .. ' - ' .. EMT.AUX) + EgtOutLog( 'OnSimulPathStartAux', 5) + -- eseguo il comando + --ExecAuxCmd( EMT.AUX) +end + +--------------------------------------------------------------------- +function OnSimulPathEndAux() + --EgtOutLog( 'OnSimulPathEndAux - ' .. EgtNumToString( EMT.AUXIND, 0) .. ' - ' .. EMT.AUX) + EgtOutLog( 'OnSimulPathEndAux', 5) + -- eseguo il comando + --ExecAuxCmd( EMT.AUX) +end + +--------------------------------------------------------------------- +function OnSimulMoveStart() + -- se lunghezza pezzo oltre il limite, aggancio le tavole + if EMT.TAB2 then + EgtSetAxisPos( 'Y2', EgtGetAxisPos( 'Y') - DimTabX - OffsetTabs) + EMT.AuxAxes = 1 + EMT.A1n = 'Y2' + EMT.A1m = 'Y' + end + -- se rapido a fine lavorazione con testa bassa, prima risalgo opportunamente in Z + if EMT.HEAD == 'H1' and EMT.MOVE == 0 and EMT.FLAG == 3 and EMT.L3p < SafeZ1 then + SimulMoveAxis( 'Z1', SafeZ1, MCH_SIM_STEP.RAPID) + end +end + +--------------------------------------------------------------------- +function OnSimulMoveEnd() +end + +--------------------------------------------------------------------- +function OnSimulCollision() + -- se prima collisione della lavorazione, la segnalo + if EMT.MCHNAME ~= EMT.LAST_MCHNAME_COLLIDE then + 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 + +--------------------------------------------------------------------- +function ParkForScrapRemove() + local b3Raw = EgtGetRawPartBBox( EMT.RAWID) + local ParkY = min( ( MaxY + b3Raw:getMin():getX() + b3Raw:getDimX() + 3000), MaxY) + SimulMoveAxis( 'Z1', EgtGetAxisHomePos( 'Z1'), MCH_SIM_STEP.RAPID) + if EMT.TAB2 then + SimulMoveAxes( 'Y', ParkY, MCH_SIM_STEP.RAPID, 'Y2', ParkY - DimTabX - OffsetTabs, MCH_SIM_STEP.RAPID) + else + SimulMoveAxis( 'Y', ParkY, MCH_SIM_STEP.RAPID) + end +end + +--------------------------------------------------------------------- +function ExecScrapRemove() + if EMT.VMILL then + local nPart = EgtVolZmapPartCount( EMT.VMILL) + if nPart > 1 then + -- recupero i box dei pezzi + local vPrtBox = {} + local nPartId = EgtGetFirstPartInRawPart( EMT.RAWID) + while nPartId do + local b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) + table.insert( vPrtBox, b3Part) + nPartId = EgtGetNextPartInRawPart( nPartId) + end + -- tengo solo le parti del Vmill che contengono almeno un box di un pezzo + for i = nPart, 1, -1 do + -- recupero il box della parte + local b3VmPart = EgtVolZmapGetPartBBoxGlob( EMT.VMILL, i - 1, GDB_BB.STANDARD) + -- lo ingrandisco per sicurezza + b3VmPart:expand( 100) + -- verifiche per parte da eliminare + local bToRemove = true + -- se box abbastanza grande, allora da verificare + local dVol = b3VmPart:getDimX() * b3VmPart:getDimY() * b3VmPart:getDimZ() + if dVol > 1e6 then + for j = 1, #vPrtBox do + local b3Part = vPrtBox[j] + if EnclosesXY( b3VmPart, b3Part) then + bToRemove = false + break + end + end + end + -- se richiesta eliminazione, la eseguo + if bToRemove then + EgtRemoveVolZmapPart( EMT.VMILL, i - 1) + end + end + -- se sono rimaste più parti del numero di pezzi, devo fare ulteriori verifiche + local nRest = EgtVolZmapPartCount( EMT.VMILL) + if nRest > #vPrtBox then + -- recupero tutti i box delle parti + local vVmpBox = {} + for i = 1, nRest do + local b3VmPart = EgtVolZmapGetPartBBoxGlob( EMT.VMILL, i - 1, GDB_BB.STANDARD) + table.insert( vVmpBox, b3VmPart) + end + -- + local vVmpFlag = {} + for i = 1, #vPrtBox do + local b3Part = vPrtBox[i] + local nVmp + local dErr = 400 + for j = 1, nRest do + local b3VmPart = vVmpBox[j] + local dCurrErr = ( b3Part:getCenter() - b3VmPart:getCenter()):len() + + abs( b3Part:getDimX() - b3VmPart:getDimX()) + + abs( b3Part:getDimY() - b3VmPart:getDimY()) + + abs( b3Part:getDimZ() - b3VmPart:getDimZ()) + if dCurrErr < dErr then + nVmp = j + dErr = dCurrErr + end + end + if nVmp then + vVmpFlag[nVmp] = i + end + end + for i = nRest, 1, -1 do + if not vVmpFlag[i] then + EgtRemoveVolZmapPart( EMT.VMILL, i - 1) + end + end + end + end + end +end + +--------------------------------------------------------------------- +function ExecUnloading() + if EMT.VMILL then + -- 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( EMT.VMILL)) + EgtRelocate( EMT.VMILL, nLayId) + EgtSetLevel( EMT.VMILL, GDB_LV.USER) + -- aggiungo gli spigoli + local nFirstId, nCount = EgtVolZmapGetEdges( EMT.VMILL, nLayId) + if nFirstId then + for nId = nFirstId, nFirstId + nCount - 1 do + EgtSetColor( nId, Color3d( 96, 96, 96)) + end + end + -- rilascio Vmill + EMT.VMILL = nil + -- aggiorno la visualizzazione + EgtDraw() + -- se finito + if EMT.PHASE == EgtGetPhaseCount() then + -- 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 +end + +--------------------------------------------------------------------- +function ShowToolInTcPos( sTcPos, bShow) + -- recupero il gruppo dell'utensile + local TcExitId = EgtGetFirstNameInGroup( EgtGetTcPosId( sTcPos or '') or GDB_ID.NULL, 'T1') + if not TcExitId then return end + -- imposto lo stato di visualizzazione + EgtSetStatus( TcExitId, EgtIf( bShow, GDB_ST.ON, GDB_ST.OFF)) +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 + + +--------------------------------------------------------------------- +-- *** ESTIMATION T&L *** +--------------------------------------------------------------------- +local RAPID_X_FEED = 75000 -- mm/min +local RAPID_Y_FEED = 20000 -- mm/min +local RAPID_Z_FEED = 50000 -- mm/min +local RAPID_C_FEED = 5000 -- deg/min +local RAPID_B_FEED = 10000 -- deg/min +local RAPID_MIN_T = 0.1 -- s +local SCRAP_REMOVE_T = 30 -- s + +--------------------------------------------------------------------- +function OnEstimStart() + EMT.INCHES = not EgtUiUnitsAreMM() -- unità di misura mm/inches + -- Non effettuata pausa per rimozione sfridi + EMT.SCRAPFIRST = true +end + +--------------------------------------------------------------------- +function OnEstimEnd() +end + +--------------------------------------------------------------------- +function OnEstimProgramStart() + -- imposto inizio movimenti da Home + EMT.L1 = EgtGetAxisHomePos( 'Y') + EMT.L2 = EgtGetAxisHomePos( 'X1') + EMT.L3 = EgtGetAxisHomePos( 'Z1') + EMT.R1 = EgtGetAxisHomePos( 'C1') + EMT.R2 = EgtGetAxisHomePos( 'B1') + -- 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() + -- inizio disposizione + EMT.OPEISDISP = true + -- sulla prima fase dichiaro carico barra + if EMT.PHASE == 1 then + EMT.LOAD = true + else + EMT.LOAD = false + end +end + +--------------------------------------------------------------------- +function OnEstimDispositionEnd() + -- emetto dati in sospeso + if EMT.TLE_NAME then + EmtTleAddMachining( EMT.TLE_NAME, EmtSecToHMS( EMT.TLE_TIME), ' - ', ' - ') + EMT.TLE_NAME = nil + EMT.TLE_TIME = nil + end + -- termine disposizione + EMT.OPEISDISP = false +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 = EgtGetOperationName( EMT.MCHID) + EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE) + EgtOutLog( 'Mach : ' .. EMT.MCHNAME, 5) + -- eventuale pausa per rimozione sfridi + if EMT.SCRAPFIRST then + if ( EMT.HEAD == 'H3' and string.sub( EMT.MCHNAME, 1, 5) == 'Csaw_') or EgtExistsInfo( EMT.MCHID, 'MOVE_AFTER') then + EMT.SCRAPFIRST = false + local dTime = SCRAP_REMOVE_T + EMT.TOTEXTTIME = EMT.TOTEXTTIME + dTime + EmtTleAddMachining( 'Scrap remove', EmtSecToHMS( dTime), ' - ', ' - ') + end + end + -- reset contatori di lavorazione + EMT.MCHCUTLEN = 0 + EMT.MCHCUTTIME = 0 + EMT.MCHEXTLEN = 0 + EMT.MCHEXTTIME = 0 +end + +--------------------------------------------------------------------- +function OnEstimMachiningEnd() + -- nel caso di foratura devo dimezzare la lunghezza di taglio perchè comprende anche l'uscita + if EMT.MCHTYPE == MCH_MY.DRILLING then + EMT.MCHCUTLEN = EMT.MCHCUTLEN / 2 + end + local sName = EgtGetName( EMT.MCHID) + 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 + -- emetto dati in sospeso + if EMT.TLE_NAME then + EmtTleAddMachining( EMT.TLE_NAME, EmtSecToHMS( EMT.TLE_TIME), ' - ', ' - ') + EMT.TLE_NAME = nil + EMT.TLE_TIME = nil + end +end + +--------------------------------------------------------------------- +function OnEstimPathStart() + EMT.AUXTYPE = nil + EMT.MCHMOVEFIRST = true +end + +--------------------------------------------------------------------- +function OnEstimPathEnd() + EMT.AUXTYPE = nil +end + +--------------------------------------------------------------------- +function OnEstimPathStartAux() +end + +--------------------------------------------------------------------- +function OnEstimPathEndAux() +end + +--------------------------------------------------------------------- +function OnEstimRapid() + -- dati movimento + local dL1 = EMT.L1 - ( EMT.L1p or 0) + local dL2 = EMT.L2 - ( EMT.L2p or 0) + local dL3 = EMT.L3 - ( EMT.L3p or 0) + 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 + ---- se primo posizionamento della lavorazione il movimento di L1 è già conteggiato in quello dei carrelli + --if EMT.MCHMOVEFIRST then + -- EMT.MCHMOVEFIRST = false + -- dL1 = 0 + --end + -- calcolo lunghezza + local dLen = sqrt( dL1 * dL1 + dL2 * dL2 + dL3 * dL3) + EMT.MCHEXTLEN = EMT.MCHEXTLEN + dLen + -- 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 + EgtOutLog( string.format( ' G0 Len=%.0f Rot=%.0f° Time=%.2f', dLen, abs( dR1) + abs( dR2), dTime), 5) + -- 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 + +--------------------------------------------------------------------- +-- *** 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 + +--------------------------------------------------------------------- +-- *** END GENERAL *** +--------------------------------------------------------------------- diff --git a/Essetre-WALL.mlse b/Essetre-WALL.mlse new file mode 100644 index 0000000..b5f88db --- /dev/null +++ b/Essetre-WALL.mlse @@ -0,0 +1,63 @@ +-- Special Operations macchina Essetre-WALL by EgalTech s.r.l. 2020/11/16 + +-- Intestazioni +require( 'EmtGenerator') +EgtEnableDebug( false) + +EgtOutLog ( '** Essetre-WALL.mlse '..PP_VER..' **', 1) + +--------------------------------------------------------------------- +function OnSpecialMoveZup() + + -- Inizializzazioni + EMC.MODIF = false + EMC.ERR = 1 + + -- Se fresa + if EMC.HEAD == 'H1' then + if EMC.L3 > -300 then + EMC.R1 = EgtGetAxisHomePos( 'C1') + EMC.R2 = EgtGetAxisHomePos( 'B1') + EMC.TDIR = EgtGetCalcToolDirFromAngles( EMC.R1, EMC.R2) + EMC.MODIF = true + end + -- se altrimenti sega a catena + elseif EMC.HEAD == 'H3' then + -- disabilito + do EMC.ERR = 0 return end + local L3New = EMC.L3 + local R1New = EMC.R1 + local R2New = EMC.R2 + if EMC.L3 > -300 then + L3New = min( EMC.L3, -250) + R1New = EgtGetAxisHomePos( 'C1') + R2New = EgtGetAxisHomePos( 'B1') + EMC.MODIF = true + end + if EMC.L2 > -1200 then + R1New = 180 + EMC.MODIF = true + elseif EMC.L2 < -4700 then + R1New = 0 + EMC.MODIF = true + end + if EMC.MODIF then + EMC.L3 = L3New + EMC.R1 = R1New + EMC.R2 = R2New + EMC.TDIR = EgtGetCalcToolDirFromAngles( EMC.R1, EMC.R2, EMC.R3) + end + -- se altrimenti lama + elseif EMC.HEAD == 'H2' then + if EMC.L3 > -200 then + EMC.R1 = EgtGetAxisHomePos( 'C2') + EMC.R2 = EgtGetAxisHomePos( 'B2') + EMC.TDIR = EgtGetCalcToolDirFromAngles( EMC.R1, EMC.R2) + EMC.MODIF = true + end + -- altrimenti errore + else + error( "Unknown Head") + end + EMC.ERR = 0 +end diff --git a/README.md b/README.md deleted file mode 100644 index 5379b30..0000000 --- a/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# Essetre-90580011 - - - -## 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/essetre/essetre-90580011.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](https://gitlab.steamware.net/egalware-machines/essetre/essetre-90580011/-/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. diff --git a/Scripts/ExitMach.lua b/Scripts/ExitMach.lua new file mode 100644 index 0000000..18f86ad --- /dev/null +++ b/Scripts/ExitMach.lua @@ -0,0 +1,36 @@ +-- 2018/11/21 17:30:00 +-- Machining Exit for Essetre-FAST machine + +-- Intestazioni +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( false) + +-------------------------------------------------------------------------------- +-- *** Uscita da Lavorazioni *** + +-- Nascondo il pezzo così marcato e le geometrie aggiunte, visualizzo il Box +local function ProcessPart( PartId) + -- visualizzo il Box + EgtSetStatus( EgtGetFirstNameInGroup( PartId, 'Box') or GDB_ID.NULL, GDB_ST.ON) +end + +-- Disabilito segnalazione modifica progetto +local bEnMod = EgtGetEnableModified() +EgtDisableModified() + +-- Processo i pezzi nella radice (già chiusi tutti i gruppi di lavoro) +local PartId = EgtGetFirstPart() +while PartId do + ProcessPart( PartId) + PartId = EgtGetNextPart( PartId) +end + +EgtZoom( SCE_ZM.ALL, false) + +-- Ripristino segnalazione modifica progetto +if bEnMod then + EgtEnableModified() +end + +MACH.ERR = 0 diff --git a/Scripts/InitMach.lua b/Scripts/InitMach.lua new file mode 100644 index 0000000..6ac761b --- /dev/null +++ b/Scripts/InitMach.lua @@ -0,0 +1,44 @@ +-- 2018/11/21 16:30:00 +-- Machining Init for Essetre-FAST machine + +-- Intestazioni +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( false) + +-------------------------------------------------------------------------------- +-- *** Ingresso in Lavorazioni *** + +-- Rendo visibile il pezzo e le geometrie aggiunte, nascondo il Box +local function ProcessPart( PartId) + -- nascondo il Box + EgtSetStatus( EgtGetFirstNameInGroup( PartId, 'Box') or GDB_ID.NULL, GDB_ST.OFF) +end + +-- Disabilito segnalazione modifica progetto +local bEnMod = EgtGetEnableModified() +EgtDisableModified() + +-- Processo i pezzi nella radice +local PartId = EgtGetFirstPart() +while PartId do + ProcessPart( PartId) + PartId = EgtGetNextPart( PartId) +end + +-- Processo i pezzi già nei gruppi di lavoro (quando appena lanciata Process) +local GhostId = EgtGetFirstGhostPart() +while GhostId do + local PartId = EgtGetInfo( GhostId, GDB_SI.SOURCE, 'i') + if PartId then + ProcessPart( PartId) + end + GhostId = EgtGetNextGhostPart( GhostId) +end + +-- Ripristino segnalazione modifica progetto +if bEnMod then + EgtEnableModified() +end + +MACH.ERR = 0 diff --git a/Scripts/SetUp.lua b/Scripts/SetUp.lua new file mode 100644 index 0000000..f04718b --- /dev/null +++ b/Scripts/SetUp.lua @@ -0,0 +1,219 @@ +-- 2020/11/13 +-- Gestione attrezzaggio per Essetre-FAST + +-- 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 = "H1", Group = "G1"}, + {Pos = "Pos2", TcPos = "T2", Head = "H1", Group = "G1"}, + {Pos = "Pos3", TcPos = "T3", Head = "H1", Group = "G1"}, + {Pos = "Pos4", TcPos = "T4", Head = "H1", Group = "G1"}, + {Pos = "Pos5", TcPos = "T5", Head = "H1", Group = "G1"}, + {Pos = "Pos6", TcPos = "T6", Head = "H1", Group = "G1"}, + {Pos = "Pos7", TcPos = "T7", Head = "H1", Group = "G1"}, + {Pos = "Pos8", TcPos = "T8", Head = "H1", Group = "G1"}, + {Pos = "Pos9", TcPos = "T9", Head = "H1", Group = "G1"}, + {Pos = "Pos10", TcPos = "T10", Head = "H1", Group = "G1"}, + {Pos = "Pos11", TcPos = "T11", Head = "H1", Group = "G1"}, + {Pos = "Pos12", TcPos = "T12", Head = "H1", Group = "G1"}, + {Pos = "Pos13", TcPos = "T13", Head = "H1", Group = "G1"}, + {Pos = "Pos14", TcPos = "T14", Head = "H1", Group = "G1"}, + {Pos = "Pos15", TcPos = "T15", Head = "H1", Group = "G1"}, + {Pos = "Pos16", TcPos = "T16", Head = "H1", Group = "G1"}, + {Pos = "Pos17", TcPos = "T17", Head = "H1", Group = "G1"}, + {Pos = "Pos18", TcPos = "T18", Head = "H1", Group = "G1"}, + {Pos = "Pos19", TcPos = "T19", Head = "H1", Group = "G1"}, + {Pos = "Pos20", TcPos = "T20", Head = "H1", Group = "G1"}, + {Pos = "Pos21", TcPos = "T21", Head = "H1", Group = "G1"}, + {Pos = "Pos22", TcPos = "T22", Head = "H1", Group = "G1"}, + {Pos = "Pos23", TcPos = "T23", Head = "H1", Group = "G1"}, + {Pos = "Pos24", TcPos = "T24", Head = "H1", Group = "G1"}, + {Pos = "Pos25", TcPos = "T25", Head = "H1", Group = "G1"}, + {Pos = "Pos26", TcPos = "T26", Head = "H1", Group = "G1"}, + {Pos = "Pos27", TcPos = "T27", Head = "H1", Group = "G1"}, + {Pos = "Pos28", TcPos = "T28", Head = "H1", Group = "G1"}, + {Pos = "Pos29", TcPos = "T29", Head = "H1", Group = "G1"}, + {Pos = "Pos30", TcPos = "T30", Head = "H1", Group = "G1"}, + {Pos = "Pos31", TcPos = "T101", Head = "H3", Group = "G1"}} + +local UsePositionHead = true + +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 == nill 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 diff --git a/THolders/ChainSaw.nge b/THolders/ChainSaw.nge new file mode 100644 index 0000000..d29af27 Binary files /dev/null and b/THolders/ChainSaw.nge differ diff --git a/THolders/MillNoTip.nge b/THolders/MillNoTip.nge new file mode 100644 index 0000000..414ea8e Binary files /dev/null and b/THolders/MillNoTip.nge differ diff --git a/THolders/Saw.nge b/THolders/Saw.nge new file mode 100644 index 0000000..05161e2 Binary files /dev/null and b/THolders/Saw.nge differ diff --git a/THolders/SawOnH2.nge b/THolders/SawOnH2.nge new file mode 100644 index 0000000..6b1bf63 Binary files /dev/null and b/THolders/SawOnH2.nge differ diff --git a/THolders/Standard.nge b/THolders/Standard.nge new file mode 100644 index 0000000..23ee6c6 Binary files /dev/null and b/THolders/Standard.nge differ diff --git a/THolders/Standard_78.nge b/THolders/Standard_78.nge new file mode 100644 index 0000000..bb1e695 Binary files /dev/null and b/THolders/Standard_78.nge differ diff --git a/THolders/Standard_LC.nge b/THolders/Standard_LC.nge new file mode 100644 index 0000000..7d2b4c3 Binary files /dev/null and b/THolders/Standard_LC.nge differ diff --git a/Wall/MachiningTypes.ini b/Wall/MachiningTypes.ini new file mode 100644 index 0000000..84a9b4c --- /dev/null +++ b/Wall/MachiningTypes.ini @@ -0,0 +1,25 @@ +[Cut] +1=Standard + +[Drill] +1=Drill +2=Pocket + +[Milling] +1=FreeContour +2=Side +3=SideGroove +4=DtMortise +5=Mark +6=Text +7=CleanCorner60 +8=CleanCorner30 +9=SideMill + +[Pocketing] +1=Pocket +2=OpenPocket +3=Mortise + +[Sawing] +1=Sawing diff --git a/Wall/NestingData.ini b/Wall/NestingData.ini new file mode 100644 index 0000000..3ef74c1 --- /dev/null +++ b/Wall/NestingData.ini @@ -0,0 +1,3 @@ +[WALL] +Kerf=10 +Offset=25 diff --git a/Wall/WallData.lua b/Wall/WallData.lua new file mode 100644 index 0000000..4ed517e --- /dev/null +++ b/Wall/WallData.lua @@ -0,0 +1,93 @@ +-- WallData.lua by Egaltech s.r.l. 2023/09/18 +-- Raccolta dati generali per Pareti + +EgtOutLog( ' 90580011-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 = 10, -- altezza minima del grezzo + MAX_LENGTH = 20000, -- lunghezza massima del grezzo + MAX_WIDTH = 3500, -- larghezza massima del grezzo + MAX_HEIGHT = 200, -- altezza massima del grezzo + STD_RAW_LENGTH = 10000, -- lunghezza standard del grezzo + STD_RAW_WIDTH = 3000, -- 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 = 0, -- affondamento extra standard per tagli di lama e fresature + CUT_EXTRA_MIN = 0, -- affondamento extra ridotto 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) + DRILL_TOL = 0.5, -- tolleranza tra diametro foro e diametro punta + DRILL_VZ_MIN = 0.5, -- componente limite in Z del versore di un foro + DRILL_VX_MAX = 0.866, -- componente limite in X del versore di un foro sulle facce laterali + DRILL_OVERLAP = 5, -- sovrapposizione tra due mezze forature + MILL_OVERLAP = 5, -- sovrapposizione tra due mezze fresature + MAX_CLEAN_CRN30 = 60, -- massimo spessore per pulitura angolo con fresa 30deg + MAX_CLEAN_CRN60 = 141, -- massimo spessore per pulitura angolo con fresa 60deg + 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) + MAXDIAM_POCK_CORNER= 70, -- diametro massimo utensile ammesso per tasche con angoli interni + RAWCOL = { 255, 160, 32, 30}, -- colore del grezzo + SIMUL_VIEW_DIR = 3, -- 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 (default), TR, BL, TL) + RAWPART_ROT = 180, -- rotazione del pannello grezzo rispetto alla descrizione BTL + CUT_WITH_OUTLINE = false, -- taglio delle feature con l'outline del pezzo + TAB_EXTRA_XP = 10500, -- extra spazio su tavola per grezzo in X più + TAB_EXTRA_XM = 0, -- extra spazio su tavola per grezzo in X meno + TAB_EXTRA_YP = 0, -- extra spazio su tavola per grezzo in Y più + TAB_EXTRA_YM = 20, -- extra spazio su tavola per grezzo in Y meno + DELTA_X = 0, -- allontanamento in X dai riferimenti + DELTA_Y = 0, -- allontanamento in Y dai riferimenti + DELTA_Z = 0, -- sollevamento dalla tavola +} + +local function GetChainSawBlockedAxis( nInd) + if nInd == 1 then + return 'A1=0' + else + return 'A1=90' + end +end +WallData.GetChainSawBlockedAxis = GetChainSawBlockedAxis + +-- Aggiornamento con dati da TechnoEssetre7 +local sTs3Data = EgtGetStringFromIni( 'Wall', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-90580011.data" +local sData = EgtGetSourceDir().."\\Ts3Data.lua" +if EgtExistsFile( sTs3Data) then + EgtCopyFile( sTs3Data, sData) + local sTs3DataOld = sTs3Data..'.old' + EgtEraseFile( sTs3DataOld) + EgtRenameFile( sTs3Data, sTs3DataOld) +end +if EgtExistsFile( sData) then + local Machine = dofile( sData) + if Machine then + if Machine.Offsets then + WallData.DELTA_X = Machine.Offsets.DELTA_Y or WallData.DELTA_X + WallData.DELTA_Y = Machine.Offsets.DELTA_X or WallData.DELTA_Y + WallData.DELTA_Z = Machine.Offsets.DELTA_Z or WallData.DELTA_Z + end + if Machine.Trave then + WallData.MIN_LENGTH = Machine.Trave.YMIN or WallData.MIN_LENGTH + WallData.MIN_WIDTH = Machine.Trave.XMIN or WallData.MIN_WIDTH + WallData.MIN_HEIGHT = Machine.Trave.ZMIN or WallData.MIN_HEIGHT + WallData.MAX_LENGTH = Machine.Trave.YMAX or WallData.MAX_LENGTH + WallData.MAX_WIDTH = Machine.Trave.XMAX or WallData.MAX_WIDTH + WallData.MAX_HEIGHT = Machine.Trave.ZMAX or WallData.MAX_HEIGHT + end + end +end + +------------------------------------------------------------------------------------------------------------- +local function GetOrigCorner( RefPos) + -- sempre origine macchina 1 + return 'TL' +end +WallData.GetOrigCorner = GetOrigCorner + +--------------------------------------------------------------------- +return WallData diff --git a/Wall/WallTableTemplate.ini b/Wall/WallTableTemplate.ini new file mode 100644 index 0000000..ccb02c1 --- /dev/null +++ b/Wall/WallTableTemplate.ini @@ -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%