I'm not sure what the best way to go about this would be. I'm thinking it should be a simple conditional rule that converts the shape's type to roundabout if its corresponding node has a valence of one, but I just started getting into CityEngine a few days ago and am still grappling with CGA. Is there a way to control shapes based on their underlying graph properties?
Thank you for any help in advance!
Thank you for this question.
The CGA street rules work on CityEngine dynamic shapes and their attributes.
By changing the underlying graph properties, the shapes are automatically regenerated.
Here is a Python script to accomplish this task:
''' Created on Apr 23, 2018 @author: ESRI R&D Center Zurich ''' from scripting import * # get a CityEngine instance ce = CE() def findDeadEnds(nodes): deadEnds =  for node in nodes: if ce.getAttribute(node,'valency') == 1.0: deadEnds.append(node) return deadEnds if __name__ == '__main__': # get selected nodes nodes = ce.getObjectsFrom(ce.selection(), ce.isGraphNode) # get all dead end nodes deadEnds = findDeadEnds(nodes) # set all dead ends to 'Roundabout' ce.setAttribute(deadEnds, '/ce/crossing/type', 'Roundabout') ce.setAttributeSource(deadEnds, '/ce/crossing/type', 'USER') pass