# Split a line with a gap

**URL:** <https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542>\
**Category:** Revit\
**Tags:** dynamo\
**Created:** [January 20, 2021, 5:56pm UTC](https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542 "2021-01-20T17:56:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 20, 2021, 5:56pm UTC](https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542/1 "2021-01-20T17:56:59Z")

</div>

I have a polycurve and two lines that intersect it. I want to form a gap between the two intersect lines.

I’ve done it like this (not put the overall curve back together but don’t worry about that)…

This just seems REALLY contrived, there must be a simpler way?

Also, I may want to split the polycurve at another point too so I think this way is going to cause me a headache…

1 - is the polycurve  
2 - the two vertical cut lines  
3 - the line I want to cut

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/a/dae0bc2e2e002df8d3dcad3bd2c6fa5c84c3d0c4.png)

And like I said I’d still have to stick it back together.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/a/ba0651c24b7b25e39f456a4f97cc5df8b732aeeb.png)

---

<div class="post-metadata">

**Author:** ![haganjake2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/haganjake2/32/119069_2.png) [@haganjake2](https://forum.dynamobim.com/u/haganjake2)\
**Post date:** [January 20, 2021, 6:54pm UTC](https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542/2 "2021-01-20T18:54:28Z")

</div>

Hi Alien,

I think your best bet here in using the ‘Curve Split by Parameter’ node to isolate and remove the piece between the two points of intersection. See attached image and file.

Hope this helps.  
[CurveIntersectionTrim.dyn](https://forum.dynamobim.com/uploads/short-url/9aMpwkk7nVXzZI42bA0VUzFjTBb.dyn) (38.0 KB)

 ![Trimming intersecting curves](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/e/8eecda7e0be394e93395039546144b40d3fbe970.png)

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 20, 2021, 7:01pm UTC](https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542/3 "2021-01-20T19:01:30Z")

</div>

Thanks 🙂

Does that work with the polycurve as opposed to the single line though? You’re still going to have to work out if it intersects and isolate that index?

I’m not sure how that’ll work with two openings? Any ideas?

---

<div class="post-metadata">

**Author:** ![haganjake2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/haganjake2/32/119069_2.png) [@haganjake2](https://forum.dynamobim.com/u/haganjake2)\
**Post date:** [January 20, 2021, 7:07pm UTC](https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542/4 "2021-01-20T19:07:55Z")

</div>

Will work the same with a polycurve it will just change the value of the parameter given as a result of the ‘Parameter at Point’ test to reflect the increased length of curve.

As for two openings - You could do a further intersection test with the other openinng and just increase the list of parameters to split the curve by. Then you would just remove item at index of 1 & 3.

Can do another further visual representation tomorrow.

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 20, 2021, 7:09pm UTC](https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542/5 "2021-01-20T19:09:33Z")

</div>

Awesome! Thanks 🥳

Here’s the virtual star I promised 🌟

---

<div class="post-metadata">

**Author:** ![Robert\_Younger](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/robert_younger/32/205603_2.png) [@Robert\_Younger](https://forum.dynamobim.com/u/Robert_Younger)\
**Post date:** [January 20, 2021, 7:14pm UTC](https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542/6 "2021-01-20T19:14:41Z")

</div>

Concept for the intersection test: take the four endpoints that comprise the splitting lines and draw Dynamo lines from Line1 Endpoints to Line 2 Endpoints. If the test lines intersect a line segment that segment is filtered out for deletion.

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

When you have multiple splitting line pairs you’d would group the pairs before generating lines.

---

<div class="post-metadata">

**Author:** ![Alien](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alien/32/40701_2.png) [@Alien](https://forum.dynamobim.com/u/Alien)\
**Post date:** [January 21, 2021, 9:11am UTC](https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542/7 "2021-01-21T09:11:56Z")

</div>

Not quite with you Robert. I’m wanting to delete a segment of the line not the whole line.

---

<div class="post-metadata">

**Author:** ![haganjake2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/haganjake2/32/119069_2.png) [@haganjake2](https://forum.dynamobim.com/u/haganjake2)\
**Post date:** [January 21, 2021, 1:25pm UTC](https://forum.dynamobim.com/t/split-a-line-with-a-gap/59542/8 "2021-01-21T13:25:06Z")

</div>

This achieves what you were looking for and can actually accept multiple entrances:

Pretty sure my list compilation at the end is wrong and there are just loads of instances stacked on top of each other. But as far as splitting the original polyline/boundary goes this does that.

 ![Trimming intersecting curves V2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/5/25dd76bbccac86f2f1100d745019b3a199ad52b3.png)
