Lot sizes rule

623
2
Jump to solution
05-28-2013 12:49 AM
StevenCuthbert
New Contributor III
Hi,

I'm currently trying to write a rule that will allow me to create buildings based on lot sizes. If the lot is too big, split the building; if it is too small, reduce setbacks. At the moment i have randomised variations to make the buildings all different sizes. Except with smaller lots, I'm getting very thin buildings extruded. So I've added a case clause to try and sort this out, but to no avail.

Also, i can't seem to do multiple setbacks unless they're nested in each other within the Lot function. I would like the setbacks to be part of the case clause, but yet again...I'm struggling. Attached is my code.

Any help would be delightful.

Cheers,
Steve
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Steve,

Here's a bit of your code rearranged based on what you are describing:

@StartRule
Lot -->
case (geometry.area() > 2000):
  # If the lot is too big, make more lots.
  ResidentialBlock
case (geometry.area() < 500):
  # If lot is too small, reduce setbacks.
  DoSetbacks(0.5)
else:
  # Otherwise make a building using usual setbacks.
  DoSetbacks(1)

ResidentialBlock -->
split(z){ ~Building_Width : DoSetbacks(1) | ~Distance_Seperation : NIL }*

DoSetbacks(reduceSetbackPercent) -->
setback(Front_Yard_Depth * reduceSetbackPercent) { street.front: NIL | remainder:
  setback(Rear_Yard_Depth * reduceSetbackPercent) { street.back: NIL | remainder:
    setback(Side_Yard_Width * reduceSetbackPercent) { street.side: NIL | remainder:
     Grow
   }
  }
}

Grow -->
extrude(rand(6,8))

------------
I just moved the checking of the lot size to the first rule, since it seems to be how your logic is flowing. It seems that your ResidentialBlock  rule is concerned with making more lots when a lot is too big, so I moved setbacks to a later step. Does this seem to help?

Also, to check for very narrow shapes you can use something like this:

YourRule -->
case scope.sx > scope.sz * 5 || scope.sz > scope.sx * 5: HandleNarrowShape
else: HandleNormalShape

View solution in original post

0 Kudos
2 Replies
by Anonymous User
Not applicable
Steve,

Here's a bit of your code rearranged based on what you are describing:

@StartRule
Lot -->
case (geometry.area() > 2000):
  # If the lot is too big, make more lots.
  ResidentialBlock
case (geometry.area() < 500):
  # If lot is too small, reduce setbacks.
  DoSetbacks(0.5)
else:
  # Otherwise make a building using usual setbacks.
  DoSetbacks(1)

ResidentialBlock -->
split(z){ ~Building_Width : DoSetbacks(1) | ~Distance_Seperation : NIL }*

DoSetbacks(reduceSetbackPercent) -->
setback(Front_Yard_Depth * reduceSetbackPercent) { street.front: NIL | remainder:
  setback(Rear_Yard_Depth * reduceSetbackPercent) { street.back: NIL | remainder:
    setback(Side_Yard_Width * reduceSetbackPercent) { street.side: NIL | remainder:
     Grow
   }
  }
}

Grow -->
extrude(rand(6,8))

------------
I just moved the checking of the lot size to the first rule, since it seems to be how your logic is flowing. It seems that your ResidentialBlock  rule is concerned with making more lots when a lot is too big, so I moved setbacks to a later step. Does this seem to help?

Also, to check for very narrow shapes you can use something like this:

YourRule -->
case scope.sx > scope.sz * 5 || scope.sz > scope.sx * 5: HandleNarrowShape
else: HandleNormalShape
0 Kudos
StevenCuthbert
New Contributor III
Thank you so much for your help.

Life saver.
0 Kudos