I wish to have the overlap line between two lines

I wish to get the overlapping line between two lines.

Thank you in advance.
Vijesh

Select the two overlapping lines and call Intersect.

I am trying to code it, Sir. I unable to find where am doing the mistake.

another try,

Assigned to Grasshopper Developer category

Hello,

I don’t know a single word of Python, but in C# this works. Hope you can make use of it.

The LineLine intersection doesn’t analyze overlaps, you have indeed to use the CurveCurve method.

private void RunScript(Curve x, Curve y, ref object A)
  {
    Rhino.Geometry.Intersect.CurveIntersections ci = Rhino.Geometry.Intersect.Intersection.CurveCurve(x.ToNurbsCurve(), y.ToNurbsCurve(), Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);
    IEnumerator ie = ci.GetEnumerator();

    while (ie.MoveNext())
    {
      Rhino.Geometry.Intersect.IntersectionEvent iev = ie.Current as Rhino.Geometry.Intersect.IntersectionEvent;
      if (iev.IsOverlap)
      {
        A = x.ToNurbsCurve().Trim(iev.OverlapA);
      }

    }
  }
1 Like

Thank you for the reply. I am using python, and this code will be a part of another. I wish I could get it in python. I tried ‘curveintersections’ in python but was not able to proceed due to an error.

d = rg.Intersect.CurveIntersections(c1,c2,0,0)

What error were you seeing?

Pretty much the same as what @magicteddy posted, except in Python.

curve_overlap_python.gh (7.7 KB)

-Kevin

1 Like