This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Adding Tag to multiple objects
#1
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
Reply
#2
You don't need script for that. Just filter your object and use Mass edit then Object properties. Select TAG and you are done
------------------------------
Ctrl+F5
Reply
#3
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.
Reply
#4
Use this script:
Code:
tags = { 'Tag1', 'Tag2', 'Tag3' }

from = buslib.encodega('1/0/0')
to = buslib.encodega('2/0/0') - 1

for addr = from, to do
  grp.addtags(addr, tags)
end
Reply
#5
It works like a charm ! Thanks a lot for your support and reactivity, I really do appreciate it Smile
Reply


Forum Jump: