Custom contour and Inside/Outside sort

Hi Everyone,

I’m working on a 3D print pricing tool where I’m having to sort interior from exterior contour curves. This is needed so I can then minus the area of the interior curves from the area of the external curves to work out part pricing.

Here’s a snippet of my C# script:

for (int i = 0; i < crvTree.BranchCount; i++){
  List<Point3d> measurePoint = new List<Point3d>();
  List<Curve> measureCurve = new List<Curve>();

  int elementCount = crvTree.Branch(i).Count;

  for( int j = 0; j < elementCount; j++){


  int mPointCount = measurePoint.Count;
  for( int k = 0; k < mPointCount; k++){

    if (measurePoint.Count > 1){

      Curve conTest = measureCurve[k]; // Comparison Curve Creation
      measurePoint.Remove(measurePoint[k]); // Comparison Point List Creation

      for( int m = 0; m < measurePoint.Count; m++){

        if( conTest.Contains(measurePoint[m], new Plane(conTest.PointAt(0.0), new Vector3d(0, 0, 1)), 0.1).ToString() == "Inside"){


        } else
        Print("not today");


For a reason unknown to me, I’m not triggering any positive result for my Contains operation.
Any help would be much appreciated.


Darcy (62.6 KB)


Just checking your code in the file, measure point is defined as follows:

  int elementCount = crvTree.Branch(i).Count;

  for(int j = 0; j < elementCount; j++)

So the result of the contTest.Contains() function later should return “Coincident”, no? In fact it doesn’t, it actually returns “Outside” for reasons I’m not sure of, maybe something to do with your tweaks to the list. To be honest it’s very difficult to get my head around the code with all the removal of elements and the such like, coming into it cold is not easy.

Perhaps have a look at the attached which is a slight modification should the coincident result for the curves and the points. I hope this will help you get to the correct modifications to your code:

contains (54.6 KB)


1 Like