Negative Extrude / Delete Building elements

398
1
10-19-2017 03:06 PM
ThureKjer
New Contributor

Hey (:

I've run into a problem and I need your help

I just started using the city engine and tried to change the script "Building_From_Footprint.cga"
I'm gonna try to explain my problem by using a few images.

As you can see in the image 1 there is the basic structure. My next step was to extrude a new level (image 2)

I implemented a interactive extrude function which allows me to change the structure form (image 2- 3)

I want to delete the red colored area (image 4). First I tried to control from where the extrude should begin. But coudlnt figure out how to do it. Than I though I could make it work to extrude the other sides ( -x and -z axis ) into the building. But also at this point, didnt know how to do it. My last try and hope was it, to extrude again and substruct this from the first extrusion.

I used this code to make it work


SetbackBaseZ -->
    [ extrude(_getLevelHeight*Floor_Ht) Mass(false) ]
    t(_getXAxis,_getLevelHeight*Floor_Ht,_getZAxis)

    split(z){ 'rand(_getExtrudeZAxis/100,1):
        split(x){ 'rand(_getExtrudeXAxis/100,1)
        :Extrusion(_getExtrudeHeight*Floor_Ht,true,6)}}
//New extrusion to subtrac it
        split(z){ 'rand(_getExtrudeMinusZAxis/100,1):
        split(x){ 'rand(_getExtrudeMinusXAxis/100,1)
        :Extrusion(_getExtrudeHeight*Floor_Ht,true,6)}}

I hope you understand my problem and if you could help me out here. That would be great !

Regards

MaxPayne | Micro

0 Kudos
1 Reply
CherylLau
Esri Regular Contributor

If I understand correctly, you would like to subtract the red part in image 4 from the top part of the building which is constructed on top of the original building from image 1.

Sorry, boolean operations, like subtracting one shape from another shape, are not supported in CityEngine.

However, given that the roof of the original building is your new footprint, if you just want to specify the spatial extent in x and z for the footprint and then extrude to get the part of the building on top of the original building, you can do so with two successive splits.  The split in x will take into consideration the x bounds on both sides, and the split in z will cut the footprint to the z bounds on both sides.  Then, you can extrude to get your building.

split(x) { xMarginLeft: NIL
         | ~1: split(z) { zMarginFar: NIL
                             | ~1: Footprint
                             | zMarginNear: NIL }
         | xMarginRight: NIL }
0 Kudos