Question: I created a street network by hand replicating an old map of a medieval town, some streets are wide other are very narrow. Then I grew secondary streets on it to add complexity.
I now figured out I made the whole things way too big, because when I try to create shapes for lots on a real scale City Engine crashes. I guess it's too many geometries for my computer. City is supposed to be 20 miles long and 6.5 wide but I don't think this size is handable so I thought about reducing the overall size by half.
Is there a way to scale down the whole street network keeping the streets in proportion? So that the street width and sidewalk width are scaled down too?
Or maybe I'm doing something wrong and a 20 Miles * 6.5 should be doable..
Any advice is welcome
hi Abele Giandoso
The area of your city 20 Miles * 6.5 should be doable. But since area is quite big, there might be too many polygons inside. Then you need to partition your scene into multiple scenes.
However, if you have modeled your City in the wrong scale, you can use the following python script to adjust the size of the street network:
from scripting import *
# get a CityEngine instance
ce = CE()
def scaleAttr(segments, attrList, scaleFactor):
for s in segments:
for a in attrList:
value = ce.getAttribute(s, a)
ce.setAttribute(s, a, value * scaleFactor)
if __name__ == '__main__':
scaleFactor = 1/2
scaleAttributes = ['/ce/street/laneWidth', '/ce/street/sidewalkWidthLeft', \
'/ce/street/sidewalkWidthRight', '/ce/street/streetOffset', \
segments = ce.getObjectsFrom(ce.scene, ce.isGraphSegment)
ce.scale(segments, [scaleFactor, 0, scaleFactor])
scaleAttr(segments, scaleAttributes, scaleFactor)
First of all thanks again for giving me the script back in October!.
I had to take a break from the project until now but finally I arrived to the point where I can implement the script you gave me.
Right now I select my script network and then I run the script you gave me (which I saved as .py using the create Pyton Module) pressing F9.
But instead o scaling by half the street width, the whole street networks get all jumbled up in a knot.
It s the first pyton I run so I am definitively doing something wrong. Any help you may give on the subject would be greatly appreciated