Better algorithm for creating pitched roof (probably)?

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Better algorithm for creating pitched roof (probably)?

Post by ebrahim raeyat »

maybe we can use polygonal_surface_reconstruction in CGAL, but i am not a fan of c++:

https://doc.cgal.org/latest/Polygonal_s ... index.html
polyfit_pipeline.png
polyfit_pipeline.png (142.3 KiB) Viewed 2831 times
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Better algorithm for creating pitched roof (probably)?

Post by ebrahim raeyat »

I added an edges_height parameter for each edge of base roof:
roof.gif
roof.gif (806.26 KiB) Viewed 2770 times
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Better algorithm for creating pitched roof (probably)?

Post by ebrahim raeyat »

There is a library in python named Pyskeleton that can produce (?) nonuniform angle roof:

It works with python2 and have some bugs. I changed the code to work with python3 and remove some of them, but it seems it didn't create the skeleton of the roof correctly:
pyskeleton2.png
pyskeleton2.png (18.06 KiB) Viewed 2726 times
below is the same polygon in FreeCAD with my WB:
pyskeleton_FreeCAD.png
pyskeleton_FreeCAD.png (128.13 KiB) Viewed 2726 times
pyskeleton_FreeCAD_3D.png
pyskeleton_FreeCAD_3D.png (30.2 KiB) Viewed 2726 times
Pyskeleton with different angle(speed), red edge that is half an other edges:
pyskeleton2_weight.png
pyskeleton2_weight.png (18.01 KiB) Viewed 2726 times
I think we can work on this library and correcting the problems. thanks
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Better algorithm for creating pitched roof (probably)?

Post by ebrahim raeyat »

This library works for curved edges:

bpypolyskel
logo.jpg
logo.jpg (247.24 KiB) Viewed 2678 times
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Better algorithm for creating pitched roof (probably)?

Post by bitacovir »

Good job! keep working! :)
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Better algorithm for creating pitched roof (probably)?

Post by ebrahim raeyat »

I implemented gable in roof. My goal is to user click on any edge of the sketch and then convert it to gable line, then I change the skeleton of the roof:
Before convert to Gable:
gable1.png
gable1.png (7.99 KiB) Viewed 2518 times
After convert to gable:
gable2.jpeg
gable2.jpeg (47.06 KiB) Viewed 2518 times
My question:

How can I save the edges that user select? I searched and found the object has "App::PropertyVectorList" but for edges I can't find appropriate property. I wanted to set it in a property, because the user can modify the base shape and the geometry of the sketch maybe change.
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Better algorithm for creating pitched roof (probably)?

Post by ebrahim raeyat »

Until that time, I set it in "App::PropertyIntegerList" property with 0 and 1, 1 denote that the edge is Gable:
gable3.png
gable3.png (14.47 KiB) Viewed 2505 times
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Better algorithm for creating pitched roof (probably)?

Post by ebrahim raeyat »

I added angles property to the roof object. Now edges with 90-degree angle takes as gable and negative angle denote for negative slope:
negative_roof.png
negative_roof.png (10.41 KiB) Viewed 2472 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Better algorithm for creating pitched roof (probably)?

Post by Kunda1 »

Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Better algorithm for creating pitched roof (probably)?

Post by bitacovir »

Kunda1 wrote: Tue Jan 12, 2021 12:30 pm
An aside, just wanted to make you aware of https://github.com/prochitecture/bpypolyskel
Context: https://twitter.com/BlenderBIM/status/1 ... 2951173120
It was already mentioned in the thread...
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
Post Reply