Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
amrit3701
Posts: 318
Joined: Mon Jun 13, 2016 5:37 pm

yorik wrote:
Thu Jun 01, 2017 6:44 pm
Hello everyone,

Here is my TODO task list which I will complete before final phase evaluation:
1. Complete circular stirrup (spiral) which Yorik posted it in his previous post in this thread.
2. Create wiki pages for all rebar shapes which I completed.
3. Add "Apply" button in all dialog boxes of rebar shapes.
4. Add user facility to give custom spacing when he/she creating rebar. Now user gives custom spacing after creating rebar with rebar tool.
5. Also, discuss with Yorik that can we add rebar tools as default FreeCAD feature.

Currently, I am working on task 1 which is 30 percent completed. I will share on the forum next week.

Regards,
Amritpal Singh
Github, Like my work, sponsor me!
amrit3701
Posts: 318
Joined: Mon Jun 13, 2016 5:37 pm

chakkree wrote:
Tue Jul 11, 2017 4:13 am
I try to coding for a circular column.
But spiral stirrup is not a smooth curve.

Code: Select all

``````"""
Test Circular Column Rebbar
11 July 2017

"""

import Arch , Draft

from math import pi , sin , cos

def makeCircularColumn():
dia_col = 300.0*2

h_col = 5000
concShape.Height = h_col
column = Arch.makeStructure(concShape)
column.ViewObject.Transparency = 80

L = h_col+500
iAngle = 0.0
covering = 50
dia = 20 # main rebar
dia_stir = 16
dx = covering+dia_stir+dia/2
R = dia_col/2.  -dx  #dia_col-dx
num = 8
for i in range(0,num):
iAngle = i*(2*pi)/num
x = R* cos(iAngle)
y = R* sin(iAngle)
#Msg("%d x = %.1f , y=%.1f\n"%(i+1 , x,y))
points=[Vector(x,y,0.0),
Vector(x,y,L)]
line = Draft.makeWire(points,closed=False,face=True,support=None)
line.ViewObject.Visibility = False
rebar1 = Arch.makeRebar(diameter = dia)
rebar1.Base = line
rebar1.Label = 'RebarMain%d'%(iAngle+1)
rebar1.Host = column
rebar1.Amount = 1
rebar1.OffsetStart =0 ; rebar1.OffsetEnd =0
rebar1.Role = u"Rebar"

spacing = 150
segment = 8*2
#numCircular = h_col / spacing
dx = covering+dia_stir/2
dz = float(spacing) / segment
z = 20
R = dia_col/2.  -dx
points = []
#for n in range(0,numCircular):
count = 1
while (z<h_col):
for i in range(0,segment):
#Msg('count = %d , i=%d \n'%(count,i))
iAngle = i*(2*pi)/segment
x = R* cos(iAngle)
y = R* sin(iAngle)
points.append( Vector(x,y,z))
z += dz
count += 1
line2 = Draft.makeWire(points,closed=False,face=True,support=None)
line2.ViewObject.Visibility = False
rebar2 = Arch.makeRebar(diameter = dia_stir)
rebar2.Base = line2
rebar2.Label = 'spiralStirrup'
rebar2.Host = column
rebar2.Amount = 1
rebar2.OffsetStart =0 ; rebar1.OffsetEnd =0
rebar2.Role = u"Rebar"

if __name__=="__main__":
makeCircularColumn()
Msg('Done!!\n\n')``````
Hi @chakkree,

Can you explain this "iAngle = i * (2 * math.pi) / edges"? It will be better if you share the sources which help to create circular stirrup.

Till now I added circular stirrup which will only work when a column is parallel is z-axis (i.e. vertical). You test it by updating rebar tool.
circularStirrup1.png (253.08 KiB) Viewed 1433 times
circularStirrup.png (206.49 KiB) Viewed 1433 times
Regards,
Amritpal Singh
Github, Like my work, sponsor me!
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

amrit3701 wrote:
Sun Aug 06, 2017 11:57 am

Hi @chakkree,

Can you explain this "iAngle = i * (2 * math.pi) / edges"? It will be better if you share the sources which help to create circular stirrup.

Till now I added circular stirrup which will only work when a column is parallel is z-axis (i.e. vertical). You test it by updating rebar tool.

Regards,
This code is not quite good. It's not real curve.
It's approximate point of a line.
I think spring or helix macro will guide to use a real curve, for example, B-spline.
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

may be try Part.makeHelix

amrit3701
Posts: 318
Joined: Mon Jun 13, 2016 5:37 pm

chakkree wrote:
Sun Aug 06, 2017 2:04 pm
This code is not quite good. It's not real curve.
It's approximate point of a line.
I think spring or helix macro will guide to use a real curve, for example, B-spline.
Yes, I know that we are making helix / circle from small straight lines but if I used Part::Helix as the base of rebar object then rebar shape is not cylindrical. I also shared this bug with Yorik and he told me that I can start with that and if later on, we find a way to use the helix.

Shape of Rebar when I set Part::Helix as a base object.
helix.png (294.88 KiB) Viewed 1400 times
helix2.png (232.08 KiB) Viewed 1400 times

Shape of Rebar when I set wire (small straight lines) as a base object.
circluarStirrup3.png (278.56 KiB) Viewed 1400 times
circularStirrup4.png (261.08 KiB) Viewed 1400 times
Regards,
Amritpal Singh
Github, Like my work, sponsor me!
regis
Posts: 723
Joined: Sun Jul 12, 2015 8:17 am
Contact:

good progress, looking good,
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Try to use Part.arc
But it has some problems.
1) arc C4 is not show
2) It can not pass part.wire to rebar object for base object. May be to pass data to Draft.wire.

Code: Select all

``````"""
Test Circular Column Rebar
8 Aug 2017

"""

import Arch , Draft

from math import pi , sin , cos, radians

def makeOneLoop(r=150 , p=150 , n=1 ):
v1 = Vector(r,0,0)
v3 = Vector(0,r,p/4.0)
C1 = Part.Arc(v1,v2,v3)

v1 = Vector(0,r,p/4.0)
v3 = Vector(-r,0,p/4.0*2)
C2 = Part.Arc(v1,v2,v3)

v1 = Vector(-r,0,p/4.0*2)
v3 = Vector(0,-r,p/4.0*3)
C3 = Part.Arc(v1,v2,v3)

v1 = Vector(0,-r,p/4.0*3)
v3 = Vector(r,0,p)
C4 = Part.Arc(v1,v2,v3)

S1 = Part.Shape([C1,C2,C3,C4])

W = Part.Wire(S1.Edges)
Part.show(W)

if __name__=="__main__":
makeOneLoop()
Msg('Done!!\n\n')``````
spiral01.png (278.69 KiB) Viewed 1332 times
yorik
Posts: 12210
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

It is possible to use makePipeShell with a helix:
Screenshot from 2017-08-08 11-11-44.png (216.79 KiB) Viewed 1300 times

Code: Select all

``````helix = App.ActiveDocument.addObject("Part::Helix","Helix")
helix.Pitch=150
helix.Height=300
helix.Angle=0.00
helix.LocalCoord=0
helix.Style=1
# not sure what LocalCoord and Style are for...

App.ActiveDocument.recompute()

# to create a tangential circle:
wire = helix.Shape
edge = wire.Edges[0]
basepoint = edge.Vertexes[0].Point
tangent = edge.tangentAt(0)
circle = Part.makeCircle(50,basepoint,tangent)

# now the pipe works
pipe = wire.makePipeShell([circle],True, False,2)``````
Attachments
helix.fcstd
regis
Posts: 723
Joined: Sun Jul 12, 2015 8:17 am
Contact:

yorik wrote:
Tue Aug 08, 2017 2:19 pm
It is possible to use makePipeShell with a helix:
Screenshot from 2017-08-08 11-11-44.png

Code: Select all

``````helix = App.ActiveDocument.addObject("Part::Helix","Helix")
helix.Pitch=150
helix.Height=300
helix.Angle=0.00
helix.LocalCoord=0
helix.Style=1
# not sure what LocalCoord and Style are for...

App.ActiveDocument.recompute()

# to create a tangential circle:
wire = helix.Shape
edge = wire.Edges[0]
basepoint = edge.Vertexes[0].Point
tangent = edge.tangentAt(0)
circle = Part.makeCircle(50,basepoint,tangent)

# now the pipe works
pipe = wire.makePipeShell([circle],True, False,2)``````
bravo, smoother output, this gives a better 2d and 3d printing out put on techdraw as well,
amrit3701
Posts: 318
Joined: Mon Jun 13, 2016 5:37 pm

amrit3701 wrote:
Sat Aug 05, 2017 7:10 pm
Hello everyone,

Here is my TODO task list which I will complete before final phase evaluation:
1. Complete circular stirrup (spiral) which Yorik posted it in his previous post in this thread.
2. Create wiki pages for all rebar shapes which I completed.
3. Add "Apply" button in all dialog boxes of rebar shapes.
4. Add user facility to give custom spacing when he/she creating rebar. Now user gives custom spacing after creating rebar with rebar tool.
5. Also, discuss with Yorik that can we add rebar tools as default FreeCAD feature.
Yeah! I have completed my 3rd task. Now, all rebar dialog boxes have "Apply" button.
applybutton.png (251.41 KiB) Viewed 1255 times
Thanks,
Amritpal Singh
Github, Like my work, sponsor me!