Skip to content

Commit 7edf81f

Browse files
authored
8.2 Deployment (#314)
2 parents e07b89f + 0ba5399 commit 7edf81f

13 files changed

Lines changed: 822 additions & 259 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*
2+
* This file is part of the Buildings and Habitats object Model (BHoM)
3+
* Copyright (c) 2015 - 2025, 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 BH.Engine.Adapter;
24+
using BH.Engine.LadybugTools;
25+
using BH.Engine.Serialiser;
26+
using BH.oM.Adapter;
27+
using BH.oM.Base;
28+
using BH.oM.LadybugTools;
29+
using System;
30+
using System.Collections.Generic;
31+
using System.IO;
32+
using System.Linq;
33+
using System.Text;
34+
35+
namespace BH.Adapter.LadybugTools
36+
{
37+
public partial class LadybugToolsAdapter : BHoMAdapter
38+
{
39+
private List<object> RunCommand(FacadeCondensationRiskCommand command, ActionConfig actionConfig)
40+
{
41+
if (command.EPWFile == null)
42+
{
43+
BH.Engine.Base.Compute.RecordError($"{nameof(command.EPWFile)} input cannot be null.");
44+
return null;
45+
}
46+
47+
if (!System.IO.File.Exists(command.EPWFile.GetFullFileName()))
48+
{
49+
BH.Engine.Base.Compute.RecordError($"File '{command.EPWFile.GetFullFileName()}' does not exist.");
50+
return null;
51+
}
52+
53+
List<double> thresholds;
54+
if (command.Thresholds == null || command.Thresholds.Count() == 0)
55+
{
56+
thresholds = new List<double>{10, 7, 4, 1, -2, -5};
57+
}
58+
else
59+
{
60+
thresholds = command.Thresholds;
61+
}
62+
string thresholdsStr = string.Join(" ", thresholds);
63+
64+
string epwFile = System.IO.Path.GetFullPath(command.EPWFile.GetFullFileName());
65+
string script;
66+
67+
if (command.Heatmap)
68+
{
69+
script = Path.Combine(Engine.LadybugTools.Query.PythonCodeDirectory(), "LadybugTools_Toolkit\\src\\ladybugtools_toolkit\\bhom\\wrapped\\plot", "facade_condensation_risk_heatmap.py");
70+
}
71+
else
72+
{
73+
script = Path.Combine(Engine.LadybugTools.Query.PythonCodeDirectory(), "LadybugTools_Toolkit\\src\\ladybugtools_toolkit\\bhom\\wrapped\\plot", "facade_condensation_risk_chart.py");
74+
}
75+
76+
string returnFile = Path.GetTempFileName();
77+
78+
// run the process
79+
string cmdCommand = $"{m_environment.Executable} \"{script}\" -e \"{epwFile}\" -t {thresholdsStr} -r \"{returnFile.Replace('\\', '/')}\" -p \"{command.OutputLocation}\"";
80+
string result = Engine.Python.Compute.RunCommandStdout(command: cmdCommand, hideWindows: true);
81+
82+
string resultFile = result.Split('\n').Last();
83+
84+
if (!File.Exists(resultFile))
85+
{
86+
BH.Engine.Base.Compute.RecordError($"An error occurred while running the command: {result}");
87+
File.Delete(returnFile);
88+
return new List<object>();
89+
}
90+
91+
CustomObject obj = (CustomObject)BH.Engine.Serialiser.Convert.FromJson(System.IO.File.ReadAllText(returnFile));
92+
File.Delete(returnFile);
93+
PlotInformation info = Convert.ToPlotInformation(obj, new CollectionData());
94+
95+
m_executeSuccess = true;
96+
return new List<object> { info };
97+
}
98+
}
99+
}
Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
5-
<AssemblyVersion>8.0.0.0</AssemblyVersion>
6-
<Description>https://github.com/BHoM/LadybugTools_Toolkit</Description>
7-
<Version>6.0.0</Version>
8-
<Authors>BHoM</Authors>
9-
<Copyright>Copyright © https://github.com/BHoM</Copyright>
10-
<RootNamespace>BH.Adapter.LadybugTools</RootNamespace>
11-
<FileVersion>8.1.0.0</FileVersion>
12-
<OutputPath>..\Build\</OutputPath>
13-
</PropertyGroup>
14-
15-
<ItemGroup>
16-
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
17-
</ItemGroup>
18-
19-
<ItemGroup>
20-
<ProjectReference Include="..\LadybugTools_Engine\LadybugTools_Engine.csproj" />
21-
<ProjectReference Include="..\LadybugTools_oM\LadybugTools_oM.csproj" />
22-
</ItemGroup>
23-
24-
<ItemGroup>
25-
<Reference Include="Adapter_Engine">
26-
<HintPath>$(ProgramData)\BHoM\Assemblies\Adapter_Engine.dll</HintPath>
27-
<SpecificVersion>False</SpecificVersion>
28-
<Private>False</Private>
29-
</Reference>
30-
<Reference Include="Adapter_oM">
31-
<HintPath>$(ProgramData)\BHoM\Assemblies\Adapter_oM.dll</HintPath>
32-
<SpecificVersion>False</SpecificVersion>
33-
<Private>False</Private>
34-
</Reference>
35-
<Reference Include="BHoM">
36-
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM.dll</HintPath>
37-
<SpecificVersion>False</SpecificVersion>
38-
<Private>False</Private>
39-
</Reference>
40-
<Reference Include="BHoM_Adapter">
41-
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM_Adapter.dll</HintPath>
42-
<SpecificVersion>False</SpecificVersion>
43-
<Private>False</Private>
44-
</Reference>
45-
<Reference Include="BHoM_Engine">
46-
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM_Engine.dll</HintPath>
47-
<SpecificVersion>False</SpecificVersion>
48-
<Private>False</Private>
49-
</Reference>
50-
<Reference Include="Data_oM">
51-
<HintPath>$(ProgramData)\BHoM\Assemblies\Data_oM.dll</HintPath>
52-
<SpecificVersion>False</SpecificVersion>
53-
<Private>False</Private>
54-
</Reference>
55-
<Reference Include="Dimensional_oM">
56-
<HintPath>$(ProgramData)\BHoM\Assemblies\Dimensional_oM.dll</HintPath>
57-
<SpecificVersion>False</SpecificVersion>
58-
<Private>False</Private>
59-
</Reference>
60-
<Reference Include="Geometry_oM">
61-
<HintPath>$(ProgramData)\BHoM\Assemblies\Geometry_oM.dll</HintPath>
62-
<SpecificVersion>False</SpecificVersion>
63-
<Private>False</Private>
64-
</Reference>
65-
<Reference Include="Physical_oM">
66-
<HintPath>$(ProgramData)\BHoM\Assemblies\Physical_oM.dll</HintPath>
67-
<SpecificVersion>False</SpecificVersion>
68-
<Private>False</Private>
69-
</Reference>
70-
<Reference Include="Python_Engine">
71-
<HintPath>$(ProgramData)\BHoM\Assemblies\Python_Engine.dll</HintPath>
72-
<Private>False</Private>
73-
<SpecificVersion>False</SpecificVersion>
74-
</Reference>
75-
<Reference Include="Python_oM">
76-
<HintPath>$(ProgramData)\BHoM\Assemblies\Python_oM.dll</HintPath>
77-
<Private>False</Private>
78-
<SpecificVersion>False</SpecificVersion>
79-
</Reference>
80-
<Reference Include="Serialiser_Engine">
81-
<HintPath>$(ProgramData)\BHoM\Assemblies\Serialiser_Engine.dll</HintPath>
82-
<Private>False</Private>
83-
<SpecificVersion>False</SpecificVersion>
84-
</Reference> </ItemGroup>
85-
86-
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
87-
<Exec Command="xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /C /Y" />
88-
</Target>
89-
90-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<AssemblyVersion>8.0.0.0</AssemblyVersion>
6+
<Description>https://github.com/BHoM/LadybugTools_Toolkit</Description>
7+
<Version>6.0.0</Version>
8+
<Authors>BHoM</Authors>
9+
<Copyright>Copyright © https://github.com/BHoM</Copyright>
10+
<RootNamespace>BH.Adapter.LadybugTools</RootNamespace>
11+
<FileVersion>8.2.0.0</FileVersion>
12+
<OutputPath>..\Build\</OutputPath>
13+
</PropertyGroup>
14+
15+
<ItemGroup>
16+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<ProjectReference Include="..\LadybugTools_Engine\LadybugTools_Engine.csproj" />
21+
<ProjectReference Include="..\LadybugTools_oM\LadybugTools_oM.csproj" />
22+
</ItemGroup>
23+
24+
<ItemGroup>
25+
<Reference Include="Adapter_Engine">
26+
<HintPath>$(ProgramData)\BHoM\Assemblies\Adapter_Engine.dll</HintPath>
27+
<SpecificVersion>False</SpecificVersion>
28+
<Private>False</Private>
29+
</Reference>
30+
<Reference Include="Adapter_oM">
31+
<HintPath>$(ProgramData)\BHoM\Assemblies\Adapter_oM.dll</HintPath>
32+
<SpecificVersion>False</SpecificVersion>
33+
<Private>False</Private>
34+
</Reference>
35+
<Reference Include="BHoM">
36+
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM.dll</HintPath>
37+
<SpecificVersion>False</SpecificVersion>
38+
<Private>False</Private>
39+
</Reference>
40+
<Reference Include="BHoM_Adapter">
41+
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM_Adapter.dll</HintPath>
42+
<SpecificVersion>False</SpecificVersion>
43+
<Private>False</Private>
44+
</Reference>
45+
<Reference Include="BHoM_Engine">
46+
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM_Engine.dll</HintPath>
47+
<SpecificVersion>False</SpecificVersion>
48+
<Private>False</Private>
49+
</Reference>
50+
<Reference Include="Data_oM">
51+
<HintPath>$(ProgramData)\BHoM\Assemblies\Data_oM.dll</HintPath>
52+
<SpecificVersion>False</SpecificVersion>
53+
<Private>False</Private>
54+
</Reference>
55+
<Reference Include="Dimensional_oM">
56+
<HintPath>$(ProgramData)\BHoM\Assemblies\Dimensional_oM.dll</HintPath>
57+
<SpecificVersion>False</SpecificVersion>
58+
<Private>False</Private>
59+
</Reference>
60+
<Reference Include="Geometry_oM">
61+
<HintPath>$(ProgramData)\BHoM\Assemblies\Geometry_oM.dll</HintPath>
62+
<SpecificVersion>False</SpecificVersion>
63+
<Private>False</Private>
64+
</Reference>
65+
<Reference Include="Physical_oM">
66+
<HintPath>$(ProgramData)\BHoM\Assemblies\Physical_oM.dll</HintPath>
67+
<SpecificVersion>False</SpecificVersion>
68+
<Private>False</Private>
69+
</Reference>
70+
<Reference Include="Python_Engine">
71+
<HintPath>$(ProgramData)\BHoM\Assemblies\Python_Engine.dll</HintPath>
72+
<Private>False</Private>
73+
<SpecificVersion>False</SpecificVersion>
74+
</Reference>
75+
<Reference Include="Python_oM">
76+
<HintPath>$(ProgramData)\BHoM\Assemblies\Python_oM.dll</HintPath>
77+
<Private>False</Private>
78+
<SpecificVersion>False</SpecificVersion>
79+
</Reference>
80+
<Reference Include="Serialiser_Engine">
81+
<HintPath>$(ProgramData)\BHoM\Assemblies\Serialiser_Engine.dll</HintPath>
82+
<Private>False</Private>
83+
<SpecificVersion>False</SpecificVersion>
84+
</Reference> </ItemGroup>
85+
86+
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
87+
<Exec Command="xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /C /Y" />
88+
</Target>
89+
90+
</Project>

0 commit comments

Comments
 (0)