Extrusion based on highest vertex after alignment to terrain

434
8
Jump to solution
10-11-2018 06:42 AM
JafarNajafli
New Contributor III

Maybe this question was asked before but I could not find anything about it and it affects all my projects :\

So basically I want CGA to measure my extrusion distance from the HIGHEST vertex of each shape instead of the lowest which is the rule default of extrude(world.up.flatTop). Because when the my buildings are aligned to terrain and extruded based on lowest vertex my building look shorter than they are supposed to in terms of height. 

Picture attached

0 Kudos
1 Solution

Accepted Solutions
MartinManzer
New Contributor II

You are applying the split along the y extent which starts at the lowest y coordinate. The orange ground floor has a height of 3, but because the initial shape is non-planar the height is lower at some vertices.

Here is a modification to you rule.

Lot-->
     alignScopeToAxes(y)
     Extrude(scope.sy)
     
Extrude(nonPlanarHeight) -->
     extrude(world.up.flatTop, height + nonPlanarHeight)
     Building(nonPlanarHeight)
     
Building(nonPlanarHeight) -->
     split(y) { nonPlanarHeight : Basement | { ~floorheight : Floor. }* }
     
Basement --> color("#fc824e")‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

8 Replies
MartinManzer
New Contributor II

Hi Jafar!

You could add the current geometry height to the extrusion height.

For example

Lot --> extrude(world.up.flatTop, myHeight + geometry.height)

or

Lot --> alignScopeToAxes(y)
        extrude(world.up.flatTop, myHeight + scope.sy)

Hope that helps!

0 Kudos
JafarNajafli
New Contributor III

Thanks for your answer Martin, 

but this CGA adds an extra basement to my highest vertex where the extrusion is supposed to be based on. See attachment please. In this case there is a 4 floored building with floorheight of 3 meters. And I want to be extruded to 4*3=12 meters from the highest vertex of the lot.

I want the total height to be not more than 12.50 meters 

0 Kudos
MartinManzer
New Contributor II

You are applying the split along the y extent which starts at the lowest y coordinate. The orange ground floor has a height of 3, but because the initial shape is non-planar the height is lower at some vertices.

Here is a modification to you rule.

Lot-->
     alignScopeToAxes(y)
     Extrude(scope.sy)
     
Extrude(nonPlanarHeight) -->
     extrude(world.up.flatTop, height + nonPlanarHeight)
     Building(nonPlanarHeight)
     
Building(nonPlanarHeight) -->
     split(y) { nonPlanarHeight : Basement | { ~floorheight : Floor. }* }
     
Basement --> color("#fc824e")‍‍‍‍‍‍‍‍‍‍‍‍
JafarNajafli
New Contributor III

thank you. it worked. but I still don't get why there's not a simple option/command to choose whether you want the extrusion to be measured from the lowest or highest vertex of a nonplanar shape.

0 Kudos
MartinManzer
New Contributor II

Happy it worked for you.

We're trying to limit the available parameters and the amount of operations if a goal can also be achieved by a combination of several simpler operations & functions.

0 Kudos
JafarNajafli
New Contributor III

one more question, is nonPlanarHeight a pre-defined function (couldn't find anything about it in CE Help) in here or it is just a symbolic word you put for sync purposes? I am trying to understand the code so I can further develop it myself. thanks in advance for your time

0 Kudos
MartinManzer
New Contributor II

Its a parameterized rule.

See Online Manual.

So "nonPlanarHeight" in rule definition

Extrude(nonPlanarHeight) -->

is just a self-chosen parameter name. Relevant is only that it is called with scope.y

Extrude(scope.sy)

Because in this use case scope.y equals the height of a non-planar shape, it makes sense to give the parameter this name.

0 Kudos
JafarNajafli
New Contributor III

Can you also give me directions on how to start the extrusion from the middle vertice of parcel's street edge?

I know I already asked too many questions but I really appreciate your help:)

0 Kudos