Dev logs of Rebar Addon for FreeCAD - GSoC project

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
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

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

Post by amrit3701 »

bernd wrote: Sun Jul 02, 2017 11:27 am For me the stirrup intersects. See attached screen. I would rather let there be 1 mm or 2 air between them. Just to be sure not to have an intersection.
I have fixed it. Now, stirrup's end does not intersect with each other. They have some gap between them.

stirrup.png
stirrup.png (273.86 KiB) Viewed 1784 times
Amritpal Singh
Github, Like my work, sponsor me!
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

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

Post by bernd »

cool. Does the gap depend on the diameter or is it a absolute value. From my point of view the gap should be minimum 0.05 x rebar diameter. Means 0.5 mm for a diameter of 10 mm. If rebar is exchanged the rebars may be get tessellated. To be sure even with tessellation the gap is still there I would not make it to small and make it depend on diameter. Diameter somehow could span between 6 mm and 60 mm.

bernd
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

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

Post by amrit3701 »

chakkree wrote: Tue Jul 18, 2017 3:39 am Test create a continuous beam.
Rebars are made from LShape, Straight, and Stirrup.
Add rebar at column used dummy structure for containing rebar.
If the rebar's properties, "S-Cover", separate to Left-Side-Cover and Right-Side-Cover, dummy structure may be not necessary.
You can eliminate dummy structure by selecting a column(as shown in below image) and create straight rebar by giving side cover in negative like -2000 mm. BTW I will separate side cover to right and left side cover. But for stirrup, should I separate side cover in four parts (like right, left, top and bottom cover)?

straightrebar.png
straightrebar.png (329.96 KiB) Viewed 1745 times
Amritpal Singh
Github, Like my work, sponsor me!
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

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

Post by ickby »

Hello,

from time to time I skip over this thread to read about the progress, nice work so far, well done!
From my little experiance helping friends out building their house I know that rebars are used A LOT, there are so many of them. Also seeing your pictures I realized they are not using a trival geometry in freecad, the pipes with those bends will have quite a significant triangle count. So I wonder what performance impact this will have on large house models, I could imagine that it is hughe. So just as an idea one could optimize this by using the coin level of detail node: https://grey.colorado.edu/coin3d/classS ... etail.html
It should easily work to replace the whole surface of a rebar by a single wire for larger distances. This hsould help rendering speed sigificantly for large projects and not have a visual quality decrease if the distance is chosen right.

Maybe something to consider.

Regards,
Stefan
User avatar
saso
Veteran
Posts: 1924
Joined: Fri May 16, 2014 1:14 pm
Contact:

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

Post by saso »

I was actually thinking about the same thing as ickby, but from a bit different perspective... As far as I know it is actually quite common, even with commercial tools to have the option for rebar to display as real 3d geometry or as just wire, not just for the live 3d model but also on paper. So instead of this dynamic / automatic level of detail based on the zoom level as suggested by ickby (can of course also be useful), I was thinking about an option to manually set the visibility as wanted by the user, and yorik also has already developed his HiRes mode for architectural objects, so was thinking if that should not be available with all rebar objects by default?
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

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

Post by amrit3701 »

bernd wrote: Wed Jul 19, 2017 8:23 am cool. Does the gap depend on the diameter or is it a absolute value. From my point of view the gap should be minimum 0.05 x rebar diameter. Means 0.5 mm for a diameter of 10 mm. If rebar is exchanged the rebars may be get tessellated. To be sure even with tessellation the gap is still there I would not make it to small and make it depend on diameter. Diameter somehow could span between 6 mm and 60 mm.
Yes, gap depends on the diameter of the rebar. When rebar diameter is 10 mm and 60 mm then gap is .52mm approx. and 6.5 mm approx. respectively.

Regrads,
Amritpal Singh
Github, Like my work, sponsor me!
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

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

Post by amrit3701 »

bernd wrote: Wed Jul 19, 2017 8:23 am cool. Does the gap depend on the diameter or is it a absolute value. From my point of view the gap should be minimum 0.05 x rebar diameter. Means 0.5 mm for a diameter of 10 mm. If rebar is exchanged the rebars may be get tessellated. To be sure even with tessellation the gap is still there I would not make it to small and make it depend on diameter. Diameter somehow could span between 6 mm and 60 mm.
Yes, gap depends on the diameter of the rebar. When rebar diameter is 10 mm and 60 mm then gap is .52mm approx. and 6.5 mm approx. respectively.

Regards,
Amritpal Singh
Github, Like my work, sponsor me!
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

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

Post by yorik »

ickby/saso

That's a very interesting idea to debate further.

It's already easy to do that manually: Just set the display mode of the rebar to wireframe. The wire that appears will not be exactly at the center of the rebar, but at large scales that is a very minimal problem.

I think the rebar would only be one of the cases that would require such mechanism. For ex. imagine a very detailed door, with all its metal parts and hinges, in a residential tower there could be more than a hundred of them, that would clog everything.

So I think that could be a mechanism implemented at a higher level than the rebar. Also, there is the question that you would probably need that LOD not only in the 3D view, but also on 2D sheets. If you print your whole floor plan, you will need something different than if you print a detail of one column.

Revit and ArchiCAD have both a manual system, where you can switch manually an object between coarse, medium or refined versions. That's more or less what I tried with the HiRes system. It would be fairly simple to add one more, a "LowRes" system, if needed.

Then maybe there could be a way to have an automatic coin LOD system from these? That would be an interesting thing to investigate...
User avatar
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

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

Post by chakkree »

amrit3701 wrote: Wed Jul 19, 2017 11:16 am
.... But for stirrup, should I separate side cover in four parts (like right, left, top and bottom cover)?
I think stirrup should be separate side cover in four parts.(Example in attached picture)

TestColumn02.png
TestColumn02.png (526.77 KiB) Viewed 1670 times
TestColumn02.FCStd
(36.73 KiB) Downloaded 56 times

Code: Select all

#-*- coding=utf8 -*-
"""
   TestColumn02.py
   20 Jul 2017
"""
import FreeCAD
import Arch
import Draft

from FreeCAD import Vector
from math import cos, radians

# Custom DWire
# *** Prototype ***
class StirrupShape(Draft._Wire):
    def __init__(self,obj):
        Draft._Wire.__init__(self,obj)
        obj.addProperty("App::PropertyLength", "A",    "Rebar Shape", "The Length A of Stirrup rebar").A = 200
        obj.addProperty("App::PropertyLength", "B",    "Rebar Shape", "The Length B of Stirrup rebar").B=400
        obj.addProperty("App::PropertyLength", "dia",    "Rebar Shape", "The diameter of Stirrup rebar").dia = 6
        obj.addProperty("App::PropertyEnumeration","Type","Rebar Shape","The Type of hook rebar")
        obj.Type = ['1','2','3']

    def execute(self,obj):
        A = obj.A; B = obj.B; dia = obj.dia
        R = 4*obj.dia /2.
        Rcos = R*cos(radians(45))
        l_hookcos = 6*obj.dia*cos(radians(45))
        pointslist = []
        if obj.Type=='1': # แบบงอฉาก
            
            pointslist.append(Vector(-A/2.,+B/2.-R-12*dia,0))
            pointslist.append(Vector(-A/2.,+B/2.,0))
            pointslist.append(Vector(+A/2.,+B/2.,0))
            pointslist.append(Vector(+A/2.,-B/2.,0))                
            pointslist.append(Vector(-A/2.,-B/2.,+dia))
            pointslist.append(Vector(-A/2.,+B/2.,+dia))
            pointslist.append(Vector(-A/2.+R+12*dia,+B/2.,+dia))
        elif obj.Type=='2': # แบบงอขอ
            #Msg('Type=2\n')
            x = -A/2.; y =+B/2.
            dy = R + R* cos(radians(45))
            x1 = x + R - R* cos(radians(45))
            y1 = y - dy
            l_hook = 6*obj.dia*cos(radians(45))
            pointslist.append(Vector(x1+l_hook ,y1-l_hook,0))
            pointslist.append(Vector(x1-dy,y,0))
            
            #points.append(Vector(-A/2.,+B/2.,0))
            pointslist.append(Vector(+A/2.,+B/2.,0))
            pointslist.append(Vector(+A/2.,-B/2.,0))                
            pointslist.append(Vector(-A/2.,-B/2.,+dia))
            
            x1 = x + R + R* cos(radians(45))
            y1 = y - R + R* cos(radians(45))
            pointslist.append(Vector(x,y1+dy,+dia))
            pointslist.append(Vector(x1+l_hook,y1-l_hook,+dia))
            
        elif obj.Type=='3': # แบบงอข้าม
            
            x = -obj.A/2.; y =-obj.B/2.
            dx = R + R* cos(radians(45))
            dy = dx
            x1 = x + dx
            y1 = y + R - R* cos(radians(45))
            l_hook = 6*obj.dia*cos(radians(45))
            
            pointslist.append(FreeCAD.Vector(x1+l_hook,y1+l_hook,0))
            pointslist.append(FreeCAD.Vector(x,y1-dy,0))
            x = -obj.A/2.; y =+obj.B/2.
            pointslist.append(FreeCAD.Vector(x,y,0))
            
            pointslist.append(FreeCAD.Vector(+obj.A/2.,+obj.B/2.,0))
            pointslist.append(FreeCAD.Vector(+obj.A/2.,-obj.B/2.,0))                
            pointslist.append(FreeCAD.Vector(-obj.A/2.,-obj.B/2.,+obj.dia))
            
            x1 = x + R + R* cos(radians(45))
            y1 = y - R + R* cos(radians(45))
            pointslist.append(FreeCAD.Vector(x,y1+dy,+obj.dia))
            pointslist.append(FreeCAD.Vector(x1+l_hook,y1-l_hook,+obj.dia))
            
        obj.Points = pointslist
        obj.Closed = False
        obj.MakeFace = False
        obj.Support = None
        
        Draft._Wire.execute(self,obj)


def makeTestColumn02():
    doc =FreeCAD.ActiveDocument
    b = 300
    t = b
    covering = 20
    dia = 15
    dia_stir = 6
    
    concrete = Arch.makeStructure(length=b,width=t,height=500.0)
    
    h_mainRebar = 750

    x = +b/2 
    total_covering = covering + dia_stir + dia/2.
    gap = (b - 2*total_covering - dia*2 )/3.
    line1 = Draft.makeLine((x,x-total_covering,0) , (x,x-total_covering,h_mainRebar))
    rebar1 = Arch.makeRebar(diameter = dia)
    rebar1.Base = line1
    rebar1.Label = 'CustomRebar'
    rebar1.Host = concrete
    rebar1.Amount = 4
    rebar1.Direction = (-1., 0., 0.)
    rebar1.Rounding = 2
    rebar1.OffsetStart =total_covering ; rebar1.OffsetEnd =total_covering
    rebar1.Role = u"Rebar"
    
    line2 = Draft.makeLine((x,-x+total_covering,0) , (x,-x+total_covering,h_mainRebar))
    rebar2 = Arch.makeRebar(diameter = dia)
    rebar2.Base = line2
    rebar2.Label = 'CustomRebar'
    rebar2.Host = concrete
    rebar2.Amount = 4
    rebar2.Direction = (-1., 0., 0.)
    rebar2.Rounding = 2
    rebar2.OffsetStart =total_covering ; rebar2.OffsetEnd =total_covering
    rebar2.Role = u"Rebar"

    y = +b/2.-total_covering-gap-dia/2.
    line3 = Draft.makeLine((x,y,0) , (x,y,h_mainRebar))
    rebar3 = Arch.makeRebar(diameter = dia)
    rebar3.Base = line3    
    rebar3.Label = 'CustomRebar'
    rebar3.Host = concrete
    rebar3.Amount = 2
    rebar3.Direction = (-1., 0., 0.)
    rebar3.Rounding = 2
    rebar3.OffsetStart =total_covering ; rebar3.OffsetEnd =total_covering
    rebar3.Role = u"Rebar"
    
    y = -b/2.+total_covering+gap+dia/2.
    line4 = Draft.makeLine((x,y,0) , (x,y,h_mainRebar))
    rebar4 = Arch.makeRebar(diameter = dia)
    rebar4.Base = line4    
    rebar4.Label = 'CustomRebar'
    rebar4.Host = concrete
    rebar4.Amount = 2
    rebar4.Direction = (-1., 0., 0.)
    rebar4.Rounding = 2
    rebar4.OffsetStart =total_covering ; rebar4.OffsetEnd =total_covering
    rebar4.Role = u"Rebar"
    
    line5= doc.addObject("Part::Part2DObjectPython",'stirrup1')
    StirrupShape(line5)
    line5.Type = '2'
    line5.dia = dia_stir
    line5.Placement.Base = Vector(0,0,500+50)
    Draft._ViewProviderWire(line5.ViewObject)
    line5.A = b- 2*covering - dia_stir 
    line5.B = b- 2*covering - dia_stir 
    line5.MakeFace = False
    line5.FilletRadius = 2*dia_stir 
    rebar5 = Arch.makeRebar(diameter = dia_stir)
    rebar5.Base = line5    
    rebar5.Label = 'CustomRebar'
    rebar5.Host = concrete
    rebar5.Amount = 1
    rebar5.Direction = (-1., 0., 0.)
    rebar5.Rounding = 0
    rebar5.OffsetStart =0 ; rebar5.OffsetEnd =0
    rebar5.Role = u"Rebar"
    rebar5.ViewObject.ShapeColor = (0.667,0.000,0.000)
    
    line6= doc.addObject("Part::Part2DObjectPython",'stirrup2')
    StirrupShape(line6)
    line6.Type = '2'
    line6.dia = dia_stir
    line6.Placement.Base = Vector(0,0,500+50+dia_stir*2)
    line6.Placement.Rotation.Axis= Vector(0.,0.,1.)
    line6.Placement.Rotation.Angle= radians(-90)
    Draft._ViewProviderWire(line6.ViewObject)
    #Draft.rotate([line6], -90.0 ,Vector(0.,0.,0.),axis=Vector(0.,0.,1.),copy=False)
    line6.A = b- 2*covering - dia_stir -dia - 2*gap - dia_stir/2
    line6.B = b- 2*covering - dia_stir 
    line6.MakeFace = False
    line6.FilletRadius = 2*dia_stir 
    rebar6 = Arch.makeRebar(diameter = dia_stir)
    rebar6.Base = line6    
    rebar6.Label = 'CustomRebar'
    rebar6.Host = concrete
    rebar6.Amount = 1
    rebar6.Direction = (-1., 0., 0.)
    rebar6.Rounding = 0
    rebar6.OffsetStart =0 ; rebar6.OffsetEnd =0
    rebar6.Role = u"Rebar"
    rebar6.ViewObject.ShapeColor = (0.667,0.000,0.000)
    
    line7= doc.addObject("Part::Part2DObjectPython",'stirrup3')
    StirrupShape(line7)
    line7.Type = '2'
    line7.dia = dia_stir
    line7.Placement.Base = Vector(0,0,500+50+dia_stir*4)
    line7.Placement.Rotation.Axis= Vector(0.,0.,1.)
    line7.Placement.Rotation.Angle= radians(180)
    Draft._ViewProviderWire(line7.ViewObject)
    line7.A = b- 2*covering - dia_stir -dia - 2*gap - dia_stir/2
    line7.B = b- 2*covering - dia_stir 
    line7.MakeFace = False
    line7.FilletRadius = 2*dia_stir 
    rebar7 = Arch.makeRebar(diameter = dia_stir)
    rebar7.Base = line7    
    rebar7.Label = 'CustomRebar'
    rebar7.Host = concrete
    rebar7.Amount = 1
    rebar7.Direction = (-1., 0., 0.)
    rebar7.Rounding = 0
    rebar7.OffsetStart =0 ; rebar7.OffsetEnd =0
    rebar7.Role = u"Rebar"
    rebar7.ViewObject.ShapeColor = (0.667,0.000,0.000)

if __name__=='__main__':
    makeTestColumn02()
    Msg('Done!!\n\n')
    FreeCAD.ActiveDocument.recompute()
-------------------
Rebar Addon: Commits on Jul 20, 2017
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11616 (Git)
Build type: Release
Branch: master
Hash: aba4338808178b508f3170237f205e0066a5b437
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)
User avatar
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

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

Post by chakkree »

@Amritpal
In the sample file, test to create a simple beam(without scripting). Bar no.3 is top main rebar using UShape with rotation and translate.
In this point, for the user, UShape rebar can be top or bottom(like in LShape that can select 4 types).

TestSimpleBeam4.png
TestSimpleBeam4.png (525.96 KiB) Viewed 1658 times
SimpleBeam.FCStd
(70.32 KiB) Downloaded 46 times
ref. beam data from http://debug.pi.gr/default.aspx?ch=53


-------------------
Rebar Addon: Commits on Jul 20, 2017
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11616 (Git)
Build type: Release
Branch: master
Hash: aba4338808178b508f3170237f205e0066a5b437
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)
Post Reply