Grasshopper pitched roof file not working on site of boxes

Hi , I am new to grasshopper and I have a rhino file of a site full of houses that are now in the shape of boxes. How do i apply a simple pitched roof to all of the boxes.

I have this grasshopper file but its not working on my geometry.

Thank you! (14.2 KB)



Thank you for replying !
I think there is something weird in the site file’s geometry
when i draw a box in rhino and apply the grasshopper geometry to it , it works.
however when i apply it to the geometry in my site file, it doesn’t.
In the screenshot , the box on the left is a box i drew in rhino and applied grasshopper geometry
the box on the right is a box i copied and pasted from the site file .


roof.3dm (252.9 KB)

The problem is that you assumed the top of the box will always be at index position 5 (last) in the list of faces from Explode (AKA DeBrep or Deconstruct Brep). That’s not always the case. The solution is to sort the surfaces by the ‘Z’ value of their center points; Area C (Centroid) or, as I’ve done here in the white group, DiscAvr (which is faster but will fail if the surface isn’t a rectangle or regular polygon). (28.6 KB)

Geometry is internalized in this GH file, no need for the Rhino file.

Oops, there appears to be a problem (older version?) copying the Geo works geometry parameter. Replaced in this copy with GH Version 0.9.0076 Geo parameter. (44.1 KB)

i am new to grasshopper and i am having a problem by baking the final roof geometry. When i bake it, only a flat surface is generated over my geometry.

It all depend were you click for baking. You must click on components that output the roof geometry. Change the preview geometry to selected object only green button icon on top right and seek for the roofs

Still not working but thanks for the atention… which would be the components ?

The grasshopper definition creates Invalid breps (I don’t know why, haven’t looked into it properly). You cannot bake invalid breps.

Here a script with my script, it bakes without problem.

roof_2018Feb4b (56.7 KB)
If you want color bake the preview, bake with the mouse over the icon of preview component. On G it bakes without color.
Also like Siemen showed, it is always good to see the output information and to post a script.

Finally! Thank you so much!!!

Im new to grasshopper and your script looks awesome! When I click on the link to your script, it says “private or doesn’t exist” would you be able to repost? I may be missing something obvious.

Thanks so much! greatly appreciated!!

this is the problem. Server problem with the old files.

roof_2018Feb4b (56.7 KB)

I got it working perfectly! thank you so much for reposting!