rebar2

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: rebar2

Post by balrobs »

Thank you @Bernd for the welcome!
Also a big thank to you @Suraj for developing the BOM feature. It is a very important part of the whole thing.
I've retested BOM-rebar for the two example files provided by Bernd: example_04_vat.ifc and example_03_crane_foundation.ifc.
Now BOM-tables are created for rebar2 objects - WOW!
As shown in the following picture there remains some minor issues.
BOM_for_example_03_crane_foundation.png
BOM_for_example_03_crane_foundation.png (90.86 KiB) Viewed 1247 times
In the model there is a rebar-shape with diameter 18mm, in the BOM-List, maybe due to rounding problems, it is shown in an unespected mode. Another improvement could be to limit the digits shown for the columns depending on the units choosen. For bar "Diameters in mm" and for "Length in cm/piece" the digits maybe are unnecessary. This has to be discussed.

Thank you for your work
balrobs
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: rebar2

Post by bernd »

balrobs wrote: Wed Apr 29, 2020 8:43 pm For bar "Diameters in mm" and for "Length in cm/piece" the digits maybe are unnecessary. This has to be discussed.
+1
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: rebar2

Post by Suraj Dadral »

bernd wrote: Wed Apr 29, 2020 8:10 pm https://github.com/berndhahnebach/rebar ... 5684e54fc2 adds a new object linear reinforcement. It can be used to distribute any base rebar object along a line. Amount, Distance, Spacing OffsetStart and OffsetEnd, all Attributes from standard FreeCAD rebar can be given.

Code: Select all

import FreeCAD, Draft, archadd
from FreeCAD import Vector as vec
wire1 = Draft.makeWire([vec(0, 0, 0), vec(3000, 0, 0)])
baserebar4 = archadd.BaseRebar(wire1, diameter=30, mark=4, name="BaseRebar_4")
FreeCAD.ActiveDocument.recompute()
rebdistribution6 = archadd.ReinforcementLinear(baserebar4, amount=20, spacing=100, name="Reinforcement_6")
FreeCAD.ActiveDocument.recompute()
Looks cool.
With code provided above, the linear rebar2 is created successfully. But, when I reopened same file, it gives following error and reinforcement object moved outside of BaseRebar object.

Code: Select all

Traceback (most recent call last):
  File "/home/blank/.FreeCAD/Mod/rebar2/archobjects/base_rebar.py", line 156, in onDocumentRestored
    super().onDocumentRestored(self, obj)
<class 'TypeError'>: onDocumentRestored() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
  File "/home/blank/.FreeCAD/Mod/rebar2/archobjects/reinforcement_generic.py", line 178, in onDocumentRestored
    super().onDocumentRestored(self, obj)
<class 'TypeError'>: onDocumentRestored() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
  File "/home/blank/.FreeCAD/Mod/rebar2/archobjects/base_rebar.py", line 156, in onDocumentRestored
    super().onDocumentRestored(self, obj)
<class 'TypeError'>: onDocumentRestored() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
  File "/home/blank/.FreeCAD/Mod/rebar2/archobjects/reinforcement_generic.py", line 178, in onDocumentRestored
    super().onDocumentRestored(self, obj)
<class 'TypeError'>: onDocumentRestored() takes 2 positional arguments but 3 were given

Related FreeCAD file:
linear_rebar2.FCStd
(17.65 KiB) Downloaded 31 times

My FreeCAD info:
OS: Kali GNU/Linux Rolling (GNOME/gnome)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20655 (Git) AppImage
Build type: Release
Branch: master
Hash: e8e67e8c5ebbc9f9ed9ea67aba5b891969595ece
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/India (en_IN)

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

Re: rebar2

Post by bernd »

found the same here too this morning. Need to tackle this down.

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

Re: rebar2

Post by bernd »

Suraj Dadral wrote: Thu Apr 30, 2020 10:25 am With code provided above, the linear rebar2 is created successfully. But, when I reopened same file, it gives following error and reinforcement object moved outside of BaseRebar object.
https://github.com/berndhahnebach/rebar ... e1b62160a9
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: rebar2

Post by Suraj Dadral »

balrobs wrote: Wed Apr 29, 2020 8:43 pm As shown in the following picture there remains some minor issues.

BOM_for_example_03_crane_foundation.png

In the model there is a rebar-shape with diameter 18mm, in the BOM-List, maybe due to rounding problems, it is shown in an unespected mode. Another improvement could be to limit the digits shown for the columns depending on the units choosen. For bar "Diameters in mm" and for "Length in cm/piece" the digits maybe are unnecessary. This has to be discussed.
Thanks @balrobs for reporting this issue.
It is fixed as per commit: https://github.com/SurajDadral/FreeCAD- ... 8daf342920

Solution: Use user preferred units from FreeCAD preferences. Related code to get precision:

Code: Select all

# Get user preferred unit precision
precision = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals")
Please let me know if you have another suggestions.

BOM outputs for example files provided by @bernd:
example_02_channel_foundation.svg
(23.87 KiB) Downloaded 39 times
example_03_crane_foundation.svg
(29.73 KiB) Downloaded 43 times
example_04_vat.svg
(28.15 KiB) Downloaded 42 times

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

Re: rebar2

Post by Suraj Dadral »

bernd wrote: Thu Apr 30, 2020 11:50 am
Suraj Dadral wrote: Thu Apr 30, 2020 10:25 am With code provided above, the linear rebar2 is created successfully. But, when I reopened same file, it gives following error and reinforcement object moved outside of BaseRebar object.
https://github.com/berndhahnebach/rebar ... e1b62160a9
Thanks @bernd
Now, error is gone.

Thanks,
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: rebar2

Post by balrobs »

Hi @Bernd,
I could'nt resist to see what's happening when I copy a Reinforcement-object with the Draft copy-command.
I got an unexpected result. I expected to see a new Reinforcement-object under the same BaseRebar-object.
What I see is a new object outside with only Placement and Label properties.
Copying a Rebar-Object produces an object with only Placement and Label properties too.
What is your opinion in the regard, how should copying of these objects work?
Thanks
balrobs
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: rebar2

Post by bernd »

clone or copy ?
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: rebar2

Post by balrobs »

Hi @Suraj,
thank you for your commit. I tried it and think that the choise to use the "number of decimals" from the Preference-Dialog is a quite good solution ... especially when the RebarLengthUnit and the RebartotalLengthUnit chosen by the user correspond to the LenghtUnit of the Preference-dialog.
Suraj Dadral wrote: Thu Apr 30, 2020 7:38 pm Please let me know if you have another suggestions.
If not maybe a solution like in the picture below could be considered. IMO it could be very helpfull to add a "Save Preferences"-Button in order that all preferences can be loaded when the next BOM is created.
Proposal_Rebars_Bill_Of_Material_Dialog.png
Proposal_Rebars_Bill_Of_Material_Dialog.png (23.4 KiB) Viewed 1125 times
We can also consider to make this inputs available in the Preference-Dialog of FreeCAD under the section Preferences\Arch\Defaults\RebarBOM (or something like that?). Maybe a user is expecting to find them their.
What do you think?
Thanks
balrobs
Post Reply