-- ShowBuilding.lua by Egaltech s.r.l. 2025/10/11 -- Gestione visualizzazione travi come struttura -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() EgtEnableDebug( false) -- Recupero elenco assemblaggi presenti local AsseBaseId = EgtGetNameInGroup( GDB_ID.ROOT, 'AsseBase') for i = #AsseBaseId, 1, -1 do if EgtGetGroupObjs( AsseBaseId[i]) == 0 then table.remove( AsseBaseId, i) end end -- Se nessun assemblaggio, esco con avvertimento if #AsseBaseId == 0 then EgtOutBox( "There are no assemblies", 'ShowBuilding', 'WARNING', 'OK') return end -- Se un solo assemblaggio if #AsseBaseId == 1 then -- Recupero l'attivazione dell'assemblaggio local bOn = EgtBeamGetBuildingIsOn() -- Modifico lo stato dell'assemblaggio EgtBeamShowBuilding( not bOn) -- altrimenti più assemblaggi else -- Recupero gli assemblaggi attivi local On = {} for i = 1, #AsseBaseId do if EgtBeamGetBuildingIsOn( AsseBaseId[i]) then table.insert( On, i) end end -- Se almeno uno attivo, li spengo tutti if #On > 0 then for j = 1, #On do EgtBeamShowBuilding( AsseBaseId[On[j]], false) end -- altrimenti chiedo quale attivare else local sCombo = 'CB:1' for i = 2, #AsseBaseId do sCombo = sCombo .. ',' .. tostring( i) end local Res = EgtDialogBox( 'Choose Assembly', { 'To Activate', sCombo}) if Res then local nId = tonumber( Res[1]) EgtBeamShowBuilding( AsseBaseId[nId], true) end end end EgtZoom( SCE_ZM.ALL) -- end