Skip to content

Commit be5dafa

Browse files
committed
Made a method to create openings from a panel.
1 parent 8061d35 commit be5dafa

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* This file is part of the Buildings and Habitats object Model (BHoM)
3+
* Copyright (c) 2015 - 2021, the respective contributors. All rights reserved.
4+
*
5+
* Each contributor holds copyright over their respective contributions.
6+
* The project versioning (Git) records all such contribution source information.
7+
*
8+
*
9+
* The BHoM is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published by
11+
* the Free Software Foundation, either version 3.0 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* The BHoM is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
21+
*/
22+
23+
using System;
24+
using System.Collections.Generic;
25+
using BH.oM.Reflection.Attributes;
26+
using System.ComponentModel;
27+
using BH.oM.Environment.Elements;
28+
using System.Linq;
29+
using System.Text;
30+
using System.Threading.Tasks;
31+
32+
namespace BH.Engine.Environment
33+
{
34+
public static partial class Convert
35+
{
36+
[Description("Applies an opening to the full area of a panel. Existing openings will be removed/replaced by the opening generated to match the size of the panel.")]
37+
[Input("panel", "Panel to generate an opening from.")]
38+
[Input("openingType", "Speficy the type of the opening to convert the panel into.")]
39+
[Output("panel", "Returns the panel with the opening applied.")]
40+
public static Panel OpeningFromPanel(this Panel panel, OpeningType openingType = OpeningType.Window)
41+
{
42+
Opening o = new Opening();
43+
o.Edges = new List<Edge>(panel.ExternalEdges);
44+
o.Type = openingType;
45+
panel.Openings = new List<Opening>();
46+
panel.Openings.Add(o);
47+
48+
return panel;
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)