Draw lines based on the elevational differences between two cogo points

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.

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

and grid line 3. Thank you.

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?

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.

Can you attached example drawing

See attached dynamo file
Draw Grid lines that exceed slope.dyn (1.4 MB)

see attached cad file.
TEST.dwg (2.4 MB)

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!!

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.

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?

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?

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.

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.

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

Nothing moves, this would just change the order.

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

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.dyn (62.8 KB)

by lisp
7

2 Likes

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

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

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?

Hi @yuben112,

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