# Align Block to Polyline

**URL:** <https://forum.dynamobim.com/t/align-block-to-polyline/86262>\
**Category:** Civil 3D\
**Tags:** dynamo\
**Created:** [February 16, 2023, 8:55pm UTC](https://forum.dynamobim.com/t/align-block-to-polyline/86262 "2023-02-16T20:55:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew.Schwartz](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@Matthew.Schwartz](https://forum.dynamobim.com/u/Matthew.Schwartz)\
**Post date:** [February 16, 2023, 8:55pm UTC](https://forum.dynamobim.com/t/align-block-to-polyline/86262/1 "2023-02-16T20:55:06Z")

</div>

I’m basically trying to do what the measure command does when you place blocks around a polyline and it prompts you to align objects to the polyline direction. I can create points and blocks but for ‘rotationDegrees’ I would either need each point to evaluate the direction that the polyline is traveling in or at the very least evaluate the previous point and create a rotation angle from that. But I have no idea.

---

<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 16, 2023, 9:08pm UTC](https://forum.dynamobim.com/t/align-block-to-polyline/86262/2 "2023-02-16T21:08:00Z")

</div>

Hi  
Looking at this

> [@Get rotation or direction from selected object (polyline)](https://forum.dynamobim.com/t/get-rotation-or-direction-from-selected-object-polyline/71300/13):
>
> Thanks guys, I learn a lot this week. I was able to apply the rotation from KirkWM suggestion. I added the Curve.CoordinateSystemAtParamter with the 1 parameter… when I isolate that I do get the blocks inserted at the end point, however I don’t see how to add those points to the existing list of points. I did look at the primer list helps but didn’t see how I could add to the my list given how my script was setup. or how I’d add if I started with a new script. I’m still pretty new at this so so…

And

> [@Rotating blocks along the path (Dynamo for C3D)](https://forum.dynamobim.com/t/rotating-blocks-along-the-path-dynamo-for-c3d/83972/10):
>
> Please take a look when you have a time. Thank you. [ubacivanje KT iz excela.dyn](https://forum.dynamobim.com/uploads/short-url/lLQ0SjPtIkMr1OCKwTiNn8k2HFC.dyn) (166.5 KB) [Drawing11.dwg](https://forum.dynamobim.com/uploads/short-url/axRwtuA6ckCgRCHW2MXe7puzy9f.dwg) (1.8 MB) [excel-xyz coordinates.xlsx](https://forum.dynamobim.com/uploads/short-url/bhZ4JDsea8vIfGki1g9SFUN4j6e.xlsx) (15.2 KB)

---

<div class="post-metadata">

**Author:** ![jcoon](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jcoon](https://forum.dynamobim.com/u/jcoon)\
**Post date:** [February 17, 2023, 12:36pm UTC](https://forum.dynamobim.com/t/align-block-to-polyline/86262/3 "2023-02-17T12:36:13Z")

</div>

Thanks Hosneyalaa

---

<div class="post-metadata">

**Author:** ![Matthew.Schwartz](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@Matthew.Schwartz](https://forum.dynamobim.com/u/Matthew.Schwartz)\
**Post date:** [February 17, 2023, 3:24pm UTC](https://forum.dynamobim.com/t/align-block-to-polyline/86262/4 "2023-02-17T15:24:55Z")

</div>

Would it be easier to turn the polyline into an alignment? I’m having a hard time sorting out what I need to do for this compared to the 2 posts you linked to me.  
[MJS-Divide.dyn](https://forum.dynamobim.com/uploads/short-url/uZLC23L9gT2AoKnW4d1kGwgVKos.dyn) (33.9 KB)

---

<div class="post-metadata">

**Author:** ![omar.g](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/omar.g/32/146129_2.png) [@omar.g](https://forum.dynamobim.com/u/omar.g)\
**Post date:** [February 17, 2023, 4:48pm UTC](https://forum.dynamobim.com/t/align-block-to-polyline/86262/5 "2023-02-17T16:48:40Z")

</div>

Hi @Matthew.Schwartz

Turning the polyline into an alignment is another way to go about it but the concept behind both ways will be the same. I think the best way to figure out the rotation is using a coordinate system along the polyline (can also use a coordinate along an alignment as well). Coordinate systems align along the direction of the polyline.

Here are a couple of nodes that could help you solve what you’re looking to do.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/0/d0526c7f710978ddf59de61ae77ae72a38215d87.png)  
You first get the coordinate system and then place the block by that coordinate system. Parameters range from 0 to 1 along the length of the curve (polyline/polycurve in your case) so you’ll need to determine where along polyline you want your blocks. So something like this

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/d/0ddbd74fb83c33cbb7c4af7cde6c343c1c3d289f.png)  
Hope that helps

---

<div class="post-metadata">

**Author:** ![Matthew.Schwartz](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@Matthew.Schwartz](https://forum.dynamobim.com/u/Matthew.Schwartz)\
**Post date:** [February 17, 2023, 10:13pm UTC](https://forum.dynamobim.com/t/align-block-to-polyline/86262/6 "2023-02-17T22:13:21Z")

</div>

Got it to work! Wanted to share my results with anyone that might be passing through. Thank you @hosneyalaa and @omar.g for the assistance!

 ![MJS-Measure_2023-02-17_10-23-34](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/c/8c5bc5a896359eac0135d69673b286c84cd7d4d8.png)
