Rules

6406
41
Jump to solution
01-18-2013 10:06 AM
NicoleHanson
New Contributor III
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
1 Solution

Accepted Solutions
MatthiasBuehler1
Frequent Contributor
Hi !


You need to distinguish between 2 things :

1] The GUI creates streets and shapes ( I usually call this phase 'shape creation' ). That's done either manually or via Python.

2] CGA starts on a given, existing shape with attribute evaluation and model generation.

Phase 2 comes after phase 1. This also means that CGA can NOT alter the state of things that change shapes.

Thus, your things need and can be done with Python.

Make sense ?



Matt

View solution in original post

0 Kudos
41 Replies
MatthiasBuehler1
Frequent Contributor
Hi !

Are you using and altering an existing rule set ? E.g. the Modern Street rules ?

If so, maybe you simply have set the wrong Start Rule, where it is already clear that only 1 land is created.


It not and you're creating your own rules, make sure you have a repetitive split in the right direction (u or v texture coordinate direction) which creates the lanes.

split(v, unitSpace) {~laneWidth : Lane. }*

Let me know if this helps.

Matt
0 Kudos
NicoleHanson
New Contributor III
Hi Matt!

I'm using an existing rule: Street Construction - that came with the 3D City Creation data download. 

I'm not familar with programming, so I'm not even sure where to start with creating my own.  Is there a tutorial?

Thanks!
0 Kudos
NicoleHanson
New Contributor III
# create left and right side of the street (per default same nbr of lanes in both directions, but user can influence it via attributes)
Streetsides -->
 case calcNbrOfLanes < 1.1 : Asphalt
 case Nbr_of_left_lanes == 0 && Nbr_of_right_lanes == 0:
  split(v,unitSpace,0){ ~calcLanesLeft    : Lanes(calcNbrOfLanes,connectionEnd,0) Vehicles(0)
       | Median_width      : Median
       | ~calcLanesRight   : scaleUV(0,-1,-1) Lanes(calcNbrOfLanes,connectionStart,2) Vehicles(2) }
 else:
  split(v,unitSpace,0){ ~Nbr_of_left_lanes : Lanes(Nbr_of_left_lanes,connectionEnd,0) Vehicles(0)
       | Median_width      : Median
       | ~Nbr_of_right_lanes : scaleUV(0,-1,-1) Lanes(Nbr_of_right_lanes,connectionStart,2) Vehicles(2) }


Here's what I have for the lanes.  Would I change the Vehicles to 1 instead of 2?
0 Kudos
MatthiasBuehler1
Frequent Contributor
Hi !

Hmm. Can you also post a screenshot (please also of the navigator, so I can see the Start Rule and the attributes you have set) ? I'm not perfectly sure if I understood correctly what you meant in your first post.

You have only 1 textured lane but 2 lanes of cars, it that right ?

Let me know..

Matt
0 Kudos
NicoleHanson
New Contributor III
Hi !

You have only 1 textured lane but 2 lanes of cars, it that right ?

Let me know..

Matt


Yes, that's correct. 
[ATTACH=CONFIG]21161[/ATTACH]

And now I have some cars perpendicular to the road.
0 Kudos
MatthiasBuehler1
Frequent Contributor
Hi !

If you have edited Vehicle() in your code, cars will be rotated because that drives their orientation.

I know editing somebody else's code, especially if it's that complex..

It seems the code was not created to support all possible scenarios. For this example, I guess I cannot just quickly fix it either.

Maybe you'd be interested in starting a new rule which does what you want ?
I could help you a little with it and you'd learn a lot about CGA ! 🙂

[I usually start fresh if other people's code is too complex for me to understand.]


Let me know ..

Matt
0 Kudos
NicoleHanson
New Contributor III
If you'll help me, sure!  Let's start fresh. 

What do I need to do first?!
0 Kudos
MatthiasBuehler1
Frequent Contributor
First ..

What controls do you need ?
What elements you want to have on your streets ?

Number of Left Lanes / Right Lanes ?
Median on/off ?
..
0 Kudos
NicoleHanson
New Contributor III
First ..

What controls do you need ?
What elements you want to have on your streets ?

Number of Left Lanes / Right Lanes ?
Median on/off ?
..


I want to have both cement and asphalt.  Yellow lines and dashed white lines.  I need 3 Right Lanes, 3 Left Lanes.  But also, need it to be able to vary, as I need 2 for both, and 1.  As I have a split highway with on/off ramps, and local roads.
Median on for part of it, but also off for some of it.
Also, to be able to populate cars, with changing frequency.  And I need to be able to animate it (so that I can show the public what will happen at a specific interchange).

I figure I can wait a little bit before adding buildings.  Right now I want to be sure that I can get a working model of the roads.

Thanks Matt!
0 Kudos