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
ragohix769
Posts: 568
Joined: Sat Jul 18, 2020 7:04 am
Location: Rome - Italy

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

Post by ragohix769 »

I found some trouble with the Arch_roof tool with my project:

https://forum.freecadweb.org/viewtopic.php?f=23&t=64584

So knowing that there is another more powerful tool for roof, it's incredible!

It's a pity it's not in the addon manager of the Workbench, it should, so many users can test it easily.
After #ElonMuskBuyTwitter I'm no more on Twitter, that's really enough :-(
=> Now you can find me here on #Mastodon: https://mastodon.uno/@opensoul - I hope more people do the same :-)
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

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

Post by paullee »

As @ragohix769 suggested, this should go into an External Add-on? :)

Or better still, incorporated in official tool.

Kunda1 wrote: ping
Can you indicate how this could be added into the External Add-on?

ebrahim raeyat wrote: ping
Would like to do so?


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 »

paullee wrote: Fri Dec 17, 2021 10:45 pm
Would like to do so?

Thanks.
I added more tools and if I have time, I like to share it with community, like recognizing line type automatically like hip, valley and gutter.
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

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

Post by paullee »

Thanks, hope @Kunda would guide you how to add to the External Add-on :)
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 »

Several methods to create a workbench:
https://github.com/FreeCAD/freecad.workbench_starterkit
https://wiki.freecadweb.org/Workbench_creation
Or just look at the how other workbenches have done it https://github.com/FreeCAD/FreeCAD-addons/

How to add it to the Addon Manager:
https://github.com/FreeCAD/FreeCAD-addo ... collection
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
ProjectBP
Posts: 406
Joined: Tue Jun 06, 2023 2:33 pm
Contact:

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

Post by ProjectBP »

I can say that this solution is great! It would solve a lot of problems with pitched roofs.

Can you tell me if the component works in the latest versions of Freecad (0.20.2-0.21)?
I did everything according to the manual, but the workbench does not appear in the selection.

But I didn't find a component called euclid3 in the repository and installed the python-euclid3 I found (Manjaro-linux/ Archlinux)

An error is displayed in the console:
"During initialization the error "No module named 'euclid3'" occurred in /home/UserName/.local/share/FreeCAD/Mod/PitchedRoof/InitGui.py
Please look into the log file for further information"

We probably need to fix something in line 10 of polyskel.py. (from euclid3 import * ) To make it initialize.

I tried to remove this line altogether and the component went into freecad (but of course it doesn't work)

The available paths to the euclid3 in the system are in the picture.
I would change it myself, but I don't know python at all



UPD/
I put the euclid3.py file in the PitchedRoof component folder and it initialized.
But when I build the roof using the sketch, I get errors:

Code: Select all

Traceback (most recent call last):
  File "/home/USERNAME/.local/share/FreeCAD/Mod/PitchedRoof/roof3d.py", line 84, in execute
    projection_face_points, wire_edges = extrude_pieces.create_3D_roof(base_obj, obj.angle, [], obj.angles)
  File "/home/USERNAME/.local/share/FreeCAD/Mod/PitchedRoof/extrude_pieces.py", line 81, in create_3D_roof
    edges, outer_points_edges = roof_poly.get_skeleton_lines_of_roof(wire, angles)
  File "/home/USERNAME/.local/share/FreeCAD/Mod/PitchedRoof/roof_poly.py", line 59, in get_skeleton_lines_of_roof
    skeleton = get_skeleton_of_roof(sketch)
  File "/home/USERNAME/.local/share/FreeCAD/Mod/PitchedRoof/roof_poly.py", line 19, in get_skeleton_of_roof
    skeleton = polyskel.skeletonize(poly, [])
  File "/home/USERNAME/.local/share/FreeCAD/Mod/PitchedRoof/polyskel.py", line 484, in skeletonize
    slav = _SLAV(polygon, holes)
  File "/home/USERNAME/.local/share/FreeCAD/Mod/PitchedRoof/polyskel.py", line 216, in __init__
    contours = [_normalize_contour(polygon)]
  File "/home/USERNAME/.local/share/FreeCAD/Mod/PitchedRoof/polyskel.py", line 68, in _normalize_contour
    contour = [Point2(float(x), float(y)) for (x, y) in contour]
  File "/home/USERNAME/.local/share/FreeCAD/Mod/PitchedRoof/polyskel.py", line 68, in <listcomp>
    contour = [Point2(float(x), float(y)) for (x, y) in contour]
Recompute failed!

Attachments
Scr_20230608_093449.jpg
Scr_20230608_093449.jpg (39.17 KiB) Viewed 1667 times
Last edited by ProjectBP on Thu Jun 08, 2023 7:13 am, edited 6 times in total.
There may be a misunderstanding :!: . I communicate with the help of a translator :P
User avatar
ProjectBP
Posts: 406
Joined: Tue Jun 06, 2023 2:33 pm
Contact:

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

Post by ProjectBP »

1. Solved the problem with launching the component. Probably the problem was in the cache after the first run.
Completely deleted folder /Mod/PitchedRoof and created it anew. I put file euclid.py in it, renaming it to euclid3.py (taken from https://github.com/euclid3/euclid3)

2. To set the thickness of the roof, you can use extrude on the Z (global) axis.

This is a great solution for multi-pitch roofs! Many thanks to the developer!
There may be a misunderstanding :!: . I communicate with the help of a translator :P
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 »

ProjectBP wrote: Sat Jun 10, 2023 10:15 am 1. Solved the problem with launching the component. Probably the problem was in the cache after the first run.
Completely deleted folder /Mod/PitchedRoof and created it anew. I put file euclid.py in it, renaming it to euclid3.py (taken from https://github.com/euclid3/euclid3)

2. To set the thickness of the roof, you can use extrude on the Z (global) axis.

This is a great solution for multi-pitch roofs! Many thanks to the developer!
Many thanks to you. I worked on it a little more, for example recognize various edge types automatically. If you interested, I can update the repo.
User avatar
ProjectBP
Posts: 406
Joined: Tue Jun 06, 2023 2:33 pm
Contact:

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

Post by ProjectBP »

ebrahim raeyat wrote: Tue Jun 13, 2023 2:17 pm Many thanks to you. I worked on it a little more, for example recognize various edge types automatically. If you interested, I can update the repo.
That would be really great!
I haven't gotten to the serious roofing tasks yet, but any refinements would be helpful.
Thanks!
There may be a misunderstanding :!: . I communicate with the help of a translator :P
Post Reply