GSoC Proposal: Extended functionality of Rebar Addon
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: GSoC Proposal: Extended functionality of Rebar Addon
Exporting to svg in Gui mode only. IMHO it should not be a showstopper.
- Suraj Dadral
- Posts: 307
- Joined: Fri Sep 07, 2018 5:32 pm
- Contact:
Re: GSoC Proposal: Extended functionality of Rebar Addon
Hello everyone,
Here is update:
Created script for proof of concept for automatic dimensioning for Straight Rebars generated using Reinforcement workbench: https://github.com/SurajDadral/FreeCAD- ... drawing.py
This can be tested by using below script:
Sample model to use with this script:
Some sample outputs:
Roadmap till now:
For automatic dimensioning of rebars, we need:
So, exploring more, I came across a function getSVG() in Draft workbench, which produces svg content for given object.
So, getting idea from there and copying some functions , I created custom functions to get visible rebars and perform their dimensioning.
So now, workflow for automatic drawing and dimensioning:
1. Create structure drawing using Draft.getSVG().
Why not Drawing.projectToSVG() Answer: https://forum.freecadweb.org/viewtopic. ... =10#p45601
2. For rebars generated using Reinforcement workbench, create rebars drawing and dimensions using custom functions.
3. For rebars not generated using Reinforcement workbench, create rebars drawing using Draft.getSVG()
Now, going to improve functions created above and add drawing functions for different rebar types available in Reinforcement workbench.
Suggestions are always welcome.
Thanks,
Here is update:
Created script for proof of concept for automatic dimensioning for Straight Rebars generated using Reinforcement workbench: https://github.com/SurajDadral/FreeCAD- ... drawing.py
This can be tested by using below script:
Code: Select all
import FreeCAD
import Draft
from ReinforcementDrawing import structure_drawing
output_dir = "/home/blank/dim_col_"
rebars_list = Draft.get_objects_of_type(FreeCAD.ActiveDocument.Objects, "Rebar")
structure = FreeCAD.ActiveDocument.Structure
front_view = structure_drawing.get_reinforcement_drawing(
structure, rebars_list, "Front",
)
with open(output_dir + "reinforcement_front_view.svg", "w") as f:
f.write(front_view)
rear_view = structure_drawing.get_reinforcement_drawing(
structure, rebars_list, "Rear",
)
with open(output_dir + "reinforcement_rear_view.svg", "w") as f:
f.write(rear_view)
left_view = structure_drawing.get_reinforcement_drawing(
structure, rebars_list, "Left",
)
with open(output_dir + "reinforcement_left_view.svg", "w") as f:
f.write(left_view)
right_view = structure_drawing.get_reinforcement_drawing(
structure, rebars_list, "Right",
)
with open(output_dir + "reinforcement_right_view.svg", "w") as f:
f.write(right_view)
top_view = structure_drawing.get_reinforcement_drawing(
structure, rebars_list, "Top",
)
with open(output_dir + "reinforcement_top_view.svg", "w") as f:
f.write(top_view)
bottom_view = structure_drawing.get_reinforcement_drawing(
structure, rebars_list, "Bottom",
)
with open(output_dir + "reinforcement_bottom_view.svg", "w") as f:
f.write(bottom_view)
Some sample outputs:
Roadmap till now:
For automatic dimensioning of rebars, we need:
- List of visible rebars in selected view.
- Placement of rebars in svg plane.
- If we select structure and its rebars, then rebars inside structure remains hidden. To show them, we can turn an option to show hidden lines, but then rebars are shown as dotted lines, which doesn't looks good as our main focus is on rebars object for automatic drawing and dimensioning.
- We have no idea which rebars are visible or not, so we can't perform dimensioning for that.
- The Drawing.project() function returns list of visible edges. And again, we can't map that which visible edge corresponds to which rebar .
So, exploring more, I came across a function getSVG() in Draft workbench, which produces svg content for given object.
So, getting idea from there and copying some functions , I created custom functions to get visible rebars and perform their dimensioning.
So now, workflow for automatic drawing and dimensioning:
1. Create structure drawing using Draft.getSVG().
Why not Drawing.projectToSVG() Answer: https://forum.freecadweb.org/viewtopic. ... =10#p45601
2. For rebars generated using Reinforcement workbench, create rebars drawing and dimensions using custom functions.
3. For rebars not generated using Reinforcement workbench, create rebars drawing using Draft.getSVG()
Now, going to improve functions created above and add drawing functions for different rebar types available in Reinforcement workbench.
Suggestions are always welcome.
Thanks,
Re: GSoC Proposal: Extended functionality of Rebar Addon
Looking good! Nice progresses Suraj!
Re: GSoC Proposal: Extended functionality of Rebar Addon
Great.
Two questions:
How do we change automatic drawings? May be adding a text.
Is it possible to mix automated rebar dimensioning with manually rebar dimensioning? In real live projects one might not be able to automate all rebar dimensions of a builing element.
Two questions:
How do we change automatic drawings? May be adding a text.
Is it possible to mix automated rebar dimensioning with manually rebar dimensioning? In real live projects one might not be able to automate all rebar dimensions of a builing element.
Re: GSoC Proposal: Extended functionality of Rebar Addon
Hello everyone,
I also find it difficult to imagine a Freecad-workflow to create a reinforcement plan. I assume that the automatically generated reinforcement views for columns and beams have to be reworked very often. In addition, there are other irregular elements such as stair flights, ceiling slabs, etc., for which the reinforcement views probably also have to be reworked manually. How could a possible workflow look like for the creation of their reinforcement plans? A possible solution could be to show reinforcement-bars in TechDraw and to be able to add information such as rebars-count mark-number, length, etc. using suitable annotation tools.
Thank you for your great work
I also find it difficult to imagine a Freecad-workflow to create a reinforcement plan. I assume that the automatically generated reinforcement views for columns and beams have to be reworked very often. In addition, there are other irregular elements such as stair flights, ceiling slabs, etc., for which the reinforcement views probably also have to be reworked manually. How could a possible workflow look like for the creation of their reinforcement plans? A possible solution could be to show reinforcement-bars in TechDraw and to be able to add information such as rebars-count mark-number, length, etc. using suitable annotation tools.
Thank you for your great work
- Suraj Dadral
- Posts: 307
- Joined: Fri Sep 07, 2018 5:32 pm
- Contact:
Re: GSoC Proposal: Extended functionality of Rebar Addon
Thanks @yorik
We will store svg content generated in TechDraw::DrawViewSymbol object. Then user can also insert their own dimensions and annotations using TechDraw workbench.
So, this way, user will be able to mix automated dimensioning with manual dimensioning.
Thanks @balrobs
I am also planing same as discussed above.
Thanks,
Re: GSoC Proposal: Extended functionality of Rebar Addon
Yes, automatic dimensioning and labelling is only primitive rebars (like straight, L-shape rebar etc). However, I user create any custom rebar then he can add dimensions and label manually using TechDraw workbench.Suraj Dadral wrote: ↑Wed Jun 24, 2020 9:01 pmWe will store svg content generated in TechDraw::DrawViewSymbol object. Then user can also insert their own dimensions and annotations using TechDraw workbench.
So, this way, user will be able to mix automated dimensioning with manual dimensioning.
- Suraj Dadral
- Posts: 307
- Joined: Fri Sep 07, 2018 5:32 pm
- Contact:
Re: GSoC Proposal: Extended functionality of Rebar Addon
Hello everyone,
An update:
Use xml python library for reinforcement drawing svg and Implemented creating LShape Rebars drawing. https://github.com/SurajDadral/FreeCAD- ... 403f5101fc
Todo:
1. Create stirrups, UShape and BentShape bar drawing.
2. Then start with automatic dimensioning of rebars.
Thanks,
An update:
Use xml python library for reinforcement drawing svg and Implemented creating LShape Rebars drawing. https://github.com/SurajDadral/FreeCAD- ... 403f5101fc
Todo:
1. Create stirrups, UShape and BentShape bar drawing.
2. Then start with automatic dimensioning of rebars.
Thanks,
- Suraj Dadral
- Posts: 307
- Joined: Fri Sep 07, 2018 5:32 pm
- Contact:
Re: GSoC Proposal: Extended functionality of Rebar Addon
Hello everyone,
Here is update:
1. Code improvement: Improve logic for calculation of min and max x & y by utilizing BoundBox of compound of structure and rebars. commit
2. Create Stirrup, UShape, BentShape, Helical and custom rebars svg.
3. Create ReinforcementDrawingContent object same as BOMContent object, to show reinforcement drawing in FreeCAD. And Implement passing structure list to create reinforcement drawing, if not provided, reinforcement drawing will be generated for all structures acting as Host for rebar objects. commit
You can test it as below:
Sample outputs:
Sample output model: https://github.com/SurajDadral/FreeCAD- ... wing.FCStd
Suggestions are always welcome
Thanks,
Here is update:
1. Code improvement: Improve logic for calculation of min and max x & y by utilizing BoundBox of compound of structure and rebars. commit
2. Create Stirrup, UShape, BentShape, Helical and custom rebars svg.
3. Create ReinforcementDrawingContent object same as BOMContent object, to show reinforcement drawing in FreeCAD. And Implement passing structure list to create reinforcement drawing, if not provided, reinforcement drawing will be generated for all structures acting as Host for rebar objects. commit
You can test it as below:
Code: Select all
from ReinforcementDrawing import structure_drawing
structure_drawing.makeStructuresReinforcementDrawing(view="Front")
structure_drawing.makeStructuresReinforcementDrawing(view="Rear")
structure_drawing.makeStructuresReinforcementDrawing(view="Left")
structure_drawing.makeStructuresReinforcementDrawing(view="Right")
structure_drawing.makeStructuresReinforcementDrawing(view="Top")
structure_drawing.makeStructuresReinforcementDrawing(view="Bottom")
Sample outputs:
Sample output model: https://github.com/SurajDadral/FreeCAD- ... wing.FCStd
Suggestions are always welcome
Thanks,
Re: GSoC Proposal: Extended functionality of Rebar Addon
Hi Suraj,
I've tried to test your code but entcountered some problems. After installing your update I created a sample column and tried to launch your commands
in order to create some ReinforcementDrawing.
In the object-tree the single pages (Front, Rear, Left, Right, Top and Bottom) are created but unfortunately don't contain any reinforcement.
What could be the problem here?
Thank you for yout answer
Here my test-file Edit:
forgot to attach my configuration:
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20655 (Git)
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: German/Germany (de_DE)
I've tried to test your code but entcountered some problems. After installing your update I created a sample column and tried to launch your commands
Code: Select all
from ReinforcementDrawing import structure_drawing
structure_drawing.makeStructuresReinforcementDrawing(view="Front")
structure_drawing.makeStructuresReinforcementDrawing(view="Rear")
structure_drawing.makeStructuresReinforcementDrawing(view="Left")
structure_drawing.makeStructuresReinforcementDrawing(view="Right")
structure_drawing.makeStructuresReinforcementDrawing(view="Top")
structure_drawing.makeStructuresReinforcementDrawing(view="Bottom")
In the object-tree the single pages (Front, Rear, Left, Right, Top and Bottom) are created but unfortunately don't contain any reinforcement.
What could be the problem here?
Thank you for yout answer
Here my test-file Edit:
forgot to attach my configuration:
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20655 (Git)
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: German/Germany (de_DE)