POST
|
I've already outlined a way to allocate landuses based on a static shape layer, as we get nearer placing buildings on our plots we need to ensure that the "lots" are the correct size and shape. This following rule can be adapted to test a Lot's area (in sqm) and then onto the next rule depending on its area. I've used this to place different building types on a lot depending on it's area but you could just as easily tie this into the woodland rule set above...
//the descriptive names can be changed and are more of a guide really change or add more areas for your needs
attr areatest =
case geometry.area < 100 : "100orLess"
case geometry.area < 200 && geometry.area > 100 : "100to200"
case geometry.area < 300 && geometry.area > 200 : "200to300"
case geometry.area < 400 && geometry.area > 300 : "300to400"
case geometry.area < 500 && geometry.area > 400 : "400to500"
case geometry.area < 600 && geometry.area > 500 : "500to600"
case geometry.area < 700 && geometry.area > 600 : "600to700"
case geometry.area < 800 && geometry.area > 700 : "700to800"
case geometry.area < 900 && geometry.area > 800 : "800to900"
case geometry.area < 1000 && geometry.area > 900 : "900to1000"
case geometry.area > 1000 : "1000orMore"
else : "0"
Lot-->
res_areatest
//this directs the rule to the appropriate model depending on the area size
res_areatest-->
case areatest == "100orless" : res_100orless
case areatest == "100to200" : res_100to200
case areatest == "200to300" : res_200to300
case areatest == "400to500" : res_400to500
case areatest == "500to600" : res_500to600
case areatest == "600to700" : res_600to700
case areatest == "700to800" : res_700to800
case areatest == "800to900" : res_800to900
case areatest == "900to1000" : res_900to1000
case areatest == "1000orMore" : res_1000orMore
else : stop.
res_100orless-->
extrude(5) report("1000", geometry.area())
//etc....
As usual does anyone have any thoughts/suggestions/corrections?
... View more
03-05-2012
06:14 AM
|
1
|
0
|
286
|
POST
|
A quick CGA rule share here! This one allows you to place randomly a selection of tree models on a lot (with start rule "woodland"). In my city model I wanted to place some trees in open areas by a river so this was a quick solution. This places a number of random trees (100) of different sizes and ranges, I've also allowed for a setback so when the lot fronts a road the trees are not right up against it. Obviously you can change the names of the rules to what you use and you could combine this with the landuses code I posted first in this discussion thread. If you need a tree you could use SketchUp and if you have the free version you might want this OBJ exporter plugin
tree_asset = fileRandom("trees/tree*.obj") // you could just have *.obj and it would randomly pick any obj file in this directory, you can use sketchup to create an obj
attr treenumber = 100 //change this depending on your lot size, or maybe run an area test on the lot to determine the density of your woodland!
attr treeminheight = 5 // know your tree to get that realistic height, perhaps wiki it?
attr treemaxheight = 15
attr woodlandsetback = 5
woodland-->
setback(woodlandsetback) { streetSide : woodlandborder | remainder : trees}
trees-->
scatter(surface, treenumber, uniform) { palmtree }
woodlandground
singletree-->
t(0,0,0) // you can change these numbers as well if you didn't want to place the tree at the scatter point centre
s(0,rand(treeminheight ,treemaxheight ),0)
r(0,rand(0,360),0) // rotates tree at a random rotation
i(tree_asset)
woodlandborder-->
extrude(1) woodlandbordercolor
woodlandground-->color("#005B00")
woodlandbordercolor-->color("#AAAA55")
As usual if anyone has any suggestions/thoughts/modifications please reply!
... View more
03-02-2012
03:40 AM
|
0
|
0
|
286
|
POST
|
Since my first post has produced such an amazing response 🙂 I shall continue and start a thread on using GIS data on landuses. What I have been doing is using my road network in ArcGIS and importing it into CityEngine where I make a suitable road network, this I use to create blocks that are not sub-divided. I then export these block shapes as a shapefile back into ArcGIS where I add new fields (like an LBCS or landuse Code). I can then make an outline landuse plan from these in ArcGIS and symbolise them. So we start back again in CityEngine with some static shapes with an object attribute for the landuse (in my case I've called it LBCSCode). The layer attributes code would look like this :
attr landuse = getObjectAttr("LBCS_Code")
Then to colour the static shapes I could use the following code (don't forget to apply the rule file!):
attr landuse = "0" // this just initialises the attribute that we have in our layer attributes
Lot--> //I didn't use LotInner as this example doesn't create a subdivision
case landuse == "1000" : color("#FFFF00") report("1000", geometry.area())
case landuse == "2000" : color("#FF0000") report("2000", geometry.area())
case landuse == "3000" : color("#A020F0") report("3000", geometry.area())
case landuse == "4000" : color("#0000FF") report("4000", geometry.area())
case landuse == "5000" : color("#BEBEBE") report("5000", geometry.area())
case landuse == "6000" : color("#2F4F4F") report("6000", geometry.area())
case landuse == "7000" : color("#90EE90") report("7000", geometry.area())
case landuse == "8000" : color("#228B22") report("8000", geometry.area())
case landuse == "9000" : color("#FFFFFF") report("9000", geometry.area())
else : color("#000000")
You can also see that I've used the report operation to produce a summary of the land areas (helpful when doing landuse plans!) So would anyone do this differently? Thoughts/suggestions/corrections? The next post will cover using this static shape layer to inform a dynamic model so change landuses in the object attributes here will change what happens in the dynamic model.
... View more
03-02-2012
12:21 AM
|
0
|
2
|
3469
|
POST
|
The next part of this thread is to start a simple road CGA rule file that can take into account the road classification field. This code is based in part on the tutorial examples given by CityEngine but I've modified them for the purpose of this discussion (with myself). The principles here can be applied for many rule sets not just road networks. This CGA rule will create different looking roads depending on the road classification and place a lamp post at regular intervals on designated streets. I've also added a rule for a covered market street but this is to be added manually in CityEngine. Road classes are taken from the Streetnetwork's "layer attribbutes" with code code like this : attr roadClass = getObjectAttr("ROADCLASS_FIELDNAME_FROM_GIS")
const lamp_asset = "lamppost.obj" // this is under your assets directory you can get a quick model from places like Google 3D Warehouse just be sure you have permission to use them!
attr sidewalkHeight =0.25
attr lampDistance =25 // you could change this or add different attributes for each road class
attr roadClass = "None" // attribute name declared in layer attribute
Street--> // I've coloured these in simple primary colours so you can see what's happening
case roadClass == "Primary" : color ("#ff0000")
case roadClass == "Secondary" : color ("#00ff00")
case roadClass == "Tertiary" : color ("#0000ff") // you can add more classes here
else : color("#535353")
Sidewalk-->
set(trim.vertical,false) set(trim.horizontal,false)
comp(f){ all: SidewalkPart }
SidewalkPart -->
case scope.sx > 5:
SidewalkWithCurbs
alignScopeToAxes(y) t(0,sidewalkHeight,0)
SidewalkLampTest
else:
SidewalkWithCurbs
SidewalkWithCurbs -->
extrude(world.y,sidewalkHeight)
comp(f)
{ top : split(y){ sidewalkHeight : Curbs | ~1 : Pavement }
| front : Curbs }
SidewalkLampTest--> // in this example only my primary and secondary classes of street get lampposts!
case roadClass == "Primary" : SidewalkLamps
case roadClass == "Secondary" : SidewalkLamps
else : nil
SidewalkLamps -->
split(x){ ~lampDistance : NIL
| { 0.1: Lamp | ~lampDistance : NIL }* }
Pavement -->
color("#C0C0C0")
Lamp -->
t(0,0,scope.sz-sidewalkHeight*2)
s(0,5,0)
r(0,90,0)
i(lamp_asset)
Curbs -->
color("#C0C0C0")
Crossing-->
color("#535353")
Junction-->
color("#535353")
JunctionEntry-->
color("#535353")
Island-->
extrude(0.5) color("#008000")
StreetMarketRoof--> // you need to select the shapes start rule manually to enable this but you could do it via road class as well
extrude(10) comp(f) { bottom : marketstreet | top : marketroof }
marketroof--> roofGable(22.5)
marketstreet --> reverseNormals color("#008000") // I seem to need to do this so I can have a coloured street under my marketroof
Has anyone got anything else to add or correct? Can someone provide code for a nice simple bridge?
... View more
02-29-2012
01:33 AM
|
0
|
0
|
364
|
POST
|
Hello Everyone, I thought I'd start a thread for people wishing to make simple City Models based in part, on real world data in ArcGIS. Hopefully it will help in the creation of quite a complex city model that people can modify for their own purposes. It's intended to be a simple discussion that anyone can join in with so feel free to add to it! This will assume a basic working knowledge of CityEngine, for example import/export of data as well as tools like 'CleanUp' graph. NB : I am not a programmer and my knowledge is limited in many areas of CityEngine so if you spot mistakes or can suggest betters ways of doing something, please tell me! As you can link CGA rules together and add to the complexity I thought it would be helpful to break the various components down. Firstly I'm a planner mainly working on Master Planning projects so this is from my perspective, I would welcome other people's perspectives though! The city model I want to create already has a few distinct data sets, they can be simply characterised as: Existing data, shapefiles/GDBs (polylines, and polygons) of the existing city which are quite detailed New data, GDBS (again polylines, and polygons) of the proposals/planned expansion which as a master plan are more general (No internal local streets yet) which I have created Now to break it down further, I want to control and model in CityEngine the general headings below: Transport Infrastructure (mainly roads, but some rail and other types, such as covered market street) LandUse (I put it at the top because,it's what I do) Plotsizes (Blocks on or off, Lot sizes, lot minimum width etc..) Models, initially simple block models that we can add detail to based on Landuse, plotsizes etc.. So I'm proposing that we aim to create a set of CGA rules that are easy to understand and create a basic city model from which we can add more complexity to. I really want to build code that can be flexible, often there are a couple of ways to do rules in CityEngine but I propose we don't always do the simple route, that way people can build in complexity. I'm also assuming that we start with all the base data we need. I suggest we start with a discussion of Transport Infrastructure since these allow blocks to be created. I've looked at the rule files in the tutorials in particular the Modern streets CGA. However as we're building on existing data I think we need to start with what fields in the polyline data from the GIS we might want to use: Right of Way (ROW) width Number of Lanes Direction (one way, two way and actual direction) Pavement (sidewalk in the USA!) Left Pavement (sidewalk in the USA!) Right Surface (asphalt, unmade etc..) Class (Motorway/Highway/Main/Secondary/Distributor/Access/Track) Central reservation Bridge? Any other fields we might want to use in CityEngine, any suggestions? So the best way of controlling how CityEngine draws the correct width of your streetnetwork is via the "layer attributes" window once you've selected the imported Streetnetwork data in the Scene window. CityEngine helpfully already does some of this automatically but it doesn't hurt to repeat it! I've modified the code to show you can change the road width based on a text field not just a number :
streetscale = 1 // street width scale factorstreetWidthDefault = 5
width = getObjectAttr("rdClass")// Instead of reading a number this reads the type of road eg motorway or local street I use prefix rd to indicate where it is located
attr streetWidth = // street width dependeding on "width" attributes
case width == "Primary" : 55 * streetscale
case width == "Secondary" : 30 * streetscale
case width == "Tertiary" : 20 * streetscale
case width == "Footpath" : 2.5 * streetscale
case width == "" :0 *streetscale // if there is no class attribute then the width is zero
else : streetWidthDefault
So can anyone add anything more to this, thoughts about the process or additional ways to set road widths? Next post will be creating a CGA rule file that models a road based on the object attributes such as surface and class...
... View more
02-28-2012
06:43 AM
|
0
|
2
|
3928
|
POST
|
Firstly please accept my apologies nici_h, I completely read that wrong and gave you an answer you already had... no excuses other than replying to threads whilst distracted by a new born is a bad idea (the replying to forums bit, not being distracted by babies!)... 🙂 Anyway cutting the block with a zero width street as Timrob suggests might be a good solution, there are issues though. I think I've had problems with orientation of lots. However I wonder if this old thread would help you if orientation issues happen? It's about Orientating first edges of static shapes to dynamic streets... http://forums.esri.com/cityengine/forum-5617.html Not sure if that will help but I might give you a different angle of attack...
... View more
12-05-2011
12:52 AM
|
0
|
0
|
493
|
POST
|
You don't need to use Python scripts (although I'm sure it could be done). You can create a function map layer and use the example code in the layer attributes: attr subDivisionRecursive = true
attr lotAreaMin = 200
attr lotAreaMax = 250
attr lotWidthMin = 15
attr irregularity = 0
attr forceStreetAccess = 1 You also need to ensure that the function map layer covers the area you want, I tend to change the colour from white to blue (for example) and then manually move and resize the map layer so it sits below my city, once done you can switch off the visibility. Make sure you go to the Block Parameters and use the Attribute Connection Editor to use the values in the Function Map layer as well. Also try this forum thread where I asked something similar Matthias has kindly included an example! http://forums.arcgis.com/threads/44423-Map-Layer-Functions?p=144024#post144024 Hope this helps
... View more
12-02-2011
04:59 AM
|
0
|
0
|
493
|
POST
|
Just thought you'd like to know for users of the free version of SketchUP there is a plugin to enable OBJ exports (with materials). I can't remember where I got it from exactly but go to this thread on SketchUcation would be a good start. Or you could message me directly and I can send you it.. 🙂
... View more
11-01-2011
02:15 AM
|
0
|
0
|
614
|
POST
|
Thanks Matthias I figured as much about the trial version... it seems quicker too! I've followed up on my call to our Account manager, the information I've got is that it's not yet ready for download and the original download site has been pulled (well sort of because I can still access procedural's old website here). Information is a bit short on the ground so I hope someone from ESRI can provide more information as to when exactly the update will be available. After all it had it's official launch! Existing customers will be contacted (I think by ESRI Inc) when the upgrade is available.
... View more
10-27-2011
06:07 AM
|
0
|
0
|
493
|
POST
|
timrob I've been told to contact your local ESRI team . I've just rung our ESRIUK account manager (we already purchase ArcGIS from them) and as it's all a bit new they're finding out what happens next for us.... Hoping it all goes smoothly, the upgrade seems well worth it, especially with support for rounadabouts!
... View more
10-27-2011
01:23 AM
|
0
|
0
|
493
|
POST
|
Will this work for existing CityEngine customers with support contracts? Hi Tim, Please click on the following link http://www.esri.com/software/cityengine/index.html and look under "What's new" (bottom right) to download your free trial. Thank you.
... View more
10-26-2011
12:04 PM
|
0
|
0
|
493
|
POST
|
I've been using code like the extract below to test whether a lot is on a corner (i.e. has two streetwidth variables greater than 0). Is there a better way to do this? I know you can create LotCorners but these are triangular lots that I don't want. Lot -->
setback(0.1) {streetSide: nil | remainder : test(comp.index)}
test(compIndex) -->
case streetWidth(0) > 0 && streetWidth(1) > 0 : building
case streetWidth(0) > 0 && streetWidth(2) > 0 : building
case streetWidth(0) > 0 && streetWidth(3) > 0 : building
case streetWidth(1) > 0 && streetWidth(1) > 0 : building
case streetWidth(1) > 0 && streetWidth(2) > 0 : building
case streetWidth(1) > 0 && streetWidth(3) > 0 : building
case streetWidth(2) > 0 && streetWidth(1) > 0 : building
case streetWidth(2) > 0 && streetWidth(2) > 0 : building
case streetWidth(2) > 0 && streetWidth(3) > 0 : building
case streetWidth(3) > 0 && streetWidth(1) > 0 : building
case streetWidth(3) > 0 && streetWidth(2) > 0 : building
case streetWidth(3) > 0 && streetWidth(3) > 0 : building
else : nil
building-->
offset(-2, inside)
extrude(rand(3,15))
... View more
10-25-2011
05:31 AM
|
1
|
9
|
4908
|
POST
|
I'm currently developing a very simple CGA rule wizard for CityEngine, if anyone is interested in trying out a beta version of it please let me know. You can see a video of it in action here on my blog (hope it's okay posting this here, there doesn't seem to be topic folders like on the previous forums...)
... View more
10-25-2011
05:26 AM
|
0
|
0
|
274
|
Title | Kudos | Posted |
---|---|---|
1 | 10-25-2011 05:31 AM | |
1 | 03-05-2012 06:14 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|