My buildings extent are not exactly rectangular (static shapes)

1612
8
Jump to solution
08-16-2014 08:11 AM
ThibaultThibault
New Contributor

Hi,

I imported some buildings extent interpreted by CE as static shapes, but they are not perfect rectangles.

So every time I attempt to use a split(x/z) or a comp(f) followed by some t(x,y,z), it is all messed up.

Example using split :

General viewCGA

version "2014.0"

@StartRule

A -->

    extrude(6)

    B

B -->

    split(x){

        0.5:P|

        ~1:M|

        0.5:P}

P -->

    color("#FF80C0")

M -->

    color("#00FF00")

Example using comp(f) :

General viewIssues

The yellow face is the "front" face of the ground floor, translated backward.

On the left it overshoots

On the right it undershoots

I guess my problem is that all my operations are based on the scope of my model, which is rectangular, but my shape, so my model, are not.

What would be the best way to handle this ?

Thank you.

Thibault

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DevinLavigne
Occasional Contributor III

I see whats happening - your Transformation command t(0,0,-corridorWidth)is shifting along the Z-axis of the shape - so straight back, but that "straight back" is not aligned with your object since - like we know - your shape isn't square.

What I have done with the code below is isolated your ground floor - then split off the corridorWidth with a NIL so its gone. The result should be what you are looking for - on the left...

/**

* File:    Thibault-NEW.cga

* Created: 17 Aug 2014 07:08:00 GMT

* Author:  devlavigne

*/

version "2014.0"

attr HEIGHT = 9.5

attr groundFloorHeight = 4

attr floorHeight = 4

attr roofHeight = 1.5

attr groundFloorElevation = 0.20

attr corridorWidth = 2

@StartRule

Building-->

    [extrude(groundFloorHeight) LowerMass]

    UpperMass

UpperMass-->

    t(0,groundFloorHeight,0)

    extrude(HEIGHT-groundFloorHeight)

    split(y){floorHeight:Floor | roofHeight:Roof}

LowerMass-->

    split(y) {groundFloorElevation:GroundFloorElevation | GroundFloorBuilding}

GroundFloorBuilding-->

    split(z) {GroundFloorFacades | corridorWidth:NIL }

GroundFloorFacades-->

    comp(f){

        front:GroundFloorFacade|

        left:GroundFloorBuildingLeft|

        right:GroundFloorBuildingRight|

        back:GroundFloorBuildingBack}

GroundFloorFacade-->

    color("#FFFF00")

View solution in original post

0 Kudos
8 Replies
MatthiasBuehler
Occasional Contributor III

A -->

     innerRect

     Continue.

Check the CGA docs if needed.

Ok ?

Matt

0 Kudos
ThibaultThibault
New Contributor

innerRect is a solution, but I would like not to modify the extent of my buildings.

What I am trying to do is maybe not possible, but I'd like to understand how to write a code similar to:

@StartRule

A -->

    extrude(5)

    split(x){

        '0.5:B|

        '0.5:C}

and get something like :

instead of :

Thank you.

Thibault

0 Kudos
DevinLavigne
Occasional Contributor III

In your 2nd example above, what is the shape you are starting with - its a little unclear. It looks like a mirror operation could work, unless your starting from the triangle on the left.

The solution you are looking for might be tweaking the the code in what you are trying to do. I've applied all types of rules to all types of building footprints from GIS data and I can assure you probably none of them were perfectly square.

0 Kudos
ThibaultThibault
New Contributor

The second example is maybe a little confusing.

https://community.esri.com/servlet/JiveServlet/showImage/2-397489-3568/pastedImage_12.png

The model (in dark grey) is manually edited, from a 2d shape (extent of a building, totally not rectangular), extruded, then I manually splited each faces to simulate what I am trying to achieve trough CGA.

If you go back to the first example part two, using comp(f), it shows what I am really trying to do.

Using Matt suggestion with "innerRect" solve the over/undershoot issues (see the yellow face) :

but the building doesn't follow the extent any more. And as I have a few of these buildings next to each other, I have gaps in between :

instead of :

but here I have the under/overshoot issues (it is the first example) :

0 Kudos
ThibaultThibault
New Contributor

Here is a simplified (and incomplete but working) version of the CGA code with which I am having trouble :

--

version "2014.0"

attr HEIGHT = 0

attr groundFloorHeight = 4

attr floorHeight = 4

attr roofHeight = 1.5

attr groundFloorElevation = 0.20

attr corridorWidth = 2

@StartRule

Building -->

    //innerRect

    extrude(HEIGHT)

    split(y){

        groundFloorHeight:GroundFloor|

        floorHeight:Floor|

        roofHeight:Roof}

   

GroundFloor -->

    split(y){

        groundFloorElevation:GroundFloorElevation|

        ~1:GroundFloorBuilding}

GroundFloorBuilding -->

    comp(f){

        front:GroundFloorFacade|

        left:GroundFloorBuildingLeft|

        right:GroundFloorBuildingRight|

        back:GroundFloorBuildingBack}

       

GroundFloorFacade -->

    t(0,0,-corridorWidth)

    color("#FFFF00")

GroundFloorBuildingLeft -->

    split(x){

        ~1:GroundFloorBuildingSideWall|

        corridorWidth:NIL}

GroundFloorBuildingRight -->

    split(x){

        corridorWidth:NIL|

        ~1:GroundFloorBuildingSideWall}

--

Resulting model with over/undershoot issues on the yellow face:

0 Kudos
DevinLavigne
Occasional Contributor III

I see whats happening - your Transformation command t(0,0,-corridorWidth)is shifting along the Z-axis of the shape - so straight back, but that "straight back" is not aligned with your object since - like we know - your shape isn't square.

What I have done with the code below is isolated your ground floor - then split off the corridorWidth with a NIL so its gone. The result should be what you are looking for - on the left...

/**

* File:    Thibault-NEW.cga

* Created: 17 Aug 2014 07:08:00 GMT

* Author:  devlavigne

*/

version "2014.0"

attr HEIGHT = 9.5

attr groundFloorHeight = 4

attr floorHeight = 4

attr roofHeight = 1.5

attr groundFloorElevation = 0.20

attr corridorWidth = 2

@StartRule

Building-->

    [extrude(groundFloorHeight) LowerMass]

    UpperMass

UpperMass-->

    t(0,groundFloorHeight,0)

    extrude(HEIGHT-groundFloorHeight)

    split(y){floorHeight:Floor | roofHeight:Roof}

LowerMass-->

    split(y) {groundFloorElevation:GroundFloorElevation | GroundFloorBuilding}

GroundFloorBuilding-->

    split(z) {GroundFloorFacades | corridorWidth:NIL }

GroundFloorFacades-->

    comp(f){

        front:GroundFloorFacade|

        left:GroundFloorBuildingLeft|

        right:GroundFloorBuildingRight|

        back:GroundFloorBuildingBack}

GroundFloorFacade-->

    color("#FFFF00")

0 Kudos
ThibaultThibault
New Contributor

Hi Devin,

Your solution works well.

Isolating the lower mass (ground floor) of the building and applying a "split(z)" before a "comp(f)" is a good workaround (instead of a "comp(f)" and a split() on each facade one after another). It avoids over/undershooting and it is much simpler.

Thank you for your help.

Thibault

0 Kudos
MatthiasBuehler
Occasional Contributor III

Good you guys found a solution !

0 Kudos