Circular wall rebar using python script

Hi everyone,
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.



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)


1 Like


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.



Can you help me pls?


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()
		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
	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
		restArc = Arc.ByCenterPointRadiusAngle(offset_arc.CenterPoint, offset_arc.Radius, end_Angle - marginAngle, start_Angle + marginAngle, normal_vect)
		# if it's the last bar
		if math.ceil(restArc.Length) < len_Bar:
			restArc = restArc.Translate(0,0, a * -1 * offset_beetwen_overlap_bar)
			# remove small curves
			temp = [c for c in temp if c.Length > margin_overlap]
		# 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
OUT = out
1 Like

Thanks a lot Cyril for your help

Your script solve my issue.