Select to view content in your preferred language

# Fixed number of split?

840
3
05-18-2017 01:51 PM
by
New Contributor III

Hi,

Is there a way to specify the exact number of times a shape is split?

For example (from the manual):

A--> split(x){ 2 : X(2) | 1 : Y(1) }*

will give as many of the "2 1 2 1 ..." pattern as can fit.

But what if I want to have exactly 3, as in "2 1 2 1 2 1" and leave the rest of the shape unused?

I can always do:

A--> split(x){ 2 : X(2) | 1 : Y(1) | 2 : X(2) | 1 : Y(1) | 2 : X(2) | 1 : Y(1) }

But I want the number of times to repeat to be an attribute.  Something like:

A--> split(x){ 2 : X(2) | 1 : Y(1) } * repeat

Thanks!

3 Replies
Esri Regular Contributor

No, unfortunately, there is no easy way to specify how many times you want the pattern to repeat.

You would have to calculate the length of the last part and put that in the split.

OR

You would have to write it recursively to keep splitting until the desired count is reached.

by
New Contributor III

Thanks.  How does one go about making a feature request?

Esri Regular Contributor

GeoNet users can make CityEngine feature requests on ArcGIS Ideas - CityEngine