Hoping that someone can help me out. I am a python newbie and I am trying to create a script that will select all objects that have the Object Attribute "amenity" equal to "school". Could some please help me identify what is wrong with the below code?
from scripting import *
# get a CityEngine instance
ce = CE()
def selectByAttribute(attr, value):
objects = ce.getObjectsFrom(ce.scene)
selection = []
for item in objects:
attribute = ce.getAttribute(item, attr)
if attribute == value:
selection.append(item)
ce.setSelection(selection)
if __name__ == '__main__':
selectByAttribute("/ce/geometry/amenity", "school")