It looks like there is an issue where a particular floor plan will generate an infinite rafter parallel to the z-axis (and also not-so-right geometry at the intersection of 2 hips).
See if you can reproduce the bug by starting with the following face in the xy-plane:
points = [
Geom::Point3d.new(327.593, 1082, 0),
Geom::Point3d.new(327.593, 224.52, 0),
Geom::Point3d.new(692.16, 224.52, 0),
Geom::Point3d.new(813.08, 123.019, 0),
Geom::Point3d.new(1073.71, 123.019, 0),
Geom::Point3d.new(1199.38, 224.52, 0),
Geom::Point3d.new(1395.05, 224.52, 0),
Geom::Point3d.new(1395.05, 1082, 0)
face = Sketchup.active_model.entities.add_face(points)
It also appears that the order of selecting edges around the outline matters. I’ve created a simple T-shaped floor plan and the geometry is messed up when starting from the very bottom edge and going counter-clockwise (note that the roof was correctly created when starting from the very right edge – while also following the CCW direction).
My own 3D hip-roof tool (although very basic in comparison to yours) simply lets the user pick the face and the geometry is generated right away. I feel like there is an implementation issue with how you are constructing the straight skeleton as a different starting point should not affect the final geometry (given that the same CCW direction is used).
You can also do something cool if you allow the user to select the face. Here are two examples of buildings that feature interior holes.
You are correct, if the user were able to select the face then the possibility of having interior holes as you’ve shown could be implemented. This is something I need to do.
What is the name of your roof tool?
I will give you more details in a PM.
The issue with this roof is that the straight skeleton is breaking down. The correct straight skeleton is shown below:
At this point I think my straight skeleton algorithm has run into some specific limitations. I may need to revisit it and come up with a more robust straight skeleton algorithm which can handle the most severe roof geometry. It certainly will not handle interior holes in its current configuration.
The straight skeleton generated using my tool agrees with the one above. It’s a very unrealistic case anyway (like the crazy buildings with holes ).
its like popcorn… you’ll see what I mean…
It should be noted that this also happened once before when simply drawing the roof, I don’t think the subtractive geometry has anything to do with it.
for Nathan Test 2.skp (456.6 KB)
Error: #<NoMethodError: undefined method `normal' for nil:NilClass>
c:/users/linea/appdata/roaming/sketchup/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_complex_rafters.rbe:1258:in `block in draw_ridges'
c:/users/linea/appdata/roaming/sketchup/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_complex_rafters.rbe:1132:in `each'
c:/users/linea/appdata/roaming/sketchup/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_complex_rafters.rbe:1132:in `draw_ridges'
c:/users/linea/appdata/roaming/sketchup/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_complex_rafters.rbe:138:in `draw_framing'
c:/users/linea/appdata/roaming/sketchup/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_complex.rbe:1539:in `draw_selector_complex'
c:/users/linea/appdata/roaming/sketchup/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_complex.rbe:589:in `main_menu_roof_edit'
c:/users/linea/appdata/roaming/sketchup/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_complex.rbe:664:in `roof_regen_menu'
c:/users/linea/appdata/roaming/sketchup/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_load.rbe:682:in `block (2 levels) in <module:MedeekTrussPlugin>'
Let me take a look at that, it is something breaking down in the ridge framing module.
It had been a long time since I had to go back through my notes from my college career. I had completely forgotten how to solve sloped roofs.
Version 3.3.1d - 09.09.2023
- Fixed a bug within the global settings for complex roofs.
- Updated the straight skeleton algorithm to better remove redundant edges within roof planes/faces.
- Improved the robustness of the complex roof module (framing and cladding) for specific cases.
The complex roof module is now a bit more robust than it was and should be able to handle more cases than it did previously.
However there still does exist the special cases where the fascia line is not all on one level that is still not possible to draw. The discussion on that topic is presented in this video:
Hip and Ridge is still pending. Previously I was unable to fully work out the algorithm in order to deal specifically with flying hips. I will need to give this another hard look and see if my topological problem solving skills have improved since 2021.
This one has 28 roof planes:
With my 10 year old computer it takes about 15 seconds to regenerate. A bit slow but it might also be partly my computers fault.
Another thing that I realized is that my roof plane labeling algorithm ended at “Z”, I’ve now extended it to allow for up to 50 roof planes. More than that and I think one should consider splitting their complex roof into smaller “chunks”.
Also, previously the sheathing and cladding groups were simply labeled (instance name) as either “SHEATHING” or “CLADDING”. Now each piece will have its roof plane letter appended (ie. SHEATHING_A, SHEATHING_B etc…), this will come in handy when complex roofs are added to the estimating module.
Currently working on the estimating module for complex roofs, this one should be interesting and if it works it will be rather impressive.
First look at some estimating output for a complex roof with 10 roof planes:
Notice I haven’t added any rafters yet.
Similar to regular rafter roofs, the estimating module will calculate not only total area but net area for sheathing and cladding, so roof connections and boolean subtractions are accounted for.
Version 3.3.2 - 09.17.2023
- Added statistics for complex roofs (Medeek Estimator integration).
Tutorial 25: Estimating Complex Roofs (13:13 min.)
Version 3.3.3 - 09.22.2023
- Improved the responsiveness of the “Edit Roof Plane” tool and the “Move Roof Edge” tool for complex roofs.
Previously when a complex roof was positioned on top of any wall assemblies and either of the two tools mentioned above were executed there existed the possibility of collinear edges with the roof assembly and the wall assemblies below. This conflict would then not allow one to properly select the desired roof edge unless the wall assemblies were hidden, or put on a hidden tag/layer. This fix should mitigate that problem and allow one to select a roof edge (on the roof outline) without having to take that additional step.
I highly recommend upgrading to this latest version if you are using complex roofs.