BHoM / BHoM/BHoM_Engine

Geometry_Engine: PlanarSurface throws unhelpful errors on some geometries

Open
#3,322 2 comments 0 reactions 3 assignees Claimed by @Felix-Mallinder View on GitHub
type:bug
Dominant language
C#
Stars
30
Forks
13
Avg merge
7d 10h
Merged PRs (30d)
5

Description

#### Description:

Coming up in testing IES and XML toolkits, There are multiple panels which have geometry similar to this:
![image](https://github.com/BHoM/BHoM_Engine/assets/142492848/7705cd77-a741-4e26-9bb6-fde2530285f0)
where an internal curve (as an opening) meets the external curve. When these curves are input into PlanarSurface, it causes this error to be raised:
```
1. This component failed to run properly.
- Error: Sequence contains more than one element
- Occured in BH.Engine.Geometry.Create.PlanarSurface(ICurve externalBoundary, List`1 internalBoundaries, Double tolerance)
called from BH.UI.Base.Caller.Run(List`1 inputs)
- Are you sure you have the correct type of inputs? Check their description for more details.
```
This was introduced a few years back in creating planar surfaces when multiple try/catches were removed, and some of the logic was changed. The error is thrown here:https://github.com/BHoM/BHoM_Engine/blob/aed0d0617bb80b49519fec32e548610c02ba8aab/Geometry_Engine/Create/PlanarSurface.cs#L139
caused by BooleanDifference returning a list with more than one element due to there being more than one region returned from boolean difference.
#### Steps to reproduce:

Use `Create.PlanarSurface(externalBoundary, internalBoundaries, tolerance)` with geometry similar to that of the image below.

#### Expected behaviour:

Not sure how to describe it, but it should create a surface that looks like this:
![image](https://github.com/BHoM/BHoM_Engine/assets/142492848/3c425898-3924-4f3e-953f-86211ac03468)

#### Test file(s):

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.