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.
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)
------------ 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:
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)
------------ 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: