GSoC Proposal: Extended functionality of Rebar Addon

A forum dedicated to the Draft, Arch and BIM workbenches development.
User avatar
Suraj Dadral
Posts: 304
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby Suraj Dadral » Fri Apr 10, 2020 5:21 pm

bernd wrote:
Thu Apr 09, 2020 8:43 pm
tried a real world example ... very cool we have a BOM :)
Nice to see this for real world example.

bernd wrote:
Thu Apr 09, 2020 8:43 pm
- the diameter would look much better if rounded on mm as well
It can be done by adding ' (single quote) before diameter in each diameter cell. It can be done in BOM program.
But, the problem is the cell content will be converted into string instead of FreeCAD Quantity object. And we will not be able to modify units after it is converted into string (Need to add = equal sign in cell at start before changing units).
If that thing is acceptable, then I will proceed to do above.

BTW, i think first I should complete its export to svg and we can cutomize this type of stuff during export like rounding diameter.
What is your opinion?

bernd wrote:
Thu Apr 09, 2020 8:43 pm
- the column count of the rebars for each mark is missing (the manufactor needs to know how many of each marks he should produce)
Unable to get this.

bernd wrote:
Thu Apr 09, 2020 8:43 pm
compared the crane foundation example and th BOM with sharp edges. Still the length is different.
My mistake, I missed that for rebar2.
Now implemented as per commit: https://github.com/SurajDadral/FreeCAD- ... 433d689c12

Function to do so:

Code: Select all

def getRebarSharpEdgedLength(rebar):
    """getRebarSharpEdgedLength(Rebar):
    Returns sharp edged length of rebar object.
    """
    base = rebar.Base
    # When rebar is drived from DWire
    if hasattr(base, "Length"):
        # When wire shape is created using DraftGeomUtils.filletWire()
        if not hasattr(base, "FilletRadius"):
            return base.Length
        # If FilletRadius of DWire is zero
        elif not base.FilletRadius:
            return base.Length
        else:
            edges = base.Shape.Edges
            if base.Closed:
                corners = len(edges) / 2
            else:
                corners = (len(edges) - 1) / 2
            extension_length = 2 * corners * base.FilletRadius
            rebar_straight_length = 0
            for edge in edges[::2]:
                rebar_straight_length += edge.Length
            rebar_sharp_edged_length = (
                FreeCAD.Units.Quantity(str(rebar_straight_length) + "mm")
                + extension_length
            )
            return rebar_sharp_edged_length
    # When rebar is drived from Sketch
    elif base.isDerivedFrom("Sketcher::SketchObject"):
        rebar_length = 0
        for geo in base.Geometry:
            rebar_length += geo.length()
        return FreeCAD.Units.Quantity(str(rebar_length) + "mm")
    else:
        print("Cannot calculate rebar length from its base object")
        return FreeCAD.Units.Quantity("0 mm")
Thanks,
User avatar
Suraj Dadral
Posts: 304
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby Suraj Dadral » Mon Apr 13, 2020 8:38 pm

Suraj Dadral wrote:
Fri Apr 10, 2020 5:21 pm
bernd wrote:
Thu Apr 09, 2020 8:43 pm
- the diameter would look much better if rounded on mm as well
It can be done by adding ' (single quote) before diameter in each diameter cell. It can be done in BOM program.
But, the problem is the cell content will be converted into string instead of FreeCAD Quantity object. And we will not be able to modify units after it is converted into string (Need to add = equal sign in cell at start before changing units).
If that thing is acceptable, then I will proceed to do above.

BTW, i think first I should complete its export to svg and we can cutomize this type of stuff during export like rounding diameter.
What is your opinion?
SVG export is done and you can test it from ui.
Commits:
https://github.com/SurajDadral/FreeCAD- ... 98f088b454
https://github.com/SurajDadral/FreeCAD- ... b655885f21

Updated ui:
SVGModifiedUi.png
SVGModifiedUi.png (48.95 KiB) Viewed 368 times

Sample output:
BOM.svg
(10.12 KiB) Downloaded 13 times

Please let me know the required customisation.
I am improving code and will add required customisation as confiuration.

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

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby bernd » Mon Apr 13, 2020 9:48 pm

the svg it's a great start ... :)

- page size is 100 x 100 mm if opened in inscape
- page size should be some reasonable one like iso A4 in whole Europe
- table should fit on the page.
- see what happens ATM if online converted to pdf with https://cloudconvert.com/svg-converter

BOM.pdf
(5.2 KiB) Downloaded 14 times
User avatar
bernd
Posts: 11096
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby bernd » Mon Apr 13, 2020 9:51 pm

Why is rebar2 BOM in separate repo? Is there a difference to normal rebar? What is needed to merge standard rebar BOM and rebar2 BOM?
User avatar
Suraj Dadral
Posts: 304
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby Suraj Dadral » Tue Apr 14, 2020 11:10 pm

bernd wrote:
Mon Apr 13, 2020 9:51 pm
Why is rebar2 BOM in separate repo? Is there a difference to normal rebar? What is needed to merge standard rebar BOM and rebar2 BOM?
These are the differences in arch rebar and rebar2:
1. While creating arch rebar, user pass wire/sketch as base object with sharp edges and pass rounding parameter to function to apply rounding/fillet at corners.
In rebar2, there is no rounding parameter passed to function, instead base object is to be created by applying rounding.
So, in case of arch rebar, rebarobj.Length gives length with sharp edges. And in case of rebar2, baserebarobj.Length gives real length of rebar i.e. without sharp edges.
So, I need to define function to get real length in case of arch rebar. And define function to get length with sharp edges in case of rebar2.

2. There is no attribute to find which structure the rebar2 reinforcement distribution belongs to. In case of arch rebar, I used "member" as key to store related rebars in dictionary, which can't be used in case of rebar2 thus used mark number as key instead of member.

Solutions to above first problem maybe to implement Rounding attribute same as done in case of arch rebar. And user will pass base object with sharp edges and rounding parameter to makeBaseRebar() function. Or may be something better than this :)

I will try to merge both after above.

BTW, I have one doubt. We will be keeping the previous ArchRebar function or will be replacing it with new arch rebar2 ?

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

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby bernd » Wed Apr 15, 2020 4:15 pm

Suraj Dadral wrote:
Tue Apr 14, 2020 11:10 pm
bernd wrote:
Mon Apr 13, 2020 9:51 pm
Why is rebar2 BOM in separate repo? Is there a difference to normal rebar? What is needed to merge standard rebar BOM and rebar2 BOM?
These are the differences in arch rebar and rebar2:
1. While creating arch rebar, user pass wire/sketch as base object with sharp edges and pass rounding parameter to function to apply rounding/fillet at corners.
In rebar2, there is no rounding parameter passed to function, instead base object is to be created by applying rounding.
So, in case of arch rebar, rebarobj.Length gives length with sharp edges. And in case of rebar2, baserebarobj.Length gives real length of rebar i.e. without sharp edges.
So, I need to define function to get real length in case of arch rebar. And define function to get length with sharp edges in case of rebar2.

2. There is no attribute to find which structure the rebar2 reinforcement distribution belongs to. In case of arch rebar, I used "member" as key to store related rebars in dictionary, which can't be used in case of rebar2 thus used mark number as key instead of member.

Solutions to above first problem maybe to implement Rounding attribute same as done in case of arch rebar. And user will pass base object with sharp edges and rounding parameter to makeBaseRebar() function. Or may be something better than this :)

I will try to merge both after above.
depends ... see attached file, standard ArchRebar, but no structure and no roundings ...

Suraj Dadral wrote:
Tue Apr 14, 2020 11:10 pm
BTW, I have one doubt. We will be keeping the previous ArchRebar function or will be replacing it with new arch rebar2 ?
Thanks,
We can not replace it, because all your AddOn would not work anymore. We need to find some smart way to merge them. But I would like to move to have two objects in any case, one for the rebar and one for the reinforcement made out of the rebar. But step by step.


std-rebar-curved.FCStd
(610.91 KiB) Downloaded 8 times

Screenshot_20200415_181317.png
Screenshot_20200415_181317.png (157.95 KiB) Viewed 303 times
User avatar
bernd
Posts: 11096
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby bernd » Wed Apr 15, 2020 4:17 pm

We could introduce the mark number in standard Arch Rebar as well if this would help?

But the mark number is uniqe only in one BOM not in the whole building.
User avatar
bernd
Posts: 11096
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby bernd » Wed Apr 15, 2020 4:18 pm

We could make the rebar objects childreen of the BOM they belong to? Either the structure nor the mark number would matter than.
User avatar
Suraj Dadral
Posts: 304
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby Suraj Dadral » Fri Apr 17, 2020 5:26 pm

bernd wrote:
Wed Apr 15, 2020 4:17 pm
We could introduce the mark number in standard Arch Rebar as well if this would help?

But the mark number is uniqe only in one BOM not in the whole building.
I think introducing mark number in standard Arch Rebar and structure (structures list in case of continuous beam) in Rebar2 Reinforcement will be helpful to reduce diiference between both.

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

Re: GSoC Proposal: Extended functionality of Rebar Addon

Postby Suraj Dadral » Fri Apr 17, 2020 8:33 pm

bernd wrote:
Wed Apr 15, 2020 4:15 pm

depends ... see attached file, standard ArchRebar, but no structure and no roundings ...
Interesting. I can manage to merge code if there is structure or not (as you shown). But, if user creates rebars by applying rounding as in file you shared, then how we can find rebar length with sharp edges in such rebars?

bernd wrote:
Wed Apr 15, 2020 4:15 pm
Suraj Dadral wrote:
Tue Apr 14, 2020 11:10 pm
BTW, I have one doubt. We will be keeping the previous ArchRebar function or will be replacing it with new arch rebar2 ?
Thanks,
We can not replace it, because all your AddOn would not work anymore. We need to find some smart way to merge them. But I would like to move to have two objects in any case, one for the rebar and one for the reinforcement made out of the rebar. But step by step.
Yeah, looking forward to make this happen.

Thanks,