# Midpoint of polylines

**URL:** <https://forum.dynamobim.com/t/midpoint-of-polylines/98091>\
**Category:** Civil 3D\
**Created:** [February 14, 2024, 3:49pm UTC](https://forum.dynamobim.com/t/midpoint-of-polylines/98091 "2024-02-14T15:49:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![KPRV](https://avatars.discourse-cdn.com/v4/letter/k/bbe5ce/32.png) [@KPRV](https://forum.dynamobim.com/u/KPRV)\
**Post date:** [February 14, 2024, 3:49pm UTC](https://forum.dynamobim.com/t/midpoint-of-polylines/98091/1 "2024-02-14T15:49:38Z")

</div>

Is there a way of getting the midpoints of multiple polylines that have been selected by layer?

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [February 14, 2024, 5:57pm UTC](https://forum.dynamobim.com/t/midpoint-of-polylines/98091/2 "2024-02-14T17:57:56Z")

</div>

Select polylines  
Then geometry  
Use note  
Curve.PointAtParameter

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [February 14, 2024, 7:21pm UTC](https://forum.dynamobim.com/t/midpoint-of-polylines/98091/3 "2024-02-14T19:21:09Z")

</div>

> [@hosneyalaa](#):
>
> Use note  
> Curve.PointAtParameter

Note that PointAtParameter may not be the middle length, but anywhere along the length of the curve. Parameterization is ‘% of the forces which generate the curve’, not ‘% of the length’.

This is particularly true in civil projects where curves are more likely to be non-uniform. Anything spline shaped or reporting as a ‘NURBS’ curve should cause a bit of caution in this respect.

To ensure you are at the ‘middle of the overall length’, you can instead use a `Curve.Length` node to get the length of the curve, a division node to get half of the resulting length, and a `Curve.PointAtSegmentLength` node to find the midpoint.

---

<div class="post-metadata">

**Author:** ![newshunhk](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@newshunhk](https://forum.dynamobim.com/u/newshunhk)\
**Post date:** [February 15, 2024, 12:37am UTC](https://forum.dynamobim.com/t/midpoint-of-polylines/98091/4 "2024-02-15T00:37:40Z")

</div>

I usually rebuild the curve first becoz the curve may not be parametrized

---

<div class="post-metadata">

**Author:** ![Anton\_Huizinga](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/anton_huizinga/32/155377_2.png) [@Anton\_Huizinga](https://forum.dynamobim.com/u/Anton_Huizinga)\
**Post date:** [February 15, 2024, 6:58am UTC](https://forum.dynamobim.com/t/midpoint-of-polylines/98091/5 "2024-02-15T06:58:44Z")

</div>

> [@jacob.small](#):
>
> Note that PointAtParameter may not be the middle length

I’ve not tested lately, but a while ago I noticed that there is a difference between the API and Dynamo in this approach. While in the API each segment of a Polyline starts with a new parameter, Dynamo uses one parameter for the whole Polycurve.

> [@Why is the parameter method in Dynamo different from the parameter method in AutoCAD](https://forum.dynamobim.com/t/why-is-the-parameter-method-in-dynamo-different-from-the-parameter-method-in-autocad/78424):
>
> I ran into something weird. I have a polycurve in Dynamo which consists of several curves. Let’s say two elements, but the polycurve is obviously one object. I can recreate the polycurve in AutoCAD as polyline, which also consists of two elements but still is a single object. In AutoCAD (with C#) the polyline has two parameters in total. Each vertex is a parameter. So if I request a point that lies on the second element, I get a parameter between 1 and 2: [image] If I request the parameter at…

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [February 15, 2024, 1:27pm UTC](https://forum.dynamobim.com/t/midpoint-of-polylines/98091/6 "2024-02-15T13:27:01Z")

</div>

Yes - different applications parameterize things differently. AutoCAD (the application in use when talking polylines, civil consumes that API) doesn’t treat them continuously. In this case we’re discussing Dynamo tools though so I assumed that we had Dynamo geometry rather than AutoCAD ones.

Also Revit doesn’t usually permit non-uniform curves, so the parameterization is directly related to percentage of the length in most cases. This was done as the concepts are difficult to explain and parameterization is given in two methods in the Revit user interface. I am not sure if AutoCAD parameters are forced to be uniform or not.

---

<div class="post-metadata">

**Author:** ![Anton\_Huizinga](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/anton_huizinga/32/155377_2.png) [@Anton\_Huizinga](https://forum.dynamobim.com/u/Anton_Huizinga)\
**Post date:** [February 15, 2024, 2:38pm UTC](https://forum.dynamobim.com/t/midpoint-of-polylines/98091/7 "2024-02-15T14:38:24Z")

</div>

He/she was talking about polylines on layers, so that means AutoCAD objects 🙂  
So calculating the mid could be done with a node that uses a Polycurve representation, or with Python which can work with the Polyline object directly.

I think it is saver to not use parameterization, the Length property and a PointAtDistance (API) or PointAtSegmentLength (Dynamo) is a good choice.

(Although a Length property of a Civil 3D Profile arc segment in the API is the 2D length and not the curve length, so as a general advice: check everything!)
