File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Collections . Generic ;
2
3
using System . Drawing ;
3
4
using System . Linq ;
4
5
using System . Windows . Forms ;
@@ -78,11 +79,43 @@ protected override void SolveInstance(IGH_DataAccess da)
78
79
var polylinesA = Polyline3D . ConvertCurvesToPolyline ( curvesA ) . ToList ( ) ;
79
80
var polylinesB = Polyline3D . ConvertCurvesToPolyline ( curvesB ) . ToList ( ) ;
80
81
82
+ // Further tests:
83
+ // if (polylinesA.Count == 0 && (type == ClipType.ctIntersection || type == ClipType.ctDifference))
84
+ // {
85
+ // da.SetDataList("Result", new List<Polyline> ());
86
+ // return;
87
+ // }
88
+ //
89
+ // if (polylinesA.Count == 0 && (type == ClipType.ctXor || type == ClipType.ctUnion))
90
+ // {
91
+ // da.SetDataList("Result", polylinesB);
92
+ // return;
93
+ // }
94
+ //
95
+ // if (polylinesB.Count == 0 && (type == ClipType.ctIntersection || type == ClipType.ctDifference))
96
+ // {
97
+ // da.SetDataList("Result", new List<Polyline>());
98
+ // return;
99
+ // }
100
+
101
+
81
102
// If we don't have a plane, let's try to create a plane from the first curve.
82
103
if ( pln . Equals ( default ) || ! pln . IsValid )
83
104
{
84
105
// ReSharper disable once PossibleMultipleEnumeration
85
- pln = polylinesA . First ( ) . FitPlane ( ) ;
106
+ if ( polylinesA . Count != 0 )
107
+ {
108
+ pln = polylinesA . First ( ) . FitPlane ( ) ;
109
+ } else if ( polylinesB . Count != 0 )
110
+ {
111
+ pln = polylinesB . First ( ) . FitPlane ( ) ;
112
+ }
113
+ else
114
+ {
115
+ // both are empty..
116
+ da . SetDataList ( "Result" , new List < Polyline > ( ) ) ;
117
+ return ;
118
+ }
86
119
}
87
120
88
121
// do the boolean operation
You can’t perform that action at this time.
0 commit comments