Help converting Autodesk.DB.CurveLoop vs DS Polygon

I’m trying to run some point containment checks on a grid of regular XYZs compared to the an analytical surface. Because it is thousands of points I figured I should do this pythonically (its too slow using dynamo geometry). So I wanted to run a polygon containment test on the analyticalSurface, but I’m very confused on how to that. I think I’m trying to convert an Autodesk.DB.CurveLoop to DS.geometry.polygon or a closed DS.Geometry.PolyCurve, but I’m not sure how to go about doing that. I tried various types ToPrototype() but it always results in null. Weirdly enough curveloops exist in python, but become a list of AD.DB.Lines in Dynamo (see the screen cap).

So how would I go about converting geometry between CurveLoops, Polygons and PolyCurves pythonically?

Curve loops contain individual curves, and so when you try to convert you’ll get individual curves.

After converting to Dynamo curves you can convert the list of curves to a PolyCurve using a PolyCurve.ByJoinedCurves method on the sublists.

However, it’s likely you should stick to the native Revit object types if the scope of the problem is a concern. Look into the ReferenceIntersector class as one possible thought.

thanks, this solution works technically. But it isn’t scalable enough to analyze a whole building. Since I’m working with potentially 50k-ish points, I need to avoid storing too much in the graph. I’m trying to avoid intersection and using containment tests.

My goal is to input all floor slabs and bounds bounding box and only get out points every 1’-0" only where the XY is contained in the floor. essentially a bitmap where each pixel is contained or not.

Certainly could without issue - I’ve used more points in this context before. In fact just today I demo’d a tool which does almost a full order of magnitude more for testing relationship to a surface (above or below) without issue.

However as I have noted you’ll be better off utilizing the native Revit ReferenceIntersector class to just get a boolean for each XYZ. That is assuming you have an XYZ to start with and not external data or Dynamo geometry - conversion from object type to object type without good memory management is the most frequent cause of slowdowns.

As always, to get more direct help you need a sample data set and progress this far.