From ed80dccaf09e97c23faacfd66c8d84e60b7cf818 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 22 Jan 2026 08:08:00 +0100 Subject: [PATCH] DataWall 3.1a1 : - aggiunta gestione sgrossatura superfici per Feature Variant 1 (se lav.ne abilitata da Ini macchina). --- LuaLibs/WMachiningLib.lua | 3 +- LuaLibs/WProcessVariant.lua | 82 ++++++++++++++++++++++--------------- LuaLibs/WallExec.lua | 8 +++- Version.lua | 6 +-- 4 files changed, 59 insertions(+), 40 deletions(-) diff --git a/LuaLibs/WMachiningLib.lua b/LuaLibs/WMachiningLib.lua index 43cd040..f8eadba 100644 --- a/LuaLibs/WMachiningLib.lua +++ b/LuaLibs/WMachiningLib.lua @@ -214,7 +214,8 @@ function WMachiningLib.FindSurfacing( sType) local Surfacing = Surfacings[i] if Surfacing.On and Surfacing.Type == sType and SetCurrMachiningAndTool( Surfacing.Name) then local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) - if nMchType == MCH_MY.SURFFINISHING then + if (( sType == 'Roughing' and nMchType == MCH_MY.SURFROUGHING) or + ( sType == 'Finishing' and nMchType == MCH_MY.SURFFINISHING)) then return Surfacing.Name end end diff --git a/LuaLibs/WProcessVariant.lua b/LuaLibs/WProcessVariant.lua index 2de64a0..16d38bd 100644 --- a/LuaLibs/WProcessVariant.lua +++ b/LuaLibs/WProcessVariant.lua @@ -52,6 +52,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione local function MakeCode_1( Proc, nRawId, b3Raw) + local sWarn -- recupero e verifico l'entità curva associata local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') if AuxId then @@ -63,41 +64,54 @@ local function MakeCode_1( Proc, nRawId, b3Raw) return false, sErr end local vtExtr = EgtCurveExtrusion( AuxId or GDB_ID.NULL, GDB_ID.ROOT) - -- recupero la lavorazione - local sSurfFin = WM.FindSurfacing( 'Finishing') - if not sSurfFin then - local sErr = 'Error : surface finishing not found in library' - EgtOutLog( sErr) - return false, sErr + -- cerco e applico le lavorazioni di superficie opportune + local sMachIni = EgtGetCurrMachineDir()..'\\'..EgtGetCurrMachineName()..'.ini' + local bSurfRough = ( EgtGetNumberFromIni( 'Machinings', 'SurfRoughing', 0, sMachIni) >= 1) + local SurfLav = { { Type='Roughing', Name='SurfRou_', Err=true}, { Type='Finishing', Name='SurfFin_', Err=true}} + local nStart = EgtIf( bSurfRough, 1, 2) + for i = nStart, 2 do + -- recupero la lavorazione + local sSurfLav = WM.FindSurfacing( SurfLav[i].Type) + if not sSurfLav then + if SurfLav[i].Err then + local sErr = 'Error : surface '.. SurfLav[i].Type .. ' not found in library' + EgtOutLog( sErr) + return false, sErr + else + sWarn = 'Warning : surface '.. SurfLav[i].Type .. ' not found in library' + EgtOutLog( sWarn) + end + else + -- inserisco la lavorazione di superficie + local sName = SurfLav[i].Name .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchFId = WM.AddMachining( Proc, sName, sSurfLav) + if not nMchFId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sSurfLav + EgtOutLog( sErr) + return false, sErr + end + EgtSetInfo( nMchFId, 'Part', Proc.PartId) + -- se lavorazione di fianco setto la nota per spostarla dopo i tagli di lama + if vtExtr:getZ() < WD.NZ_MINA then + EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ Proc.Id, -1},{AuxId, -1}}) + -- imposto posizione braccio porta testa + local nSCC = MCH_SCC.ADIR_ZP + if AreSameVectorApprox( vtExtr, Z_AX()) then + nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP) + end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- eseguo + if not EgtApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr + end + end end - -- inserisco la lavorazione di finitura superficie - local sName = 'SurfFin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchFId = WM.AddMachining( Proc, sName, sSurfFin) - if not nMchFId then - local sErr = 'Error adding machining ' .. sName .. '-' .. sSurfFin - EgtOutLog( sErr) - return false, sErr - end - EgtSetInfo( nMchFId, 'Part', Proc.PartId) - -- se lavorazione di fianco setto la nota per spostarla dopo i tagli di lama - if vtExtr:getZ() < WD.NZ_MINA then - EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) - end - -- aggiungo geometria - EgtSetMachiningGeometry( {{ Proc.Id, -1},{AuxId, -1}}) - -- imposto posizione braccio porta testa - local nSCC = MCH_SCC.ADIR_ZP - if AreSameVectorApprox( vtExtr, Z_AX()) then - nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP) - end - EgtSetMachiningParam( MCH_MP.SCC, nSCC) - -- eseguo - if not EgtApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchFId, false) - return false, sErr - end - return true + return true, sWarn end --------------------------------------------------------------------- diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index b457f29..6c7866b 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -658,7 +658,9 @@ local function SortMachinings( nPhase, PrevMch, nPartId, nPriority) -- PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING, nil, nil, 'MOVE_AFTER', false) -- -- Fresature che sono rifiniture di spigoli -- PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Clean_'}, false, 'MOVE_AFTER', false, false, true) - -- Lavorazioni di superficie + -- Lavorazioni di sgrossatura superficie + PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFROUGHING, nil, nil, 'MOVE_AFTER', false, nil, nil, nil, nPriority) + -- Lavorazioni di finitura superficie PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFFINISHING, nil, nil, 'MOVE_AFTER', false, nil, nil, nil, nPriority) -- Fresature per gole PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Gorge_'}, true, 'MOVE_AFTER', false, nil, nil, nil, nPriority) @@ -686,7 +688,9 @@ local function SortMachinings( nPhase, PrevMch, nPartId, nPriority) PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.DRILLING, nil, nil, 'MOVE_AFTER', true) -- Svuotature che vanno fatte dopo i tagli con lama PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING, nil, nil, 'MOVE_AFTER', true) - -- Lavorazioni di superficie che vanno fatte dopo i tagli con lama + -- Lavorazioni di sgrossatura superficie che vanno fatte dopo i tagli con lama + PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFROUGHING, nil, nil, 'MOVE_AFTER', true) + -- Lavorazioni di finitura superficie che vanno fatte dopo i tagli con lama PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFFINISHING, nil, nil, 'MOVE_AFTER', true) end return PrevMch diff --git a/Version.lua b/Version.lua index 3b78f3d..16fb06d 100644 --- a/Version.lua +++ b/Version.lua @@ -1,6 +1,6 @@ --- Version.lua by Egalware s.r.l. 2025/07/17 +-- Version.lua by Egalware s.r.l. 2026/01/22 -- Gestione della versione di Wall NAME = 'Wall' -VERSION = '2.7k1' -MIN_EXE = '2.7f2' +VERSION = '3.1a1' +MIN_EXE = '3.1a1'