Filter lines with only their z coordinate as the difference

Hello everyone,

I have a drawing which consists of a series of 3d blockreferences. I would like to retrieve just the bottom lines from them.
I’ve got as far as exploding all of them to lines, which is easy. Now I’ve got a collection of lines. Basically, for horizontal lines, if x and y are exactly the same, but the z is different, I want the line with the higher z to be removed. In case of vertical lines, those can all be removed.

Do any of you have some input as to where to go next as I can’t seem to find the nodes I think I need.
Thanks in advance for any advice!

That would be easy in 2 steps.

1 Filter out the Horizontal lines
2 Sort the lines from lowest to highest.

1 - You can get the direction of the line using Curve.TangentAtParameter. If the Z value of the vector == 0 it means a curve is horizontal. Use this in combination with FitlerByBooleanMask and you have the horizontal lines

2 Get the Startpoints of all the Horizontal lines and extract the Z value. then use List.SortIndexByValue and List.GetItemAtIndex to sort them.

2 Likes

Hi @JelleAtBodemplan,

I followed the intelligent two easy steps in @Joelmick post above and came up with the below-attached script.


Get lowest lines.dyn (38.8 KB)
Hope this helps…

yes, but I see a few things that need to be different.

Seeing Jelle’s statement below indicates he is after the Perfect Horizontal lines right?

This is why I mentioned to see if the direction of the line has a Z of zero. In your picture you are checking if it is not equal to 1 (which means vertical). this will now result in allow non vertical lines to pass. This does not mean that they are horizontal!

Below you see how my “2 easy steps” would look like

I am not going to post the graph itself, because I want would like @JelleAtBodemplan to reproduce it step by step instead of just copying it :sweat_smile:

1 Like

Thank you guys for your suggestions, both of you, I will see wether I can combine your thoughts.
Just to be clear, for the purpose I’m looking to used it for, I most likely don’t need non horizontal lines. So I should be able to filter out anything with a vector z other than 0 right.
Your work on the filtering by Z looks very promising. Thank you, I’ll try.

Regards,

Jelle

Good afternoon guys,

So, over the last few days I’ve been trying to get the script going with your input.
In the picture below you can see what I’ve got so far. Pretty much everything outside of the green area is doing what it’s supposed to do. Just to be clear, yes, I know it’s disconnected in this picture :smiley:
The filtering by Z still doesn’t really do want I want it to do. In the second picture you can see what my dwg looks like right now after running the current script. Now from I here I still need to filter the top lines out, each line may have it’s own Z value which I need to retain. Therefore I cannot simply retain the bottem half of the lines or send them to z=0. Which is what I tried in the first picture, although that wasn’t succesfull either.

Could you guys elaborate on the way you filter out the higher lines in your proposals and the thoughtprocess of what you’re doing?

Regards,

Jelle


Hi @JelleAtBodemplan,

Can you post a “simple” sample of the desired output so we can understand it better?

Hi @JelleAtBodemplan Based on your description

Please find the bellow screenshot for green part of the code which you are looking for.

Hope this is what you are looking for.
P.S. Additional info:

1 Like

What is your end goal?

Thanks to all of you for your efforts.
Unfortunately I haven’t had time as of late to try to implement it into my script. Hopefully later this week though.
Basically my goal is to import foundation objects from IFC files (through revit).
I need the bottom edges of these objects and offset them by half a meter usually to create edges for an excavation model. Since I would have to do this for many objects and also potentially multiple times in a project (due to changes) I figured I would try to do some of the filtering in dynamo.

Regards,

Jelle