Dev logs of Rebar Addon for FreeCAD - GSoC project

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
chakkree
Posts: 289
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby chakkree » Thu Jul 13, 2017 6:19 am

Test create double stirrups, using basic ArchRebar Object.
Stirrup used rebar-addon's function to get DWire.

Code: Select all

"""
  TestSimpleBeam2.py
   13 Jul 2017
"""
import Arch

from FreeCAD import Vector
from Stirrup import getTrueParametersOfStructure, getParametersOfFace ,getpointsOfStirrup


def makeSimpleBeam2():
    L = 4000.0
    b = 200
    h = 400
    col_width = 200
    Ln = L-2*(col_width/2.)
    concrete = Arch.makeStructure(length=Ln,width=b,height=h)
    concrete.Placement.Base = Vector(L-col_width/2., 0 , -h/2.)
    concrete.ViewObject.Transparency = 80
    FreeCAD.ActiveDocument.recompute()


    covering = 20
    dia = 19  # Main
    diameter = 9 # Stirrup
    dx = covering+dia/2 
    y = -b/2 
    points=[Vector(-100-dx,y,-dx-2*dia-6*dia),
            Vector(-100-dx,y,-dx-diameter/2.),
            Vector(+100 + Ln +200-dx,y,-dx-diameter/2),
            Vector(+100 + Ln +200-dx,y,-dx-2*dia-6*dia),]
    line = Draft.makeWire(points,closed=False,face=False,support=None)
    line.ViewObject.Visibility = False
    rebar1 = Arch.makeRebar(diameter = 12)
    rebar1.Base = line
    rebar1.Label = 'TopMain'
    rebar1.Host = concrete
    rebar1.Amount = 3
    rebar1.Rounding = 2.000
    rebar1.MoveWithHost = True
    rebar1.Direction = (0.000,1 , 0.000)
    #rebar1.Spacing = b-2*dx
    rebar1.OffsetStart =dx+diameter/2. ; rebar1.OffsetEnd =dx+diameter/2.
    rebar1.Role = u"Rebar"
    
    points=[Vector(-100-dx,y,-h +dx+2*dia+6*dia),
            Vector(-100-dx,y,-h+dx+diameter/2.),
            Vector(+100 + Ln +200-dx,y,-h+dx+diameter/2.),
            Vector(+100 + Ln +200-dx,y,-h+dx+2*dia+6*dia),]
    line2 = Draft.makeWire(points,closed=False,face=False,support=None)
    line2.ViewObject.Visibility = False
    rebar2 = Arch.makeRebar(diameter = 12)
    rebar2.Base = line2
    rebar2.Label = 'BottomMain'
    rebar2.Host = concrete
    rebar2.Amount = 3
    rebar2.Rounding = 2.000
    rebar2.MoveWithHost = True
    rebar2.Direction = (0.000,1 , 0.000)
    #rebar2.Spacing = b-2*dx
    rebar2.OffsetStart =dx+ diameter/2. ; rebar1.OffsetEnd =dx+ diameter/2.
    rebar2.Role = u"Rebar"
    

    # Double Stirrup
    b1 = b/2+dia/2+20
    concreteDummy = Arch.makeStructure(length=Ln,width=b1 ,height=h)
    concreteDummy.Placement.Base = Vector(L-col_width/2., +(b-b1)/2 , -h/2.)
    concreteDummy.Label = 'Dummy1'
    concreteDummy.ViewObject.Transparency = 70
    FreeCAD.ActiveDocument.recompute()

    
    #selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
    structure = concreteDummy
    facename = 'Face6' #selected_obj.SubElementNames[0]
    #facename
        
    face = structure.Shape.Faces[int(facename[-1]) - 1]
    StructurePRM = getTrueParametersOfStructure(structure)
    FacePRM = getParametersOfFace(structure, face, False)
    FaceNormal = face.normalAt(0,0)
    FaceNormal = face.Placement.Rotation.inverted().multVec(FaceNormal)
    

    s_cover =  20 #b -(b/2.0-20-dia/2.0)/2.0
    bentAngle = 135
    bentFactor = 6

    rounding=2
    
    spacing = 175
    num = int(L/spacing)+1
    amount_spacing_value = num
    f_cover = ( L-((num-1)*spacing) )/2.0
    points = getpointsOfStirrup(FacePRM, s_cover, bentAngle, bentFactor, diameter, rounding, FaceNormal)
    line = Draft.makeWire(points, closed = False, face = True, support = None)
    line.Support = [(structure, facename)]
    stir = Arch.makeRebar(structure, line, diameter, amount_spacing_value, f_cover)
    stir.Direction = FaceNormal.negative()
    stir.Rounding = rounding
    stir.Role = u"Rebar"
    stir.Label = 'Stirrups1'
    stir.MoveWithHost = True

    # -------------------
    concreteDummy2 = Arch.makeStructure(length=Ln,width=b1 ,height=h)
    concreteDummy2.Placement.Base = Vector(L-col_width/2., -(b-b1)/2 , -h/2.)
    concreteDummy2.Label = 'Dummy2'
    concreteDummy2.ViewObject.Transparency = 70
    FreeCAD.ActiveDocument.recompute()

    
    #selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
    structure = concreteDummy2
    facename = 'Face6' #selected_obj.SubElementNames[0]
    #facename
        
    face = structure.Shape.Faces[int(facename[-1]) - 1]
    StructurePRM = getTrueParametersOfStructure(structure)
    FacePRM = getParametersOfFace(structure, face, False)
    FaceNormal = face.normalAt(0,0)
    FaceNormal = face.Placement.Rotation.inverted().multVec(FaceNormal)
    


    f_cover = ( L-((num-1)*spacing) )/2.0+diameter*1.5
    points = getpointsOfStirrup(FacePRM, s_cover, bentAngle, bentFactor, diameter, rounding, FaceNormal)
    line = Draft.makeWire(points, closed = False, face = True, support = None)
    line.Support = [(structure, facename)]
    stir2 = Arch.makeRebar(structure, line, diameter, amount_spacing_value, f_cover)
    stir2.Direction = FaceNormal.negative()
    stir2.Rounding = rounding
    stir2.Role = u"Rebar"
    stir2.Label = 'Stirrups2'
    stir2.MoveWithHost = True
    
    #stir2.OffsetEnd =57.
    concreteDummy.ViewObject.Visibility=False
    concreteDummy2.ViewObject.Visibility=False
    
    FreeCAD.ActiveDocument.recompute()
    stir2.OffsetEnd = 61. # fake

if __name__=="__main__":
    makeSimpleBeam2()
    FreeCAD.ActiveDocument.recompute()
    Msg('Done!!\n\n')
TestSimpleBeamRebar3.png
TestSimpleBeamRebar3.png (609.66 KiB) Viewed 676 times
-------------------------------------
Rebar Addon: Commits on Jul 12, 2017
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11570 (Git)
Build type: Release
Branch: master
Hash: a68940340747d3f18818fc7b0bc72eb59e7a0f25
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
thschrader
Posts: 1608
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby thschrader » Thu Jul 13, 2017 7:24 am

amrit3701 wrote:
Fri Jul 07, 2017 1:19 pm

With above PR, Rebar object has the ability to create non-uniform spacing between rebars.

For eg. Suppose we have a column having height 1000 mm and values of offset start and offset end of rebar object is equal to 25 mm. If we given custom spacing 6@50+4@100+6@50 it will create 50 mm spacing between 6 rebars at the start portion, 100 mm spacing between 4 rebars in the middle portion and 50 mm spacing between 6 rebars in the last portion.

For getting the correct result, first user needs to calculate spacing manually and then give that values to custom spacing property of rebar object otherwise it will get a strange result.
Amritpal :D
I got it. Please put blue text into dialog-icon :D
Still playing with "custom-spacing". Give me a try...
regards thomas
User avatar
amrit3701
Posts: 278
Joined: Mon Jun 13, 2016 5:37 pm

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby amrit3701 » Thu Jul 13, 2017 11:33 am

chakkree wrote:
Thu Jul 13, 2017 6:19 am
Test create double stirrups, using basic ArchRebar Object.
Stirrup used rebar-addon's function to get DWire.
+1

Great. It will be really helpful for me in the future.

Regards,
User avatar
amrit3701
Posts: 278
Joined: Mon Jun 13, 2016 5:37 pm

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby amrit3701 » Thu Jul 13, 2017 1:17 pm

yorik wrote:
Wed Jul 12, 2017 3:25 pm
The "custom spacing" button is only available when editing the rebar, not when creating it, is that normal?
According to me, the "custom spacing" button will run outside from the rebar dialog box because now the user will only give a custom spacing with rebar distribution dialog box if he/she created rebar from rebar addon. To overcome this limitation I think we should add "custom spacing" button inside property view of the rebar object.

@Yorik
Give your views on that?

Regards,
User avatar
regis
Posts: 713
Joined: Sun Jul 12, 2015 8:17 am
Contact:

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby regis » Thu Jul 13, 2017 2:27 pm

amrit3701 wrote:
Thu Jul 13, 2017 1:17 pm
yorik wrote:
Wed Jul 12, 2017 3:25 pm
The "custom spacing" button is only available when editing the rebar, not when creating it, is that normal?
According to me, the "custom spacing" button will run outside from the rebar dialog box because now the user will only give a custom spacing with rebar distribution dialog box if he/she created rebar from rebar addon. To overcome this limitation I think we should add "custom spacing" button inside property view of the rebar object.

@Yorik
Give your views on that?

Regards,
custom spacing inside property view data is not a bad idea. ;)
User avatar
yorik
Site Admin
Posts: 11830
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby yorik » Thu Jul 13, 2017 2:27 pm

amrit3701 wrote:
Thu Jul 13, 2017 1:17 pm
I think we should add "custom spacing" button inside property view of the rebar object.
This would require to create a new type of property to FreeCAD core, plus an editor for it, etc... Lots of work for something that will be used only once (in rebar) I think.

But this is not what I was asking. The problem was this: When you create a rebar, the "custom spacing" button is disabled (greyed out). Then, if you create the rebar (click OK), then double-click it to edit it, the task dialog appears again, and, this time, the "custom spacing" button is enabled. I wondered why it is disabled the first time.
User avatar
regis
Posts: 713
Joined: Sun Jul 12, 2015 8:17 am
Contact:

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby regis » Thu Jul 13, 2017 6:37 pm

in this tutorial I demonstrate another area where the rebar tool can be used on draftwire lines instead of depending on a face, but for this tutorial I used the pipe tool to achieve the same thing. Any ideas, conversations about if this is a necessary feature for the rebar? you guys understand coding more than me, so I'll leave that open to your imagination.
phpBB [video]
User avatar
chakkree
Posts: 289
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby chakkree » Fri Jul 14, 2017 5:25 am

Test create a column with double stirrups.

Code: Select all

"""
  TestColumn01.py
   14 Jul 2017
"""

import Arch
import Draft

from FreeCAD import Vector
from math import radians,cos
from Stirrup import getTrueParametersOfStructure, getParametersOfFace ,getpointsOfStirrup


def makeColumn01():
    h = 3000.0
    b = 400
    t = 400
    col_width = 200
    y = 0
    #Ln = L-2*(col_width/2.)
    concrete = Arch.makeStructure(length=t,width=b,height=h)
    concrete.Placement.Base = Vector(0, 0 , 0)
    concrete.ViewObject.Transparency = 80
    FreeCAD.ActiveDocument.recompute()
    
    covering = 20
    dia = 16  # Main
    diameter = 9 # Stirrup
    dx = covering+diameter+dia/2
    R = 2*dia
    LHook = 6*dia + 500
    z = -400
    
    rebarMain = []
    rebarMain.append({'x':-t/2+dx , 'y':-b/2+dx , 'angle':45} )
    rebarMain.append({'x':+t/2-dx , 'y':-b/2+dx , 'angle':90+45} )
    rebarMain.append({'x':+t/2-dx , 'y':+b/2-dx , 'angle':-90-45} )
    rebarMain.append({'x':-t/2+dx , 'y':+b/2-dx , 'angle':-45} )
    
    rebarMain.append({'x':-t/2+dx , 'y':0 , 'angle':0} )
    rebarMain.append({'x':0 , 'y':-b/2+dx , 'angle':90} )
    rebarMain.append({'x':+t/2-dx , 'y':0 , 'angle':180} )
    rebarMain.append({'x':0 , 'y':+b/2-dx , 'angle':-90} )
    count = 1
    for iBar in rebarMain:
        x = iBar['x']
        y = iBar['y']
        points=[Vector(x-R-LHook,y,z),
                Vector(x,y,z),
                Vector(x,y,+h+1000),]
        line = Draft.makeWire(points,closed=False,face=False,support=None)
        line.Support = [(concrete, 'Face1')]
        line.ViewObject.Visibility = False
        Draft.rotate(line,  iBar['angle'] , Vector(x,y,0)  )
        rebar1 = Arch.makeRebar(diameter = dia)
        rebar1.Base = line
        rebar1.Label = 'Main%d'%count
        rebar1.Host = concrete
        rebar1.Amount = 1
        rebar1.Rounding = 3.000
        count +=1
    
    structure = concrete
    facename = 'Face6' #selected_obj.SubElementNames[0]
    
    
    face = structure.Shape.Faces[int(facename[-1]) - 1]
    StructurePRM = getTrueParametersOfStructure(structure)
    FacePRM = getParametersOfFace(structure, face, False)
    FaceNormal = face.normalAt(0,0)
    FaceNormal = face.Placement.Rotation.inverted().multVec(FaceNormal)
    
    s_cover = 20
    bentAngle = 135
    bentFactor = 6
    
    rounding=2
    
    spacing = 250
    num = int(h/spacing)+1
    amount_spacing_value = num
    
    f_cover = ( h-((num-1)*spacing) )/2.0
    points = getpointsOfStirrup(FacePRM, s_cover, bentAngle, bentFactor, diameter, rounding, FaceNormal)
    line = Draft.makeWire(points, closed = False, face = True, support = None)
    line.Support = [(structure, facename)]
    stir1 = Arch.makeRebar(structure, line, diameter, amount_spacing_value, f_cover)
    stir1.Direction = FaceNormal.negative()
    stir1.Rounding = rounding
    stir1.Role = u"Rebar"
    stir1.Label = 'Stirrups1'
    stir1.MoveWithHost = True
    stir1.CustomSpacing = "%d@%d"%(num-1 ,spacing )
    stir1.OffsetStart = 100
    
    f_cover += diameter
    b1 = ((b/2.0)*cos(radians(45))*2) - covering
    s_cover = (b - b1)/2.0
    points = getpointsOfStirrup(FacePRM, s_cover, bentAngle, bentFactor, diameter, rounding, FaceNormal)
    line = Draft.makeWire(points, closed = False, face = True, support = None)
    Draft.rotate(line,  45 , Vector(0,0,0)  )
    line.Support = [(structure, facename)]
    stir2 = Arch.makeRebar(structure, line, diameter, amount_spacing_value, f_cover)
    stir2.Direction = FaceNormal.negative()
    stir2.Rounding = rounding
    stir2.Role = u"Rebar"
    stir2.Label = 'Stirrups2'
    stir2.MoveWithHost = True
    stir2.CustomSpacing = "%d@%d"%(num-1 ,spacing )
    stir2.OffsetStart = 100-diameter

if __name__=="__main__":
    makeColumn01()
    FreeCAD.ActiveDocument.recompute()
    Msg('Done!!\n\n')
TestColumn01.png
TestColumn01.png (554.21 KiB) Viewed 550 times
-------------------------------------
Rebar Addon: Commits on Jul 12, 2017
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11570 (Git)
Build type: Release
Branch: master
Hash: a68940340747d3f18818fc7b0bc72eb59e7a0f25
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
thschrader
Posts: 1608
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby thschrader » Fri Jul 14, 2017 8:32 am

regis wrote:
Thu Jul 13, 2017 6:37 pm
in this tutorial I ...
At regis off topic:
I downloaded the spaceframe from your github.
For me as a (german) structural engineer it would be of interest,
which loadings your engineers must use for a location in africa (especially wind loading).
Excellent video. regards thomas
Jee-Bee
Posts: 2011
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Postby Jee-Bee » Fri Jul 14, 2017 8:47 am