-- ClearProcess.lua by Egaltech s.r.l. 2020/03/30 -- Se la trave non รจ parte di un gruppo di lavoro, cancello geometrie aggiunte -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() EgtEnableDebug( false) -- Recupero la prima trave selezionata local ObjId = EgtGetFirstSelectedObj() local PartId = EgtGetParent( EgtGetParent( ObjId or GDB_ID.NULL) or GDB_ID.NULL) if not PartId then return end -- Recupero appartenenza a gruppi di lavoro local vMGrps = {} local sLst = EgtGetInfo( PartId, GDB_SI.LIST) if sLst then vLst = EgtSplitString( sLst) if vLst then for i = 1, #vLst do local MGrpId = EgtGetParent( EgtGetParent( EgtGetParent( vLst[i]) or GDB_ID.NULL) or GDB_ID.NULL) if MGrpId then table.insert( vMGrps, EgtGetName( MGrpId)) end end end end -- Chiedo conferma della cancellazione if #vMGrps > 0 then local sOut = 'I seguenti gruppi di lavoro verranno cancellati :\n ' .. table.concat( vMGrps, ',') .. '.\nConfermi ?' if not EgtOutBox( sOut, 'Cancella Lavorazioni', 'QUESTION') then return end end -- Cancello i gruppi di lavoro e le geometrie aggiuntive relative for i = 1, #vMGrps do EgtRemoveMachGroup( EgtGetMachGroupId( vMGrps[i]) or GDB_ID.NULL) EgtErase( EgtGetFirstNameInGroup( PartId, vMGrps[i]) or GDB_ID.NULL) end -- Cancello eventuali altre geometrie aggiuntive per gruppi di lavoro local LayId = EgtGetFirstLayer( PartId) while LayId do local NextLayId = EgtGetNextLayer( LayId) if EgtGetInfo( LayId, GDB_SI.MGRPONLY) then EgtErase( LayId) end LayId = NextLayId end -- Aggiorno interfaccia grafica EgtDeselectPartObjs( PartId) EgtDraw() -- end