# CityEngine - comp and split operations

4183
5
09-21-2015 04:33 AM
by
New Contributor II

Hi,

I would like to use comp() operation and after this the split() operation on my building.

But the building has so many faces / facades on the same sides with different attributes, like textures, windows etc.

How can I use these operations? For example if I use this operation "comp(f) {front : fFacade | side : sFacade | top : Roof}" and then if I use the split() operation, it will split all the faces on the same side, but I want to split only a specific face.

I would like to split only one face on the Y axis which is in front.

BR

Aletta

Tags (3)
1 Solution

Accepted Solutions
by
Occasional Contributor III

Going by face index (as opposed to front, etc) gives you full control but also requires more work since you, AFAIK, can't mix top/bottom/front/etc and face indexes. Try this on a T-shape:

```Lot -->
extrude(200)
comp(f){
0: zero | 1: one | 2: two | 3: rc
| 4: rc | 5: rc | 5: rc | 6:rc |
7: rc | 8: rc | 9:rc }

zero -->
split(x){~0.5: rc | ~0.5: rc}

one --> color(rand,rand,rand)
two --> color(rand,rand,rand)
rc -->  color(rand,rand,rand)```

5 Replies
Occasional Contributor

Hello Sch,

You can split the faces by the following also

comp(f){1 : 1stface | 2 : 2ndface |  ..... and so on to n th face}  -- Here you can access each face of comp(f)

This is another method rather than front, side and Top split.

Regards,

by
New Contributor II

Hi,

Thank you for your answer, but this approach of the subdivision doesn't work for me unfortunately properly.

Can you tell me more accurate informations about it?

Besides that I'm waiting for another solutions, too.

Thanks a lot!

BR

Aletta

Occasional Contributor III

I don't think you can use a number as the first character of a rule, so Jawadh's example should be altered to something like this:

comp(f){1 : First | 2 : Second |  ..... and so on to n th face}

Otherwise tell us what doesn't work - is it an error or a particular reason it doesn't work for what you're trying to achieve.

by
Occasional Contributor III

Going by face index (as opposed to front, etc) gives you full control but also requires more work since you, AFAIK, can't mix top/bottom/front/etc and face indexes. Try this on a T-shape:

```Lot -->
extrude(200)
comp(f){
0: zero | 1: one | 2: two | 3: rc
| 4: rc | 5: rc | 5: rc | 6:rc |
7: rc | 8: rc | 9:rc }

zero -->
split(x){~0.5: rc | ~0.5: rc}

one --> color(rand,rand,rand)
two --> color(rand,rand,rand)
rc -->  color(rand,rand,rand)```

by
New Contributor II

Hi,

Everything is all right, thank you everyone for the helpful advices and the perfect illustration!

BR

Aletta