First consider the case where the line $AOB$ is horizontal.
The perimeter of the bottom half (the large semicircle) is
$\pi r$. Twice the perimeter of each of the small upper
semicircles is $2 {\pi r \over 2}$, again $\pi r$. Hence when
the line $AOB$ is horizontal, the section of the perimeter
above the line and the section below the line are of equal
length. As the line $AOB$ rotates about $O$, the lengths of
the two sections of the perimeter change to $\pi r + P - Q$
on one side of the line and $\pi r + Q - P$ on the other
(where $P$ and $Q$ are lengths as defined in the diagram
above). $$Q = r \theta $$ where $\theta$ in this equation is
the angle shown in the diagram, measured in radians. Using
the property that the angle at the centre of a circle is
twice the angle at the circumference subtended by the same
arc, $$P = 2\theta ({r \over 2})= r\theta. $$ It is therefore
clear that $$P=Q$$ and that the perimeter length will always
be $\pi r$.