I'm trying to make a heating cable layout for floor heating and i got stuck with this problem. This i what i got from my code  So i made a small program asking for width,lenght of the room and calculating the are in m2. And i need a graphical representation of how cable should be on the floor. This is my code for arch: # Add C-shaped curves at the end of each section for i in range(int(width // spacing)): theta = np.linspace(0, np.pi, 100) x_curve = length + (spacing / 2) * np.cos(theta) y_curve = (i + 1) * spacing + (spacing / 2) * np.sin(theta) color = 'blue' if total_length < 5 else 'red' ax.plot(x_curve, y_curve, color=color) total_length += np.pi * (spacing / 2)  I'm a beginner so i tried what i knew so far. If someone can guide me or help me in anyway possible.
I suspect you want to lay your cable like this. The end arcs are essentially the same (so don't keep re-calculating them). Just shift them up at each crossing and alternate left and right sides.  import numpy as np import matplotlib.pyplot as plt width = 4 spacing = 0.25 N = 17 length = 4 total_length = 0 theta = np.linspace(0, np.pi, 100) xarc = (spacing / 2) * np.sin(theta) yarc = (spacing / 2) * ( 1 - np.cos(theta) ) base = 0 for i in range( N ): color = 'blue' if total_length < 5 else 'red' plt.plot( [0,length], [base,base], color=color) # draw line if i == N - 1: break # no connector at end if i % 2 == 0: x_curve = length + xarc # arc on right else: x_curve = -xarc # arc on left y_curve = base + yarc plt.plot(x_curve, y_curve, color=color) # draw connector base += spacing # update base and length total_length += length + np.pi * (spacing / 2) plt.show() 