# Joining Curves

**URL:** <https://discourse.mcneel.com/t/joining-curves/116491>\
**Category:** Rhino for Windows\
**Created:** [January 18, 2021, 3:39pm UTC](https://discourse.mcneel.com/t/joining-curves/116491 "2021-01-18T15:39:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![karakusc](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/karakusc/32/240020_2.png) [@karakusc](https://discourse.mcneel.com/u/karakusc)\
**Post date:** [January 18, 2021, 3:39pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/1 "2021-01-18T15:39:51Z")

</div>

Hello everyone, i have a file which contains for than 30.000 curvea and i want to joint them and create closes curves from it, but at some points curves do not touch each other, is there a easy way to do it?

 ![liness2](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/b/f/2/bf240ed131a10a4fbaaa730ee781a6cec659ecf6.png) ![liness](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/f/6/4f6035a79dc73e3b8586b23e505673d8616828bd.png)

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [January 18, 2021, 3:52pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/2 "2021-01-18T15:52:23Z")

</div>

Hello - no, there is no easy easy way to do it - what is the goal, once you have the closed curves?

-Pascal

---

<div class="post-metadata">

**Author:** ![karakusc](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/karakusc/32/240020_2.png) [@karakusc](https://discourse.mcneel.com/u/karakusc)\
**Post date:** [January 18, 2021, 3:55pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/3 "2021-01-18T15:55:48Z")

</div>

i try to have a clean file with curves as low as posibble.

---

<div class="post-metadata">

**Author:** ![technostark](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/technostark/32/766047_2.png) [@technostark](https://discourse.mcneel.com/u/technostark)\
**Post date:** [January 18, 2021, 3:55pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/4 "2021-01-18T15:55:54Z")

</div>

One way I could think of is as follows:

1. Get end points of all lines
2. Plug them into closest point
3. Draw a line between these two points

It is a very CPU intensive process considering the number of nodes on your model, and also might give out weird results in some places

---

<div class="post-metadata">

**Author:** ![karakusc](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/karakusc/32/240020_2.png) [@karakusc](https://discourse.mcneel.com/u/karakusc)\
**Post date:** [January 18, 2021, 3:57pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/5 "2021-01-18T15:57:41Z")

</div>

Thanks for replying, i thought there might be some kind of script to do that

---

<div class="post-metadata">

**Author:** ![karakusc](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/karakusc/32/240020_2.png) [@karakusc](https://discourse.mcneel.com/u/karakusc)\
**Post date:** [January 18, 2021, 3:58pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/6 "2021-01-18T15:58:41Z")

</div>

I found that topic in forum but could not figured out how to use these codes.

> [@Join many lines - O(n2)?](https://discourse.mcneel.com/t/join-many-lines-o-n2/46719/6):
>
> Hi If your curves to join are lines then solution is simple. We can do it without using joinCurves method because it slows things down. Instead we construct polyLines based on our Lines and codnition that end point of conecting-lines are in distance\<tolerance. For searching such points we can use RTree - see code below and coments in code for expalnation. Code can be written in shorter form, but becasue of readibilty I keep it like this. I tested it with 100.000 lines which ends up joined in 1…

---

<div class="post-metadata">

**Author:** ![technostark](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/technostark/32/766047_2.png) [@technostark](https://discourse.mcneel.com/u/technostark)\
**Post date:** [January 18, 2021, 4:00pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/7 "2021-01-18T16:00:49Z")

</div>

If you post part of the file, we can try

---

<div class="post-metadata">

**Author:** ![karakusc](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/karakusc/32/240020_2.png) [@karakusc](https://discourse.mcneel.com/u/karakusc)\
**Post date:** [January 18, 2021, 4:08pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/8 "2021-01-18T16:08:18Z")

</div>

Here is the file

> **[curvestobejoined.3dm](https://wetransfer.com/downloads/974ba8aa88c25fb94f92f542e59ceeb920210118160521/b794a5)**
>
> 1 file sent via WeTransfer, the simplest way to send your files around the world

---

<div class="post-metadata">

**Author:** ![technostark](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/technostark/32/766047_2.png) [@technostark](https://discourse.mcneel.com/u/technostark)\
**Post date:** [January 18, 2021, 6:11pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/9 "2021-01-18T18:11:42Z")

</div>

Sorry, can’t open your file. I’m on rhino 6!

---

<div class="post-metadata">

**Author:** ![karakusc](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/karakusc/32/240020_2.png) [@karakusc](https://discourse.mcneel.com/u/karakusc)\
**Post date:** [January 18, 2021, 6:50pm UTC](https://discourse.mcneel.com/t/joining-curves/116491/10 "2021-01-18T18:50:14Z")

</div>

okay, no problem
