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

Re: Automate Reinforcement GSoC proposal

Post by Suraj Dadral »

Suraj Dadral wrote: Mon Apr 08, 2019 10:46 am I created a simple function for Single Tie Column Reinforcement and can be found here:
https://github.com/SurajDadral/FreeCAD- ... ngleTie.py

Currently, this will create:
- Straight rebars and not L-shaped rebars.

I will add support for them soon.
Today, I added support for LShaped rebars and here is the code:

Code: Select all

import FreeCADGui
import sys

sys.path.append("../")
from Stirrup import makeStirrup
from StraightRebar import makeStraightRebar
from LShapeRebar import makeLShapeRebar
from Rebarfunc import getParametersOfFace


def singleTieColumn1Reinforcement(
    xdir_cover,
    ydir_cover,
    offset_of_tie,
    bentAngle,
    bentFactor,
    dia_of_tie,
    amount_spacing_check,
    amount_spacing_value,
    dia_of_rebars,
    t_offset_of_rebars,
    b_offset_of_rebars,
    rebar_type="StraightRebar",
    l_rebar_orientation="Top Inside",
    l_rebar_rounding=None,
    l_part_length=None,
    structure=None,
):
    """ singleTieColumn1Reinforcement(XDirectionCover, YDirectionCover,
    OffsetOfTie, BentAngle, BentFactor, DiameterOfTie, AmountSpacingCheck,
    AmountSpacingValue, DiameterOfRebars, RebarType, LShapeRebarOrientation,
    LShapeRebarRounding, LShapePartLength, Structure)
    Adds the Single Tie reinforcement to the selected structural column
    object.
    It takes four different orientations input for L-shaped rebars i.e. 'Top
    Inside', 'Top Outside', 'Bottom Inside', 'Bottom Outside'.
    """
    if not structure:
        selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
        structure = selected_obj.Object

    # Calculate common parameters for Straight/LShaped rebars
    f_cover = xdir_cover + dia_of_rebars / 2 + dia_of_tie / 2
    t_cover = t_offset_of_rebars
    b_cover = b_offset_of_rebars
    rebar_amount_spacing_check = True
    rebar_amount_spacing_value = 2

    # facename = "Face2"
    # find facename of face perpendicular to x-axis
    index = 1
    faces = structure.Shape.Faces
    for face in faces:
        normal = face.normalAt(0, 0)
        if normal.x == 1 and normal.y == 0 and normal.z == 0:
            facename = "Face" + str(index)
        index += 1

    # Create Straight Rebars
    if rebar_type == "StraightRebar":
        rl_cover = ydir_cover + dia_of_rebars / 2 + dia_of_tie / 2
        orientation = "Vertical"
        list_coverAlong = ["Right Side", "Left Side"]
        for coverAlong in list_coverAlong:
            makeStraightRebar(
                f_cover,
                (coverAlong, rl_cover),
                t_cover,
                b_cover,
                dia_of_rebars,
                rebar_amount_spacing_check,
                rebar_amount_spacing_value,
                orientation,
                structure,
                facename,
            )
    # Create L-Shaped Rebars
    elif rebar_type == "LShapeRebar":
        FacePRM = getParametersOfFace(structure, facename)
        face_length = FacePRM[0][0]
        if not l_part_length:
            l_part_length = (face_length - 2 * ydir_cover) / 3
        if not l_rebar_rounding:
            l_rebar_rounding = (float(dia_of_tie) / 2 + dia_of_rebars / 2) / dia_of_tie

        if (
            l_rebar_orientation == "Top Inside"
            or l_rebar_orientation == "Bottom Inside"
        ):
            l_cover = []
            r_cover = []
            l_cover.append(ydir_cover + dia_of_rebars / 2 + dia_of_tie / 2)
            r_cover.append(
                face_length
                - l_part_length
                - ydir_cover
                - dia_of_tie / 2
                - dia_of_rebars / 2
            )
            l_cover.append(r_cover[0])
            r_cover.append(l_cover[0])
            # Assign orientation value
            if l_rebar_orientation == "Top Inside":
                list_orientation = ["Top Left", "Top Right"]
            else:
                list_orientation = ["Bottom Left", "Bottom Right"]

        elif (
            l_rebar_orientation == "Top Outside"
            or l_rebar_orientation == "Bottom Outside"
        ):
            if l_rebar_orientation == "Top Outside":
                list_orientation = ["Top Left", "Top Right"]
            else:
                list_orientation = ["Bottom Left", "Bottom Right"]
            l_cover = []
            r_cover = []
            l_cover.append(ydir_cover + dia_of_rebars / 2 + dia_of_tie / 2)
            r_cover.append(
                face_length
                - ydir_cover
                - dia_of_tie / 2
                - dia_of_rebars / 2
                + l_part_length
            )
            l_cover.append(r_cover[0])
            r_cover.append(l_cover[0])

        i = 0
        for orientation in list_orientation:
            makeLShapeRebar(
                f_cover,
                b_cover,
                l_cover[i],
                r_cover[i],
                dia_of_rebars,
                t_cover,
                l_rebar_rounding,
                rebar_amount_spacing_check,
                rebar_amount_spacing_value,
                orientation,
                structure,
                facename,
            )
            i += 1

    # Calculate parameters for Stirrup
    rounding = (float(dia_of_tie) / 2 + dia_of_rebars / 2) / dia_of_tie
    l_cover = r_cover = xdir_cover
    t_cover = b_cover = ydir_cover
    f_cover = offset_of_tie

    # facename = "Face6"
    # find facename of face perpendicular to z-axis
    index = 1
    faces = structure.Shape.Faces
    for face in faces:
        normal = face.normalAt(0, 0)
        if normal.x == 0 and normal.y == 0 and normal.z == 1:
            facename = "Face" + str(index)
        index += 1

    # Create Stirrups
    makeStirrup(
        l_cover,
        r_cover,
        t_cover,
        b_cover,
        f_cover,
        bentAngle,
        bentFactor,
        dia_of_tie,
        rounding,
        amount_spacing_check,
        amount_spacing_value,
        structure,
        facename,
    )
And related git commit can be found here.

Supported orientations for L-Shaped rebars:
- Top Inside
- Top Outside
- Bottom Inside
- Bottom Outside

Please review and give your suggestions.

Regards
User avatar
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: Automate Reinforcement GSoC proposal

Post by chakkree »

Test "SingleTie.singleTieColumn1Reinforcement"
TestRebar_in_Column_LShape_05.png
TestRebar_in_Column_LShape_05.png (156.18 KiB) Viewed 1931 times

Code: Select all

"""
    20 Apr 2019
    Version: 0.19.16488 (Git)
    Python version: 3.6.6
"""
import Arch
from ColumnReinforcement import SingleTie

s = Arch.makeStructure(length=200.0,width=200.0,height=3000.0)
s.ViewObject.Transparency=80
App.activeDocument().recompute()

SingleTie.singleTieColumn1Reinforcement(
    xdir_cover=25,
    ydir_cover=25,
    offset_of_tie=50,
    bentAngle=135,
    bentFactor=3,
    dia_of_tie=6,
    amount_spacing_check=False,
    amount_spacing_value=150,
    dia_of_rebars=12,
    t_offset_of_rebars=25,
    b_offset_of_rebars=-200,
    rebar_type="StraightRebar",
    l_rebar_orientation="Top Inside",
    l_rebar_rounding=3,
    l_part_length=300,
    structure=s,
)
# L-Shape
s = Arch.makeStructure(length=200.0,width=200.0,height=3000.0)
s.Placement.Base.x = 2000
s.ViewObject.Transparency=80
App.activeDocument().recompute()

SingleTie.singleTieColumn1Reinforcement(
    xdir_cover=25,
    ydir_cover=25,
    offset_of_tie=50,
    bentAngle=135,
    bentFactor=3,
    dia_of_tie=6,
    amount_spacing_check=False,
    amount_spacing_value=150,
    dia_of_rebars=12,
    t_offset_of_rebars=25,
    b_offset_of_rebars=-200,
    rebar_type="LShapeRebar",
    l_rebar_orientation="Bottom Outside",
    l_rebar_rounding=3,
    l_part_length=300,
    structure=s,
)

Gui.activeDocument().activeView().viewIsometric()
Gui.SendMsgToActiveView("ViewFit")
User avatar
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: Automate Reinforcement GSoC proposal

Post by chakkree »

Test "SingleTie.singleTieColumn1Reinforcement" in Simple Structure, with LShape rebar in pier.
TestRebar_in_Column_06.png
TestRebar_in_Column_06.png (223.1 KiB) Viewed 1898 times
TestRebar_in_Column_07.png
TestRebar_in_Column_07.png (185.93 KiB) Viewed 1898 times

Code: Select all

"""  
  21 เมย 2562 / 21 Apr 2019
    Version: 0.19.16488 (Git)
    Python version: 3.6.6
"""
import FreeCAD
import Arch , Draft
import Part


from FreeCAD import Vector
from math import radians

xList = [-2000,2000]
yList = [-2000,2000]

def cretePomYam02(): # GuardHouse
    # Footing
    FootingFloor = Arch.makeFloor([ ],name="Footings")
    FootingFloor.Placement.Base.z = -1000
    B = 1000 ; L = 1000; t = 300
    z = -1000
    count=1
    for x in xList:
        for y in yList:
            Rect = Draft.makeRectangle(L , B)
            Rect.Placement.Base = Vector(-L/2, -B/2 , 0)
            F1 = Arch.makeStructure(Rect, height=t, name="Footing"+str(count))
            F1.Placement.Base = Vector(x, y , z)
            F1.ViewObject.Transparency = 80
            F1.IfcType = "Footing"
            F1.MoveWithHost = True
            FootingFloor.addObject(F1)
            count+=1
    # Pier
    PierFloor = Arch.makeFloor([ ],name="Piers")
    PierFloor.Placement.Base.z = -700
    b = 200; t = 200; h = 500+1000-300
    z = -1000+300
    count=1
    for x in xList:
        for y in yList:
            Rect = Draft.makeRectangle(t , b)
            Rect.Placement.Base = Vector(-b/2, -t/2 , 0)
            C1 = Arch.makeStructure(Rect, height=h, name="Pier"+str(count))
            C1.Placement.Base = Vector(x, y , z)
            C1.ViewObject.Transparency = 80
            C1.IfcType = "Column"
            C1.MoveWithHost = True
            PierFloor.addObject(C1)
            count+=1
    # Column
    Floor1 = Arch.makeFloor([ ],name="Floor1")
    Floor1.Placement.Base.z = 500
    b = 200; t = 200; h = 3000
    z = 500
    count=1
    for x in xList:
        for y in yList:
            Rect = Draft.makeRectangle(t , b)
            Rect.Placement.Base = Vector(-b/2, -t/2 , 0)
            C1 = Arch.makeStructure(Rect, height=h, name="Column"+str(count))
            C1.Placement.Base = Vector(x, y , z)
            C1.ViewObject.Transparency = 80
            C1.IfcType = "Column"
            C1.MoveWithHost = True
            Floor1.addObject(C1)
            count+=1
    # Beam Floor1
    b = 200; h = 400; L = 4000-200
    z = 500-h/2
    B1 = Arch.makeStructure(baseobj=None, length=L, width=b,height=h, name="Beam1")
    B1.Placement.Base = Vector(xList[0]+100, yList[0] , z)
    B1.IfcType = "Beam"
    B1.ViewObject.Transparency = 80
    B1.MoveWithHost = True
    Floor1.addObject(B1)
    
    B2 = Arch.makeStructure(baseobj=None, length=L, width=b,height=h, name="Beam2")
    B2.Placement.Base = Vector(xList[0], yList[0]+100 , z)
    B2.Placement.Rotation.Angle = radians(90)
    B2.IfcType = "Beam"
    B2.ViewObject.Transparency = 80
    B2.MoveWithHost = True
    Floor1.addObject(B2)
    
    B3 = Arch.makeStructure(baseobj=None, length=L, width=b,height=h, name="Beam3")
    B3.Placement.Base = Vector(xList[0]+100, yList[1] , z)
    B3.IfcType = "Beam"
    B3.ViewObject.Transparency = 80
    B3.MoveWithHost = True
    Floor1.addObject(B3)
    
    B4 = Arch.makeStructure(baseobj=None, length=L, width=b,height=h, name="Beam4")
    B4.Placement.Base = Vector(xList[1], yList[0]+100 , z)
    B4.Placement.Rotation.Angle = radians(90)
    B4.IfcType = "Beam"
    B4.ViewObject.Transparency = 80
    B4.MoveWithHost = True
    Floor1.addObject(B4)
    # Roof Beam 
    Roof = Arch.makeFloor([ ],name="Roof")
    Roof.Placement.Base.z = 3500
    b = 200; h = 400; L = 4000-200
    z = 3500-h/2
    RB1 = Arch.makeStructure(baseobj=None, length=L, width=b,height=h, name="RoofBeam1")
    RB1.Placement.Base = Vector(xList[0]+100, yList[0] , z)
    RB1.IfcType = "Beam"
    RB1.ViewObject.Transparency = 80
    RB1.MoveWithHost = True
    Roof.addObject(RB1)
    
    RB2 = Arch.makeStructure(baseobj=None, length=L, width=b,height=h, name="RoofBeam2")
    RB2.Placement.Base = Vector(xList[0], yList[0]+100 , z)
    RB2.Placement.Rotation.Angle = radians(90)
    RB2.IfcType = "Beam"
    RB2.ViewObject.Transparency = 80
    RB2.MoveWithHost = True
    Roof.addObject(RB2)
    
    RB3 = Arch.makeStructure(baseobj=None, length=L, width=b,height=h, name="RoofBeam3")
    RB3.Placement.Base = Vector(xList[0]+100, yList[1] , z)
    RB3.IfcType = "Beam"
    RB3.ViewObject.Transparency = 80
    RB3.MoveWithHost = True
    Roof.addObject(RB3)
    
    RB4 = Arch.makeStructure(baseobj=None, length=L, width=b,height=h, name="RoofBeam4")
    RB4.Placement.Base = Vector(xList[1], yList[0]+100 , z)
    RB4.Placement.Rotation.Angle = radians(90)
    RB4.IfcType = "Beam"
    RB4.ViewObject.Transparency = 80
    RB4.MoveWithHost = True
    Roof.addObject(RB4)
    
    # Rebar
    #return  # move remark if create only structures
    FreeCAD.ActiveDocument.recompute()
    from ColumnReinforcement import SingleTie
    for i in range(0,4):
        SingleTie.singleTieColumn1Reinforcement(25,25, 50, 
            135,4,6, False , 150 , 12 , 50 , 20 ,
            structure=FreeCAD.ActiveDocument.getObjectsByLabel("Column"+str(i+1))[0])
	
        SingleTie.singleTieColumn1Reinforcement(
            xdir_cover=25+12/2,
            ydir_cover=25+12/2,
            offset_of_tie=50,
            bentAngle=135,
            bentFactor=3,
            dia_of_tie=6,
            amount_spacing_check=False,
            amount_spacing_value=150,
            dia_of_rebars=12,
            t_offset_of_rebars=-500,
            b_offset_of_rebars=-250,
            rebar_type="LShapeRebar",
            l_rebar_orientation="Bottom Outside",
            l_rebar_rounding=3,
            l_part_length=300,
            structure=FreeCAD.ActiveDocument.getObjectsByLabel("Pier"+str(i+1))[0],
        )

if __name__=="__main__":
    FreeCAD.newDocument()
    cretePomYam02()
    
    FreeCAD.ActiveDocument.recompute()
    
    Msg("Done!\n\n")
Last edited by chakkree on Sat Apr 27, 2019 8:03 am, edited 1 time in total.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Automate Reinforcement GSoC proposal

Post by bernd »

related ... There is more to do than gui ... https://forum.freecadweb.org/viewtopic.php?f=39&t=35848
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: Tue Apr 23, 2019 12:47 pm related ... There is more to do than gui ... https://forum.freecadweb.org/viewtopic.php?f=39&t=35848
Thanks @bernd for pointing out

I have read that thread and the issue is related to import/export of reinforcement into ifc file to/from FreeCAD, which is not related to (IMO) what I have proposed to do during GSoC. But anyway, I will be interested to do that also. And I will enqueue it into my todo list and will do it if GSoC time limit permits or otherwise after that period.

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 »

Hello everyone

I added more orientations options for LShaped rebars in function. Now supported orientations are:
'Top Inside', 'Top Outside', 'Bottom Inside', 'Bottom Outside', 'Top Right', 'Top Left', 'Bottom Right', 'Bottom Left'

Image

Image

More changes:
- Change name of function from "singleTieColumn1Reinforcement" to "makeSingleTieFourRebars"
- Change variable name from 'l_rebar_orientation' to 'hook_orientation' and 'l_part_length' to 'hook_extension'
- Removed import statement of sys library
- Add "facename" parameter in function. Now user will either select face from FreeCAD Gui or he will pass facename during function call.

Related git commits:
https://github.com/SurajDadral/FreeCAD- ... 01327a5312
https://github.com/SurajDadral/FreeCAD- ... d77538fffe

Code:

Code: Select all

import FreeCADGui
from Stirrup import makeStirrup
from StraightRebar import makeStraightRebar
from LShapeRebar import makeLShapeRebar
from Rebarfunc import getParametersOfFace, getFaceNumber


def getLRebarOrientationLeftRightCover(
    hook_orientation,
    hook_extension,
    xdir_cover,
    ydir_cover,
    dia_of_tie,
    dia_of_rebars,
    face_length,
):
    """ getLRebarOrientationLeftRightCover(HookOrientation, HookExtension,
    XDirectionCover, YDirectionCover, DiameterOfTie, DiameterOfRebars,
    FaceLength):
    Return orientation and left and right cover of LShapeRebar in the form of
    dictionary of list.
    It takes eight different orientations input for LShapeHook i.e. 'Top
    Inside', 'Top Outside', 'Bottom Inside', 'Bottom Outside', 'Top Right',
    'Top Left', 'Bottom Right', 'Bottom Left'.
    """
    l_cover = []
    r_cover = []
    l_cover.append(xdir_cover + dia_of_rebars / 2 + dia_of_tie / 2)
    if hook_orientation == "Top Inside" or hook_orientation == "Bottom Inside":
        # Assign orientation value
        if hook_orientation == "Top Inside":
            list_orientation = ["Top Left", "Top Right"]
        else:
            list_orientation = ["Bottom Left", "Bottom Right"]
        r_cover.append(
            face_length
            - xdir_cover
            - dia_of_tie / 2
            - dia_of_rebars / 2
            - hook_extension
        )
        l_cover.append(r_cover[0])

    elif hook_orientation == "Top Outside" or hook_orientation == "Bottom Outside":
        if hook_orientation == "Top Outside":
            list_orientation = ["Top Left", "Top Right"]
        else:
            list_orientation = ["Bottom Left", "Bottom Right"]
        r_cover.append(
            face_length
            - xdir_cover
            - dia_of_tie / 2
            - dia_of_rebars / 2
            + hook_extension
        )
        l_cover.append(r_cover[0])

    elif hook_orientation == "Top Left" or hook_orientation == "Bottom Left":
        if hook_orientation == "Top Left":
            list_orientation = ["Top Left", "Top Right"]
        else:
            list_orientation = ["Bottom Left", "Bottom Right"]
        r_cover.append(
            face_length
            - xdir_cover
            - dia_of_tie / 2
            - dia_of_rebars / 2
            + hook_extension
        )
        l_cover.append(
            face_length
            - xdir_cover
            - dia_of_tie / 2
            - dia_of_rebars / 2
            - hook_extension
        )

    elif hook_orientation == "Top Right" or hook_orientation == "Bottom Right":
        if hook_orientation == "Top Right":
            list_orientation = ["Top Left", "Top Right"]
        else:
            list_orientation = ["Bottom Left", "Bottom Right"]
        r_cover.append(
            face_length
            - xdir_cover
            - dia_of_tie / 2
            - dia_of_rebars / 2
            - hook_extension
        )
        l_cover.append(
            face_length
            - xdir_cover
            - dia_of_tie / 2
            - dia_of_rebars / 2
            + hook_extension
        )

    r_cover.append(l_cover[0])
    l_rebar_orientation_cover = {}
    l_rebar_orientation_cover["list_orientation"] = list_orientation
    l_rebar_orientation_cover["l_cover"] = l_cover
    l_rebar_orientation_cover["r_cover"] = r_cover
    return l_rebar_orientation_cover


def getLRebarTopBottomCover(
    hook_orientation, dia_of_rebars, t_offset_of_rebars, b_offset_of_rebars
):
    """ getLRebarTopBottomCover(HookOrientation, DiameterOfRebars
    TopOffsetofRebars, BottomOffsetofRebars):
    Return top and bottom cover of LShapeRebar in the form of list. 
    """
    if "Top" in hook_orientation:
        t_offset_of_rebars -= dia_of_rebars / 2
    else:
        b_offset_of_rebars -= dia_of_rebars / 2
    return [t_offset_of_rebars, b_offset_of_rebars]


def makeSingleTieFourRebars(
    xdir_cover,
    ydir_cover,
    offset_of_tie,
    bentAngle,
    bentFactor,
    dia_of_tie,
    amount_spacing_check,
    amount_spacing_value,
    dia_of_rebars,
    t_offset_of_rebars,
    b_offset_of_rebars,
    rebar_type="StraightRebar",
    hook_orientation="Top Inside",
    l_rebar_rounding=None,
    hook_extension=None,
    structure=None,
    facename=None,
):
    """ makeSingleTieFourRebars(XDirectionCover, YDirectionCover, OffsetofTie,
    BentAngle, BentFactor, DiameterOfTie, AmountSpacingCheck,
    AmountSpacingValue, DiameterOfRebars, TopOffsetofRebars,
    BottomOffsetofRebars, RebarType, LShapeHookOrientation,
    LShapeRebarRounding, LShapePartLength, Structure, Facename):
    Adds the Single Tie reinforcement to the selected structural column
    object.
    It takes eight different orientations input for L-shaped hooks i.e. 'Top
    Inside', 'Top Outside', 'Bottom Inside', 'Bottom Outside', 'Top Left',
    'Top Right', 'Bottom Left', 'Bottom Right'.
    """
    if not structure and not facename:
        selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
        structure = selected_obj.Object
        facename = selected_obj.SubElementNames[0]

    # Calculate common parameters for Straight/LShaped rebars
    f_cover = ydir_cover + dia_of_rebars / 2 + dia_of_tie / 2
    t_cover = t_offset_of_rebars
    b_cover = b_offset_of_rebars
    rebar_amount_spacing_check = True
    rebar_amount_spacing_value = 2

    # Find facename of face normal to selected/provided face
    face = structure.Shape.Faces[getFaceNumber(facename) - 1]
    normal1 = face.normalAt(0, 0)
    faces = structure.Shape.Faces
    index = 1
    for face in faces:
        normal2 = face.normalAt(0, 0)
        if int(normal1.dot(normal2)) == 0 and int(normal1.cross(normal2).x) == 1:
            facename_for_rebars = "Face" + str(index)
            break
        index += 1

    # Create Straight Rebars
    if rebar_type == "StraightRebar":
        rl_cover = xdir_cover + dia_of_rebars / 2 + dia_of_tie / 2
        orientation = "Vertical"
        list_coverAlong = ["Right Side", "Left Side"]
        for coverAlong in list_coverAlong:
            makeStraightRebar(
                f_cover,
                (coverAlong, rl_cover),
                t_cover,
                b_cover,
                dia_of_rebars,
                rebar_amount_spacing_check,
                rebar_amount_spacing_value,
                orientation,
                structure,
                facename_for_rebars,
            )
    # Create L-Shaped Rebars
    elif rebar_type == "LShapeRebar":
        FacePRM = getParametersOfFace(structure, facename_for_rebars)
        face_length = FacePRM[0][0]
        if not hook_extension:
            hook_extension = (face_length - 2 * xdir_cover) / 3
        if not l_rebar_rounding:
            l_rebar_rounding = (float(dia_of_tie) / 2 + dia_of_rebars / 2) / dia_of_tie
        l_rebar_orientation_cover = getLRebarOrientationLeftRightCover(
            hook_orientation,
            hook_extension,
            xdir_cover,
            ydir_cover,
            dia_of_tie,
            dia_of_rebars,
            face_length,
        )
        list_orientation = l_rebar_orientation_cover["list_orientation"]
        l_cover = l_rebar_orientation_cover["l_cover"]
        r_cover = l_rebar_orientation_cover["r_cover"]
        tb_cover = getLRebarTopBottomCover(
            hook_orientation, dia_of_rebars, t_offset_of_rebars, b_offset_of_rebars
        )
        t_cover = tb_cover[0]
        b_cover = tb_cover[1]

        i = 0
        for orientation in list_orientation:
            makeLShapeRebar(
                f_cover,
                b_cover,
                l_cover[i],
                r_cover[i],
                dia_of_rebars,
                t_cover,
                l_rebar_rounding,
                rebar_amount_spacing_check,
                rebar_amount_spacing_value,
                orientation,
                structure,
                facename_for_rebars,
            )
            i += 1

    # Calculate parameters for Stirrup
    rounding = (float(dia_of_tie) / 2 + dia_of_rebars / 2) / dia_of_tie
    l_cover = r_cover = xdir_cover
    t_cover = b_cover = ydir_cover
    f_cover = offset_of_tie

    # Create Stirrups
    makeStirrup(
        l_cover,
        r_cover,
        t_cover,
        b_cover,
        f_cover,
        bentAngle,
        bentFactor,
        dia_of_tie,
        rounding,
        amount_spacing_check,
        amount_spacing_value,
        structure,
        facename,
    )
Please review and suggest changes.

Regards,
Last edited by Suraj Dadral on Sat May 04, 2019 6:18 pm, edited 1 time in total.
Invictus
Posts: 4
Joined: Thu Feb 14, 2019 5:12 am

Re: Automate Reinforcement GSoC proposal

Post by Invictus »

Looks good, Suraj. But how do you define left and right in 3D?

Regards,

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

Re: Automate Reinforcement GSoC proposal

Post by Suraj Dadral »

Invictus wrote: Sat May 04, 2019 6:39 am Looks good, Suraj. But how do you define left and right in 3D?
Left and right is defined with respect to top view of column as shown in freecad.
In GUI, user will be shown top view of column. And left and right side will be according to that top view.
If there is any terminology to define left and right in 3D then please let me know.
Suggestions are always welcome.

Regards,
User avatar
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: Automate Reinforcement GSoC proposal

Post by chakkree »

Traceback (most recent call last):
File "<input>", line 18, in <module>
File "C:\Users\User1\AppData\Roaming\FreeCAD\Mod\Reinforcement\ColumnReinforcement\SingleTie.py", line 227, in makeSingleTieFourRebars
l_rebar_orientation_cover = getLRebarOrientationCover(
NameError: name 'getLRebarOrientationCover' is not defined
Error occur on test "SingleTie.makeSingleTieFourRebars".
Cannot find function name "getLRebarOrientationCover".
User avatar
Suraj Dadral
Posts: 307
Joined: Fri Sep 07, 2018 5:32 pm
Contact:

Re: Automate Reinforcement GSoC proposal

Post by Suraj Dadral »

chakkree wrote: Sat May 04, 2019 6:07 pm
Traceback (most recent call last):
File "<input>", line 18, in <module>
File "C:\Users\User1\AppData\Roaming\FreeCAD\Mod\Reinforcement\ColumnReinforcement\SingleTie.py", line 227, in makeSingleTieFourRebars
l_rebar_orientation_cover = getLRebarOrientationCover(
NameError: name 'getLRebarOrientationCover' is not defined
Error occur on test "SingleTie.makeSingleTieFourRebars".
Cannot find function name "getLRebarOrientationCover".
I updated code in code segment of above post.
https://forum.freecadweb.org/viewtopic. ... 50#p305659

You may test now.

Regards,
Post Reply