How to apply different rates of change to different parts of the building?

2913
9
Jump to solution
01-23-2016 02:16 PM
TianfangJiang
New Contributor II

Hi guys,

The grids in the following picture is the .shp file which is exported from ArcGIS. Then I read the MEAN_Z attribute from the Object Attribute and attributed it to the following grids.

After that I obtained the building in the following picture. Now my work is to modify this building. First I want to change the heights of different parts of the building. My problem is how to apply different rates of change to different parts of the building.

I tried to write the code like this:  attr MEAN_Z

                                                     attr height= MEAN_Z*0.5;

but the result is the height of the whole building became 0.5 times than before which is not what I need.

How can I divide this building into different parts based on so many grids and how can I apply different rates of change to different parts?

I think you guys are more professional than me and thank you for your help

0 Kudos
1 Solution

Accepted Solutions
CherylLau
Esri Regular Contributor

Ok, so I was under the assumption that you had one shape with multiple faces.  In this case, the split operation would work, but if you had multiple initial shapes, there's no way to combine them in the rules.  I would suggest combining all the shapes into a single shape either in CE or in the software you are using to generate the shapefile.

You could combine all the shapes into one shape in CityEngine by selecting them -> Shapes -> Combine Shapes.  This will give you a single shape with multiple faces.  Then you can apply a rule to the single shape.

Or, you could combine all the shapes into a single shape before you export your shapefile.  It should be a similar procedure as in CityEngine (select all the polygons, then find the menu item to combine the polygons).

View solution in original post

0 Kudos
9 Replies
CherylLau
Esri Regular Contributor

You could apply a component split to get all the faces of your object and then apply a rule to each face.  The rule could set the height of building.  (For the following code, assign the start rule Lot to your initial shape.)

Lot -->

     comp(f) { all : Face }

Face -->

          extrude(rand()*20 + 0.5*MEAN_Z)     // set height to random value in [MEAN_Z - 10, MEAN_Z + 10]

0 Kudos
TianfangJiang
New Contributor II

Thank you Cheryl, but I don't want to set the height of building in a random value, I want to set it as a specific value which I need. And do you know how to divide the building into several parts?

Thank you for your help.

0 Kudos
CherylLau
Esri Regular Contributor

You can set the building height to whatever you want.  I just chose random heights as an example, but you can put in your own calculations.

If you want to divide something into parts, then you'll probably want to use the split() operation:

split Operation

Or, if you want to separate out the individual faces, then you'll probably want to use the comp() operation:

Component Split Operation

0 Kudos
TianfangJiang
New Contributor II

Thank you Cheryl, I think you are right, maybe I need to use the Split Operation, and then attribute different heights to different parts.

0 Kudos
TianfangJiang
New Contributor II

Hi Cheryl,

I tried to apply the Split Operation but the result is that the separation can only be applied on each grid instead of the whole building geometry. The follow picture shows the result,

\

The code I write for the separation is:    split(x) {'0.5:Z|

                                                                            '0.2:Y|

                                                                            '0.3:X}

What should I do if I don't want to split each grid but to group these grids into several parts?

Thanks!

0 Kudos
CherylLau
Esri Regular Contributor

I'm not sure what you are referring to when you say "grids".  Are you referring to each face of your building footprint?

What is the shape that you apply the split rule to?

What is your initial shape?  Is it a single initial shape with many faces?  Or, are there many initial shapes?

Since I don't fully understand the situation, here are some general examples that might help you determine how to split your shapes to get what you want.

If you start with a single initial shape (which contains many faces), then you can use split() to separate it into two parts:

Lot -->

    split(x) { '0.5 : A

                | '0.5 : B }

Then, part A will contain all the faces on the first half, and part B will contain all the faces on the second half.  I think this is probably along the lines of what you want to do if you want to keep some faces together.

If you use comp(f), then you separate your initial shape into faces where each face becomes a different shape, unless you use the = operator.

This code separates the shape into different faces where each face is a Face shape.

Lot -->

    comp(f) { all : Face }

This code separates the shape into faces but keeps all the vertical faces together as a single shape VerticalFaces.  The non-vertical faces are separated into individual Face shapes.

Lot -->

    comp(f) { vertical = VerticalFaces

                  | all : Face }

0 Kudos
TianfangJiang
New Contributor II

Yes, when I referring grids I mean the initial shapes imported from the .shp file. In the following picture you can see many shapes in gray color, these are the "grids" (shapes) which are imported from the .shp file.

But in my case, I want to combine all these shapes together and let them become one building. In the picture, all these shapes combined together shows the footprint of my building.

0 Kudos
CherylLau
Esri Regular Contributor

Ok, so I was under the assumption that you had one shape with multiple faces.  In this case, the split operation would work, but if you had multiple initial shapes, there's no way to combine them in the rules.  I would suggest combining all the shapes into a single shape either in CE or in the software you are using to generate the shapefile.

You could combine all the shapes into one shape in CityEngine by selecting them -> Shapes -> Combine Shapes.  This will give you a single shape with multiple faces.  Then you can apply a rule to the single shape.

Or, you could combine all the shapes into a single shape before you export your shapefile.  It should be a similar procedure as in CityEngine (select all the polygons, then find the menu item to combine the polygons).

0 Kudos
TianfangJiang
New Contributor II

Cheryl, thank you so much for your help! I think you are right, I should combine all the initial shapes together before I input them into the CityEngine, there is no way to combine the initial shapes by the CGA rules.

I will take your advise and combine them in the ArcGIS.

Thank you so much

0 Kudos