# SplitArea Function

1878
13
05-22-2017 07:11 PM
New Contributor II

Hi, I am trying to break down a parcel using splitArea(x/z) function some how it says unexpected token: splitArea.

I am trying to build a query where I can divide parcel 60-40% and in which 40% of the plot be subdivided into 3000sqm area and extrude building over it. Also I want to manage the orientation based on some angle (0-360 deg)

Can somebody help me with this. or suggest be best possible way to do this

Thank you

Ab

13 Replies
Occasional Contributor III

Hi Abhishek,

Can you tell us your CE Version? Are you included all expected parameters?

David Wasserman, AICP
New Contributor II

Hi David,

I am having City Engine V 2015.2 advanced License. I am new to CityEngine so I am following tutorial, I don't know what parameters are needed for the function to work. Please let me know if my version covers everything that is needed.

Thanks

Ab

New Contributor II

Hi all, While searching in the discussion forum, I found part of my answer of dividing the plot in direction to achieve the floor area for building which is 3000 sqm.

split(x) {50 : split(z){60:Extrude_Building}*}*}

also the rotation scope can be managed via,

rotateScope(0,Rotation,0)

but I am unable to randomize the split function, lets say my plot has to be divided in 33% of green cover and 27% of Openspace (which will also include setback from street and distance between the buildings) and rest 40% should be cover by buildings with 3000sqm foot print, and all this should also gives options so that when I regenerate the model I can choose which is better.

I tried using the percentage but somehow it is not working

Lot -->

35% : split(x) {50 : split(z){60:Extrude_Building}*}*
27% : OpenSpace
33% : Greencover
else : Extrude_Building

The above code provides just the one of the options but not all together.

Can anyone suggest how can I achieve this.

Thanks

Ab

Esri Regular Contributor

The splitArea() function is only available starting with 2016.0, but I would recommend upgrading to the latest, which is currently 2016.1.

With the splitArea() function, you can split a shape by percentage area.

For example, this split divides the area of the current geometry into 33% green space, 27% open space, and 40% building space:

``splitArea(x) { '0.33: GreenSpace | '0.27: OpenSpace | ~1: BuildingSpace }‍``

You can also split the current geometry according to an absolute area.  For example, this split divides the area of the current geometry into one piece that has exactly 3000 sqm and one piece that has the remaining area.

``splitArea(x) { 3000: BuildingSpace | ~1: OtherSpace }‍``

Note that splitArea (and split) only splits the geometry in one direction.  If you want to split in two directions (e.g. x and z), you'll have to do nested splits (as you figured out).

The reason why the percentages in the code you wrote don't work the way you expected is because the percentage syntax has a different meaning.  It means that the rule will choose one of the cases with some probability, and that probability is defined by the percentage.  So, if the rule is executed 100 times, it will choose to create ExtrudeBuilding approximately 35 times, and it will choose to create OpenSpace approximately 27 times.

New Contributor II

Hi Abhishek,

I second Cheryl on the version update. CLau-esristaff is that in the docs somewhere? I can't find it under the splitArea function.
David

Esri Regular Contributor

It's in the changelog.  A link to it can be found at the bottom of the cga reference page.

New Contributor II

Thanks Cheryl!

New Contributor II

Hi Cheryl,

Thank you for letting me know about the misinterpretation of stochastic rule, I was using that thinking of randomizing the placement of building, green space and open space.

When I use split(x) {'.33: OpenSpace | '.27: color("#FFC500") | '.4 : split(x) {50 : split(z){60:Building}*}*}

but this divides in one direction which gives me one option.

If we see block division parameter where we can see offset division where we can create courtyard division with openspace in the middle and buildings around it, similarly recursive subdivision we can give randomization of parcels.

My intention is creating the similar code where I can give this randomization or courtyard visualization for a parcel which I have in 5ac of plot. I think this function can be made without using block division parameter.

I hope this is understandable, Please let me know if there's a way where we can achieve this subdivision function.

Thanks

Ab.

Esri Regular Contributor

CityEngine 2015.2 licenses won't work for CityEngine 2016.1
Go to https://my.esri.com to check if you have a license for 2016.1