How to actually merge two or more curves to one curve?

Hi, I have a problem. When I use merge function to merge many curves become single curve, it seem to like one curve, but actually it still compose of many curves. I try to use the following method to merge…finally it still is polycurve. how to actually become one curve? Help!!

    Dim t_flag As Boolean
    Select_Entity_and_Give_Group_Name(5, "Select Curves", t_flag)
    If t_flag = False Then
        Exit Sub
    End If

    '
    Dim obj As Rhino.DocObjects.RhinoObject
    Dim i, j As Integer

    Dim cur_list As New List(Of Curve)
    Dim cur, cur_all As Curve
    For i = 0 To CAD_Left_Relation_num - 1
        obj = RhinoDoc.ActiveDoc.Objects.Find(CAD_Left_Relation_data(i))
        cur = obj.Geometry.Duplicate()
        cur_list.Add(cur)
    Next

    '
    Dim num, num2 As Integer
    num = cur_list.Count

    '
    Dim dumy_tt(num) As RMA.OpenNURBS.IOnCurve
    Dim dumy_tt2(0) As RMA.OpenNURBS.OnCurve
    Dim lines As New List(Of RMA.OpenNURBS.OnCurve)()
    Dim kumy As RMA.OpenNURBS.OnCurve

    '
    For i = 0 To num - 1
        kumy = Rhino.Runtime.Interop.ToOnCurve(cur_list.Item(i))
        lines.Add(kumy)
    Next
    Dim fg As Boolean
    fg = RMA.Rhino.RhUtil.RhinoMergeCurves(lines.ToArray(), dumy_tt2, 0.2)

    '
    Dim crvv As New RMA.Rhino.MRhinoCurveObject()
    Dim curt As Curve
    For i = 0 To dumy_tt2.Length - 1
        crvv.SetCurve(dumy_tt2(i))
        kumy = crvv.Curve.DuplicateCurve()
        curt = Rhino.Runtime.Interop.FromOnCurve(kumy)
        RhinoDoc.ActiveDoc.Objects.AddCurve(curt)
    Next

    '
    Rhino.RhinoDoc.ActiveDoc.Views.Redraw()
    cur_list.Clear()

Hi @jerry1,

I see you are still using the obsolete Rhino_DotNet.dll. What is the reason for this? Are you writing code for Rhino 5 or Rhino 6?

To answer your question, RhinoMergeCurves, or Curve.JoinCurves in RhinoCommon, will create a PolylineCurve if possible. Otherwise, it will create a PolyCurve. If you won’t want a PolyCurve, then convert it to NURBS using PolyCurve.ToNurbsCurve.

– Dale

Thank Dale, I already solve it using Curve.JoinCurves