How to get the center of polycurve?

Hi all,

I made a PolyCurve by joining Curves.

Can somebody let me know how to get the center of the polycurve?

I try the “Polygon.Center”, but it doesn’t work.

thank you,

Richard

Hi Richard,

First of all are you looking for the centre point bound to the curve, or the centre point of the area bound by the curve?

If it’s the prior, PolyCurves are a bit tricky in the sense that actions and queries performed on curves usually work for PolyCurves but not in the expected way. Usually you’d expect that if you run “PointAtParameter” on a curve with the value of 0.5, that would give you the mid point. However when you run the same on a PolyCurve, you find out that Dynamo’s PolyCurve ignores the length of the individual segments inside it. Consider the three examples below:

2015-03-05_132138

In the first one, we have 2 segments - a long one and a short one. The PC’s mid point is at the connection of the two.

In the second example we have two short straight lines and a NURBS curve forming a PC. The mid point is placed in the middle of the middle segment.

The third example consists of 6 lines. The mid point is the connection of the two middle segments.(similar to the first one)

I am not sure what’s the best approach to solve this. Lately the way I’ve been using of going around the current implementation is to use the “PointAtDistance” method instead. Query the PC’s length, get the middle distance and apply it:

2015-03-05_132951

2015-03-05_133024

2015-03-05_133121

If what interests you instead is the center point of the area of the PolyCurve, consider viewing the PC as a surface. Make sure your PC is closed with “PolyCurve.CloseWithLine” and convert it to a surface with “.ByPatch”. Once you have the surface, you could implement “Surface.PointAtParameter” with 0,5 for both U and V

2015-03-05_133439

Hello Yu-Ke Lin,

I think the easiest way to get it using Curve.PointAtParameter node by providing parameter as 0.5, which was shown in nice examples by Dimitar Venkov.

Do let us know if that doesn’t work for you or if you are looking for some different approach.

Do click on Resolved if this solves your problem.

Keep Using Dynamo!!!

Thanks,

Ritesh

 

Hello All,

I am happy to inform you all that we have fixed issue related to creating PointAtParameter on PolyCurve.

It is available now in daily build.

Please give it a try and let me know.

Thanks,

Ritesh

Just stumbled onto this older thread while looking for a surface.centroid node. Be careful, UV point 0.5,0.5 is bound by the logic of the way the surface was created. For 4-sided flat surfaces this may usually coincide with the actual centroid, but not always. And triangular surfaces especially, the centroid will likely be in a different location than the UV center. I’m surprised there is not a Surface.Centroid node.

1 Like

Hi,

How can I get the example 3? I cannot see the image attached.

I think that PointAtDistance node is not avalaible and has been replaced by Curve. PointsAtEqualSegmentLength