Curve.contain()

Hello everyone!

I just faced a little problem while I was checking rhinocommon. Let me explain! When we want to check if a point is inside a curve or not we use curve.contain() == rg.containment. inside-outside-…
But this function only works if we want to check the situation of a “Single” point!
I was looking for any other function that works with a list of points but couldn’t find any!
Is it possible for any of you to help me in this case?

With respect
Mehrzad

Hi,
you tagged it with C#, but your code seems to be P.
Anyway, you could loop over your point list.

from Rhino.Geometry import Plane
import scriptcontext as sc
a = []
for pt in pts:
    a.append(crv.Contains(pt, Plane.WorldXY, sc.doc.ModelAbsoluteTolerance))
private void RunScript(Curve crv, List<Point3d> pts, ref object A)
{
  var relationships = new List<PointContainment>();
  foreach(var pt in pts)
    relationships.Add(crv.Contains(pt, Plane.WorldXY, RhinoDocument.ModelAbsoluteTolerance));
  A = relationships;
}

Mehrzad.gh (8.0 KB)

1 Like

Thanks,

Yep but it works either way in both C# or Python!

And yes I tried “Item” for loop. But I just got stock in a hanging upside-down situation! Rhino stopped working and …

Also not sure why it did not work. Since it should work also with item access and without a loop.
But as often without code and explicit description of the problem :man_shrugging:

It works perfectly.
Thanks a looooot :pray: :pray: :pray:

3 Likes

By Item I meant foreach loops in both C and P!
Don’t know sometimes it happens for amateurs like me! :smiley:
But thanks for your quick answers and help.