Gable/Hip Overhang and Testing against overlaps

2056
3
03-17-2014 10:47 AM
curtedmonds
New Contributor III
Hi All,

The problem I face is I would like to create a roof with volume (not just a flat poly but with height extrusion) and overhang.
Then test this overhang (on a gable or hip roof) and remove if it touches another building or roof section.

#1 The complications with this is the roof section overhang (side next to removed one) should adjust accordingly.
#2 The volumes are not just rectangles ..includes T and U based volumes
#3 extrusions should be on whole roof as single poly to avoid internal and unwanted polys.


things stopping me further:

#direction great for rectangles but not for other shapes
doCreateGableRoof(isCorner ) -->
    case scope.sx > scope.sy :
        roofGable(InternalRoofAngle,InternalRoofOverhang, InternalRoofOverhang, false, 1)
        doCreateGableRoofSideRemove(isCorner )
    else:
     roofGable(InternalRoofAngle, InternalRoofOverhang, InternalRoofOverhang, false, 0)
     doCreateGableRoofSideRemove(isCorner )

#test seem to fail when U and T shapes and other unknown volumes > 8 vertex
#tests have to be volumes so I have to cut roof at overlap section
#orientation unknown
#sides don't know if a touch has happened to side next to itself
#false test , one needs to know which is the long section (gable) so a split can be created at length ends to test
and a few others I can remember...

some ideas:
#just move roof up and find way to create overhang after the roof is created (dont know options for this) extrude down to create illusion of roof volume
#slice and dice everything on extruded volume (poly count = 😞  )
#give up...
#find hidden function that does this

any ideas welcome
c
0 Kudos
3 Replies
curtedmonds
New Contributor III
So ...
This does not seem totally possible with the engine, my rough starting point for those interested:

#insure direction of Gable is aligned
doCreateGableRoof -->
    case scope.sx > scope.sy :
        roofGable(InternalRoofAngle,InternalRoofOverhang, InternalRoofOverhang, false, 1)
        doCreateGableRoofSideRemove(isCorner )
    else:
     roofGable(InternalRoofAngle, InternalRoofOverhang, InternalRoofOverhang, false, 0)
     doCreateGableRoofSideRemove(isCorner )

#get the side section out of a gable roof
doCreateGableRoofSide -->
       comp(f) {top=doCreateGableRoofTest | bottom:NIL | side:col.PINK }

#see if the roof top section has more than 2 faces if so different case (ie:not possible with engine..lots of hacking needed)
doCreateGableRoofVolumeTest-->
case  geometry.nFaces() > 2:
   col.RED
else: #this should be triangle overhang
split(x) { InternalRoofOverhang: doSplitTestExtrude
   | ~1: col.ORANGE #middle section,will need another split for long edge
   | InternalRoofOverhang:doSplitTestExtrude
   }


#extrude
doSplitTestExtrude-->
  extrude(world.y, -RoofThickness)
  doCreateTouch

#test overlap if it overlaps NIL out and clean up edge

doCreateTouch()-->
case overlaps(inter): #overlap so cap end
   split(x) { RoofThickness/2:col.GREEN| ~1:NIL }
   else : # all good so cap end
   split(x) {  ~1:col.ORANGE |RoofThickness/2:col.GREEN}

my lesson so far is the programming language needs further development to be considered a complete procedural modeling tool.
0 Kudos
curtedmonds
New Contributor III
With persistence comes reward...sort of

Cant do it the logical way but....the trick seems to be use edges to "simulate" the overhang and special case the Triangle section
eg:
#section off side of cable ie:Triangle
doSeperateEdgesAndTriangle(isCorner) -->
comp(e) {ridge: i("builtin:cube")  s('1, RoofThickness, RoofThickness)  center(yz) doGableTopSectionRidge
   | hip:  i("builtin:cube")  s('1, RoofThickness, RoofThickness)  center(yz) doGableTopSectionHip
   | eave: i("builtin:cube")  s('1, RoofThickness, RoofThickness)  center(yz) doGableTopSectionEave
    }
comp(f) {top=doGableTopSection(isCorner ) | bottom:NIL | side:alignScopeToAxes(y) doGableTriangleSectionAndEdge(isCorner ) }#=doCreateGableRoofTest2 }


#the Triangle section special case example
doGableTriangleSectionAndEdge(isCorner )-->
doGableTriangleSection
comp(e) {  3:NIL | 1:  doGableTriangleSectionEdge(isCorner ,1) | 2:  doGableTriangleSectionEdge(isCorner ,2)  }
          
hope this helps others, has caused be many late nights and loose hair...again
0 Kudos
MatthiasBuehler1
Frequent Contributor
Hi,

Thanks for the insights ! ( in-sigh-ts ) 🙂
0 Kudos