xlhomme

SelectByName

Discussion created by xlhomme on Mar 20, 2014
Latest reply on Mar 20, 2014 by AUlmer-esristaff
Hi

I wrote this little script in order to select some shapes by name but it doesn't seem to work.
If you have any Idea.

from scripting import *

def selectByAttribute(attr, value):
    objects = ce.getObjectsFrom(ce.scene)
    selection = []
    for o in objects:
        attrvalue = ce.getAttribute(o, attr)
        if attrvalue  ==  value:
            selection.append(o)
        
    ce.setSelection(selection)
    
 
# get a CityEngine instance
ce = CE()

if __name__ == '__main__':
    selectByAttribute("Name","Q2")


xl

Outcomes