Select to view content in your preferred language

Rules

7596
41
Jump to solution
01-18-2013 10:06 AM
NicoleHanson
Deactivated User
I think there's a step in my rule somewhere that doesn't take into account the number of lanes I have.  On one stretch of road, it's one lane going in one direction.  But I have two lanes of cars after applying the rule.  Any idea where I can find out how to get this fixed?
0 Kudos
41 Replies
MatthiasBuehler1
Deactivated User
Can you post a few representative images too ?

I'll have to think about this then .. 🙂
0 Kudos
NicoleHanson
Deactivated User
So here are some examples of what I'm looking to model.  [ATTACH=CONFIG]21314[/ATTACH][ATTACH=CONFIG]21315[/ATTACH][ATTACH=CONFIG]21316[/ATTACH][ATTACH=CONFIG]21317[/ATTACH]
0 Kudos
MatthiasBuehler1
Deactivated User
Hi !

Here's a start.

Read it carefully and try to understand every little step.

Let me know if there's questions so far .. 😮
0 Kudos
NicoleHanson
Deactivated User
OK, I have a lot of questions, and I barely got to the functions line...

First off - how do I know what language (like knowing what to use: attr, case, else, etc)?

How do I know what values to use for default, are they real world, or a scaled down?  For example the lanes on the roads are 12ft, but for the attr laneWidth it's 3.

Does it matter what the attributes are called?


Is there a book or something that would have the programming language, like the functions, or knowing how to set it up?  It looks so different than python (well the little bit I know about python).

Oh, and what does the --> mean?

And how do you know what values to do for the color scheme?

I do know that there's a list of attributes, which I think is the parts that can vary for the imput. 

Sorry!!  And Thanks for your help!!  I'm going to look it over again, but those are the questions I have so far.

Nicole
0 Kudos
MatthiasBuehler1
Deactivated User
Hi !

No problem .. 🙂


The units are in meters .. always in CGA ( CGA is CityEngine's scripting language which creates the geometries ).

The '-->' is the definition of a CGA 'rule'.

The best intro into CGA you get with my tutorial video 6...
http://video.arcgis.com/watch/1772/tutorial-6-basic-shape-grammar

It may explain most questions you have right now at the beginning, then we can cover more questions until all is clear ..

ok ? 🙂
0 Kudos
NicoleHanson
Deactivated User
OK, so I think I've watched that tutorial a couple of times now...

But it still didn't really answer how to know what CGA programming codes/words to use: ie attr, case...

It also didn't talk about knowing the color codes. 

Also, I'm not sure what the @ in front of some words means.

And on the functions, how do you even know what it is?
0 Kudos
MatthiasBuehler1
Deactivated User
Hi !


It all just looks more complex than it actually is.

Let's go through it step by step in the CGA code :

1]
We want to create a Street model from Street shapes. So we use a CGA rule to split that shape and colorize it until it represents a street how you need it.

2]
For now, we only work on Street Shapes, so we NIL Crossing and Sidewalk Shapes in the CGA code. This means no Model is generated.

3]
We define a series of attributes we can use :
- laneOffset : With the offset, we can shift the lanes sideways e.g. 2 left and 3 right can become 1 left and 4 right.
- laneWidth : Width of a street lane in meters (3 meters.. code in meters !! )
- medianWidth : 0.1 meter
- oneWay : @Range ("no", "left", "right") . the attr oneWay gets specified better with that 'annitation'. This makes that you have the 3 options as a dropdown in the Inspector for this attribute.
- doMedian: true or false. This is a 'boolean' value which is either true or false. Depending on it's state, a median will be made or not.


4]
functions : functions are there to calculate some values and return a value.
e.g.
f = 5

if f is called, the value of 5 is returned. In print ( f ), 5 will be printed.

5]
- rint() means round integer. this rounds up or down to the next full integer number. 5.1 will be rounded to 5.
- geometry.dv(0,unitSpace) is the width of a curved street, in meters.

6]
attrs with the @Hidden annotations are not displayed in the Inspector. We use them hidden as 'generic attributes' to pass values down our rules, thus they are set at the very beginning, after Street -->

7]
case : .. else : is the same as an 'if statement' in other programming languages. this tests if something is true or not.

to TEST if something is true or not, the '==' (double equal sign) is used.

E.g.
5 == 5 is 'true' in real world, so we try to create similar statements in CGA to split our geometries.


8]
In the rule called 'DoStreet', we then distinguish the different cases and split the street geometries among the U and V dimension. Those are actually texture coordinates. This is a good trick, because Street Shapes already have proper UV coordinates. The V direction is along the WIDTH of the street.

9]
So in general, with the functions, what we basically do is find out the proper number of possible lanes in each direction, with or without a median and then split the geometries accordingly.


Let me know if this short input helps you a little further...

I know it's complicated at the beginning. But once you know what's happening, the magic becomes easy ! 🙂

m.
0 Kudos
NicoleHanson
Deactivated User
Yes!  That helps a lot!  Thank you!
0 Kudos
MatthiasBuehler1
Deactivated User
Hi !

Ok, cool.

So go through the code and play around with it, together with curved Street Shapes.

If you have more questions so far, let me know ..

m.
0 Kudos
NicoleHanson
Deactivated User
Ok, got another question, but I wasn't sure if I should start another thread or not...

Once I have my streets how I like them, how do I add points/polygons to show where the street furniture are?  Mainly, traffic lights and lamps?  Would I just create another shapefile in ArcMap, and then import it into CE, then apply the rules for them?
0 Kudos