Looking to Subdivide a parcel based on calculated total building square footage

2431
4
Jump to solution
07-18-2013 06:10 AM
SeanAdkins
New Contributor
I am trying to subdivide a parcel based on the calculate building height. In my code I first have calculated a random building height based on zoning codes.  I then am trying to subdivide a lot based on whether or not the building can be legally built on that parcel.  Let me sketch it out the loop I am trying to create:

If LotSize >= 5000:
  While TotSqft > 43711.30436:
     Split the Parcel
Else: Build the Building

Right now I am trying to incorporate this into my cga file.  I am wondering if I should just write a separate python script to do this. 

Copy+Pasted my code below:

#-----------------------------
#Maryland Department of Planning
#Planning Data Services
#301 West Preston Street
#Baltimore, MD  21201

/**
* File:    developmentCap.cga
* Created: 12 Jul 2013 13:48:20 GMT
* Author:  ----------
*/
#revised 7/18/13
version "2012.1"

###################
#SET UP ATTRIBUTES
###################
#maximum 75 foot building height
#using 11.5 for minimum of 3 storeys (mixed use)
@Hidden
attr height = rand (11.5, 22.86)
@Hidden
attr LotSize = geometry.area / 0.09290304
#attr LotWidth =
@Hidden
#Maximum 40 units per acre.
#Average Unit Sqft size in downtownSby: 1092.782609ft2 = 101.52m2
#40 * 101.52 = 4060.8 total sqft.
@Hidden
attr distanceStreet = 1.524
@Hidden
attr distanceInnerLot = 3.048
@Hidden
attr floorH = 3.5
@Hidden
attr utilH = floorH/2
@Hidden
attr groundFloorH = 4
@Hidden
attr windowW = 2.5
@Hidden
attr doorW = 3.5
@Hidden
attr white = "#ffffff"
@Hidden
attr storeys = (1.15 + height)  / (floorH)
@Hidden
attr tileW = 3
const groundEntrance = "facade/ModernEnt.png"
const window_tex = "facade/windows/1_glass_2_blue.tif"
const roof_tex = "otherTex/blackRoof.png"

#########################
#CBD ZONING REGULATIONS
#########################

#Maximum building height of 75 feet,
#accounted for in attribute setup.

#Lot width minimum of 50 ft;
#Not possible to code in an iterator code
#Need a hard value

#Maximum 40 units per acre.
#Average Unit Sqft size in downtownSby: 1092.782609ft2 = 101.52m2
#40 * 1092.782609 = 43711.30436 total sqft per building
#Multiply lot size by storeys to find total sqft.
TotSqft = LotSize * storeys
#Also; Lot area minimum of 5,000 square feet:

@StartRule
ParcelStart -->
case LotSize < 5000: ParcelFront
case TotSqft > 43711.30436 : BlockSplit
else: NIL

BlockSplit -->
split(z) {'1 : ParcelFront | '1 : OpenSpace}*
#Minimum 5 foot setback from street:
#Minimum 10 foot setback from interior lot lines * Wicomico River:
#Using 10 setback all around for better pedestrian access
ParcelFront -->
setback(distanceInnerLot){ street.front: OpenSpace | remainder: ParcelRear }
ParcelRear -->
setback(distanceInnerLot){ street.back: OpenSpace | remainder: ParcelSide }
ParcelSide -->
setback(distanceInnerLot){ street.side: OpenSpace | remainder: Lot }
OpenSpace -->
color("#77ff77")

########################
#CREATING THE BUILDING 
########################

Lot -->
extrude(height) Building
Building -->
comp(f){ front : FrontFacade | side : SideFacade | top : Roof }
FrontFacade -->
split(y){ groundFloorH : GroundFloor | { ~floorH : Floor }* }
SideFacade -->
split(y){ groundFloorH : Floor | { ~floorH : Floor }* }
Floor -->
split(x){ 1 : Wall | { ~tileW : Tile }* | 1 : Wall }
GroundFloor -->
split(x){ 1 : Wall | { ~tileW : Wall }* | ~tileW : EntranceTile | 1 : Wall }
Tile -->
split(x){ ~1 : Wall | 2 : split(y){ 1 : Wall | 1.5 : Window | ~1: Wall } | ~1 : Wall }
EntranceTile -->
Entrance

#######################
#CREATING THE WINDOWS
#######################

Window -->
s('1,'1,0.4)
t(0,0,-0.05)
Glass

############
#TEXTURING
############

Wall --> color(BuildingColor)
Blind --> color(WindowTop)
Frame --> extrude (frameE) color(white)
Glass -->
projectUV(0)
texture(window_tex) color(white)
set(material.specular.r,0.4)
set(material.specular.g,0.4)
set(material.specular.b,0.4)
set(material.shininess,4)
set(material.reflectivity,0.3)
Entrance -->
setupProjection(0, scope.xy, scope.sx, scope.sy) projectUV(0)
set(material.colormap, groundEntrance)
Roof -->
setupProjection(0, scope.xy, scope.sx, scope.sy) projectUV(0)
set(material.colormap, roof_tex)

@Range(0,4)
@Hidden
attr OuterWall = 25%:1 25%:2 25%:3 25%:4 else:0

BuildingColor =
case OuterWall == 1: "#FFB870"
case OuterWall == 2: "#E0C266"
case OuterWall == 3: "#FFE6B6"
case OuterWall == 4: "#ECDAA3"
else : "#99FF99"

#HISTORIC regulation
#Must use appropriate colors and design



Thanks for any and all help!
0 Kudos
1 Solution

Accepted Solutions
MatthiasBuehler1
Frequent Contributor
hey Sean,

parcelling is a bit tricky in CGA since there's still some CGA features missing to do this well.

the first step would be to understand recursions in CGA :

check out this code and let me know if this makes sense to you :

it's basically a counter, but you'd use the same approach, just with the area.

Lot -->     Rec(5)  Rec(n) -->      case n == 0 :         NIL     else :         doSomething         Rec(n-1)


let me know if this start makes sense.

matt

View solution in original post

0 Kudos
4 Replies
MatthiasBuehler1
Frequent Contributor
Hi,

How's 'TotSqft' defined ?


I'm not perfectly sure if I understood your pseudo-code right. Can you explain it a bit precise, maybe with a screenshot with a few cut lines ? Doesn't need to be perfect, just to show the 'flow of the code'.

lemme know..

Matt
0 Kudos
SeanAdkins
New Contributor
I'll get precise. I convert from square meters into feet when calculating lot size. Then I calculate the total estimated square feet of the lot size based on stories.

attr height = rand (11.5, 22.86)
attr LotSize = geometry.area / 0.09290304
attr floorH = 3.5
attr stories = (1.15 + height) / (floorH)
TotSqft = LotSize * stories


Here is where I find the minimum lot requirement. That works fine. Then I determine if the lot size is too large.  This also works.

ParcelStart -->
  case LotSize < 5000: ParcelFront
  case TotSqft > 43711.30436 : BlockSplit
  else: NIL


Here is where I am having problems. I am not sure how to split the parcels up. I have curved and irregular parcels so I can't do a defined size.  I want the parcels to split following this logic (I tend to think in Python);
-While TotSqft > 43711.30436:
--Split the Parcel

BlockSplit -->
  split(z) {'1 : ParcelFront | '1 : OpenSpace}*


(ParcelFront simply starts creating setbacks and extruding the building)

Again thanks for responding and helping me out!
0 Kudos
MatthiasBuehler1
Frequent Contributor
hey Sean,

parcelling is a bit tricky in CGA since there's still some CGA features missing to do this well.

the first step would be to understand recursions in CGA :

check out this code and let me know if this makes sense to you :

it's basically a counter, but you'd use the same approach, just with the area.

Lot -->     Rec(5)  Rec(n) -->      case n == 0 :         NIL     else :         doSomething         Rec(n-1)


let me know if this start makes sense.

matt
0 Kudos
SeanAdkins
New Contributor


Lot -->
    Rec(5)

Rec(n) -->
     case n == 0 :
        NIL
    else :
        doSomething
        Rec(n-1)


let me know if this start makes sense.

matt


I get it. It's a little different than python but I'm getting it to work, well better at least. Will let you know if there are any other issues, thanks for taking the time to answer my question!
0 Kudos