Polygon Center Error

What is wrong with this component? How do I define the center?

it says it right there, it needs a polyline, that is not a polyline. Use the area component.

1 Like

Good, but why can’t it convert?

Because polylines can find the center in a quicker way by using averages of corners and edge lengths. Curves do not have equally comparable straight edge lengths and corners. It is meant just for polylines.

I understand, but the error says that it was not possible to convert the curve into a polyline. So he can still work with the curves, but now it did not work … Or does the error convey false notions? As you say, the component only works with polylines.

It is telling you that it needs a polyline, you gave it a curved curve, it cannot interpret that curve as a polyline (there is no single method for turning a curved curve into a polyline). It cannot and never will be able to use a curve that is not a Polyline. Why is it saying convert? well because a polyline can be considered a curve (if passed through a curve container), but you curve cannot be considered a polyline. Other curves can also be converted to polylines such as lines, rectangles, polygons, etc. Essentially any curve with all straight segments can be converted into a polyline.

1 Like

Got it. Thank you very much for the help! :smiley:

just as a sideinfo. A polyline is a collection of points where lines are drawn in between. But its primarily a collection of points. Now the average center is calculated by adding all point coordinates together and divide them by the point count. If you do this with controlpoints of non linear curves it would simply return the average of the cp, but not the curve center. Therefore its not supported.

Its true you could convert a polycurve to a polyline beforehand. But the would change the shape and so the result mightbecome unexpected.

I‘m also big fan of encapsulation. Converting geometry and calculating a centerpoint are two operations and would violate against the single responsible principle. So the behavior is correct in my oppinion.