python scripting selection help!

815
1
08-10-2016 12:14 PM
SandeshIyer
New Contributor


How do i select only the lots from the imported openstreetmap and assign a rule file to that and how to i select only the street network(roads that is) and assign another rule file to that using only python scripting? Im new to scipting, so if someone could do a small writeup of this code, it would be useful.  Thank you!

0 Kudos
1 Reply
LR
by
Regular Contributor

Untested, but this should get you pretty close:

layerName = "yourLayerName"
shapeRule = "rules/yourRule.cga"

if __name__ == '__main__':

    layer = ce.getObjectsFrom(ce.scene, ce.isLayer, ce.withName(layerName))
        
    for x in layer:
       shapes = ce.getObjectsFrom(x)        
        
    for shape in shapes:
       ce.setRuleFile(shape, shapeRule)
       ce.setStartRule(shape, 'Lot')
0 Kudos