(Tutorial 16) How to clip the grid to the shape area ?

674
2
05-05-2017 08:50 AM
KushanDave
New Contributor

Hello everyone,

 

Wonder if there is a way to 'clip' the grid that is created by Marker_Based_Building.cga (rule by Matthias Buehler) to just the shape that is being applied to ? Appreciate all the responses. 

 

 

Thanks. 

 

tut_16_Ref

 

------------------------------------------------------------ PART RULE BELOW -------------------------------

 

@StartRule
Building_Marker -->
alignScopeToAxes(y)
s(mainLength, 0, mainDepth)
center(xz)
primitiveCube()
comp(f) {bottom: alignScopeToAxes(y) reverseNormals CreateGrid | all : NIL
}

 

CreateGrid --> 
s(gridWidth * scope.sx + (gridWidth - 1) * gridDistWidth, 0, gridDepth * scope.sz + (gridDepth - 1) * gridDistDepth)
center(xz)
GridSplitX

 

GridSplitX -->
split(x) {{mainLength : GridSplitZ | ~gridDistWidth : NIL}* | mainLength : GridSplitZ }

 

GridSplitZ -->
split(z) {{mainDepth : FootprintBase | ~gridDistDepth : NIL}* | mainDepth : FootprintBase }

 

FootprintBase -->
r(scopeCenter, 0, buildingRotation, 0)
FootprintForm

 

 

FootprintForm -->

 

case footprintForm == "Rectangle":

mirrorScope(footprintMirrorWidth, false, footprintMirrorDepth)

SHAPE_BASED_BUILDING.Footprint   (footprint rules)

0 Kudos
2 Replies
CherylLau
Esri Regular Contributor

You could try to use occlusion queries.  Create a shape (needs to be closed shape with volume) that has the boundaries of your initial shape.  Then, before creating each building, test for occlusion.

Occlusion Query Functions 

0 Kudos
KushanDave
New Contributor

Thanks Cheryl. That seemed to do the trick.

0 Kudos