# Setbacks based on neighboring building's height

Question asked by k.karamitov@esribulgaria.com on May 9, 2018
Latest reply on May 29, 2018 by CLau-esristaff

I am currently working on 3D zoning and I face 3 issues for which I looked all over the forum, the help documentation and the tutorials and I can't figure out how to solve them. Here is a link to the first and a link to the second one. This issue is about setting the setbacks of a building according to the height of the buildings around it.

The setback regulations in Bulgaria for residential buildings above 10m is considering the height of the buildings because of the created shades. An example you can see in the attached file. We have two buildings - S(southern) and N(northern). The max height of S must be no greater than the distance between the two buildings, which includes the north setback of S and the south setback of N. This way even the ground floor of N is guaranteed to have access to sunlight.

As a workflow for turning this regulation in CGA rules I marked the following steps:

- a parcel shape needs to know which are its neighbors -

- then to check weather they are south, north of it and to select them accordingly

- then get the data from the attributes for height

- and calculate and divide the height of the neighbor to the setbacks of the current shape and the neighbor shape

I didn't find a way to catch the distance between scopes which is kind of blocking the further steps. I tried using the minimumDistance as you can see from the cga code but without success.

Is there a way this regulation to be recreated through CGA rules?

``@Group("Setbacks")@Order(1)attr Front_setback = 5@Group("Setbacks")@Order(2)attr Back_setback = 5@Group("Setbacks")@Order(3)attr Left_setback = 5@Group("Setbacks")@Order(4)attr Right_setback = 5@Group("Visual")@Order(1)attr Function = "#ff0000"@Group("Visual")@Order(2)attr Opacity = 0.7@Group("Volume")@Order(1)attr Eave_height = 0@Group("Volume")@Order(2)attr Max_height = 0@Group("Volume")@Order(3)attr Roof_angle =      case Max_height == Eave_height : 0     else: 45@Group("Volume")attr height = Max_height@StartRuleParcel --> setback(Front_setback) { street.front: Garden | remainder:   setback(Back_setback) { street.back: Garden | remainder:    setback(Left_setback) { street.left: Garden | remainder:     setback(Right_setback) { street.right: Garden | remainder:      label("label")      Tester                              }   }  } }Tester -->     case minimumDistance(intra,"label") < 1 : offset(-1)BuildVolume # тук проверяваме за разстояния между обекти с label "label", които са всички за момента и им задаваме BuildVolume. Самият BuildVolume трябва да има предвид височината си според височината на другата сграда.    else : primitiveCylinder(16, 0.05, 0.5)          Garden --> color("#27ae60")BuildVolume -->     envelope(world.up, Max_height, Eave_height, Roof_angle, Eave_height, Roof_angle, Eave_height, Roof_angle, Eave_height, Roof_angle)     set(material.opacity, Opacity)``