This isn't always perfect, but it's a trick I use and works well - I scale up the roofplane and then center it.
/**
* File: Geonet_Overhang.cga
* Created: 27 Sep 2017 15:58:51 GMT
* Author: Devin Lavigne
*/
version "2017.0"
#THIS IS A PERCENTAGE
@Range(1.0,2.0)
attr overHang=1
@Range("Shed","Pyramid")
attr roofStyle = "Shed"
@StartRule
Generate-->
extrude(10)
comp(f) {top:RoofPlane | side:Wall}
RoofPlane-->
s('1*overHang,'1*overHang,'1) center(xy)
BuildRoof
BuildRoof-->
case roofStyle=="Shed": roofShed(10)
else: roofPyramid(40)
Here's some ancient code I wrote once to make a "true" overhang, unfortunately it only works properly for buildings with equal width and depth due to the trig used to calculate the y-offset. You could always eyeball it, though. Or just change it to have a floating "tent" hovering close above the structure.
attr overHang = 5
attr roofAngle = 30
@StartRule
Lot -->
extrude(1)
s(20,10,20)
center(xz)
comp(f){top: Roof RoofOverhang| all: NIL.}
Roof -->
roofPyramid(roofAngle)
RoofOverhang -->
s(scope.sx+overHang*2, scope.sy+overHang*2,'1)
roofPyramid(roofAngle)
center(xz)
split(y){overHang*tan(roofAngle): Overhang | ~1: NIL}
Overhang -->
t(0,-(overHang)*tan(roofAngle),0)
comp(f){top: styleOverhang | bottom: NIL}
Thanks!