Select to view content in your preferred language

# Rotate innerRect  building

3050
10
10-01-2013 08:02 PM
New Contributor III
Hi all,

I'm trying to rotate a building created by innerRect, so it sits flush with the property boundaries. The attached image shows some buildings not sitting 'naturally' in the lot. Preferably I would like them to site parallel to the lot boundaries away from the road. The only function that seem to rotate it is the 'rotate' tool, but as I'm trying to mass model i haven't found a way to automate the rotation. When looking into the scope.rx etc it just says it's 0, and i'm not sure how i get the angle of the lot boundary so i can align it to it?

Any help with this would be wonderful.

Steve

[ATTACH=CONFIG]27947[/ATTACH]
Tags (3)
1 Solution

Accepted Solutions
Frequent Contributor II
Hi,

ah, I see.

so you'd like to get a rectangular footprint, but oriented to the 'back' of the lot instead of the front, the so-called 'first edge'.

my first idea would be to align the scope to the 'back' edge, as follows :

`attr Building_Height = 9 attr Front_Yard_Depth = 10 attr Rear_Yard_Depth = 10 attr Side_Yard_Depth = 5 attr Roof_Angle = 20 attr Roof_Overhang = 1 attr Floors = (Building_Height/6) attr Rotation = 0  func = rint(geometry.nEdges / 2 )  @StartRule Lot -->  alignScopeToGeometry(yUp, 0, func)  setback(Front_Yard_Depth ) { street.front: NIL | remainder:   setback(Rear_Yard_Depth ) { street.back: NIL | remainder:    setback(Side_Yard_Depth ) { street.side: NIL | remainder:     MakeRectangle    }   }  }    MakeRectangle -->  innerRect  Done.`

Of course, this will not always work, but it may give you an idea.
[ATTACH=CONFIG]28228[/ATTACH]
10 Replies
Frequent Contributor II
Hi,

Sorry, not following. 🙂

Can you post a graphic ?

Let me know.

m.
New Contributor III
Hi Matthias,

I've attached two images which show a before and after of what i would like to happen.

In the before image you can see that the building doesn't sit parallel to the lot boundaries furtherest away from the street.

[ATTACH=CONFIG]27984[/ATTACH]

In the after image below the building sits parallel with the lot boundaries away from the street.

[ATTACH=CONFIG]27988[/ATTACH]

I'm using innerRect to create the initial building footprint, but would like to change it's orientation to fit the lot better. (Liek what's seen in the after image)

Hope this makes more sense 🙂

Steve
Frequent Contributor II
hmm..

'better' is difficult to explain in gemetric terms .. 😉

what's your code so far ?

did you try playing with setback() ?
New Contributor III
Very true. I guess that's why I'm struggling to come up with a way of automating it. I've attached my code so far.

I originally just had setbacks to create my buildings, but this creates odd shaped buildings (triangular) as it depends on the shape of the lot as to how the building looks. So what I'm trying to do is only have buildings that have right angles, but then also have this sitting within a lot that looks realistic.

What i was trying to originally do was set the set the scope's rotation to be the same as the lots, but i couldn't get this to work.
Frequent Contributor II
Hmm. the code's missing .. Can you edit the post ?
New Contributor III
Ah, I didn't notice that cga files aren't valid attachments. I've pasted the code below

attr Building_Height =   9
attr Front_Yard_Depth =  10
attr Rear_Yard_Depth =   10
attr Side_Yard_Depth =   5
attr Roof_Angle =    20
attr Roof_Overhang =   1
attr Floors =    (Building_Height/6)
attr Rotation =    0

@Hidden
attr lotArea =     0
@Hidden
attr bldgArea =    0
@Hidden
attr Floor_Height =   (Building_Height/Floors)
@Hidden
attr bldgVolume =   0

@StartRule
Lot -->
innerRect()
SetBack

SetBack -->
case (geometry.area() > 4500):
report("Lots.largest",1)
DoSetbacks(1.3)
case (geometry.area() > 3500 && geometry.area() <= 4500):
report("Lots.larger",1)
DoSetbacks(1.2)
case (geometry.area() > 1800 && geometry.area() <= 2500):
report("Lots.smaller",1)
DoSetbacks(0.8)
case (geometry.area() < 1800):
report("Lots.smallest",1)
DoSetbacks(0.5)
else:
report("Lots.middle",1)
DoSetbacks(1)

DoSetbacks(reduceSetbackPercent) -->
set(lotArea,geometry.area())
setback(Front_Yard_Depth * reduceSetbackPercent) { street.front: NIL | remainder:
setback(Rear_Yard_Depth * reduceSetbackPercent) { street.back: NIL | remainder:
setback(Side_Yard_Depth * reduceSetbackPercent) { street.side: NIL | remainder:
BuildableArea(reduceSetbackPercent)
}
}
}

BuildableArea(BlgHeightRatio) -->
case (BlgHeightRatio == 1.3):
Up(1.3)
case (BlgHeightRatio == 1.2):
Up(1.2)
case (BlgHeightRatio == 1):
Up(1)
case (BlgHeightRatio == 0.8):
Up(0.9)
case (BlgHeightRatio == 0.5):
Up(0.8)
else:
Up(1)

Up(Height)-->
set(bldgArea,geometry.area())
extrude(Building_Height*Height)
set(bldgVolume,geometry.volume)
report("Floorspace area (m2)",(bldgArea*Floors))
report("Lot Area (m2)",lotArea)
report("Max Building Footprint (m2)",bldgArea)
report("GFA Potential (m3)",bldgVolume/Floor_Height)
report("FAR Potential",bldgVolume/Floor_Height/lotArea)
ResidentialBlock

ResidentialBlock -->
comp(f) { top: Type | all : Side }

Type -->
roofGable(Roof_Angle, Roof_Overhang, Roof_Overhang)

Side -->
A.
Frequent Contributor II
Hi,

Well, your code looks valid, but there's nothing I see that would be specific about bad orientation.

Let's do it like this :

You create about 5 Lot scenario sketches, with how the footprint shall be placed on that lot ( and which form it needs ), plus a few annotations on what you want to orient on. Plus, on which Lot sides any streets are.

Then I can give you better inputs. Sounds ok ?

m.
New Contributor III
The attached image shows a block with individual lots. You'll see that some of the buildings don't run parallel to two boundaries of the lot, therefore the building doesn't sit squarely. I've highlighted the two boundaries edges (blue) that i would like the building boundaries (red) to align to. So in other words i would like the two red edges to be parallel to the two blue edges on the lots I've marked.

The lots i haven't marked look fine, so I'm not to bothered.

[ATTACH=CONFIG]28209[/ATTACH]

Steve
Frequent Contributor II
Hi,

ah, I see.

so you'd like to get a rectangular footprint, but oriented to the 'back' of the lot instead of the front, the so-called 'first edge'.

my first idea would be to align the scope to the 'back' edge, as follows :

`attr Building_Height = 9 attr Front_Yard_Depth = 10 attr Rear_Yard_Depth = 10 attr Side_Yard_Depth = 5 attr Roof_Angle = 20 attr Roof_Overhang = 1 attr Floors = (Building_Height/6) attr Rotation = 0  func = rint(geometry.nEdges / 2 )  @StartRule Lot -->  alignScopeToGeometry(yUp, 0, func)  setback(Front_Yard_Depth ) { street.front: NIL | remainder:   setback(Rear_Yard_Depth ) { street.back: NIL | remainder:    setback(Side_Yard_Depth ) { street.side: NIL | remainder:     MakeRectangle    }   }  }    MakeRectangle -->  innerRect  Done.`

Of course, this will not always work, but it may give you an idea.
[ATTACH=CONFIG]28228[/ATTACH]