# Circular wall rebar using python script

Hi everyone,
@c.poupin
to create my wall circular rebars I wanted to make changes to your script used here, Centerline tangentiel reinforcement but I admit that it is difficult for me at the moment to understand the python codes and to use them correctly (I can’t translate my curves vertically according to the spacing defined in my script below)

wall_rebar.dyn (62.3 KB)

circulaire_wall.rvt (2.0 MB)

So I’m once again asking you to help me write the correct python script.

Thanks.

Hello,

Why don’t you use the previous script with a single entry rayon then a geometry translate in Z
(with a series with your spacing)

cordially
christian.stan

1 Like

@christian.stan

I used the same approch of the previous script that you help create and I actually thank you for that however I prefere to use a python script that gives me more accurate results concerning lengths of bars.

Thanks.

@c.poupin

Can you help me pls?

Thanks.

try this one and try to understand the code

import sys
import clr
import math
from Autodesk.DesignScript.Geometry import *

def isClockwise(arc):
"""check if the arc is Clockwise"""
pStart = arc.StartPoint
pCenter = arc.CenterPoint
pEnd = arc.EndPoint
vecta = Vector.ByTwoPoints(pCenter, pStart)
vectb = Vector.ByTwoPoints(pCenter, pEnd)
cp = vecta.Cross(vectb)
return cp.Z < 0

def fix_inputArc(arc):
"""check if the input arc is correct"""
arc = arc[0] if hasattr(arc, "__iter__") else arc
if isClockwise(arc):
return arc.Reverse()
else:
return arc

input_arc = fix_inputArc(IN[0])
lstOffset = IN[1]
len_Bar = IN[2]
margin_overlap = 1 # in meter
offset_beetwen_overlap_bar = 0.02 # in meter
normal_vect = Vector.ByCoordinates(0,0,1)
out = []

for d in lstOffset:
temp = []
offset_arc = input_arc.Translate(0,0,d)
start_Angle = offset_arc.StartAngle
end_Angle = offset_arc.StartAngle + offset_arc.SweepAngle
#
perimeter = offset_arc.Radius * 2 * math.pi
temp.append(offset_arc)
a, b = 1, -1
k= 0
# copy and rotate new arcs
while k < 500:
k += 1
a, b = b, a # swap each loop
# compute the overlap angle beetwen bars
marginAngle = (margin_overlap * 360) / (2 * math.pi * offset_arc.Radius)
# compute the arc remainder
# if it's the last bar
if math.ceil(restArc.Length) < len_Bar:
restArc = restArc.Translate(0,0, a * -1 * offset_beetwen_overlap_bar)
temp.append(restArc)
# remove small curves
temp = [c for c in temp if c.Length > margin_overlap]
out.append(temp)
break
#
# rotate the new arc
offset_arc = offset_arc.Rotate(offset_arc.CenterPoint, Vector.ByCoordinates(0,0,1), offset_arc.SweepAngle - marginAngle)
# add a small vertical offset
offset_arc = offset_arc.Translate(0,0, a * offset_beetwen_overlap_bar)
# update end angle
end_Angle = offset_arc.StartAngle + offset_arc.SweepAngle
temp.append(offset_arc)
#
OUT = out
1 Like

@c.poupin
Thanks a lot Cyril for your help