Fixed number of split?

792
3
05-18-2017 01:51 PM
RobertYu
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!

0 Kudos
3 Replies
CherylLau
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.

RobertYu
New Contributor III

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

0 Kudos
ThomasFuchs
Esri Regular Contributor

GeoNet users can make CityEngine feature requests on ArcGIS Ideas - CityEngine 
Other users with the same request can vote on it and add comments.

This section is moderated by the CityEngine development team.

0 Kudos