Adding Tag to multiple objects - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Adding Tag to multiple objects (/showthread.php?tid=3649) |
Adding Tag to multiple objects - PAPILLON - 27.10.2021 Hello, I'm pretty new to LogicMachine and I got one simple issue I'm trying to fix. My goal here is to add a tag to a lot of objects. To be more precise, I would like to add the tag 'ENSLG_LOGS_CLIENT' to all the objects wich address start with '1/*/*' So far I have found this script : ******* ListeObjets={} ---Liste contenant les strings des adresses des objets (ex: {'1/1/1','1/1/2'}) ListeTags={} ---Liste de strings contenant les tags (ex: {'ENSLG_MA', 'PMA0'}, {'PMA0'}) for i, obj in ipairs(ListeObjets) do grp.addtags(obj,ListeTags) end script.disable('Ajouter tags à des objets') ******** This script adds all the tags in 'ListeTags' to the objects which addresses are referred in 'ListeObjets' I would like to be able to apply the tags to all the objects with their addresses starting with '1/*/*' rather than typing each addresses myself in 'ListObjets' I thought of using a for loop to increment the adresses, but as I've just started using LogicMachine I'm not confortable with the scripting and I could really use a hand. Thanks for reading me ! Matthieu Papillon RE: Adding Tag to multiple objects - Daniel - 27.10.2021 You don't need script for that. Just filter your object and use Mass edit then Object properties. Select TAG and you are done RE: Adding Tag to multiple objects - PAPILLON - 27.10.2021 This is a very interesting tool, thanks for pointing it out. There is one remaining issue though. Using this method deletes the tags that where already in place. I want the tags that where already here to remain, for that I believe I do have to make a script for it. RE: Adding Tag to multiple objects - admin - 27.10.2021 Use this script: Code: tags = { 'Tag1', 'Tag2', 'Tag3' } RE: Adding Tag to multiple objects - PAPILLON - 27.10.2021 It works like a charm ! Thanks a lot for your support and reactivity, I really do appreciate it |