# Draw lines based on the elevational differences between two cogo points

**URL:** <https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313>\
**Category:** Civil 3D\
**Tags:** dynamo\
**Created:** [September 13, 2024, 1:41am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313 "2024-09-13T01:41:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 13, 2024, 1:41am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/1 "2024-09-13T01:41:24Z")

</div>

Hi all,  
I am very new to dynamo so please excuse my lack of dynamo terminology. so I have a cad file with a civil 3d surface and a grid of cogo points showing the elevations of the surface at the 10 ft by 10 ft grid. image “grid line 3”. am trying to create a script that automatically draw a 10 ft long line (thick red line) between two cogo points, but only draw the line if the elevational differences between the nearest two cogo points are greater than a certain value, say 0.02 ft (it’s a volumetric surface). I had to manually draw them and the process took hours.

I did try to create a script (see images grid line 1 and grid line 2), and was able to create an array of green lines seen in image grid line 3 (I intentionally rotated the green lines so they dont overlap with the grid lines). I used the line by point length direction node but looking back now, maybe i should have used the line by two points? will linebytwopoints also create a nice array of lines?

(side note: please help me understand how did the “line.bypointlengthdirection” node create an array of line and didn’t mix up the northing and easting, meaning how come it didn’t pick the northing of point 1 and say easting of point 2 which would completely mess up the grid, but instead it created a grid of lines using all the cogopoints)

When creating a series of blocks to conditionally create lines between two adjacent points if the elevational difference is more than 0.02 ft, I got lost with the data collection and logic operations. could someone shed some light on this part please. Thanks a bunch.

 ![grid line 1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/8/58a68a42deada9c9c21521d341c1b54e9f30c5b1.png)

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 13, 2024, 1:42am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/2 "2024-09-13T01:42:25Z")

</div>

Sorry, the forum only allows me to attach one image at a time because i am a new user. here is image grid line 2

 ![grid line 2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/6/966ca6172a32c8571c1cd3a9aa71b360e231092a.png)

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 13, 2024, 1:43am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/3 "2024-09-13T01:43:01Z")

</div>

and grid line 3. Thank you.

 ![grid line 3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/e/cef1e28af3c6d7373702a64ddea4bf15329b758b.jpeg)

---

<div class="post-metadata">

**Author:** ![A.C3D](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/a.c3d/32/196902_2.png) [@A.C3D](https://forum.dynamobim.com/u/A.C3D)\
**Post date:** [September 13, 2024, 6:05am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/4 "2024-09-13T06:05:21Z")

</div>

Hi,  
I have two questions:  
Do you only want the two nearest points? You mentioned: “but only draw the line if the elevational differences between the nearest two COGO points are greater than a certain value.”  
Why do you need the direction if you’re going to create a line between two points?

---

<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:** [September 13, 2024, 7:57am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/5 "2024-09-13T07:57:30Z")

</div>

One idea;

1. Group the the points into rows using the Y value (assuming this is orthogonal - consider transforming them to an orthogonal state if at the origin if not).
2. Sort the groups by the points X value to get them ordered from ‘lowest’ to ‘highest’ in each row.
3. Draw a polycurve along the points in each row and explode it. Flatten the list to remove extra dimension - you won’t need it anymore.
4. For each line, get it’s direction (a vector), extract the Z component thereof and take the absolute value.
5. Test if that value is greater than your maximum offset.
6. Filter the list of lines (step 3) by the greater than test result. The ‘in’ results need to be converted to red lines in autocad; consider an Object.ByGeometry node or a Line creation node from the AutoCAD section of the library.
7. Repeat steps 1-6 but with grouping by the X value in step 1 and sorting by the Y value in step 2.

---

<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:** [September 13, 2024, 4:38pm UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/6 "2024-09-13T16:38:41Z")

</div>

Can you attached example drawing

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 16, 2024, 5:38pm UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/7 "2024-09-16T17:38:38Z")

</div>

See attached dynamo file  
[Draw Grid lines that exceed slope.dyn](https://forum.dynamobim.com/uploads/short-url/jVAmR9tg0TM2wO9lVrEIY7qzAfs.dyn) (1.4 MB)

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 16, 2024, 5:39pm UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/8 "2024-09-16T17:39:12Z")

</div>

see attached cad file.  
[TEST.dwg](https://forum.dynamobim.com/uploads/short-url/zJ2099MXVYutQBg2wx99TCPNwmT.dwg) (2.4 MB)

---

<div class="post-metadata">

**Author:** ![gilberto.arechigaiba](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gilberto.arechigaiba/32/204980_2.png) [@gilberto.arechigaiba](https://forum.dynamobim.com/u/gilberto.arechigaiba)\
**Post date:** [September 17, 2024, 6:57am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/9 "2024-09-17T06:57:11Z")

</div>

Hola amigo @yuben112 buenas. there are multiple ways to make lines or directly polylines, using start and end, or by using groups of points, take a look to the topics of lacing and levels in dynamo primer, seems you are progresing well, i let you also the link a couple of post for basics of C3D Dynamo, hope this helps you!!

> [@\[Request for Feedback\] Dedicated Civil 3D chapter in the Dynamo Primer](https://forum.dynamobim.com/t/request-for-feedback-dedicated-civil-3d-chapter-in-the-dynamo-primer/87141/15):
>
> Amigos Buenas, following with the basics of Dynamo Autocad, Lines, LineByTwoPoints is the node that does the magic, it works the same as Line.ByStartPointEndPoint of Dynamo, be careful with the inputs, the start points must be in a different list from the end points. Extra Tip, this nodes will not create lines in Dynamo, only in Autocad, to be able to have elements in dynamo there is two options use in paralel Line.ByStartPointEndPoint or use in serie Object.Geometry! [Li…](https://forum.dynamobim.com/uploads/short-url/8nuzh8QAH6TLigzwDWs7Hpaxr44.dyn)

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 18, 2024, 12:27am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/10 "2024-09-18T00:27:52Z")

</div>

Yes. one line between two nearest points, if the elevational difference between the two points is more than 0.02 ft.

My intention was to populate the horizontal (ish) lines with one script thread and the vertical lines with another script thread.

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 18, 2024, 12:43am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/11 "2024-09-18T00:43:06Z")

</div>

Thank you, Jacob.

Please excuse my lack of understanding and could you elaborate on:

1. transforming to an orthogonal state. can you recommend a node name?
2. grouping and sorting. Does sorting a group of points by X value and y value re-arrange the coordinates of my points? All the points need to stay where they are.
3. I understand logically that you intend to filter out any line with a z value greater than my threshold, and does the Object.ByGeometry node do it and only draw lines that have a z value greater than my threshold?

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 18, 2024, 12:53am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/12 "2024-09-18T00:53:48Z")

</div>

Thank you amigo,  
your posts are very helpful. I might incorporate the “layer.create” node in my script.

I have been having troubles with the linebytwopoints node. in my application, i needed to use a base point with particular coordinates from a state plane coordinate system and then create an array of lines following the correct vector based on the state plane coordinate system. Or use every cogopoint that I created by the grid cogopoint function in civil 3D and draw lines from these points. but when I used the linebyetwopoints node, it simply connected all of my cogopoints in an ascending order which looks like one single polyline that connects all cogopoints. I wasn’t able to get a nice array of lines. I was able to use the linebylengthdirection node to create the array of lines, but couldn’t proceed with the conditional logic operation i mentioned above. any insight on that?

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 18, 2024, 1:04am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/13 "2024-09-18T01:04:40Z")

</div>

To answer your second question.  
Essentially I wanted to create one group of lines that start from one cogo point and then connects to the nearest point to the right. Then a second group that connects all cogo points to the nearest ones below them, plus the conditional formatting.

I am not very familiar with using line.bytwopoints node. when i tried it simply connects all cogopoints in an ascending order, and at the end of each column the next line connects to the very top line of the next column. It looks like a long zigzagged polyline when I needed them to be an array of lines.

---

<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:** [September 18, 2024, 6:21am UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/14 "2024-09-18T06:21:03Z")

</div>

Generally I used a word directly in the node name to help you find stuff, so if it feels like you are missing nodes or you aren’t sure which nodes you need check the prior post. If you get stuck post an image of your canvas, using the ideal process to [export your workspace as an image](https://forum.dynamobim.com/t/how-to-export-a-graph-image-correctly/99364).

> [@yuben112](#):
>
> transforming to an orthogonal state. can you recommend a node name?

Yes. Geometry.Transform. Use the version with two coordinate system inputs. The first will be your coordinates, the second the identity coordinate system.

> [@yuben112](#):
>
> grouping and sorting. Does sorting a group of points by X value and y value re-arrange the coordinates of my points? All the points need to stay where they are.

Nothing moves, this would just change the order.

> [@yuben112](#):
>
> does the Object.ByGeometry node do it and only draw lines that have a z value greater than my threshold?

Yes, as the lines exceeding your threshold are no longer in the list thanks to the filter.

---

<div class="post-metadata">

**Author:** ![gilberto.arechigaiba](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gilberto.arechigaiba/32/204980_2.png) [@gilberto.arechigaiba](https://forum.dynamobim.com/u/gilberto.arechigaiba)\
**Post date:** [September 18, 2024, 12:47pm UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/15 "2024-09-18T12:47:20Z")

</div>

Amigo @yuben112 buenas. broo, you have a real challenge here, i’ve try it a gemetric solution but your CS and distribution of cogo poins has not a clear criteria to group the cogopoints, also they has no metadata (RAW or description) that allows to filter either, by lucky the cogopoints are sorted in progresive order that allows to create a polycurve and then filter only parallel curves in 1 direction, the other direction is an other history, i advice to follow Jacob’s instructions and rotate at least in the script your cogopoints to easily grouping by regular X and Y Values you will save a lot of time and frustration, any way i let you my script in case helps you to get any ideas!

 ![Paralell lines only since cogo points array Preview](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/6/36f70c9d8366a6b02965920bc5489cf5ad1d2af6.png)  
 ![Paralell lines only since cogo points array](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/c/3c61fbfea7f03a2ffb1a931bebaa634a26bb9923.png)

[Paralell lines only since cogo points array.dyn](https://forum.dynamobim.com/uploads/short-url/6ofAcs7FHNv4iz6VoD7DXwlpZ88.dyn) (62.8 KB)

---

<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:** [September 19, 2024, 12:24pm UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/16 "2024-09-19T12:24:58Z")

</div>

by lisp  
 ![7](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/6/76a3061ffbbc54b7257bf422d2679e5e02edbced.gif)

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 19, 2024, 1:34pm UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/17 "2024-09-19T13:34:50Z")

</div>

Thank you, Jacob. I will give it a try.

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 19, 2024, 1:39pm UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/18 "2024-09-19T13:39:08Z")

</div>

That’s amazing. That lisp did exactly what I needed!  
Did you make that lisp yourself? care to share? thanks.

---

<div class="post-metadata">

**Author:** ![yuben112](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yuben112](https://forum.dynamobim.com/u/yuben112)\
**Post date:** [September 19, 2024, 2:00pm UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/19 "2024-09-19T14:00:01Z")

</div>

I would love to know how to created the lisp as well if you have the time and energy to share. I have used some downloaded LISPs in the past and they were very helpful, but don’t have any experience creating any lisps. What’s the learning curve like for LISPs? I have done some simple python coding and i really like the visual programing aspect of dynamo. So far it seems that dynamo has a lot of features for revit but not so much for civil 3D (or maybe it’s jus tthat i haven’t seen the whole civil 3d picture yet) In your opinion, when it comes to Civil 3D applications, is LISP more powerful than dynamo?

---

<div class="post-metadata">

**Author:** ![zachri.jensen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zachri.jensen/32/205331_2.png) [@zachri.jensen](https://forum.dynamobim.com/u/zachri.jensen)\
**Post date:** [September 19, 2024, 2:24pm UTC](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313/20 "2024-09-19T14:24:00Z")

</div>

Hi @yuben112,

> [@yuben112](#):
>
> So far it seems that dynamo has a lot of features for revit but not so much for civil 3D (or maybe it’s jus tthat i haven’t seen the whole civil 3d picture yet)

I would take a look at Civil 3D 2025.1 when you’re able 🙂

> [@Dynamo for Civil 3D 2025.1 Release](https://forum.dynamobim.com/t/dynamo-for-civil-3d-2025-1-release/103667):
>
> Howdy folks! Today is a super exciting day for Dynamo for Civil 3D. We just released the Civil 3D 2025.1 update, which has over 1,100+ new nodes! If you’ve been around for awhile, this is exactly what you’ve been waiting for smiley New nodes, new sample graphs, a totally fresh Dynamo home experience, new icons, better node documentation, important bug fixes…and more on the way rocket Get it now! [[Dynamo Nodes | Civil 3D 2025.1] ](https://www.youtube.com/watch?v=ChUL5tYHdU0)

[Next page](https://forum.dynamobim.com/t/draw-lines-based-on-the-elevational-differences-between-two-cogo-points/104313.md?page=2)
