I wish to get the overlapping line between two lines.
Thank you in advance.
Vijesh
I wish to get the overlapping line between two lines.
Thank you in advance.
Vijesh
Select the two overlapping lines and call Intersect.
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);
}
}
}
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