Select A Range of Edge Index

696
5
09-22-2017 04:00 PM
LesiMai1
New Contributor II

Hi all,

I'm fairly new to CityEngine and wondering if there is a way to select multiple edges in the setback operation without typing in each one separately. For instance, I want edges with index from 0 to 4 to have a 3m setback. I can do it by 

setback(3){0:X|1:X|2:X|3:X|4:X|remainder:Y}

But is there a way I can do it more efficiently? I have lots with over 90 edges because of the curves. So it will help me tremendously if there is an easier way to do it.

Thank you in advance for any pointers!

Lesi

0 Kudos
5 Replies
LR
by
Regular Contributor

No but you can use Excel to build rules like that easily. For example, put =A1&": "&B1&" |" in cell C1, Index in A and rule name in B. Then just pull the cells down.

0 Kudos
LesiMai1
New Contributor II

That's an interesting way to do it! I just wish it can be accomplished dynamically within CityEngine.

0 Kudos
LR
by
Regular Contributor

You could also use a conditional rule with indexes, like so:

attr startIndex = 0
attr endIndex = 0

@StartRule 
 Lot --> 
 comp(f){side:IndexCase} 
 
IndexCase -->
 case comp.index >= startIndex && comp.index <= endIndex: DoThing
 else: Stop‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
LesiMai1
New Contributor II

Thank you for all the helpful suggestions along the way! If you don't mind, I'd like to add a little context to the original question. I'm interested in setting different setbacks based on the street width the lot front is facing. For example, if a corner lot has two street fronts, how can I set up the rule so that it can read the streetWidth attribute to decide the amount of setback needed?

0 Kudos
CherylLau
Esri Regular Contributor

With regards to your larger goal, unfortunately, I don't know of a good way to do this.  It's not possible to make a single setback with different distances on different edges.  If you do one setback followed by another setback on the remainder, then you might accomplish what you want for somewhat rectangular lots.  However, as soon as you have the rounded corner with many edges that are all considered to be part of street.front, then you have to choose a single setback distance to get a nice result.  Otherwise, if you try to do multiple setbacks, then you'll probably get something ugly and unintended like this (so I'm not sure if recursive setbacks will solve your problem) (and, also, minor disclaimer: this screenshot has the second setback on street.front, so it repeats a setback on the first edge, but it serves the purpose to show that a result would be ugly):

With regards to grouping indices, no, sorry, it is not possible to group indices for use as a selector in either setback or comp.

Sorry to not have better news, but maybe someone else has an idea for a workaround.

0 Kudos