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!
Post Reply
Bance
Veteran
Posts: 4190
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by Bance »

I think weight (tonnage) should be included, since this is how steel is sold.
See https://www.reinforcing-bar.com/technol ... sizes.html for some conversion factors.
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 »

Bance wrote: Wed Apr 01, 2020 4:52 pm I think weight (tonnage) should be included, since this is how steel is sold.
See https://www.reinforcing-bar.com/technol ... sizes.html for some conversion factors.
Thanks @Bance for reference.
Now, I think we can have mapping of rebar diameter with its weight in configuration file.
Users from different countries can modify configuration file to meet their standards.
It 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 »

Bance wrote: Wed Apr 01, 2020 4:52 pm I think weight (tonnage) should be included, since this is how steel is sold.
See https://www.reinforcing-bar.com/technol ... sizes.html for some conversion factors.
Its done as per commit: https://github.com/SurajDadral/FreeCAD- ... 194be9df15

Sample output:
SampleBOMOutput3.png
SampleBOMOutput3.png (255.74 KiB) Viewed 2202 times

Suggestions are always welcome.

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 »

Update:
Modified program to automatically calculate column dia headers

Before:
Column dia headers are read from a variable in configuration file.
- If there exists rebars with diameter which is not present in variable column_dia_headers in config.py file, then generating BOM produces error.
- There are redundand diameter headers present in BOM corresponding to which, there exists no rebar.

Now:
- Configuration variable column_dia_headers is eliminated and column dia headers are calculated automatically by script
- Only that diameter headers are present in BOM corresponding to which there exists rebars.

Output:
SampleBOMOutput4.png
SampleBOMOutput4.png (216.13 KiB) Viewed 2175 times

In above output, the total weight for diameter 10 is not calculated because weight/m for diameter 10 is not specified in configuration variable "dia_weight_map".

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

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by bernd »

great, need to give it a try. But first I will finish to make my rebar code public.

BTW: great we gone attrac this rebar cut shape list. The idea dates back into 2017 ... https://forum.freecadweb.org/viewtopic. ... 40#p180645
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by bernd »

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 »

bernd wrote: Thu Apr 02, 2020 8:40 pm great, need to give it a try. But first I will finish to make my rebar code public.
I also added a new icon for BOM in dropdown menu of Rebar Addon. And code is present in branch "BOM" here: https://github.com/SurajDadral/FreeCAD- ... t/tree/BOM
bernd wrote: Thu Apr 02, 2020 8:40 pm BTW: great we gone attrac this rebar cut shape list. The idea dates back into 2017 ... https://forum.freecadweb.org/viewtopic. ... 40#p180645
Yeah.
I am thinking of making columns in Material Bill configurable i.e. user can choose which columns to be shown and their sequence. Do you think this will be helpful?

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

Re: GSoC Proposal: Extended functionality of Rebar Addon

Post by bernd »

yes good idea!

What do you use for material calculation, the real length or the length with sharp edges. In switzerland the sharp edge length is taken, even if modeled in 3D! You can check on the example I provided.

How about india and other countries?
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 »

bernd wrote: Fri Apr 03, 2020 7:00 am yes good idea!
Implemented above.
And these are the changes:
1. Pass structure elements as input to BOM function
New function definition:
def makeBillOfMaterial(
column_headers=COLUMN_HEADERS,
dia_weight_map=DIA_WEIGHT_MAP,
structures_list=None,
obj_name="RebarBillOfMaterial",
)
e.g.
from BillOfMaterial import BillOfMaterial
BillOfMaterial.makeBillOfMaterial(structures_list=[FreeCAD.ActiveDocument.Structure, FreeCAD.ActiveDocument.Structure001])

2. Make column names and sequence configurable
Column are configurable i.e. you can change Name of column header,
change their sequence and show/hide column.
1. To change column headers, change first value in tuple in below
dictionary.
e.g. To change column header "Member" to "Member Name" replace
("Member", 1) with ("Member Name", 1)
2. To modify sequence of column, change second value in tuple in below
dictionary.
e.g. To place "Member" column at third column in BOM, change
("member", 1) to ("Member", 3)
3. To hide column, set second value in tuple in below dictionary to 0.
And to show column, set it to other than 0 which will be used used as
placement sequence number for that column.
e.g. to hide column "Member", replace ("Member", 1) with ("Member", 0)

Note: You must take care that no two columns get same placement number.
And must not delete/modify values in LHS of ":" (colon).

COLUMN_HEADERS = {
"Member": ("Member", 1),
"Mark": ("Mark", 2),
"RebarsCount": ("No. of Rebars", 3),
"Diameter": ("Diameter in mm", 4),
"RebarLength": ("Length in m/piece", 5),
"RebarsTotalLength": ("Total Length in m", 6),
}

And implemented GUI for above:
BOMGui.png
BOMGui.png (62.25 KiB) Viewed 2082 times

Suggestions are always welcome. :)

bernd wrote: Fri Apr 03, 2020 7:00 am What do you use for material calculation, the real length or the length with sharp edges. In switzerland the sharp edge length is taken, even if modeled in 3D! You can check on the example I provided.
I used rebar length with sharp edges.
I think we should implement with both real length and length with sharp edges, And user can choose which one to use.

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 »

Suraj Dadral wrote: Sun Apr 05, 2020 1:03 am
I used rebar length with sharp edges.
I think we should implement with both real length and length with sharp edges, And user can choose which one to use.
Implemented above.
Now, user can switch between using real rebar length and length with sharp edges by modifying configuration variable REBAR_LENGTH_TYPE which takes values "RealLength" and "LengthWithSharpEdges"
User can also select this through UI while creating Rebars Bill of Material.

Modified UI:
BOMGui2.png
BOMGui2.png (40.32 KiB) Viewed 2041 times

Output with rebar length with sharp edges:
RebarLengthWithSharpEdges.png
RebarLengthWithSharpEdges.png (281.22 KiB) Viewed 2041 times

Output with real rebar length:
RealRebarLength.png
RealRebarLength.png (279.92 KiB) Viewed 2041 times

Function to calculate real rebar length:

Code: Select all

def getRebarRealLength(rebar):
    base = rebar.Base
    # When rebar is drived from DWire or from Sketch
    if hasattr(base, "Length") or base.isDerivedFrom("Sketcher::SketchObject"):
        wire = base.Shape.Wires[0]
        radius = rebar.Rounding * rebar.Diameter.Value
        import DraftGeomUtils

        fillet_wire = DraftGeomUtils.filletWire(wire, radius)
        real_rebar_length = fillet_wire.Length
        return FreeCAD.Units.Quantity(str(real_rebar_length) + "mm")
    else:
        print("Cannot calculate rebar real length from its base object")
        return FreeCAD.Units.Quantity("0 mm")
Suggestions are always welcome. :)

Thanks,
Post Reply