# Loop While Geometry Intentersection \<1

**URL:** <https://forum.dynamobim.com/t/loop-while-geometry-intentersection-1/21418>\
**Category:** Geometry\
**Created:** [April 26, 2018, 2:33pm UTC](https://forum.dynamobim.com/t/loop-while-geometry-intentersection-1/21418 "2018-04-26T14:33:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ralle](https://avatars.discourse-cdn.com/v4/letter/r/5f9b8f/32.png) [@Ralle](https://forum.dynamobim.com/u/Ralle)\
**Post date:** [April 26, 2018, 2:33pm UTC](https://forum.dynamobim.com/t/loop-while-geometry-intentersection-1/21418/1 "2018-04-26T14:33:00Z")

</div>

Hi everyone!

I’m working on a graph in which I need to find the shortest distance from a point to another unspecified point on a curve. I thought that the LoopWhile node could come in handy, but I can’t wrap my head around how it works.

In order to find the shortest distance I want to create a circle by center point and radius at my known point. Then I want to test for intersections between the circle and the curve. I want to loop this and vary the circle radius until the intersection count with the curve equals 1. The point where the circle intersects the curve only once is then the output that I’m interested in. Is this at all possible to do in Dynamo? Any answers are very much appreciated.

I’ve attached a (very) simplified image of my problem:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/4/645fc1c4668f8011914bcb9e3e9159e66fafcd94.png)

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [April 26, 2018, 2:43pm UTC](https://forum.dynamobim.com/t/loop-while-geometry-intentersection-1/21418/2 "2018-04-26T14:43:44Z")

</div>

@Ralle More often than not, if you find yourself using _Loop While_, there is a better way  
In this case, just use _Geometry.ClosestPointTo_

 ![closestPoint](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/f/3fe1c349aa30b11d28956368a42cea46d9583a3e.png)

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [April 26, 2018, 2:43pm UTC](https://forum.dynamobim.com/t/loop-while-geometry-intentersection-1/21418/3 "2018-04-26T14:43:48Z")

</div>

I assume this is more than finding the correct radius but rather to find the distance from a specified point and to a curve/line? The loop-while node is a little tricky, have you had a look at the previous posts etc regarding the loopwhile node?

> [@Loop While node implementation](https://forum.dynamobim.com/t/loop-while-node-implementation/2507):
>
> Hi! I’m new at dynamo and i’m having a bit of trouble implementing the loop while node. I’ve looked up the forum for everything related to this node but still can’t get this to work. I’m trying to develop a function that imports text from a Revit General Annotation object, looks up the translation on a custom “dictionary” developed by the user (Excel file), and then writes back the translated text in another field of the Annotation. I’ve managed to get everything to work except the loop part.…

> [@Inputs for LoopWhile : to have dynamic x data to loop node actions](https://forum.dynamobim.com/t/inputs-for-loopwhile-to-have-dynamic-x-data-to-loop-node-actions/6590):
>
> Hey all, I’m trying to figure out the inputs for the LoopWhile node. I think the node you want looped goes into init but when it comes to creating the functions for the other two inputs continueWhile and loopBody I am not so sure My aim: is to produce multiple Schedules from a list that’s been List.Chop’ed according to per-Schedule. I have one KeySchedule node and the inputs include : ViewSchedule and Data. My first loop will be the input to the ViewSchedule. This is based on the fact that …

---

<div class="post-metadata">

**Author:** ![Ralle](https://avatars.discourse-cdn.com/v4/letter/r/5f9b8f/32.png) [@Ralle](https://forum.dynamobim.com/u/Ralle)\
**Post date:** [April 26, 2018, 2:52pm UTC](https://forum.dynamobim.com/t/loop-while-geometry-intentersection-1/21418/4 "2018-04-26T14:52:17Z")

</div>

Wow, I did not know this node existed. It was exactly what I needed. Thank you so much!

---

<div class="post-metadata">

**Author:** ![Nico\_Stegeman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nico_stegeman/32/19204_2.png) [@Nico\_Stegeman](https://forum.dynamobim.com/u/Nico_Stegeman)\
**Post date:** [April 26, 2018, 7:31pm UTC](https://forum.dynamobim.com/t/loop-while-geometry-intentersection-1/21418/5 "2018-04-26T19:31:20Z")

</div>

If a comment solved your problem, mark it as solution (and maye leave a like here and there).
