Roof Construction and case statement

551
1
04-02-2019 03:48 AM
BurakAydin1
New Contributor III

Hi there,

I have to rebuild a church and set conditions for it. I'm a beginner in Cityengine. I have some questions about this, in the hope that you will answer them.
1) how can I construct the roof like on the picture "Roof1"(red circle). I first modelled a "roofGable", but I don't know how to build the rear part diagonally.
2) At the church tower two colons have to be constructed (see "colon1"). How can I divide the polygon so that exactly the corners of these two colons are modelled?
3) I also have to set up some conditions. for example, should you be able to ask if the church tower is facing west or east? or if the church has colons?
If you have any other comments or help, please feel free to Thank you in advance
0 Kudos
1 Reply
CherylLau
Esri Regular Contributor

1) It seems like you want roofHip() for the rear part and roofGable() for the front part.  Maybe you could make both roofs, split them in half, and use the gable roof for the first half and the hip roof for the second half.

2) You could use comp(v) to get the vertices and insert primitive cubes there.

CreateCornersFromMass -->
	comp(f) { bottom: comp(v) { all: Vertex } }

Vertex -->
	alignScopeToAxes(y)
	primitiveCube
	s(w, h, w)
	center(xz)
	r(scopeCenter, 0, 45, 0)‍‍‍‍‍‍‍‍‍

Or, you could just insert primitiveCubes, use t() and r() to position them and rotate them.  You could use scope.sx and scope.sy to get the current scope's size.

3) You can handle conditions using case statements to test attribute values.

case orientation=="East":
	... // insert code to create church facing East
case orientation=="West":
	... // insert code to create church facing West
else:
	... // insert code to create church facing default direction‍‍‍‍‍‍