Aligning rooftops in CityEngine

643
3
08-21-2014 08:35 AM
NathanBrigmon
New Contributor

Hi all!

I'm working on a building some neighborhood CGA rules and have come across this roofing dilemma. Sometimes my roof turns the wrong way and sometimes my welcome mat gets turned (see image):

dilemma.png

Both buildings were created using the same code. Is there a good way to ensure the same building form across all lots?

Thanks!

Nathan

0 Kudos
3 Replies
PascalMueller
New Contributor III

Hi Nathan

The problem is that the roofGable tries to be smart and creates the cable along the longest side. We are aware of this problem. However there is already a solution that works in some use cases:

You can use the full-fledge roofGable operation:

  roofGable(angle, overhangX, overhangY, even, index)

The last parameter index defines to which edge the ridge should be parallel. Thus, as long as the edge indexes stay constant in your models, this solution will work.

I hope this helps.

Best

Pascal

0 Kudos
NathanBrigmon
New Contributor

Yes, I've read about the index, but it still changes from model to model. So, I guess a better question is how do I keep the edge indexes constant or, at least, consistent?

0 Kudos
PascalMueller
New Contributor III

This depends very much on the rules and use cases. Some ideas:

One thing to try is using the innerRect operation or inserting (and component splitting) a builtin:cube in case you work rectangular shapes. Then work with the index.

Or in case you know the direction (but not the index) you could scale it into the wanted direction (to make it long), apply the roofGable operation and scale it back. Means s('10,'1,'1) roofGable(angle,overhangX*10,overhangY) s('0.1,'1,'1).

0 Kudos