Duplicate Point from Dictionary for Start and End Point Calculation

Hello everyone,

I have a list from the RayBounce.ByOriginDirection node. This list shows me a start point of an element and an end point of the first element hit.

I want to calculate the length of the vector between the two points.

How can I create a new point based on the start point if the ray does not hit an element? (I hope it is explained clearly)

I tried to use List.Count to determine which dictionary only has one point, but unfortunately I don’t know how to duplicate the point from it to modify the Z value of the new point.

Thank you all!

Hi @Chr not sure why not use geometry distance to instead first create a vector and then measure the vector

1 Like

Hello @sovitek, thank you for answering! I am trying to optimize this process:

and would like to filter out / recreate rays without an endpoint.

1 Like

arhh i see :wink: …probably something here for filter out rays there dont hit…can probably help

1 Like

Aaah, I even saved this topic in my browser, but forgot that I had already read it. Thank you so much for the reminder, I will try it :slight_smile:

1 Like

I would like to show my own solution in case someone wants to do something similar. Optimization suggestions are always welcome :slight_smile:

1 Like

Just to help out a little more, you can avoid warnings by transposing and using a conditional. This also allows you to run everything through the same branch.

1 Like

Good Morning Nick, thank you very much for your help… It works great! I realize that I need to learn more about code blocks.

Using code blocks to layer functions is a good way to avoid warnings in many cases. Definitely worth exploring.

2 Likes