Setback Rule Problem

806
4
03-31-2020 05:49 PM
Kevin_Z
New Contributor II

Hi All 

Hope you all are safe and well

I have a problem with my cga code that I have no idea how to fix. Trying to create edge fence for Lots by using the setback rule, what  I have are Lots has street attribute. When I use the setback rule it works fine until i extrude it. As shown below somehow the edge that was the back of the street was extruded the same as street front whilst the sides worked fine.

Please help

The code I used:

version "2019.1"

@Enum ("yes","no")

attr fencing =    "no"

attr fence_Width =0.025

 

@StartRule

Lot -->

cleanupGeometry(all, 0.1)

print(array)

Lawn_Border

 

Lawn_Border-->

case fencing=="yes": offset(-fence_Width) Build_Fence

else: Lawn

 

 

 

Build_Fence   --> comp(f) { inside = Lawn | border= Fence_Sort }

 

Fence_Sort--> setback( comp(fe) { street.front = 5 }) { all =  Front_Fence label("Front Fence") | remainder=Rear_Fence}

Front_Fence-->

extrude(world.y,1.2)

Rear_Fence-->

extrude(world.y,1.8)

 

 

Lawn-->    

            extrude(0.05)

            color("#b3c989")

0 Kudos
4 Replies
CherylLau
Esri Regular Contributor

I'm not exactly sure what result you expected.  What is wrong with the front and back extrusions in the screenshot?

Did you want to create a fence around a lot where the fence on the street.front side is setback some distance while the fences on all other sides remain on the edge of the lot?  If so, then I would recommend a different approach.  In your code, performing an offset to get the border faces and then performing a setback on those faces is probably not what you intended because the setback is trying to perform setbacks on all 16 edges (4 edges per border face x 4 faces).

I would recommend doing the setback first to get the polygon whose edges are where you want your fence to be.  Then, create your fence.  You can either create your fence by using offset and extrude (as you did in your code), or if you want a more complicated fence, you can use one of the fence rules from ESRI.lib.

Lot -->
     setback(comp(fe) {street.front: 5}) { all= Lawn | remainder= FencePolygon }
	
FencePolygon -->
     offset(-fence_width)
     comp(f) { inside= Lawn | border= extrude(fence_height) Fence. }

Fence rules in ESRI.lib:

Fence_On_Polygon.cga and Fence_On_Polygon_Simple.cga create fences along polygon edges.  To use these, change the code as follows:

import Fence_On_Polygon:"/ESRI.lib/rules/Fences/Fence_On_Polygon.cga"

FencePolygon -->
     Fence_On_Polygon.Generate
0 Kudos
Kevin_Z
New Contributor II

Hi Cheryl 

Thanks for the reply, what I'm trying to do something like the image below, that the front yard of the lot installs low fences (maintain street appeal)and the back of rest of the lot uses high fences for (privacy), with the code above the back facing edge(fence) only extruded 1.2 rather than the intended 1.8 so I'm wondering what did I do wrong and how to fix it.

Your code sets back the front yard which splits the polygon up and by given different heights for the  boarders of the two area I can achieve what I want. But  I dont know how to code it such that the split areas can be recombined to be used for applying the local government planning rules.

0 Kudos
CherylLau
Esri Regular Contributor

This code makes a fence where the front is a different height than the other sides.  It performs an offset on a lot and extrudes the offset borders such that the side facing the street front is a different height than the others.

Lot -->
   offset(-fence_depth)
   comp(f) { inside=Lawn | border: r(90,0,0) Fence }
	
Fence -->
   case geometry.isOriented(street.front):
      r(-90,0,0)
      extrude(fence_height_front)
   else:
      r(-90,0,0)
      extrude(fence_height_other)
‍‍‍‍‍‍‍‍‍‍‍
Kevin_Z
New Contributor II

Thank you Cheryl for your great help, 

0 Kudos