rebar based on wire

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: rebar based on wire

Post by bernd »

https://github.com/FreeCAD/FreeCAD/pull/2106

once this is merged I will start to play with real world rebar models created with Nemetschek Allplan. I will try to import them by ifc in FreeCAD as real FreeCAD rebar objects based on wires and not as stupid solids.

code to make a rebar without a strucure

Code: Select all

# code to make a rebar based on a simple wire
import FreeCAD, Arch, Draft
Wire = Draft.makeWire([FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(0, 0, 3000)])
Rebar = Arch.makeRebar(None, Wire, diameter=30, amount=1)
FreeCAD.ActiveDocument.recompute()

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

Re: rebar based on wire

Post by chakkree »

The rebar without a host, it cannot create a shape with rounding, and it has only one piece(in source code given amount=5)

Rebar_without_Host.png
Rebar_without_Host.png (154.3 KiB) Viewed 1156 times

Code: Select all

# Test Rebar without host ,  U-shape 5DB12@150
import FreeCAD, Arch, Draft
from FreeCAD import Vector
Wire = Draft.makeWire([Vector(0, 0, 300), Vector(0, 0, 0),Vector(1000, 0, 0),Vector(1000, 0, 300)])
Rebar = Arch.makeRebar(None, Wire, diameter=12, amount=5)
Rebar.Rounding = 3.0
Rebar.Spacing = 150
FreeCAD.ActiveDocument.recompute()
DDM
Posts: 88
Joined: Tue Feb 05, 2019 9:06 am

Re: rebar based on wire

Post by DDM »

To create the rebar I have to modify the code:

Code: Select all

import FreeCAD, Arch, Draft
from FreeCAD import Vector
Wire = Draft.makeWire([Vector(0, 0, 300), Vector(0, 0, 0),Vector(1000, 0, 0),Vector(1000, 0, 300)])
Rebar = Arch.makeRebar(Wire, Wire, diameter=12, amount=5)
FreeCAD.ActiveDocument.recompute()
Wire is the host and the base for rebar object...
To rounfing an alternative is to change the property of the wire:

Code: Select all

Wire.FilletRadius = 80
App.activeDocument().recompute()
But I can't change Rebar.spacing property
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: rebar based on wire

Post by bernd »

chakkree wrote: Fri Apr 26, 2019 9:02 am The rebar without a host, it cannot create a shape with rounding, and it has only one piece(in source code given amount=5)
The development to fix this will follow ... IMHO the rebar should be possible without host too. The user should decide if he would like to have a parametric rebar (depending on a host) or a not parametric host. Later means the host is used to create the rebar, but after creation the rebar is independent from the host. I am not sure yet what is best.

I just know in Nemetschek Allplan rebars are not parametric connected to the host and this works quit well and has some advantages. We gone create thousands of rebars this way. I would like to start to import these Allplan rebars and make real FreeCAD rebar objects from them. The ifc exported from Allplan only have rebars which are based on wires not host object at all. They use another wire to define the direction for the spaces ...

I have some ideas how to accomplish this in FreeCAD too.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: rebar based on wire

Post by bernd »

DDM wrote: Fri Apr 26, 2019 12:53 pm To create the rebar I have to modify the code:

Code: Select all

import FreeCAD, Arch, Draft
from FreeCAD import Vector
Wire = Draft.makeWire([Vector(0, 0, 300), Vector(0, 0, 0),Vector(1000, 0, 0),Vector(1000, 0, 300)])
Rebar = Arch.makeRebar(Wire, Wire, diameter=12, amount=5)
FreeCAD.ActiveDocument.recompute()
Wire is the host and the base for rebar object...
To rounfing an alternative is to change the property of the wire:

Code: Select all

Wire.FilletRadius = 80
App.activeDocument().recompute()
But I can't change Rebar.spacing property
The code I provided will work if the PR is merged ... https://github.com/FreeCAD/FreeCAD/pull/2106
DDM
Posts: 88
Joined: Tue Feb 05, 2019 9:06 am

Re: rebar based on wire

Post by DDM »

Hi @Bernd,

If can be usefull I tried this code, and the rounding and other properties can be changed (I don't know why :D )...
I have not change the ArchRebar.py yet as you suggested...

Code: Select all

import FreeCAD, Arch, Draft
from FreeCAD import Vector
Wire = Draft.makeWire([Vector(0, 0, 300), Vector(0, 0, 0),Vector(1000, 0, 0),Vector(1000, 0, 300)])
Rebar = Arch.makeRebar(Wire, Wire, diameter=12, amount=3)
Rebar.Rounding = 3.0
Rebar.Direction = (0,1,0)
Rebar.OffsetEnd = 0
Rebar.OffsetStart = 0
Rebar.Distance = 600
FreeCAD.ActiveDocument.recompute()
My opinion is that the possibility to create a rebar without an host object is very usefull for local detailing in concrete structure (i.e. local rebar for prestressed structure)...Moreover rebars without host can be grouped and linked to a section_plane arch object and inserted in techdraw, for example for a detail of rebars only....
Attachments
Rebar_without_Host.FCStd
(14.49 KiB) Downloaded 28 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: rebar based on wire

Post by bernd »

ahh the wire is host and sketch in one objet ... I never tried that one. Mhh I do not really know which is the better way to go ...
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: rebar based on wire

Post by yorik »

With git commit 7c263899e it is now possible to make a rebar object without a host from the GUI. Just select any wire or sketch and press the rebar button.
From python, you can just do: makeRebar(None,sketch)
User avatar
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: rebar based on wire

Post by chakkree »

Test for New rebar object without a host.
Test_Rebar_without_Host_01.png
Test_Rebar_without_Host_01.png (325.39 KiB) Viewed 1014 times

Code: Select all

"""
Word size of FreeCAD: 64-bit
Version: 0.19.16616 (Git)
Python version: 3.6.6
"""
# Test Rebar without host ,  U-shape 5DB12@150
import FreeCAD, Arch, Draft
from FreeCAD import Vector
Wire = Draft.makeWire([Vector(0, 0, 300), Vector(0, 0, 0),Vector(1000, 0, 0),Vector(1000, 0, 300)])

n = 5
Rebar = Arch.makeRebar(None, Wire, diameter=12, amount=n)
Rebar.Rounding = 3.0
Rebar.Spacing = 150
Rebar.Distance = (n-1)*Rebar.Spacing
Rebar.Direction = (0.0, 1.0, 0.0)
Rebar.OffsetStart = 0
Rebar.OffsetEnd = 0

FreeCAD.ActiveDocument.recompute()
User avatar
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: rebar based on wire

Post by chakkree »

Test to change rebar's shape by set new points vector to wire.
Test_Rebar_without_Host_02.png
Test_Rebar_without_Host_02.png (312.67 KiB) Viewed 1010 times

Code: Select all

"""
    Word size of FreeCAD: 64-bit
    Version: 0.19.16616 (Git)
    Python version: 3.6.6
"""
from FreeCAD import Vector
import FreeCADGui


def changeUShapeRebar(A= 300 , B=1000 , C=300,
                      RebarEndType = 0 ,dia=12):
    sel = FreeCADGui.Selection.getSelection()[0]
    if sel.IfcType=='Reinforcing Bar':
        sel.Diameter = dia
        sel.Rounding = (3/2+0.5)
        if RebarEndType==0: # None
            points = [
                Vector(0,0,A),
                Vector(0,0,0),
                Vector(B,0,0),
                Vector(B,0,C),
            ]
        elif RebarEndType==1:  # Anchored
            Lb = 12*dia + 3.5*dia
            #if Lb<600 : Lb = 600
            points = [
                Vector(Lb,0,A),
                Vector(0,0,A),
                Vector(0,0,0),
                Vector(B,0,0),
                Vector(B,0,C),
                Vector(B-Lb,0,C),
            ]
            Msg(points)
        elif RebarEndType==2:  # Hook
            R = (3/2+0.5)*dia
            Lb = 4*dia + R
            if Lb<(R+70) : Lb = R+70
            points = [
                Vector(2*R+0.1,0,A-Lb),
                Vector(2*R,0,A),
                Vector(0,0,A),
                Vector(0,0,0),
                Vector(B,0,0),
                Vector(B,0,C),
                Vector(B-2*R-0.1,0,C),
                Vector(B-2*R-0.1,0,C-Lb),
            ]
        wire = sel.OutList[0]
        wire.Points = points

if __name__=="__main__":
    changeUShapeRebar(RebarEndType=1)
    App.activeDocument().recompute()
    Msg('Done!\n\n')
Post Reply