diff --git a/Geometry_Engine/Compute/BooleanDifference.cs b/Geometry_Engine/Compute/BooleanDifference.cs index 815fd25a0..abaa38643 100644 --- a/Geometry_Engine/Compute/BooleanDifference.cs +++ b/Geometry_Engine/Compute/BooleanDifference.cs @@ -102,9 +102,13 @@ public static List BooleanDifference(this Polyline region, List allRegions = new List { region }; Plane p = region.FitPlane(); + if (p == null) + return new List(); + foreach (Polyline refRegion in refRegions) { - if (p.IsCoplanar(refRegion.FitPlane())) + Plane refPlane = refRegion.FitPlane(); + if (refPlane != null && p.IsCoplanar(refPlane)) allRegions.Add(refRegion); } @@ -268,9 +272,13 @@ public static List BooleanDifference(this ICurve region, IEnumerable< List allRegions = new List { region }; Plane p = region.IFitPlane(); + if (p == null) + return new List(); + foreach (ICurve refRegion in refRegionsList) { - if (p.IsCoplanar(refRegion.IFitPlane())) + Plane refPlane = refRegion.IFitPlane(); + if (refPlane != null && p.IsCoplanar(refPlane)) allRegions.Add(refRegion); }