Automate Reinforcement GSoC proposal

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!
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: Automate Reinforcement GSoC proposal

Post by Suraj Dadral »

I have done all changes as suggested above. And UI file can be found in attachment.

Preview:
ColumnReinforcementUI2.png
ColumnReinforcementUI2.png (72.12 KiB) Viewed 1631 times

Clicking on button "Edit Number and Diameter" will open a new dialog box similar to "Rebar Distribution" dialog box

Regards,
Attachments
ColumnReinforcement.ui
(16.11 KiB) Downloaded 78 times
Last edited by Suraj Dadral on Sun May 12, 2019 6:21 pm, edited 1 time in total.
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: Automate Reinforcement GSoC proposal

Post by Suraj Dadral »

amrit3701 wrote: Sun May 12, 2019 7:35 am
Instead of using QLineEdit fields, you should use our FreeCAD Gui::InputField, which supports units, expressions, etc. These should normally be in your QDesigner if you compiled the FreeCAD plugin for it.

See QDesigner plugin section: https://www.freecadweb.org/wiki/CompileOnUnix
https://github.com/FreeCAD/FreeCAD/tree ... ins/widget
Thanks @amrit3701

I have compiled FreeCAD plugin for Qt Designer and now using this.

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

Re: Automate Reinforcement GSoC proposal

Post by Suraj Dadral »

hardeeprai wrote: Sat May 11, 2019 11:13 pm
With respect to image attached, for dia 20, extension should be 20*bentFactor = 20*4 = 80, but you showed 80.24 and 80.21. Like wise 39.86 and 40.38 should be 40, if whatever you wrote is correct. How you put dimensions on image? Exact or these are estimated?
Dimension in images are estimated as @amrit3701 said here.
hardeeprai wrote: Sat May 11, 2019 11:13 pm
As per you: length of extended part of stirrup = (dia_of_stirrup) x (bentFactor)

Don't call it bentFactor, call it "extensionFactor".
Done in new UI. I will modify script accordingly.

hardeeprai wrote: Sat May 11, 2019 11:13 pm
How you define "rounding of stirrups"?
I think I wrongly called dimension of length 40mm(estimated) as "rounding of stirrups" in image: https://forum.freecadweb.org/download/file.php?id=83413
If so, what is the name of that length?

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

Re: Automate Reinforcement GSoC proposal

Post by Suraj Dadral »

Hello @all

Today, I implemented the front end of UI (work in progress) and here are related commits: commit1, commit2

Code of ColumnReinforcement.py file:

Code: Select all

from RebarDistribution import runRebarDistribution, removeRebarDistribution
from Rebarfunc import getSelectedFace
from PySide import QtGui
import FreeCADGui
import os


class _ColumnTaskPanel:
    def __init__(self, Rebar=None):
        self.customSpacing = None
        if not Rebar:
            selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
            self.SelectedObj = selected_obj.Object
            self.FaceName = selected_obj.SubElementNames[0]
        else:
            self.FaceName = Rebar.Base.Support[0][1][0]
            self.SelectedObj = Rebar.Base.Support[0][0]
        self.form = FreeCADGui.PySideUic.loadUi(os.path.splitext(__file__)[0] + ".ui")
        self.form.setWindowTitle(
            QtGui.QApplication.translate("RebarAddon", "Column Reinforcement", None)
        )
        self.form.image.setPixmap(
            QtGui.QPixmap(
                os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
                + "/icons/Column_CustomConfiguration.png"
            )
        )
        self.addDropdownMenuItems()
        self.connectSignalSlots()

    def addDropdownMenuItems(self):
        self.form.columnConfiguration.addItems(
            ["Custom Configuration", "SingleTieFourRebars"]
        )
        self.form.bentAngle.addItems(["90", "135"])
        self.form.mainRebarType.addItems(["StraightRebar", "LShapeRebar"])
        self.form.x_dirRebarType.addItems(["StraightRebar", "LShapeRebar"])
        self.form.y_dirRebarType.addItems(["StraightRebar", "LShapeRebar"])

    def connectSignalSlots(self):
        self.form.columnConfiguration.currentIndexChanged.connect(
            self.changeColumnConfiguration
        )
        self.form.amount_radio.clicked.connect(self.amount_radio_clicked)
        self.form.spacing_radio.clicked.connect(self.spacing_radio_clicked)
        self.form.customSpacing.clicked.connect(lambda: runRebarDistribution(self))
        self.form.removeCustomSpacing.clicked.connect(
            lambda: removeRebarDistribution(self)
        )
        self.form.PickSelectedFace.clicked.connect(lambda: getSelectedFace(self))

    def getStandardButtons(self):
        return (
            int(QtGui.QDialogButtonBox.Ok)
            | int(QtGui.QDialogButtonBox.Apply)
            | int(QtGui.QDialogButtonBox.Cancel)
            | int(QtGui.QDialogButtonBox.Help)
            | int(QtGui.QDialogButtonBox.Reset)
        )

    def changeColumnConfiguration(self):
        column_configuration = self.form.columnConfiguration.currentText()
        if column_configuration == "Custom Configuration":
            self.form.image.setPixmap(
                QtGui.QPixmap(
                    os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
                    + "/icons/Column_CustomConfiguration.png"
                )
            )
            # if self.form.columnConfiguration.oldText() == "SingleTieFourRebars":
            self.showXdirRebarsForm()
            self.showYdirRebarsForm()
        elif column_configuration == "SingleTieFourRebars":
            self.form.image.setPixmap(
                QtGui.QPixmap(
                    os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
                    + "/icons/Column_SingleTieFourRebars.png"
                )
            )
            self.hideXdirRebarsForm()
            self.hideYdirRebarsForm()

    def amount_radio_clicked(self):
        self.form.spacing.setEnabled(False)
        self.form.amount.setEnabled(True)

    def spacing_radio_clicked(self):
        self.form.amount.setEnabled(False)
        self.form.spacing.setEnabled(True)

    def hideXdirRebarsForm(self):
        self.form.x_dirRebarsWidget.hide()

    def hideYdirRebarsForm(self):
        self.form.y_dirRebarsWidget.hide()

    def showXdirRebarsForm(self):
        self.form.x_dirRebarsWidget.show()

    def showYdirRebarsForm(self):
        self.form.y_dirRebarsWidget.show()
        
UI preview:
ColumnReinforcementUI.png
ColumnReinforcementUI.png (80.95 KiB) Viewed 1598 times

Please review and give your suggestions:

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

Re: Automate Reinforcement GSoC proposal

Post by bernd »

just would like to throw in we gone use two or three stirrups quite often ... See attached pic ... This is some real drawing just some weeks old ...

concrete_columns.jpg
concrete_columns.jpg (61.96 KiB) Viewed 1592 times
User avatar
hardeeprai
Posts: 177
Joined: Sun May 23, 2010 2:41 pm
Location: Ludhiana, Punjab, India
Contact:

Re: Automate Reinforcement GSoC proposal

Post by hardeeprai »

yorik wrote: Sun May 12, 2019 12:48 amIMHO the 4@20+3@16 notation is useful for you (easy to parse and store in a string)
Yes, I would like to do that way.

yorik wrote: Sun May 12, 2019 12:48 ambut not very easy to the user. I would change that edit field by a button, that opens a dialog that is specially made to create and edit such a string. Maybe a kind of grid where the use wouldn't have to care about entering special chars correctly...
Agree. A beginner or casual user may like that, but for heavy user, entering data, the way I suggested will be very efficient.

If both ways we can have, then that will be great.
--
H.S.Rai
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: Automate Reinforcement GSoC proposal

Post by Suraj Dadral »

bernd wrote: Mon May 13, 2019 11:11 am just would like to throw in we gone use two or three stirrups quite often ... See attached pic ... This is some real drawing just some weeks old ...
Thanks @bernd
It is there in my project proposal.
Image: https://www.freecadweb.org/wiki/File:Co ... types1.png

Regards,
User avatar
hardeeprai
Posts: 177
Joined: Sun May 23, 2010 2:41 pm
Location: Ludhiana, Punjab, India
Contact:

Re: Automate Reinforcement GSoC proposal

Post by hardeeprai »

Suraj Dadral wrote: Sat May 11, 2019 3:18 pmSo, we will take input for diameter and amount of rebars as:
Amount@Diameter: amount@diameter + amount@diameter + amount@diameter
"@" is normally used for spacing, “ϕ” or "#" is used for diameter. So better in above replace @ with #.

In your post https://forum.freecadweb.org/viewtopic. ... 90#p307712 and in image https://forum.freecadweb.org/download/file.php?id=83472 use Number in place of Amount in 7th option under ties ( i.e. Radio button Amount | Spacing ).
--
H.S.Rai
User avatar
hardeeprai
Posts: 177
Joined: Sun May 23, 2010 2:41 pm
Location: Ludhiana, Punjab, India
Contact:

Re: Automate Reinforcement GSoC proposal

Post by hardeeprai »

bernd wrote: Mon May 13, 2019 11:11 amjust would like to throw in we gone use two or three stirrups quite often ... See attached pic
@bernd

Which tool you are using to produce such drawings?
--
H.S.Rai
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: Automate Reinforcement GSoC proposal

Post by Suraj Dadral »

hardeeprai wrote: Mon May 13, 2019 12:58 pm
yorik wrote: Sun May 12, 2019 12:48 amIMHO the 4@20+3@16 notation is useful for you (easy to parse and store in a string)
Yes, I would like to do that way.
yorik wrote: Sun May 12, 2019 12:48 ambut not very easy to the user. I would change that edit field by a button, that opens a dialog that is specially made to create and edit such a string. Maybe a kind of grid where the use wouldn't have to care about entering special chars correctly...
Agree. A beginner or casual user may like that, but for heavy user, entering data, the way I suggested will be very efficient.

If both ways we can have, then that will be great.
OK, I will enable field "Number@Diameter" in UI.
So that user can either directly enter field or use button instead.

Thanks,
Post Reply