## Test Create ArchRebar2 Object

A forum dedicated to the Arch module development
chakkree
Posts: 134
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

### Re: Test Create ArchRebar2 Object

Single Line Mode with dimension. Test for find idea.
Next step, create BS shape codes

SingleLine.PNG (26.77 KiB) Viewed 447 times

Code: Select all

`"""  Test Create DWire for rebar axis ,      for concept design of scripted object in future.  check basic rebar shape code.  27 Aug 2016"""import Part import Draftfrom FreeCAD import Vector , Placementdef CreateStraightBarHook(A=1000 ,placement = None):    D = +6*12    L1 = 4*12    pt1 = Vector(D/2.0 + L1,0,D)    pt2 = Vector(0,0,D)    pt3 = Vector(0,0,0)    pt4 = Vector(A,0,0)    pt5 = Vector(A,0,D)    pt6 = Vector(A-D/2.0 - L1,0,D)            points = [pt1,pt2,pt3,pt4,pt5,pt6]            axisRebar1 = Draft.makeWire(points,closed=False,face=False,support=None)    #axisRebar1.FilletRadius = D/2.0         # Eroor <class 'Part.OCCError'>: Both points are equal    axisRebar1.FilletRadius = D/2.0 - D*0.000001  # tip for prevent error <class 'Part.OCCError'>: Both points are equal    #axisRebar1.setExpression('FilletRadius', u'+6 * 12 / 2.0')    #axisRebar1.ViewObject.LineColor = (0.00,1.00,1.00)    if placement: axisRebar1.Placement=placement        # ****** find new algorithm for position of Dimension with object    FreeCAD.DraftWorkingPlane.alignToPointAndAxis(Vector(0,0,0), Vector(0,-1,0), 0.0) # XZ plane    ptDim1 = Vector(A/2,0,-100)    Dim1 = Draft.makeDimension(pt3 , pt4 , ptDim1)    Dim1.Direction = (1.00, 0.00, 0.00)    Dim1.ViewObject.FontSize = 50    Dim1.ViewObject.ArrowSize =10    Dim1.ViewObject.ArrowType = "Arrow"    FreeCAD.DraftWorkingPlane.alignToPointAndAxis(Vector(0,0,0), Vector(0,0,1), 0.0)    if placement: axisRebar1.Placement=placement            return axisRebar1    def CreateLShape(A=1000,B=300):    pt1 = Vector(0,0,0)    pt2 = Vector(A,0,0)    pt3 = Vector(A,0,B)        points = [pt1,pt2,pt3]            axisRebar1 = Draft.makeWire(points,closed=False,face=False,support=None)      axisRebar1.FilletRadius = 50    #axisRebar1.ViewObject.LineColor = (0.00,1.00,1.00)        return axisRebar1#CreateLShape()rebar1 = CreateStraightBarHook()FreeCAD.ActiveDocument.recompute()placement2 = Placement()placement2.Base.x = 1500createBSShape01 =  CreateStraightBarHookrebar2 = createBSShape01(placement=placement2)Msg('rebar1 length = {}\n'.format(rebar1.Length) )`
chakkree
Posts: 134
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

### Re: Test Create ArchRebar2 Object

Try to create rebar in FreeCAD like Reinforcment Example from @bernd
Only Rebar in a footing. Not included piers. Test for find idea.
Use DWire for represent rebar in single mode.

Code: Select all

`"""     from bernd Example, Footing     http://forum.freecadweb.org/viewtopic.php?f=18&t=17061#p135030     27 Aug 2016"""import Part import Draftfrom FreeCAD import Vector , Placementdef CreateRebar_01(A=540, B=1440 , dia = 12 ,placement = None):    D = +6*dia        pt1 = Vector(0,0,0)    pt2 = Vector(0,0,A)    pt3 = Vector(B,0,A)    pt4 = Vector(B,0,0)    points = [pt1,pt2,pt3,pt4]        axisRebar1 = Draft.makeWire(points,closed=False,face=False,support=None)    axisRebar1.FilletRadius = D/2.0    if placement: axisRebar1.Placement=placement    return axisRebar1def CreateRebar_01_Up(A=540, B=1440 , dia = 12 ,placement = None):    D = +6*dia        pt1 = Vector(0,0,A)    pt2 = Vector(0,0,0)    pt3 = Vector(B,0,0)    pt4 = Vector(B,0,A)    points = [pt1,pt2,pt3,pt4]        axisRebar1 = Draft.makeWire(points,closed=False,face=False,support=None)    axisRebar1.FilletRadius = D/2.0    if placement: axisRebar1.Placement=placement    return axisRebar1def  CreateRebar_02(A=400, B=3900 , dia = 18 ,placement = None):    D = +6*dia        pt1 = Vector(0,0,A)    pt2 = Vector(0,0,0)    pt3 = Vector(0,B,0)        points = [pt1,pt2,pt3]        axisRebar1 = Draft.makeWire(points,closed=False,face=False,support=None)    axisRebar1.FilletRadius = D/2.0    axisRebar1.ViewObject.LineColor = (0.00,0.00,1.00)        if placement: axisRebar1.Placement=placement    return axisRebar1def  CreateRebar_02_2(A=400, B=3900 , dia = 18 ,placement = None):    D = +6*dia        pt1 = Vector(0,0,A)    pt2 = Vector(0,0,0)    pt3 = Vector(0,-B,0)        points = [pt1,pt2,pt3]        axisRebar1 = Draft.makeWire(points,closed=False,face=False,support=None)    axisRebar1.FilletRadius = D/2.0    axisRebar1.ViewObject.LineColor = (0.00,0.00,1.00)        if placement: axisRebar1.Placement=placement    return axisRebar1def  CreateRebar_03(A=400, B=5250 , dia = 12 ,placement = None):    D = +6*dia        pt1 = Vector(0,0,-A)    pt2 = Vector(0,0,0)    pt3 = Vector(0,B,0)        points = [pt1,pt2,pt3]        axisRebar1 = Draft.makeWire(points,closed=False,face=False,support=None)    axisRebar1.FilletRadius = D/2.0    axisRebar1.ViewObject.LineColor = (1.00,0.00,1.00)        if placement: axisRebar1.Placement=placement    return axisRebar1def  CreateRebar_03_2(A=400, B=5250 , dia = 12 ,placement = None):    D = +6*dia        pt1 = Vector(0,0,-A)    pt2 = Vector(0,0,0)    pt3 = Vector(0,-B,0)        points = [pt1,pt2,pt3]        axisRebar1 = Draft.makeWire(points,closed=False,face=False,support=None)    axisRebar1.FilletRadius = D/2.0    axisRebar1.ViewObject.LineColor = (1.00,0.00,1.00)        if placement: axisRebar1.Placement=placement    return axisRebar1if __name__=="__main__":    concrete1 = Part.makeBox(1500,7000,600)    Part.show(concrete1)    #concrete1.ViewObject.Transparency = 50    #concrete1.ViewObject.ShapeColor = (0.67,1.00,0.00)    dia = 12    Spacing = (7000-2*50)/(35-1)    z = 30    for i in range(0,35):        placement1 = Placement()        placement1.Base = Vector(30,50+i*Spacing,z)        bar = CreateRebar_01(placement=placement1)                placement2 = Placement()        placement2.Base = Vector(30,50+i*Spacing+dia,z)        bar = CreateRebar_01_Up(placement=placement2)    dia = 18    Spacing = (1500-2*50)/(7-1)    z = 30+12/2+18/2    for i in range(0,7):        placement1 = Placement()        placement1.Base = Vector(50+i*Spacing,30,z)        bar = CreateRebar_02(placement=placement1)    dia = 18    Spacing = (1500-2*50)/(7-1)    z = 30+12/2+18/2    for i in range(0,7):        placement1 = Placement()        placement1.Base = Vector(50+i*Spacing+dia,7000-30,z)        bar = CreateRebar_02_2(placement=placement1)    dia = 12    Spacing = (1500-2*50)/(7-1)    z = 600-30-12    for i in range(0,7):        placement1 = Placement()        placement1.Base = Vector(50+i*Spacing+dia,30,z)        bar = CreateRebar_03(placement=placement1)                placement1 = Placement()        placement1.Base = Vector(50+i*Spacing,7000-30,z)        bar = CreateRebar_03_2(placement=placement1)    FreeCAD.ActiveDocument.recompute()`

CombineFooting.png (640.71 KiB) Viewed 425 times

Combine_Footing_01.FCStd
(100.62 KiB) Downloaded 9 times

IFC file form benrd is very useful and file size very small. only 159 kb can represent a hundread of rebar.
Footing_IFC.png (425.9 KiB) Viewed 425 times
Last edited by chakkree on Sun Aug 28, 2016 6:57 am, edited 4 times in total.
saso
Posts: 606
Joined: Fri May 16, 2014 1:14 pm
Contact:

### Re: Test Create ArchRebar2 Object

chakkree wrote:
yorik wrote:I have another (better) idea: Let's make the rebar1 a sub-case of rebar2.

Maybe create a new toolbar in ArchWorkbench,"Arch Rebar tool"?

IMO it could be a good moment to start to think about an Structure WB. For sure in the future structure should get big and powerful enough to have its own WB.
yorik
Site Admin
Posts: 8545
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

### Re: Test Create ArchRebar2 Object

Can you share the ifc file too? Curious to have a look at it...
chakkree
Posts: 134
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

### Re: Test Create ArchRebar2 Object

@yorik I got the IFC file from this topic(FEM/Automation in Design).
viewtopic.php?f=18&t=17061#p134959

This is direct link to file reinforcement.zip (download/file.php?id=25870)
The Zip file contain 3 files.
1. reinforcement--drawing.pdf
2. reinforcement--material_bill.pdf
3. reinforcement--model.ifc -- 159 kb

When open the ifc file, the first it can see as a mass model of concrete. If hide Foontings and Columns. The reinforcement will appear. The rebars are inside the concrete.
Footing_IFC_showConcrete.png (172.9 KiB) Viewed 389 times

reattach only ifc file and many thank to bernd.
reinforcement--model.ifc
(158.23 KiB) Downloaded 10 times
yorik
Site Admin
Posts: 8545
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

### Re: Test Create ArchRebar2 Object

Oh ok thanks! I thought you generated this IFC file from FreeCAD, I didn't remember the files from Bernd's post
In any case this is interesting... I had a better look now, in IFC it works like this:

- An IfcPolyline represents the path
- An IfcSweptDiskSolid creates a solid by sweeping a disk along the path
- An IfcMappedRepresentation shares that solid between several objects (with a different placement for each)
- An IfcReinforcingBar is created for each mapped representation.

This gives a pretty compact file! The only "heavy" data is the polyline, which appears only once for each type of rebar...
There are also sets of properties which are defined once for each rebar type, and associated with each IfcReinforcingBar.

We should definitely add code to our IFC exporter to export rebars like that -> issue #2684
bernd
Posts: 3863
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: Test Create ArchRebar2 Object

yorik wrote:We should definitely add code to our IFC exporter to export rebars like that -> issue #2684
+1
Have you seen the attribute Position Number. This defines the number of the rebar shape inside the model. This rebar shape could be on different places. All have the same Position number.

Guys if you are interested. I could provide more ifc of rebars and concrete components?! I have hundreds around and we do new ones every day ...

BTW: I was especially proud of the one posted because it was done by myself. Normally I only do sketches by pen and paper and the designer does the model. But once no designer was available and I had to do the model and drawing by myself.
yorik
Site Admin
Posts: 8545
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

### Re: Test Create ArchRebar2 Object

bernd wrote:Have you seen the attribute Position Number. This defines the number of the rebar shape inside the model. This rebar shape could be on different places. All have the same Position number.

Oho, no, I hadn't noticed. That's good feature...

In a more general way, I'm still not satisfied with the way we handle IFC properties. So far either (my first option) they are stored as a dictionary, or (rockn's work) as a spreadsheet. None are really perfect I think.

Inserting a new property in the FreeCAD object for each IFC property might be a solution, why not, after all? We could also, I think, make the property groups "foldable". Another, would be to create a new kind of property, that can group several IFC properties into one, a bit like they did for the sketcher datums...
bernd
Posts: 3863
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: Test Create ArchRebar2 Object

This Position number should surely be a FreeCAD property of a rebar shape.

yorik wrote:In a more general way, I'm still not satisfied with the way we handle IFC properties. So far either (my first option) they are stored as a dictionary, or (rockn's work) as a spreadsheet. None are really perfect I think.
Me neiter, thus +1 !

yorik wrote:Inserting a new property in the FreeCAD object for each IFC property might be a solution, why not, after all? We could also, I think, make the property groups "foldable". Another, would be to create a new kind of property, that can group several IFC properties into one, a bit like they did for the sketcher datums...
One property for each IFCPorperty could get huge. I have IFC with dozens of properties.

What I do for my own: Save each PropertySet in a dictionary. For the most important properties, the one I need to access afterwards, I make a FreeCAD property but not during Import. It works but I'm not satisfied with this either.

Mhh but the grouping and folding stuff like datums sounds interesting …
yorik
Site Admin
Posts: 8545
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

### Re: Test Create ArchRebar2 Object

One of these days I'll anyway make a test if adding hundreds of properies to objects has any impact on performance, just so we know...