GSoC Proposal: Extended functionality of Rebar Addon

Contributions from the participants, questions and answers to their projects.
Discussions of proposals for upcoming events.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by balrobs »

Suraj Dadral wrote: Wed Aug 19, 2020 2:18 pm Hi @All

Generating bar bending schedule is implemented and you can test it by getting latest code from here.
Hi @Suraj, great progress :D ,
here my suggestions to improve the code:
- draw angle value not inside but outside of annotation arc -> better readability
- have two font sizes, one for rebar shapes the other for the rest -> better space optimization. BTW by reading the function parameters I couldn't figure out what units are used for the font size, maybe mm? Where are the FreeCAD preferences for changing the font size?
- display reinforcements belonging to a same object grouped together as shown in one of the first posts in this topic. This is not a must have but could help a lot to keep related rebars together.

Thank you for your great work!
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by amrit3701 »

Suraj Dadral wrote: Wed Aug 19, 2020 2:18 pm Hi @All

Generating bar bending schedule is implemented and you can test it by getting latest code from here.

getBarBendingSchedule() function signature:

Code: Select all

getBarBendingSchedule(
    rebar_objects: Optional[List] = None,
    column_headers: Optional[Dict[str, Tuple[str, int]]] = None,
    column_units: Optional[Dict[str, str]] = None,
    dia_weight_map: Optional[Dict[float, FreeCAD.Units.Quantity]] = None,
    rebar_length_type: Optional[
        Literal["RealLength", "LengthWithSharpEdges"]
    ] = None,
    font_family: Optional[str] = None,
    font_size: Optional[float] = None,
    column_width: float = 60,
    row_height: float = 30,
    rebar_shape_column_header: str = "Rebar Shape (mm)",
    rebar_shape_view_directions: Union[
        Union[FreeCAD.Vector, WorkingPlane.Plane],
        List[Union[FreeCAD.Vector, WorkingPlane.Plane]],
    ] = FreeCAD.Vector(0, 0, 0),
    rebar_shape_stirrup_extended_edge_offset: float = 2,
    rebar_shape_color_style: str = "shape color",
    rebar_shape_stroke_width: float = 0.35,
    rebar_shape_include_dimensions: bool = True,
    rebar_shape_edge_dimension_units: str = "mm",
    rebar_shape_edge_dimension_precision: int = 0,
    include_edge_dimension_units_in_dimension_label: bool = False,
    rebar_shape_bent_angle_dimension_exclude_list: Union[
        List[float], Tuple[float, ...]
    ] = (45, 90, 180),
    helical_rebar_dimension_label_format: str = "%L,r=%R,pitch=%P",
) -> ElementTree.Element
Hi Suraj,

I liked that now you are using type annotations, it helps a lot to understand your code. :)
More info about arguments can be found here: https://github.com/SurajDadral/FreeCAD- ... y#L73-L182

How to use:

Code: Select all

from xml.etree import ElementTree
import importlib

from BarBendingSchedule import BBSfunc

importlib.reload(BBSfunc)

bbs = BBSfunc.getBarBendingSchedule()

output_file = "/home/blank/GSoC20/test_bar_bending_schedule.svg"
with open(output_file, "w") as f:
    f.write(ElementTree.tostring(bbs, encoding="unicode"))

Sample output:
test_bar_bending_schedule.svg
test_bar_bending_schedule.png
test_bar_bending_schedule1.svg
test_bar_bending_schedule1.png
Yes, I also agreed with @balrobs comments. I would also suggest to bold the title headings (like, Marks, No. of Rebars ...) Font size is too small.
Amritpal Singh
Github, Like my work, sponsor me!
User avatar
ebrahim raeyat
Posts: 625
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by ebrahim raeyat »

Suraj Dadral wrote: Wed Aug 19, 2020 2:25 pm
Hi @ebrahim raeyat

Having Rebar shapes horizontal in rebar shape cut list is implemented as per this commit.

Thanks,
Thanks a lot. I have a suggestion too. I think for a rebar it is better to obtain the largest edge length and then rotate the rebar, so the largest edge become horizontal, this is useful for oblique rebars.
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by amrit3701 »

ebrahim raeyat wrote: Wed Aug 19, 2020 9:10 pm Thanks a lot. I have a suggestion too. I think for a rebar it is better to obtain the largest edge length and then rotate the rebar, so the largest edge become horizontal, this is useful for oblique rebars.
Nice suggestion! I totally agreed with you. :)
Amritpal Singh
Github, Like my work, sponsor me!
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by balrobs »

amrit3701 wrote: Thu Aug 20, 2020 4:54 pm
ebrahim raeyat wrote: Wed Aug 19, 2020 9:10 pm Thanks a lot. I have a suggestion too. I think for a rebar it is better to obtain the largest edge length and then rotate the rebar, so the largest edge become horizontal, this is useful for oblique rebars.
Nice suggestion! I totally agreed with you. :)
+1
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by Suraj Dadral »

balrobs wrote: Wed Aug 19, 2020 6:47 pm here my suggestions to improve the code:
- draw angle value not inside but outside of annotation arc -> better readability
- have two font sizes, one for rebar shapes the other for the rest -> better space optimization.
Hi @balrobs

The above two suggestions are implemented as per this commit.
- And add new parameter `rebar_shape_dimension_font_size` to function getBarBendingSchedule() to have different font size for dimension in rebar shape svg.
Now, output is much more readable than previous one. Thanks @balrobs :D
test_bar_bending_schedule.svg
(46.01 KiB) Downloaded 53 times
test_bar_bending_schedule.png
test_bar_bending_schedule.png (118.73 KiB) Viewed 1662 times
balrobs wrote: Wed Aug 19, 2020 6:47 pm BTW by reading the function parameters I couldn't figure out what units are used for the font size, maybe mm? Where are the FreeCAD preferences for changing the font size?
Yes, font-size is in mm.
The preferences values are taken from BOM preferences of Reinforcement, which can be found by navigating to: Edit -> Preferences -> Reinforcement.

balrobs wrote: Wed Aug 19, 2020 6:47 pm - display reinforcements belonging to a same object grouped together as shown in one of the first posts in this topic. This is not a must have but could help a lot to keep related rebars together.
For this, we need to make changes in BillOfMaterial code and also in BOM Gui.
So, this may take some time, but will be done soon.

Thanks,
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by Suraj Dadral »

amrit3701 wrote: Wed Aug 19, 2020 8:05 pm I liked that now you are using type annotations, it helps a lot to understand your code. :)
Thanks @amrit3701

amrit3701 wrote: Wed Aug 19, 2020 8:05 pm Yes, I also agreed with @balrobs comments. I would also suggest to bold the title headings (like, Marks, No. of Rebars ...) Font size is too small.
The above is done and the output is here: https://forum.freecadweb.org/viewtopic. ... 50#p425039

Thanks,
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by Suraj Dadral »

ebrahim raeyat wrote: Wed Aug 19, 2020 9:10 pm Thanks a lot. I have a suggestion too. I think for a rebar it is better to obtain the largest edge length and then rotate the rebar, so the largest edge become horizontal, this is useful for oblique rebars.
Hi @ebrahim raeyat

Its done as per commit: https://github.com/SurajDadral/FreeCAD- ... 866dc8cc29
Thanks for the Great suggestion. :)
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by Suraj Dadral »

Hi @All

Today I and @amrit3701 discussed about the timeline of the tasks to be done. And here is the list of tasks to be done with major focus on Documentation:

Before September 1:
1. Display reinforcements belonging to a same object (Host) grouped together.
2. Create GUI for BarBendingSchedule and RebarShapeCutList.
3. Implement BVBS export of bar bending schedule.

From September 1:
4. Modify README.md in github repo to include description of new features.
5. Create wiki pages for RebarShapeCutList and BarBendingSchedule.
6. Create wiki page for Reinforcement workbench.

Thanks,
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by bernd »

fully agree with the TODO.

one remark to the first one. It would be good if this could be done by the user some how too. None parametric rebars or rebars from IFC import do not have a host to group.

I do not know what is best in this case. May be a rebar shape cut list property, which is just a list with the references to the rebars which belong to this list. Anyway great work so far.

BTW many thanks to balbros and ebrahim for sll the help with testing. We did a real community GSoC!
Post Reply