Offsetting and rotating arcs by overlapping

Hi everyone,
@c.poupin
I’m trying throw the script below to offset my circles inwards and create arcs which can be rotated and overllaped till the remaining length in each circle becomes < 12m ( in fact my post is the same here Centerline tangentiel reinforcement but I want to make some changes)
My circles and arcs are created and offseted correctly , but some thing is wrong in my script and I can’t fill in my list like this:
image

My script:

import sys
import clr
import math
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#Circle inputs
circle = IN[0]
offset_distance = IN[1]
overlap_length = 1
# Circle's center point
Center_point = circle.CenterPoint
Start_pt1 = circle.StartPoint
End_pt1 = circle.PointAtSegmentLength(12)
arc = Arc.ByCenterPointStartPointEndPoint(Center_point, Start_pt1, End_pt1)
Radius = Line.ByStartPointEndPoint(Start_pt1, Center_point)

# vector to offset circles inwards by offset_distance
offset_vector = Radius.Direction.Normalized()
Normal_vector = Vector.ByCoordinates(0, 0, 1)
lst = [circle]
lst1 = [arc]
#Offset circles inwards
k =0
d = 0
while k < 600:
    k +=1
    d += offset_distance
    circle_offset = circle.Offset(-d)
    try:
        Radius_offset = circle_offset.Radius
    except:
        circle_offset = circle_offset.Explode()[0] 
    Start_pt1 = circle_offset.StartPoint     
    End_pt1 = circle_offset.PointAtSegmentLength(12)
    if circle_offset.Length< 12:
        break
    arc = Arc.ByCenterPointStartPointEndPoint(Center_point, Start_pt1, End_pt1)
    # filling in arcs in lst1 
    lst1.append(arc)
out = []    
for i in lst1:
    temp = []
    Start_Angle = i.StartAngle
    End_Angle = Start_Angle + i.SweepAngle
    temp.append(i)
    k = 0 
    while k < 500:
        k += 1
        overlap_Angle = (overlap_length * 360) / (2 * math.pi * i.Radius)
        # compute remaining arc
        rest_Arc = Arc.ByCenterPointRadiusAngle(Center_point, i.Radius, End_Angle - overlap_Angle, Start_Angle + overlap_Angle, Normal_vector)
        if math.ceil(rest_Arc.Length) < 12:
            temp.append(rest_Arc)
            out.append(temp)
            break
        #rotate arcs    
        i = i.Rotate(Center_point, Normal_vector, i.SweepAngle - overlap_Angle)
        #update End_Angle
        End_Angle = Start_Angle + i.SweepAngle
        temp.append(i)
        
OUT = out

my file dynamo:
circle_rebar.dyn (10.2 KB)

Thanks.

No one can help me?

Can you draw in revit start and result with model lines and post it here?

@Vladimir

I’ve attached my dynamo file above…I’ve not yet drew my model in revit ( it’s a circular slab and my goal is to obtain my tangantial rebars )
Thanks.

@REDO10

replace this

        #update End_Angle
        End_Angle = Start_Angle + i.SweepAngle

by this

        #update End_Angle
        End_Angle = i.StartAngle + i.SweepAngle
3 Likes

@c.poupin

Oh my bad!! :grimacing: I didn’t pay attention…I was so focused on other parameters that I didn’t see this one
Can you show me how to use print() inside script to debug it and manage eventual errors?

Thanks.

here an example

1 Like