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.

delete all objects without tag
#1
Hello,

Is it possible to delete all objects without tag. This is not possible in the UI, but is it possible in a script?
Reply
#2
Use this, change the tag name as needed. And make a backup just in case Smile
Code:
tag = 'test'

tagged = {}

objs = grp.tag(tag)
for _, obj in ipairs(objs) do
  tagged[ obj.address ] = true
end

objs = grp.all()
for _, obj in ipairs(objs) do
  if not tagged[ obj.address ] then
    grp.delete(obj.address)
  end
end
Reply


Forum Jump: