Select to view content in your preferred language

Rule linking coverage ratio with distances from road and boundaries.

224
4
02-28-2025 10:02 AM
Neri12
by
New Contributor

Hello,
As per the title, I am trying to create a rule that links the coverage ratio of a lot with distances from the road and boundaries. I will preface this by saying that I am a beginner in cityengine.
I have been working on this rule for two weeks now by reading several posts and following several youtube videos. I managed to create a rule that divides the notto into 5 parts.
A central part where the building is extruded and 4 other free parts. I divided the lot into all these parts so that I could adjust the distance to the boundaries and the road and have control over the building surface.
Only there is a problem. The control not perfect, in fact to be able to change the distances, I have to act on the percentage of area of the different lots. This is quite inconvenient for, because it doesn't allow me to act directly on the distances.
Being a beginner, I was wondering if there is a way to achieve this result.
Thanks in advance

0 Kudos
4 Replies
ThomasFuchs
Esri Regular Contributor

Hi @Neri12 ,

Welcome to the ArcGIS CityEngine Community. 😊
To give you an advice, it would be very helpful, to have a screenshot and some snippets of your CGA code. 

General information:

0 Kudos
ThomasFuchs
Esri Regular Contributor

As an example, you can first obtain the orientations of a parcel shape with the Compute Edge Attributes tool. Then, the following rule lets you define a maximum building coverage ratio and setback distances per side. In case the maximum coverage is smaller then the remainder of the setbackPerEdge operation, the front setback is increased by the setbackToArea operation (dark blue area).

ThomasFuchs_1-1741250823630.png

 

version "2024.1"

const lotArea = geometry.area
@Description("Maximum ratio of footprint to parcel area") @Percent 
attr area_ratio = 0.5 
@Description("Minimum street setback") @Distance @Range(min=0, max=15) 
attr setback_front = 5
@Description("Excact side setback") @Distance @Range(min=0, max=15) 
attr setback_side = 10
@Description("Excact rear setback") @Distance @Range(min=0, max=15) 
attr setback_rear = 15

dist(orientation) = case orientation == "front"	: setback_front
                    case orientation == "side"	: setback_side
                    case orientation == "rear"	: setback_rear
                    else                   	 	: 0

@StartRule
SetbackPerEdge --> setbackPerEdge( dist( edgeAttr.getString("orientations") ) ) 
	{ edgeAttr.getString("orientations") == "front"	= Grey
	| edgeAttr.getString("orientations") == "side" 	= Yellow
	| edgeAttr.getString("orientations") == "rear"	= Green
	| remainder 	= SetbackToArea }

SetbackToArea --> setbackToArea(lotArea * area_ratio) 
	{ edgeAttr.getString("orientations") == "front"	= Blue 
	| remainder = extrude(10) Cyan }

 

0 Kudos
Neri12
by
New Contributor

hello, thanks for the reply.

I tried your rule. But it doesn't work. I don't know why honestly. Anyway I somehow managed to revolve it using the function : setbackToArea(area, minDistances), only I had to compromise, like the fact that the priority is not given to coverage ratio but to distances. To solve this invonvenientè, I created within the rule a report, which showed me the actual coverage ratio, so that I could then act manually to get the coverage ratio I was looking for.

Now I don't know if there is a more refined way to achieve the same result. If you know it, I could try it.

But now I resonate an additional problem, in prtica I would need to set limits to the distances from both the boundaries and the road, basically the distances need to change both according to the height of the eficio and if necessary I need to be able to eliminate a distance of one boundary from the other.

To explain better, I need to make the distance adjust to the height I choose, this is done by setting an attribute. So far so good, The problem I find in the moment I want the distance to cancel on the right side for example and become maximum on the left side. so as to create a building at the boundary.

I have actually already tried using both the @Enum function and the @Range function, but both fail to capture what I need. The latter gives me a range, the former, on the other hand, allows me to decirede predetermined numeric values, I would like those numeric values in the @enum function to be interactive and fit the input data that I enter, i.e., the alt.

I hope I have been clear.

Thanks again for the welcome in the comiunity, I hope to be able to create my own procedural rule with cityengine.

0 Kudos
ThomasFuchs
Esri Regular Contributor

Thanks for your feedback. Great that you managed to resolve the your question.
To make my example rule work, the parcel shape requires the attribute edgeattr/orientations set by the Compute Edge Attributes tool.

0 Kudos