From 943ccea2a8b1eaf61aeca67ab6b40fd6a0ad7ee8 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 7 Dec 2021 11:05:58 +0100 Subject: [PATCH] DataWall : - varie modifiche per cliente belga. --- GetWallData.lua | 4 +- LuaLibs/WMachiningLib.lua | 7 +- LuaLibs/WProcessCut.lua | 4 +- LuaLibs/WProcessDrill.lua | 53 ++- LuaLibs/WProcessLapJoint.lua | 63 ++- LuaLibs/WallExec.lua | 2 + NestProcess.lua | 855 +++++++++++++++++------------------ 7 files changed, 521 insertions(+), 467 deletions(-) diff --git a/GetWallData.lua b/GetWallData.lua index 374d61b..085f352 100644 --- a/GetWallData.lua +++ b/GetWallData.lua @@ -21,7 +21,7 @@ EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') local sMachDir = EgtGetCurrMachineDir() if not EgtExistsFile( sMachDir .. '\\Wall\\WallData.lua') then GWD.ERR = 12 - GWD.MSG = 'Error not configured for walls machine : ' .. sMachine + GWD.MSG = 'Error not configured for walls machine : ' .. GWD.MACHINE WriteErrToLogFile( GWD.ERR, GWD.MSG) PostErrView( GWD.ERR, GWD.MSG) return @@ -35,7 +35,9 @@ EgtAddToPackagePath( sMachDir .. '\\Wall\\?.lua') local WD = require( 'WallData') -- Assegno valori di interesse +GWD.SIMUL_VIEW_DIR = WD.SIMUL_VIEW_DIR GWD.ORIG_CORNER = WD.ORIG_CORNER +GWD.NESTING_CORNER = WD.NESTING_CORNER -- Tutto ok GWD.ERR = 0 diff --git a/LuaLibs/WMachiningLib.lua b/LuaLibs/WMachiningLib.lua index 208dedc..159d96a 100644 --- a/LuaLibs/WMachiningLib.lua +++ b/LuaLibs/WMachiningLib.lua @@ -51,7 +51,7 @@ function WMachiningLib.FindCutting( sType, dDepth, nTool_ID) end --------------------------------------------------------------------- -function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam) +function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, dMaxMat) for i = 1, #Millings do local Milling = Millings[i] if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then @@ -65,6 +65,7 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam) ( not sTuuid or sTuuid == sMyTuuid) and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and + ( not dMaxMat or dTMaxMat < dMaxMat + GEO.EPS_SMALL) and ( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then return Milling.Name, dTMaxDepth, dTMaxMat, dTDiam end @@ -132,7 +133,7 @@ function WMachiningLib.FindDrilling( dDiam, dDepth, sHead) if nMchType == MCH_MY.DRILLING and dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - WD.DRILL_TOL - 10 * GEO.EPS_SMALL and ( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) and - ( not sHead or sHead == sMyHead) then + (( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then return Drilling.Name, Drilling.Type, dTMaxMat end end @@ -148,7 +149,7 @@ function WMachiningLib.FindDrilling( dDiam, dDepth, sHead) if nMchType == MCH_MY.POCKETING and dTDiam < dDiam - 10 * GEO.EPS_SMALL and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and - ( not sHead or sHead == sMyHead) then + ( ( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then return Drilling.Name, Drilling.Type, dTMaxDepth end end diff --git a/LuaLibs/WProcessCut.lua b/LuaLibs/WProcessCut.lua index 02cf974..cff0592 100644 --- a/LuaLibs/WProcessCut.lua +++ b/LuaLibs/WProcessCut.lua @@ -48,7 +48,7 @@ function WPC.FlipClassify( Proc) elseif vtNZ < -0.5 then nFlip0 = 0 else - nFlip0 = 25 + nFlip0 = 50 end if - vtNZ > - GEO.EPS_SMALL then @@ -56,7 +56,7 @@ function WPC.FlipClassify( Proc) elseif - vtNZ < -0.5 then nFlip1 = 0 else - nFlip1 = 25 + nFlip1 = 50 end --nFlip0 = EgtIf( vtN:getZ() < -0.5, 0, 100) diff --git a/LuaLibs/WProcessDrill.lua b/LuaLibs/WProcessDrill.lua index 8222098..3deb9bc 100644 --- a/LuaLibs/WProcessDrill.lua +++ b/LuaLibs/WProcessDrill.lua @@ -1,6 +1,7 @@ --- WProcessDrill.lua by Egaltech s.r.l. 2021/11/11 +-- WProcessDrill.lua by Egaltech s.r.l. 2021/12/04 -- Gestione calcolo forature per Pareti -- 2021/08/29 DS Se foratura di fianco setto flag per farla dopo i tagli. +-- 2021/12/04 DS Modifiche per forature speciali lungo Y. -- Tabella per definizione modulo local WPD = {} @@ -122,7 +123,8 @@ end --------------------------------------------------------------------- -- Classificazione della rotazione della feature per nesting -- return nRot0, nRot90, nRot180, nRot270 -function WPD.RotateClassify( Proc, ValidRotations) +function WPD.RotateClassify( Proc) + local nRot0 = -1 local nRot90 = -1 local nRot180 = -1 @@ -145,14 +147,14 @@ function WPD.RotateClassify( Proc, ValidRotations) -- se orientato perpendicolare ad X if AreSameOrOppositeVectorApprox( vtExtr, X_AX()) then nRot0 = 0 - nRot90 = EgtIf (ValidRotations.bRot90, 100, 0) + nRot90 = 100 nRot180 = 0 - nRot270 = EgtIf (ValidRotations.bRot90, 100, 0) + nRot270 = 100 return nRot0, nRot90, nRot180, nRot270 elseif AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then - nRot0 = EgtIf (ValidRotations.bRot0, 100, 0) + nRot0 = 100 nRot90 = 0 - nRot180 = EgtIf (ValidRotations.bRot0, 100, 0) + nRot180 = 100 nRot270 = 0 return nRot0, nRot90, nRot180, nRot270 end @@ -219,11 +221,19 @@ function WPD.Make( Proc, nRawId, b3Raw) local sDrilling, nType local sHead if dDiam < 200 then - if AreSameVectorApprox( vtExtr, Y_AX()) or - ( bOpen and abs( Proc.Flg) ~= 2 and AreSameVectorApprox( vtExtr, -Y_AX())) then - sHead = 'H5' - elseif AreSameVectorApprox( vtExtr, -Y_AX()) then - sHead = 'H6' + if WD.HOR_DRILL_Y_SPLIT and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then + local dExtrY = vtExtr:getY() + if abs( Proc.Flg) == 2 then + sHead = EgtIf( dExtrY > 0, 'H5', 'H6') + else + if Proc.Box:getMax():getY() > WD.HOR_DRILL_Y_SPLIT + 10 then + sHead = 'H5' + if vtExtr:getY() < 0 then bToInvert = true end + else + sHead = 'H6' + if vtExtr:getY() > 0 then bToInvert = true end + end + end end sDrilling, nType = WM.FindDrilling( dDiam, dLen, sHead) if not sDrilling then @@ -234,6 +244,7 @@ function WPD.Make( Proc, nRawId, b3Raw) if not sDrilling then sDrilling, nType = WM.FindDrilling( dDiam) end + if sDrilling then sHead = '' end end else sDrilling = WM.FindMilling( 'FreeContour', dLen) @@ -244,6 +255,14 @@ function WPD.Make( Proc, nRawId, b3Raw) EgtOutLog( sErr) return false, sErr end + -- controllo posizione Y inizio foro con testa H6 + if WD.HOR_DRILL_YNEG_MAXMIN and sHead == 'H6' then + if b3Raw:getMin():getY() > WD.HOR_DRILL_YNEG_MAXMIN then + local sErr = 'Error : horizontal hole with Drilling2 starting too far' + EgtOutLog( sErr) + return false, sErr + end + end -- recupero i dati dell'utensile local dMaxDepth = 20 local dDiamTh = 35 @@ -316,6 +335,18 @@ function WPD.Make( Proc, nRawId, b3Raw) end EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) end + -- per fori lungo Y con teste speciali aggiusto eventuale parte prima del foro ma nel grezzo + if sHead == 'H5' then + local dSafeStart = b3Raw:getMax():getY() - Proc.Box:getMax():getY() + 10 + if dSafeStart > 20 then + EgtSetMachiningParam( MCH_MP.STARTPOS, dSafeStart) + end + elseif sHead == 'H6' then + local dSafeStart = Proc.Box:getMin():getY() - b3Raw:getMin():getY() + 10 + if dSafeStart > 20 then + EgtSetMachiningParam( MCH_MP.STARTPOS, dSafeStart) + end + end -- imposto posizione braccio porta testa local nSCC = MCH_SCC.ADIR_ZP if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 57d5186..6320882 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1423,6 +1423,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d local bInvertMach local nModifyLeadInOut = 0 local nFace2ndFace + local dMaxDistToOut = 1800 -- dMillDiamTh/2 -- se orientato lungo la Y if abs( vtN:getX()) > 0.9 then dExtraLongExtPlus = abs( Proc.Box:getMax():getY() - b3Raw:getMax():getY()) @@ -1430,12 +1431,13 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d if dLongGorge + dMillDiamTh < b3Raw:getDimY() then nModifyLeadInOut = 1 -- se non può sbordare da nessuna parte do errore - if dExtraLongExtPlus > dMillDiamTh/2 and dExtraLongExtNeg > dMillDiamTh/2 and dElev > ( 0.5 * dMillDiam) then + if dExtraLongExtPlus > dMaxDistToOut and dExtraLongExtNeg > dMaxDistToOut and dElev > dMaxDistToOut then local sErr = 'Error : Not possible insert SideMill groove machining' EgtOutLog( sErr) return false, sErr + end -- se non sborda solo dai lati - elseif dExtraLongExtPlus > dMillDiamTh/2 and dExtraLongExtNeg > dMillDiamTh/2 then + if dElev < dExtraLongExtPlus and dElev < dExtraLongExtNeg then nModifyLeadInOut = 2 end end @@ -1485,12 +1487,13 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d if dLongGorge + dMillDiamTh < b3Raw:getDimX() then nModifyLeadInOut = 1 -- se non può sbordare da nessuna parte do errore - if dExtraLongExtPlus > dMillDiamTh/2 and dExtraLongExtNeg > dMillDiamTh/2 and dElev > ( 0.5 * dMillDiam) then + if dExtraLongExtPlus > dMaxDistToOut and dExtraLongExtNeg > dMaxDistToOut and dElev > dMaxDistToOut then local sErr = 'Error : Not possible insert SideMill groove machining' EgtOutLog( sErr) return false, sErr + end -- se non sborda solo dai lati - elseif dExtraLongExtPlus > dMillDiamTh/2 and dExtraLongExtNeg > dMillDiamTh/2 then + if dElev < dExtraLongExtPlus and dElev < dExtraLongExtNeg then nModifyLeadInOut = 2 end end @@ -1547,7 +1550,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d -- calcolo extra allungamenti local dExtraLongGorge = ( dMillDiamTh + 5) /2 -- recupero la lavorazione - local sMillingGorge = WM.FindMilling( 'FreeContour', nil, nil, nil, 30) + local sMillingGorge = WM.FindMilling( 'Gorge', nil, nil, nil, 80) if not sMillingGorge then local sErr = 'Error : FirstMill not found in library' EgtOutLog( sErr) @@ -1610,8 +1613,8 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d -- aggiungo l'offset laterale EgtSetMachiningParam( MCH_MP.OFFSR, ( dElevToPiece + (dC * (i-1)) + 1)) -- aggiungo allungamenti iniziali e finali - EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongGorge) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongGorge) + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni + dExtraLongGorge) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd + dExtraLongGorge) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -1696,8 +1699,10 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d EgtSetMachiningParam( MCH_MP.LOPERP, 0) end end - -- setto la nota per spostare la lavorazione alla fine - EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + -- se richiesto, setto la nota per spostare la lavorazione alla fine + if not WD.SIDEMILL_BEFORE then + EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + end else if nModifyLeadInOut > 0 then -- Invece del numero di passi in sgrossatura confronto il raggio fresa con l'elevazione dalla normale @@ -1716,8 +1721,10 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d -- setto allungamenti iniziali e finali EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd) - -- setto la nota per spostare la lavorazione alla fine - EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + -- se richiesto, setto la nota per spostare la lavorazione alla fine + if not WD.SIDEMILL_BEFORE then + EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + end end -- eseguo if not EgtApplyMachining( true, false) then @@ -1799,8 +1806,10 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d EgtSetMachiningParam( MCH_MP.LOPERP, 0) end end - -- setto la nota per spostare la lavorazione alla fine - EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + -- se richiesto, setto la nota per spostare la lavorazione alla fine + if not WD.SIDEMILL_BEFORE then + EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + end else if nModifyLeadInOut > 0 then -- Invece del numero di passi in sgrossatura confronto il raggio fresa con l'elevazione dalla normale @@ -1823,8 +1832,10 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d -- setto allungamenti iniziali e finali EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd) - -- setto la nota per spostare la lavorazione alla fine - EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + -- se richiesto, setto la nota per spostare la lavorazione alla fine + if not WD.SIDEMILL_BEFORE then + EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + end end -- eseguo if not EgtApplyMachining( true, false) then @@ -2026,7 +2037,13 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) -- recupero la lavorazione di taglio con lama e i suoi parametri local sCutting, dSawDiam, dSawThick, dSawMaxDepth = WM.FindCutting( 'Standard') -- se abilitata lavorazione ribasso con fresa di fianco e parametro Q03 abilitato - local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill') + local dMaxThick + if vtN[1]:getZ() < -0.5 then + dMaxThick = dDimY[2] + elseif vtN[2]:getZ() < -0.5 then + dMaxThick = dDimY[1] + end + local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill', nil, nil, nil, nil, dMaxThick) local _, nUseMillOnSide = EvaluateQParam( Proc) local dMaxZVers, dMinZVers, bEnableMillOnSide if sMillOnSide and nUseMillOnSide >= 1 then @@ -2056,6 +2073,7 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) if bEnableMillOnSide and dMaxDepthOnSide > 0 then dMaxDist = dMaxDepthOnSide end + dMaxDist = 1000 -- se vicino al bordo del grezzo e non troppo larga, provo con fresatura di fianco local ptMid = ( ptP1 + ptP2) / 2 local bMakeFirstGroove @@ -2239,7 +2257,7 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw) -- se di fianco if not bPckt and Proc.Fct >= 3 and vtN:getZ() < WD.NZ_MINA then -- se abilitata lavorazione ribasso con fresa di fianco e parametro Q03 abilitato - local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill') + local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill', nil, nil, nil, nil, min( dH, dV)) local _, nUseMillOnSide = EvaluateQParam( Proc) -- se ho abilitata lavorazione di fresa di fianco if Proc.Fct == 3 and sMillOnSide and nUseMillOnSide >= 1 then @@ -2294,8 +2312,15 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw) end end local nFacet = EgtIf( bPckt or vtN:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2) - -- eseguo la svuotatura - return MakeByPocketing( Proc, nFacet, nRawId, b3Raw, true) + if nFacet then + -- eseguo la svuotatura + return MakeByPocketing( Proc, nFacet, nRawId, b3Raw, true) + else + local sErr = 'Side milling not possible' + EgtOutLog( sErr) + return true, sErr + + end -- fessura verticale elseif Proc.Stype == 3 then -- riordino le facce come contorno libero da lavorare a destra (sono una U) diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index ff4eb3b..e9ecfdb 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -414,6 +414,8 @@ local function SortMachinings( nPhase, PrevMch, nPartId) PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING, nil, nil, 'MOVE_AFTER', false) -- Lavorazioni di superficie PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFFINISHING, nil, nil, 'MOVE_AFTER', false) + -- Fresature per gole + PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, 'FirstMill_', true, 'MOVE_AFTER', false) -- Fresature che sono rifiniture di spigoli PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, 'Clean_', false, 'MOVE_AFTER', false) -- Fresature che sono puliture di spigoli diff --git a/NestProcess.lua b/NestProcess.lua index 4dbc61c..c0cab1e 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -11,6 +11,7 @@ EgtEnableDebug( false) --NEST.FILE = 'c:\\TechnoEssetre7\\EgtData\\Prods\\0010\\Bar_10_1.btl' --NEST.MACHINE = 'Essetre-90480019_MW' --NEST.FLAG = 3 +--NEST.DRILL_MACH_AREA = 1 local sLog = 'NestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN["1"] .. ', ' .. WIDTH["1"] EgtOutLog( sLog) @@ -46,23 +47,8 @@ _G.package.loaded.WProcessLapJoint = nil local LapJoint = require( 'WProcessLapJoint') _G.package.loaded.WProcessDrill = nil local Drill = require( 'WProcessDrill') -_G.package.loaded.WProcessCut = nil -local Cut = require( 'WProcessCut') _G.package.loaded.WProcessDoubleCut = nil local DoubleCut = require( 'WProcessDoubleCut') -_G.package.loaded.WProcessSawCut = nil -local SawCut = require( 'WProcessSawCut') -_G.package.loaded.WProcessFreeContour = nil -local FreeContour = require( 'WProcessFreeContour') -_G.package.loaded.WProcessMortise = nil -local Mortise = require( 'WProcessMortise') -_G.package.loaded.WProcessDtMortise = nil -local DtMortise = require( 'WProcessDtMortise') -_G.package.loaded.WProcessMark = nil -local Mark = require( 'WProcessMark') -_G.package.loaded.WProcessText = nil -local Text = require( 'WProcessText') - -- Carico i dati globali local WD = require( 'WallData') @@ -134,15 +120,23 @@ local function NewMachGroupName() return nMaxMachGroup + 1 end +-- Funzione che crea il rettangolo della lavorazione +local function CreateToolRectangle( ptP1, ptP2, vtFace, nOutlineGrp) + local dExtra = 1000 * GEO.EPS_SMALL + local vtX = ptP2 - ptP1 + vtX:normalize() + -- creo il rettangolo della lavorazione + ptP1 = ptP1 - vtX * 9000 + ptP2 = ptP2 + vtX * ( WD.SIDEMILL_DIAM_DOWN / 2 + dExtra) + ptP2 = ptP2 + vtFace * ( WD.SIDEMILL_DIAM_DOWN + dExtra) + local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0)) + EgtSetColor( nId, EgtStdColor("RED")) + return nId +end -- Funzione che crea le regioni occupate dalle lavorazioni -local function CreateToolOutlines( nPartId, b3Raw) - - -- da inserire in WallData - local MILL_DIAM = 350 - local MILL_MAX_MAT = 115 - ------------------------------------- - +local function ComputeToolOutlines( nPartId) + local ToolOutlineId = {} -- recupero il gruppo con gli outlines degli utensili @@ -153,71 +147,97 @@ local function CreateToolOutlines( nPartId, b3Raw) EgtSetStatus( nOutlineGrp, GDB_ST.OFF) end - -- recupero i lap joint che sono fatti dal basso local vPartProc = WE.CollectFeatures( nPartId, b3Raw) for nInd = 1, #vPartProc do Proc = vPartProc[nInd] + + -- lap joint if LapJoint.Identify( vPartProc[nInd]) then if Proc.Fct == 2 then local vtN = {} vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) + + -- se rivolto verso il basso if ( vtN[1]:getZ() <= - 0.95 or vtN[2]:getZ() <= - 0.95) then local vtFace = EgtIf( vtN[1]:getZ() <= -0.95, vtN[2], vtN[1]) local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) + -- creo il rettangolo della lavorazione + local nId = CreateToolRectangle( ptP1, ptP2, vtFace, nOutlineGrp) + if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end + + -- se rivolto verso l'alto + elseif ( vtN[1]:getZ() >= 0.95 or vtN[2]:getZ() >= 0.95 and WD.SIDEMILL_DIAM_UP > 0) then + local vtFace = EgtIf( vtN[1]:getZ() >= 0.95, vtN[2], vtN[1]) + local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) + local b3Face = EgtSurfTmGetFacetBBoxGlob( Proc.Id, EgtIf( vtN[1]:getZ() >= 0.95, 0, 1), GDB_BB.STANDARD) + local dDim = 0 + if AreSameOrOppositeVectorApprox( vtFace, X_AX()) then + dDim = b3Face:getDimX() + elseif AreSameOrOppositeVectorApprox( vtFace, Y_AX()) then + dDim = b3Face:getDimY() + end + + -- creo il rettangolo della lavorazione + local dExtra = 1000 * GEO.EPS_SMALL local vtX = ptP2 - ptP1 vtX:normalize() -- creo il rettangolo della lavorazione - ptP1 = ptP1 - vtX * 9000 - ptP2 = ptP2 + vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL) - ptP2 = ptP2 + vtFace * ( MILL_DIAM + 100 * GEO.EPS_SMALL) - local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0)) - if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end - end + ptP1 = ptP1 - vtX * ( WD.SIDEMILL_DIAM_UP / 2 + dExtra) + ptP2 = ptP2 + vtX * ( WD.SIDEMILL_DIAM_UP / 2 + dExtra) + local dVal = max( dDim + WD.SIDEMILL_DIAM_UP / 2, WD.SIDEMILL_DIAM_UP) + ptP2 = ptP2 + vtFace * ( dVal + dExtra) + local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0)) + EgtSetColor( nId, EgtStdColor("RED")) + local nPrId = EgtGetInfo( Proc.Id, "PRID", 'i') + EgtSetInfo( nId, "PRID", nPrId) + if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end + end end - - if Proc.Fct >= 3 then - LapJoint.Classify( Proc, b3Raw) - if Proc.Stype == 1 or Proc.Stype == 2 then - -- cerco la faccia con il maggior numero di adiacenze - local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) - -- se necessario scambio le facce - if Proc.Stype == 2 then - nFacInd, dElev, nFacInd2, dElev2 = nFacInd2, dElev2, nFacInd, dElev + + -- lap joint 3 facce nel mezzo di una faccia + if Proc.Fct == 3 then + local nFacInd, dElev = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) + if nFacInd ~= -2 then + local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) + if not AreSameOrOppositeVectorApprox( vtN, Z_AX()) then + local nOtherFace = EgtIf( nFacInd == 0, 1, 0) + local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nOtherFace, GDB_ID.ROOT) + if abs( ptP1:getZ() - ptP2:getZ()) < GEO.EPS_SMALL then + local nId = CreateToolRectangle( ptP1, ptP2, vtN, nOutlineGrp) + if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end + end end - local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) - local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) - -- se di fianco e lavorabile con fresa - if vtN:getZ() < WD.NZ_MINA and dElev < MILL_DIAM / 2 - 30 and MILL_MAX_MAT >= min( dH, dV) + 20 * GEO.EPS_SMALL then - local nOtherFace - for nInd = 0, Proc.Fct - 1 do - local vt = EgtSurfTmFacetNormVersor( Proc.Id, nInd, GDB_ID.ROOT) - if abs( vt:getZ()) > 0.8 then nOtherFace = nInd end - end - local bAdj, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nOtherFace or GDB_ID.NULL, GDB_ID.ROOT) - if bAdj then - local vtX = ptP2 - ptP1 - vtX:normalize() - -- creo il rettangolo della lavorazione - ptP1 = ptP1 - vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL) - ptP2 = ptP2 + vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL) - ptP2 = ptP2 + vtN * 9000 - local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0)) - if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end - end - end - end - - end + end + end end - end + + -- fori + if NEST.DRILL_MACH_AREA and Drill.Identify( Proc) then + -- recupero dati del foro + local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 + if AuxId then AuxId = AuxId + Proc.Id end + local dLen = abs( EgtCurveThickness( AuxId)) + local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) + local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0) + -- verifico se la lunghezza del foro è maggiore della lunghezza della punta + if bOpen and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) and dLen > WD.HOR_DRILL_LEN - 10 then + local ptP1 = Proc.Box:getMin() + local ptP2 = Proc.Box:getMax() + ptP1 = ptP1 - 2000 * Y_AX() + ptP2 = ptP2 + 2000 * Y_AX() + local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0)) + EgtSetColor( nId, EgtStdColor("RED")) + if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end + end + end + + end return ToolOutlineId end - - -- Funzione che sposta e aggiunge pezzi per nesting local function AddRawParts(RawParts) -- creo tabella dei grezzi @@ -242,7 +262,7 @@ local function AddRawParts(RawParts) EgtSetName(SheetPartId, "Sheet") local SheetLayerId = EgtGroup(SheetPartId) EgtSetName(SheetLayerId, OUTLINE) - local SheetOutlineId = EgtRectangle2P(SheetLayerId, Point3d(0,0,0), Point3d(RawParts[nIndex].Len, RawParts[nIndex].Width, 0), GDB_RT.GLOB) + local SheetOutlineId = EgtRectangle2P(SheetLayerId, Point3d(0,0,0), Point3d(RawParts[nIndex].Len + 0.1, RawParts[nIndex].Width + 0.1, 0), GDB_RT.GLOB) -- EgtModifyCurveThickness(SheetOutlineId, -Material.T_mm) EgtSetName(SheetOutlineId, OUTLINE) @@ -258,225 +278,46 @@ local function AddParts(RawParts) -- ciclo su pezzi per aggiungerli al nesting for nPartId, nCount in pairs( PART) do nPartIndex = nPartIndex + 1 + -- calcolo bbox pezzo per rotazioni - local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD) - local b3Raw = b3Part - local vPartProc = WE.CollectFeatures( nPartId, b3Raw) - -- verifico se possibile flip parete - -- recupero stati di flip delle feature di lavorazione della parete - local bFlip = false - local FlipFeatureStates = {} - for nInd = 1, #vPartProc do - if LapJoint.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = LapJoint.FlipClassify(vPartProc[nInd]) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - elseif Drill.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = Drill.FlipClassify(vPartProc[nInd], b3Part) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - elseif Cut.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = Cut.FlipClassify(vPartProc[nInd], b3Part) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - elseif DoubleCut.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = DoubleCut.FlipClassify(vPartProc[nInd], b3Part) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - elseif SawCut.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = SawCut.FlipClassify(vPartProc[nInd], b3Part) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - elseif FreeContour.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = FreeContour.FlipClassify(vPartProc[nInd], b3Part) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - elseif Mortise.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = Mortise.FlipClassify(vPartProc[nInd], b3Part) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - elseif DtMortise.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = DtMortise.FlipClassify(vPartProc[nInd], b3Part) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - elseif Mark.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = Mark.FlipClassify(vPartProc[nInd], b3Part) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - elseif Text.Identify( vPartProc[nInd]) then - local nFlip0, nFlip1 = Text.FlipClassify(vPartProc[nInd], b3Part) - if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then - table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1}) - end - end - end - -- analizzo stati flip delle feature - local nFlip0Min = 100 - local nFlip0Cnt = 0 - local nFlip1Min = 100 - local nFlip1Cnt = 0 - -- calcolo punteggio minimo e sua molteplicita' per entrambi i lati - for nInd = 1, #FlipFeatureStates do - if FlipFeatureStates[nInd].Flip0 < nFlip0Min then - nFlip0Min = FlipFeatureStates[nInd].Flip0 - nFlip0Cnt = 1 - elseif FlipFeatureStates[nInd].Flip0 == nFlip0Min then - nFlip0Cnt = nFlip0Cnt + 1 - end - if FlipFeatureStates[nInd].Flip1 < nFlip1Min then - nFlip1Min = FlipFeatureStates[nInd].Flip1 - nFlip1Cnt = 1 - elseif FlipFeatureStates[nInd].Flip1 == nFlip1Min then - nFlip1Cnt = nFlip1Cnt + 1 - end - end - -- calcolo lato con punteggio minore o molteplicita' piu' alta - if nFlip0Min == nFlip1Min then - if nFlip0Cnt > nFlip1Cnt then - bFlip = true - end - elseif nFlip0Min < nFlip1Min then - bFlip = true - end - -- eseguo flip se necessario - if bFlip then - EgtRotate( nPartId, b3Part:getCenter(), X_AX(), 180, GDB_RT.GLOB) + local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD) + + -- recupero eventuali stati di flip e rotazione dalle info del pezzo + local bFlipNest = true + local bFlip = false + local bRotNest = true + local nStepRotNest = 90 + local nRotate = 0 + + -- flip + local bManualFlip = EgtGetInfo( nPartId, "MANUALFLIP", 'b') + if bManualFlip then + bFlipNest = false + elseif EgtExistsInfo( nPartId, "NestFlip") then + bFlipNest = EgtGetInfo( nPartId, "NestAllowFlip", 'b') + bFlip = EgtGetInfo( nPartId, "NestFlip", 'b') end - -- verifico quali sono le rotazioni ammesse - local ValidRotations = { bRot0 = true, bRot90 = true} - local dPartL = b3Part:getDimX() - local dPartW = b3Part:getDimY() - - local nOut0 = 0 -- grezzi che non conterrebbero il pezzo ruotato di 0°/180° - local nOut90 = 0 -- grezzi che non conterrebbero il pezzo ruotato di 90°/270° - for nInd = 1, #RawParts do - if ( dPartL > RawParts[nInd]["Len"] or dPartW > RawParts[nInd]["Width"]) then nOut0 = nOut0 + 1 end - if ( dPartW > RawParts[nInd]["Len"] or dPartL > RawParts[nInd]["Width"]) then nOut90 = nOut90 + 1 end - end - - -- se il pezzo ruotato è fuori da tutti i grezzi, blocco quelle rotazioni - if nOut0 == #RawParts then ValidRotations.bRot0 = false end - if nOut90 == #RawParts then ValidRotations.bRot90 = false end - - - local nRotate = 0 - local RotateFeatureStates = {} - for nInd = 1, #vPartProc do - if Drill.Identify( vPartProc[nInd]) then - local nRot0, nRot90, nRot180, nRot270 = Drill.RotateClassify(vPartProc[nInd], ValidRotations) - if nRot0 and nRot0 >= 0 then - table.insert( RotateFeatureStates, { Rot0 = nRot0, Rot90 = nRot90, Rot180 = nRot180, Rot270 = nRot270}) - end - end - end - -- analizzo stati rotazione delle feature - local nRot0Min = 100 - local nRot0Cnt = 0 - local nRot90Min = 100 - local nRot90Cnt = 0 - local nRot180Min = 100 - local nRot180Cnt = 0 - local nRot270Min = 100 - local nRot270Cnt = 0 - -- calcolo punteggio minimo e sua molteplicita' per tutte le rotazioni - for nInd = 1, #RotateFeatureStates do - if RotateFeatureStates[nInd].Rot0 < nRot0Min then - nRot0Min = RotateFeatureStates[nInd].Rot0 - nRot0Cnt = 1 - elseif RotateFeatureStates[nInd].Rot0 == nRot0Min then - nRot0Cnt = nRot0Cnt + 1 - end - if RotateFeatureStates[nInd].Rot90 < nRot90Min then - nRot90Min = RotateFeatureStates[nInd].Rot90 - nRot90Cnt = 1 - elseif RotateFeatureStates[nInd].Rot90 == nRot90Min then - nRot90Cnt = nRot90Cnt + 1 - end - if RotateFeatureStates[nInd].Rot180 < nRot180Min then - nRot180Min = RotateFeatureStates[nInd].Rot180 - nRot180Cnt = 1 - elseif RotateFeatureStates[nInd].Rot180 == nRot180Min then - nRot180Cnt = nRot180Cnt + 1 - end - if RotateFeatureStates[nInd].Rot270 < nRot270Min then - nRot270Min = RotateFeatureStates[nInd].Rot270 - nRot270Cnt = 1 - elseif RotateFeatureStates[nInd].Rot270 == nRot270Min then - nRot270Cnt = nRot270Cnt + 1 - end - end - - -- se c'e' qualche stato di rotazione - local MinList = { { Rot = 0, Score = nRot0Min, ScoreCnt = nRot0Cnt}, - { Rot = 90, Score = nRot90Min, ScoreCnt = nRot90Cnt}, - { Rot = 180, Score = nRot180Min, ScoreCnt = nRot180Cnt}, - { Rot = 270, Score = nRot270Min, ScoreCnt = nRot270Cnt}} - if #RotateFeatureStates > 0 then - -- calcolo lato con punteggio minore o molteplicita' piu' alta - local nRotMax = 0 - local nScoreMax = 0 - local nScoreCnt = 0 - for nInd = 1, #MinList do - if MinList[nInd].Score > nScoreMax then - nRotMax = MinList[nInd].Rot - nScoreMax = MinList[nInd].Score - nScoreCnt = MinList[nInd].ScoreCnt - elseif MinList[nInd].Score == nScoreMax then - if MinList[nInd].ScoreCnt < nScoreCnt then - nRotMax = MinList[nInd].Rot - nScoreMax = MinList[nInd].Score - nScoreCnt = MinList[nInd].ScoreCnt - end - end - end - nRotate = nRotMax - else - nRotate = 0 - end - -- eseguo rotazione se necessario - if nRotate > 0 then - EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), nRotate, GDB_RT.GLOB) - end --- -- calcolo rotazioni permesse a nesting --- local AdmittedRotation = {} --- for nInd = 1, #MinList do --- if MinList[nInd].Score >= 50 then --- table.insert( AdmittedRotation, MinList[nInd].Rot) --- end --- end - local bRotNest = false - local nStepRotNest = 0 - -- se calcolate limitazioni su rotazioni - if MinList and #MinList > 0 then - -- verifico condizioni da permettere al nesting - if MinList[1].Score >= 50 and MinList[2].Score >= 50 and MinList[3].Score >= 50 and MinList[4].Score >= 50 then - bRotNest = true - nStepRotNest = 90 - elseif (nRotate == 0 and MinList[3].Score >= 50) or ( nRotate == 90 and MinList[4].Score >= 50) then - bRotNest = true - nStepRotNest = 180 - end - else - -- altrimenti permetto tutto - bRotNest = true - nStepRotNest = 90 - end - - -- aggiungo stato a lista stati del pezzo per ripristinare alla fine - table.insert( PartStates, { PartId = tonumber(nPartId), Flip = bFlip, Rotate = nRotate}) + -- rotation + local bManualRot = EgtGetInfo( nPartId, "MANUALROT", 'b') + if bManualRot then + bRotNest = false + elseif EgtExistsInfo( nPartId, "NestRot") then + nStepRotNest = EgtGetInfo( nPartId, "NestStepRot", 'i') + nRotate = EgtGetInfo( nPartId, "NestRot", 'i') + bRotNest = EgtGetInfo( nPartId, "NestAllowRot", 'b') + -- verifico se rotazione è valida + local bValidRotation = b3Part:getDimX() < RawParts[1].Len and b3Part:getDimY() < RawParts[1].Width + if not bValidRotation then + bRotNest = true + nStepRotNest = 90 + end + end + + -- aggiungo stato a lista stati del pezzo + -- table.insert( PartStates, { PartId = tonumber(nPartId), Flip = bFlip, Rotate = nRotate}) - -- local bFtDown = false -- local vPartProc = WE.CollectFeatures( nPartId, b3Raw) -- for nInd = 1, #vPartProc do @@ -521,108 +362,136 @@ local function AddParts(RawParts) -- EgtRotate( nPartId, ptRotCen, X_AX(), 180, GDB_RT.GLOB) -- end - -- recupero contorno + -- recupero vecchio contorno se già presente local nOutlineLayer = EgtGetFirstNameInGroup(nPartId, "Outline") - -- elimino vecchio contorno se gia' presente local nOldOutline = EgtGetFirstNameInGroup(nOutlineLayer, 'ON_TMP') - EgtErase(nOldOutline or GDB_ID.NULL) + local nOutline, nCnt - -- Recupero o ricalcolo il solido - local SolidId = EgtBeamGetSolid( nPartId) - if not SolidId or not EgtGetInfo( SolidId, 'VALID') then - EgtBeamCalcSolid( nPartId, true) - SolidId = EgtBeamGetSolid( nPartId) - end - local nOutline, nCnt = EgtGetSurfTmSilhouette( SolidId, Z_AX(), 10, nOutlineLayer, GDB_RT.GLOB) - EgtBeamShowSolid( nPartId, false) - --EgtSaveFile("c:\\Temp\\ProvaNesting.nge") - - local nCurrOutline = nOutline - if nCnt > 0 then - local frSum - EgtScale( nOutline, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) - EgtModifyCurveExtrusion( nOutline, Z_AX(), GDB_RT.GLOB) + -- se l'outline non è stato calcolato oppure il pezzo è stato modificato, lo ricalcolo + local bPartIsModified = EgtGetInfo( nPartId, "MODIFIEDFORNEST", 'b') + if not nOldOutline or bPartIsModified then - -- verifico che la prima curva sia l'unico loop esterno - local vCrvRef = EgtCurveArea( nOutline) - for nInd = 1, nCnt - 1 do - local vCrv = EgtCurveArea( nOutline + nInd) - -- se trovo più loop esterni uso come contorno quello del box (quindi forzo nCurrOutline a nil) - if abs( vCrv * vCrvRef - 1) < GEO.EPS_SMALL then - nCurrOutline = nil - break - end + -- elimino il vecchio contorno se pesente + while ( nOldOutline) do + EgtErase(nOldOutline or GDB_ID.NULL) + nOldOutline = EgtGetFirstNameInGroup( nOutlineLayer, 'ON_TMP') end - - --local frSum = EgtSurfFlatRegion(nOutlineLayer, nOutline) - --EgtSaveFile("c:\\Temp\\ProvaNesting.nge") - -- -- per ogni contorno creo flat region e le sommo - -- for nIndex = 0, nCnt - 1 do - -- EgtScale( nOutline + nIndex, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) - -- EgtModifyCurveExtrusion( nOutline + nIndex, Z_AX(), GDB_RT.GLOB) - -- local frCurr = EgtSurfFlatRegion(nOutlineLayer, nOutline + nIndex) - -- if frCurr then - -- if frSum then - -- EgtSurfFrAdd(frSum, frCurr) - -- else - -- frSum = frCurr + + -- Recupero o ricalcolo il solido + local SolidId = EgtBeamGetSolid( nPartId) + if not SolidId or not EgtGetInfo( SolidId, 'VALID') then + EgtBeamCalcSolid( nPartId, true) + SolidId = EgtBeamGetSolid( nPartId) + end + nOutline, nCnt = EgtGetSurfTmSilhouette( SolidId, Z_AX(), 10, nOutlineLayer, GDB_RT.GLOB) + EgtBeamShowSolid( nPartId, false) + + for nInd = 0, nCnt - 1 do + EgtSetName( nOutline + nInd, 'ON_TMP') + EgtSetStatus( nOutline + nInd, 0) + end + + local nCurrOutline = nOutline + if nCnt > 0 then + local frSum + EgtScale( nOutline, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) + EgtModifyCurveExtrusion( nOutline, Z_AX(), GDB_RT.GLOB) + + -- verifico che la prima curva sia l'unico loop esterno + local vCrvRef = EgtCurveArea( nOutline) + for nInd = 1, nCnt - 1 do + local vCrv = EgtCurveArea( nOutline + nInd) + -- se trovo più loop esterni uso come contorno quello del box (quindi forzo nCurrOutline a nil) + if abs( vCrv * vCrvRef - 1) < GEO.EPS_SMALL then + nCurrOutline = nil + for nInd2 = 0, nCnt - 1 do + EgtErase( nOutline + nInd2) + end + nCnt = 1 + break + end + end + + --local frSum = EgtSurfFlatRegion(nOutlineLayer, nOutline) + --EgtSaveFile("c:\\Temp\\ProvaNesting.nge") + -- -- per ogni contorno creo flat region e le sommo + -- for nIndex = 0, nCnt - 1 do + -- EgtScale( nOutline + nIndex, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) + -- EgtModifyCurveExtrusion( nOutline + nIndex, Z_AX(), GDB_RT.GLOB) + -- local frCurr = EgtSurfFlatRegion(nOutlineLayer, nOutline + nIndex) + -- if frCurr then + -- if frSum then + -- EgtSurfFrAdd(frSum, frCurr) + -- else + -- frSum = frCurr + -- end -- end + -- EgtErase(frCurr) -- end - -- EgtErase(frCurr) - -- end - -- --EgtSaveFile("c:/Temp/ProvaNesting.nge") - -- -- calcolo contorno della flat region somma - -- nCurrOutline = EgtExtractSurfFrChunkLoops(frSum, 0, nOutlineLayer) - -- EgtErase(frSum) - -- -- cancello contorni - -- for nIndex = 0, nCnt do - -- EgtErase(nOutline + nIndex) - -- end - end - - if nCurrOutline and nCurrOutline ~= GDB_ID.NULL then - nOutline = nCurrOutline + -- --EgtSaveFile("c:/Temp/ProvaNesting.nge") + -- -- calcolo contorno della flat region somma + -- nCurrOutline = EgtExtractSurfFrChunkLoops(frSum, 0, nOutlineLayer) + -- EgtErase(frSum) + -- -- cancello contorni + -- for nIndex = 0, nCnt do + -- EgtErase(nOutline + nIndex) + -- end + end + + if nCurrOutline and nCurrOutline ~= GDB_ID.NULL then + nOutline = nCurrOutline + else + -- se non ho trovato contorno, lo recupero dal Box + local nBoxLayer = EgtGetFirstNameInGroup(nPartId, "Box") + local nBox = EgtGetFirstNameInGroup(nBoxLayer, "Box") + local BBox = EgtGetBBoxGlob(nBox, GDB_BB.STANDARD) + nOutline = EgtRectangle2P(nOutlineLayer, Point3d( BBox:getMin():getX(), BBox:getMin():getY(), 0), Point3d( BBox:getMax():getX(), BBox:getMax():getY(), 0), GDB_RT.GLOB) + EgtOutLog("Impossible creating silhouette for part " .. tostring(nPartId)) + nCnt = 1 + end + --if nCnt == 0 then + -- -- se non ho trovato contorno, lo recupero dal Box + -- local nBoxLayer = EgtGetFirstNameInGroup(nPartId, "Box") + -- local nBox = EgtGetFirstNameInGroup(nBoxLayer, "Box") + -- local BBox = EgtGetBBoxGlob(nBox, GDB_BB.STANDARD) + -- nOutline = EgtRectangle2P(nOutlineLayer, Point3d( BBox:getMin():getX(), BBox:getMin():getY(), 0), Point3d( BBox:getMax():getX(), BBox:getMax():getY(), 0), GDB_RT.GLOB) + -- EgtOutLog("Impossible creating silhouette for part " .. tostring(nPartId)) + --else + -- --EgtScale( nOutline, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) + -- --EgtModifyCurveExtrusion( nOutline, Z_AX(), GDB_RT.GLOB) + -- --EgtSaveFile("c:/Temp/ProvaNesting.nge") + -- EgtScale( nOutline, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) + -- EgtModifyCurveExtrusion( nOutline, Z_AX(), GDB_RT.GLOB) + -- local frSum = EgtSurfFlatRegion(nOutlineLayer, nOutline) + -- EgtSaveFile("c:\\Temp\\ProvaNesting.nge") + -- -- per ogni contorno creo flat region e le sommo + -- for nIndex = 1, nCnt - 1 do + -- EgtScale( nOutline + nIndex, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) + -- EgtModifyCurveExtrusion( nOutline + nIndex, Z_AX(), GDB_RT.GLOB) + -- local frCurr = EgtSurfFlatRegion(nOutlineLayer, nOutline + nIndex) + -- if frCurr then + -- EgtSurfFrAdd(frSum, frCurr) + -- end + -- end + -- -- calcolo contorno della flat region somma + -- nOutline = EgtExtractSurfFrChunkLoops(frSum, 0, nOutlineLayer) + -- -- cancello contorni successivi + -- for nIndex = 1, nCnt do + -- EgtErase(nOutline + nIndex) + -- end + --end + + EgtSetName( nOutline, 'ON_TMP') + EgtSetStatus( nOutline, 0) + else - -- se non ho trovato contorno, lo recupero dal Box - local nBoxLayer = EgtGetFirstNameInGroup(nPartId, "Box") - local nBox = EgtGetFirstNameInGroup(nBoxLayer, "Box") - local BBox = EgtGetBBoxGlob(nBox, GDB_BB.STANDARD) - nOutline = EgtRectangle2P(nOutlineLayer, Point3d( BBox:getMin():getX(), BBox:getMin():getY(), 0), Point3d( BBox:getMax():getX(), BBox:getMax():getY(), 0), GDB_RT.GLOB) - EgtOutLog("Impossible creating silhouette for part " .. tostring(nPartId)) + -- altrimenti uso l'outline già calcolato + nOutline = nOldOutline + -- recupero il valore di nCnt + local vOutlinesIds = EgtGetNameInGroup( nOutlineLayer, 'ON_TMP') + nCnt = #vOutlinesIds end - --if nCnt == 0 then - -- -- se non ho trovato contorno, lo recupero dal Box - -- local nBoxLayer = EgtGetFirstNameInGroup(nPartId, "Box") - -- local nBox = EgtGetFirstNameInGroup(nBoxLayer, "Box") - -- local BBox = EgtGetBBoxGlob(nBox, GDB_BB.STANDARD) - -- nOutline = EgtRectangle2P(nOutlineLayer, Point3d( BBox:getMin():getX(), BBox:getMin():getY(), 0), Point3d( BBox:getMax():getX(), BBox:getMax():getY(), 0), GDB_RT.GLOB) - -- EgtOutLog("Impossible creating silhouette for part " .. tostring(nPartId)) - --else - -- --EgtScale( nOutline, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) - -- --EgtModifyCurveExtrusion( nOutline, Z_AX(), GDB_RT.GLOB) - -- --EgtSaveFile("c:/Temp/ProvaNesting.nge") - -- EgtScale( nOutline, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) - -- EgtModifyCurveExtrusion( nOutline, Z_AX(), GDB_RT.GLOB) - -- local frSum = EgtSurfFlatRegion(nOutlineLayer, nOutline) - -- EgtSaveFile("c:\\Temp\\ProvaNesting.nge") - -- -- per ogni contorno creo flat region e le sommo - -- for nIndex = 1, nCnt - 1 do - -- EgtScale( nOutline + nIndex, GLOB_FRM(), 1, 1, 0, GDB_RT.GLOB) - -- EgtModifyCurveExtrusion( nOutline + nIndex, Z_AX(), GDB_RT.GLOB) - -- local frCurr = EgtSurfFlatRegion(nOutlineLayer, nOutline + nIndex) - -- if frCurr then - -- EgtSurfFrAdd(frSum, frCurr) - -- end - -- end - -- -- calcolo contorno della flat region somma - -- nOutline = EgtExtractSurfFrChunkLoops(frSum, 0, nOutlineLayer) - -- -- cancello contorni successivi - -- for nIndex = 1, nCnt do - -- EgtErase(nOutline + nIndex) - -- end - --end - EgtSetName( nOutline, 'ON_TMP') --[[ local nOutline local nTrimesh @@ -697,30 +566,42 @@ local function AddParts(RawParts) end ]]-- + + -- calcolo aree lavorazione + local nToolOutlineIds = ComputeToolOutlines( nPartId) + if bFlipNest and #nToolOutlineIds > 0 then + bFlipNest = false + end + if nOutline then -- aggiungo pezzo al nesting - EgtAutoNestAddPart( nPartId, nOutline, false, bRotNest, nStepRotNest, 0, nCount) + EgtAutoNestAddPart( nPartId, nOutline, bFlipNest, bRotNest, nStepRotNest, 0, nCount) -- EgtAutoNestAddPart( PartId, OutlineId, bCanFlip, bCanRotate, dRotStep, nPriority, nCount) end + -- aggiungo finestre + for nInd = 1, nCnt - 1 do + local tmp1, tmp2, area = EgtCurveArea( nOutline + nInd) + if area > WD.NEST_HOLE_MIN_AREA then + EgtAutoNestAddHoleToPart( nPartId, nOutline + nInd) + end + end + -- aggiungo aree di lavorazione del pezzo - local nToolOutlineIds = CreateToolOutlines( nPartId, b3Raw) + local sInfo = "" for nInd = 1, #nToolOutlineIds do - EgtAutoNestAddToolOutlineToPart( nPartId, nToolOutlineIds[nInd]) + EgtAutoNestAddToolOutlineToPart( nPartId, nToolOutlineIds[nInd]) + sInfo = sInfo .. tostring(nToolOutlineIds[nInd]) .. "," end - + -- salvo tra le info del pezzo gli id delle sue aree di lavorazione + if sInfo ~= "" then + EgtSetInfo( nPartId, "ToolOutlines", sInfo) + end -- verifico se anullato nesting if EgtProcessEvents( 100 + ( nPartIndex / nTotParts * 100), 0) == 1 then return false end - -- se necessario ripristino flip e rotazioni del pezzo - if bFlip then - EgtRotate( nPartId, b3Part:getCenter(), X_AX(), -180, GDB_RT.GLOB) - end - if nRotate and nRotate > 0 then - EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), -nRotate, GDB_RT.GLOB) - end end return true end @@ -760,13 +641,13 @@ end if bOk then -- aggiungo offset tra pezzi - EgtAutoNestSetInterpartGap(NEST.OFFSET) + EgtAutoNestSetInterpartGap( NEST.OFFSET) -- Impostazione corner di inizio del nesting (NST_CORNER.BL, TL, BR, TR) - EgtAutoNestSetStartCorner( NST_CORNER.TL) + EgtAutoNestSetStartCorner( NEST.CORNER) -- imposto tempo di nesting e lo avvio - EgtAutoNestCompute(true, NEST.TIME) + EgtAutoNestCompute( true, NEST.TIME) end -- Variabili di calcolo @@ -797,7 +678,7 @@ if bNestingOk then -- disposizione sheet e parts local SheetId = GDB_ID.NULL local vtAdd = V_NULL() - local nMachGroup = GDB_ID.NULL + local MachGroupList = {} local nPartCount = 0 local Sheet = {PartList = {}} local bFirstSheet = true @@ -806,50 +687,93 @@ if bNestingOk then if not nType then break end -- se sheet if nType > 0 then - -- creo gruppo di lavorazione - local MachGroupName = NewMachGroupName() - nMachGroup = EgtAddMachGroup(MachGroupName, sCurrMachName) - for nIndex = 1, #RawParts do - if RawParts[nIndex].PartId == nId then - EgtSetInfo(nMachGroup, "PANELLEN", RawParts[nIndex].Len) - EgtSetInfo(nMachGroup, "PANELWIDTH", RawParts[nIndex].Width) - EgtSetInfo(nMachGroup, "MATERIAL", RawParts[nIndex].Material) - EgtSetInfo(nMachGroup, "AUTONEST", 1) - -- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione - EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID) - EgtSetInfo( nMachGroup, "PATTID", nMachGroup) + MachGroupList = {} + for MGIndex = 1, nType do + -- creo gruppo di lavorazione + local MachGroupName = NewMachGroupName() + local nMachGroup = EgtAddMachGroup(MachGroupName, sCurrMachName) + table.insert( MachGroupList, { MGId = nMachGroup}) + for nIndex = 1, #RawParts do + if RawParts[nIndex].PartId == nId then + EgtSetInfo(nMachGroup, "PANELLEN", RawParts[nIndex].Len) + EgtSetInfo(nMachGroup, "PANELWIDTH", RawParts[nIndex].Width) + EgtSetInfo(nMachGroup, "MATERIAL", RawParts[nIndex].Material) + EgtSetInfo(nMachGroup, "AUTONEST", 1) + -- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione + EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID) + EgtSetInfo( nMachGroup, "PATTID", nMachGroup) + end end end nPartCount = 0 -- altrimenti pezzo else nPartCount = nPartCount + 1 - -- se c'e' un grezzo valido - if nMachGroup and nMachGroup ~= GDB_ID.NULL then - -- creo pezzo copia - local nPartDuploId = EgtDuploNew( nId) - -- applico flip e rotazioni fatte durante verifica posizionamento pezzo - local b3Part = EgtGetBBoxGlob( nPartDuploId, GDB_BB.STANDARD) - for nInd = 1, #PartStates do - if PartStates[nInd].PartId == nId then - if PartStates[nInd].Flip then - EgtRotate( nPartDuploId, b3Part:getCenter(), X_AX(), 180, GDB_RT.GLOB) + for MGIndex = 1, #MachGroupList do + local nMachGroup = MachGroupList[MGIndex].MGId + --EgtSetCurrMachGroup(nMachGroup) + -- se c'e' un grezzo valido + if nMachGroup and nMachGroup ~= GDB_ID.NULL then + -- creo pezzo copia + local nPartDuploId = EgtDuploNew( nId) + -- applico flip e rotazioni fatte durante verifica posizionamento pezzo + local b3Part = EgtGetBBoxGlob( nPartDuploId, GDB_BB.STANDARD) + local nPartInd + -- for nInd = 1, #PartStates do + -- if PartStates[nInd].PartId == nId then + -- -- if PartStates[nInd].Flip then + -- -- EgtRotate( nPartDuploId, b3Part:getCenter(), X_AX(), 180, GDB_RT.GLOB) + -- -- end + -- -- if PartStates[nInd].Rotate and PartStates[nInd].Rotate > 0 then + -- -- EgtRotate( nPartDuploId, b3Part:getCenter(), Z_AX(), PartStates[nInd].Rotate, GDB_RT.GLOB) + -- -- end + -- nPartInd = nInd + -- end + -- end + + local PartBBox = EgtGetBBoxGlob( nPartDuploId, GDB_BB.STANDARD) + + -- aggiungo le curve corrispondenti alle aree di lavorazione del pezzo + local sToolOutlines = EgtGetInfo( nId, "ToolOutlines", 's') + if sToolOutlines then + -- recupero o creo il gruppo per gli outlines + local nToolOutlinesGrp = EgtGetFirstNameInGroup( nPartDuploId, "ToolOutlines") + if not nToolOutlinesGrp then + nToolOutlinesGrp = EgtGroup( nPartDuploId) + EgtSetName( nToolOutlinesGrp, "ToolOutlines") + EgtSetStatus( nToolOutlinesGrp, GDB_ST.OFF) end - if PartStates[nInd].Rotate and PartStates[nInd].Rotate > 0 then - EgtRotate( nPartDuploId, b3Part:getCenter(), Z_AX(), PartStates[nInd].Rotate, GDB_RT.GLOB) - end - end + + for str in string.gmatch(sToolOutlines, "([^"..",".."]+)") do + EgtCopyGlob( tonumber(str), nToolOutlinesGrp) + end + end + + -- applico flip, rotazione e traslazione pezzo e box da nesting + if nFlag == 1 then + EgtRotate( nPartDuploId, ORIG(), X_AX(), 180, GDB_RT.GLOB) + PartBBox:rotate( ORIG(), X_AX(), 180) + end + EgtRotate( nPartDuploId, ORIG(), Z_AX(), dAngRot, GDB_RT.GLOB) + PartBBox:rotate( ORIG(), Z_AX(), dAngRot) + EgtMove( nPartDuploId, Vector3d( dX, dY, 0), GDB_RT.GLOB) + PartBBox:move( Vector3d( dX, dY, 0)) + local ptPos = Point3d( PartBBox:getMin():getX(), PartBBox:getMin():getY(), 0) + EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( ptPos:getX(), 3) .. "," .. EgtNumToString( ptPos:getY(), 3) .. "," .. 0 .."," .. 0) + EgtSetInfo( nPartDuploId, "POSX", ptPos:getX()) + EgtSetInfo( nPartDuploId, "POSY", ptPos:getY()) + + local nPartRot = EgtGetInfo( nId, "ROTATED", 'i') or 0 + local nTotRot = dAngRot + nPartRot + nTotRot = EgtIf( nTotRot < 360, nTotRot, nTotRot - 360) + EgtSetInfo( nPartDuploId, "ROT", nTotRot) + + local nPartFlip = EgtGetInfo( nId, "INVERTED", 'i') + nPartFlip = EgtIf( nPartFlip == 180, 1, 0) + local nTotFlip = nPartFlip ~ nFlag + EgtSetInfo( nPartDuploId, "FLIP", nTotFlip) + end - -- applico rotazione e traslazione pezzo da nesting - EgtRotate( nPartDuploId, ORIG(), Z_AX(), dAngRot, GDB_RT.GLOB) - EgtMove( nPartDuploId, Vector3d( dX, dY, 0), GDB_RT.GLOB) - local PartBBox = EgtGetBBoxGlob( nPartDuploId, GDB_BB.STANDARD) - local ptPos = Point3d( PartBBox:getMin():getX(), PartBBox:getMin():getY(), 0) - EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( ptPos:getX(), 3) .. "," .. EgtNumToString( ptPos:getY(), 3) .. "," .. 0 .. "," .. 0) - EgtSetInfo( nPartDuploId, "POSX", ptPos:getX()) - EgtSetInfo( nPartDuploId, "POSY", ptPos:getY()) - EgtSetInfo( nPartDuploId, "ROT", dAngRot) - EgtSetInfo( nPartDuploId, "FLIP", 0) end end end @@ -863,17 +787,87 @@ if bNestingOk then WALL.FLAG = 6 -- CREATE_PANEL nMachGroup = EgtGetFirstMachGroup() while nMachGroup do - EgtSetCurrMachGroup(nMachGroup) - if EgtGetInfo(nMachGroup, "AUTONEST",'i') == 1 then + EgtSetCurrMachGroup( nMachGroup) + if EgtGetInfo( nMachGroup, "AUTONEST",'i') == 1 then MachGroupIndex = MachGroupIndex + 1 - EgtRemoveInfo(nMachGroup, "AUTONEST") - EgtSetInfo(nMachGroup, "UPDATEUI", 1) - dofile(EgtGetSourceDir() .. "BatchProcessNew.lua") + EgtRemoveInfo( nMachGroup, "AUTONEST") + EgtSetInfo( nMachGroup, "UPDATEUI", 1) + dofile( EgtGetSourceDir() .. "BatchProcessNew.lua") -- aggiorno interfaccia EgtProcessEvents( 200 + ( MachGroupIndex / MachGroupToTCnt * 100), 0) end + -- ciclo sui duplo per sistemare Q + local nRawPartId = EgtGetFirstRawPart() + -- recupero box grezzo ridotto della tolleranza + local b3Raw = EgtGetRawPartBBox( nRawPartId) + b3Raw:expand( -WD.INSIDE_RAW_TOL) + EgtOutLog( 'RawBox='..tostring( b3Raw)) + local nPartDuploId = EgtGetFirstPartInRawPart( nRawPartId) + while nPartDuploId do + -- creo lista associazioni feature con tooloutline + local ToolOutlinesList = {} + local nToolOutlinesGrp = EgtGetFirstNameInGroup( nPartDuploId, "ToolOutlines") + if nToolOutlinesGrp and nToolOutlinesGrp ~= GDB_ID.NULL then + local nToolOutlineId = EgtGetFirstInGroup( nToolOutlinesGrp) + while nToolOutlineId and nToolOutlineId ~= GDB_ID.NULL do + -- recupero Id della feature dall'area di lavorazione + local nProcId = EgtGetInfo( nToolOutlineId, "PRID", 'i') + if nProcId and nFeatureId ~= GDB_ID.NULL then + table.insert( ToolOutlinesList, { ToolOutlineId = nToolOutlineId, ProcId = nProcId}) + end + nToolOutlineId = EgtGetNext( nToolOutlineId) + end + end + -- ciclo su feature per associare Id geometrico a PRID + local vPartProc = WE.CollectFeatures( nPartDuploId) + for ProcIndex=1, #vPartProc do + local nFeatureId = vPartProc[ProcIndex].Id + -- recupero ProcId della feature + local nFeatureProcId = EgtGetInfo( nFeatureId, "PRID", 'i') + -- ciclo su lista + for i = 1, #ToolOutlinesList do + -- verifico se hanno lo stesso ProcId + if ToolOutlinesList[i].ProcId == nFeatureProcId then + ToolOutlinesList[i].FeatureId = nFeatureId + ToolOutlinesList[i].PartProc = vPartProc[ProcIndex] + end + end + end + -- ciclo su lista associazioni + for i = 1, #ToolOutlinesList do + -- verifico tipo feature + if LapJoint.Identify( ToolOutlinesList[i].PartProc) then + local b3ToolOutline = EgtGetBBoxGlob( ToolOutlinesList[i].ToolOutlineId, GDB_BB.STANDARD) + EgtOutLog( 'ToolOutlineBox='..tostring( b3ToolOutline)) + -- se all'interno rimuovo info Q + if EnclosesXY( b3Raw, b3ToolOutline) then + -- resetto parametro Q + if ToolOutlinesList[i].PartProc.Prc == 30 then + EgtRemoveInfo( ToolOutlinesList[i].PartProc.Id, "Q08") + EgtRemoveInfo( ToolOutlinesList[i].PartProc.Id, "Q08A") + else + EgtRemoveInfo( ToolOutlinesList[i].PartProc.Id, "Q03") + EgtRemoveInfo( ToolOutlinesList[i].PartProc.Id, "Q03A") + end + end + elseif DoubleCut.Identify( ToolOutlinesList[i].PartProc) then + local b3ToolOutline = EgtGetBBoxGlob( ToolOutlinesList[i].ToolOutlineId, GDB_BB.STANDARD) + EgtOutLog( 'ToolOutlineBox='..tostring( b3ToolOutline)) + -- se all'interno rimuovo info Q + if EnclosesXY( b3Raw, b3ToolOutline) then + -- resetto parametro Q + if ToolOutlinesList[i].PartProc.Prc == 12 then + EgtRemoveInfo( ToolOutlinesList[i].PartProc.Id, "Q02") + EgtRemoveInfo( ToolOutlinesList[i].PartProc.Id, "Q02A") + end + end + end + end + nPartDuploId = EgtGetNextPartInRawPart(nPartDuploId) + end nMachGroup = EgtGetNextMachGroup(nMachGroup) end + else EgtOutLog("Errore: nesting fallito") NEST.ERR = 2 @@ -884,10 +878,9 @@ EgtResetCurrMachGroup() -- cancello rettangolo del materiale per nesting for RawPartId = 1, #RawParts do EgtErase(RawParts[RawPartId].PartId) -end + end local nOutlineGrp = EgtGetFirstNameInGroup(GDB_ID.ROOT, "ToolOutlines") -if nOutlineGrp and nOutlineGrp ~= GDB_ID.NULL then EgtErase( nOutlineGrp) end --- EgtSaveFile("c:\\Temp\\Prova1.nge") +if nOutlineGrp and nOutlineGrp ~= GDB_ID.NULL then EgtErase( nOutlineGrp) end EgtOutLog( ' +++ NestProcess completed')