Skip to content

Commit

Permalink
7.0 Deployment (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser Greenroyd authored Dec 20, 2023
2 parents 59f8333 + e97901c commit bfb9e78
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 33 deletions.
12 changes: 8 additions & 4 deletions MidasCivil_Adapter/AdapterActions/Execute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public bool RunCommand(Save command)

public bool RunCommand(SaveAs command)
{
string newDirectory = GetDirectoryRoot(m_directory) + "\\" + command.FileName;
string fileName = command.FileName;
string newDirectory = GetDirectoryRoot(m_directory) + "\\" + fileName;

if (Directory.Exists(newDirectory))
{
Expand All @@ -114,10 +115,10 @@ public bool RunCommand(SaveAs command)
Directory.CreateDirectory(newDirectory);
string[] mcbFiles = Directory.GetFiles(m_directory, "*.mcb");
foreach (string mcbFile in mcbFiles)
File.Copy(mcbFile, newDirectory);
File.Copy(mcbFile, Path.Combine(newDirectory, fileName + ".mcb"));
string[] mctFiles = Directory.GetFiles(m_directory, "*.mcb");
foreach (string mctFile in mctFiles)
File.Copy(mctFile, newDirectory);
File.Copy(mctFile, Path.Combine(newDirectory, fileName + ".mct"));
CopyAll(new DirectoryInfo(m_directory + "\\TextFiles"), new DirectoryInfo(newDirectory + "\\TextFiles"));
CopyAll(new DirectoryInfo(m_directory + "\\Results"), new DirectoryInfo(newDirectory + "\\Results"));

Expand Down Expand Up @@ -175,8 +176,11 @@ public bool RunCommand(Open command)
m_midasCivilVersion = m_midasCivilVersion.Trim();
if (File.Exists(versionFile))
{
File.Delete(versionFile);
File.AppendAllLines(versionFile, new List<string>() { "*VERSION", m_midasCivilVersion });
Engine.Base.Compute.RecordWarning("*VERSION file found, user input used to overide: version = " + m_midasCivilVersion);
}

}
else if (File.Exists(versionFile))
{
Expand All @@ -185,7 +189,7 @@ public bool RunCommand(Open command)
}
else
{
m_midasCivilVersion = "8.8.1";
m_midasCivilVersion = "9.4.0";
Engine.Base.Compute.RecordWarning("*VERSION file not found in directory and no version specified, MidasCivil version assumed default value = " + m_midasCivilVersion);
}

Expand Down
17 changes: 14 additions & 3 deletions MidasCivil_Adapter/MidasCivilAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
using BH.Engine.Adapters.MidasCivil.Comparer;
using BH.Engine.Structure;
using BH.oM.Adapter.Commands;
using BH.oM.Adapter;
using System.IO;
using BH.oM.Base.Attributes;
using System.ComponentModel;

namespace BH.Adapter.MidasCivil
{
Expand All @@ -45,7 +49,13 @@ public partial class MidasCivilAdapter : BHoMAdapter
/***************************************************/

//Add any applicable constructors here, such as linking to a specific file or anything else as well as linking to that file through the (if existing) com link via the API
public MidasCivilAdapter(string filePath, bool active = false, string version = "")
[PreviousVersion("7.0", "BH.Adapter.MidasCivil.MidasCivilAdapter(System.String, System.Boolean, System.String)")]
[Description("Adapter to create a .mct file to be used in Midas Civil command shell.")]
[Input("filePath", "Path to the .mcb file. It is recommended to save your .mcb file in a separate folder before using the adapter.")]
[Input("midasCivilSettings", "General settings that are applicable to all actions performed by this adapter, e.g. version of Midas Civil to be used.")]
[Input("active", "Initiate the adapter by setting to True.")]
[Output("adapter", "Adapter for MidasCivil.")]
public MidasCivilAdapter(string filePath, MidasCivilSettings midasCivilSettings = null, bool active = false)
{
if (active)
{
Expand Down Expand Up @@ -93,7 +103,8 @@ public MidasCivilAdapter(string filePath, bool active = false, string version =
{typeof(ILoad), new List<Type> {typeof(Loadcase) } }
};

m_midasCivilVersion = version;
if (midasCivilSettings != null)
m_midasCivilVersion = midasCivilSettings.Version;
Execute(new Open() { FileName = filePath });
}
}
Expand All @@ -109,7 +120,7 @@ public static bool IsApplicationRunning()

private List<string> m_midasText;
private string m_directory;
public string m_midasCivilVersion { get; protected set; }
public string m_midasCivilVersion { get; protected set; } = "";
private string m_forceUnit = "N";
private string m_lengthUnit = "M";
private string m_heatUnit = "KJ";
Expand Down
4 changes: 2 additions & 2 deletions MidasCivil_Adapter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.0.0.0")]
[assembly: AssemblyFileVersion("6.3.0.0")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]



48 changes: 48 additions & 0 deletions MidasCivil_Engine/Create/MidasCivilSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2023, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using BH.oM.Adapters.MidasCivil;
using BH.oM.Base.Attributes;
using System.ComponentModel;

namespace BH.Engine.Adapters.MidasCivil
{
public static partial class Create
{
/***************************************************/
/**** Public Constructors ****/
/***************************************************/

[Description("MidasCivil adapter settings.")]
[Input("version", "The version of MidasCivil to be used by the adapter.")]
[Output("MidasCivil specific adapter settings to be used by the adapter.")]
public static MidasCivilSettings MidasCivilSettings(string version = "")
{
MidasCivilSettings midasCivilSettings = new MidasCivilSettings();
if (version != "")
midasCivilSettings.Version = version;

return midasCivilSettings;
}
/***************************************************/
}
}
29 changes: 15 additions & 14 deletions MidasCivil_Engine/MidasCivil_Engine.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTarget="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -31,62 +31,62 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Adapter_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\Adapter_Engine.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Adapter_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Analytical_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Analytical_oM.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Analytical_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BHoM">
<HintPath>C:\ProgramData\BHoM\Assemblies\BHoM.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BHoM_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\BHoM_Engine.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Dimensional_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Dimensional_oM.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Dimensional_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Geometry_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\Geometry_Engine.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Geometry_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Geometry_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Geometry_oM.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Geometry_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Library_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\Library_Engine.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Library_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Physical_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Physical_oM.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Physical_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Spatial_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\Spatial_Engine.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Spatial_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Structure_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\Structure_Engine.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Structure_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Structure_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Structure_oM.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\Structure_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
Expand All @@ -102,6 +102,7 @@
<ItemGroup>
<Compile Include="Compute\FEMeshToPanel.cs" />
<Compile Include="Convert\Date.cs" />
<Compile Include="Create\MidasCivilSettings.cs" />
<Compile Include="Create\Review.cs" />
<Compile Include="Objects\AdapterIdName.cs" />
<Compile Include="Objects\ArrayComparer.cs" />
Expand All @@ -126,4 +127,4 @@
xcopy "$(TargetDir)$(TargetFileName)" "C:\ProgramData\BHoM\Assemblies" /Y
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions MidasCivil_Engine/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.0.0.0")]
[assembly: AssemblyFileVersion("6.3.0.0")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]



13 changes: 10 additions & 3 deletions MidasCivil_oM/MidasCivil_oM.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTarget="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -30,9 +30,15 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Adapter_oM">
<HintPath>$(ProgramData)\BHoM\Assemblies\Adapter_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BHoM">
<HintPath>C:\ProgramData\BHoM\Assemblies\BHoM.dll</HintPath>
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -48,6 +54,7 @@
<Compile Include="Enum\HeatUnit.cs" />
<Compile Include="Enum\LengthUnit.cs" />
<Compile Include="Settings\Metadata.cs" />
<Compile Include="Settings\MidasCivilSettings.cs" />
<Compile Include="Settings\Review.cs" />
<Compile Include="Enum\TemperatureUnit.cs" />
<Compile Include="Fragments\MidasCivilId.cs" />
Expand All @@ -60,4 +67,4 @@
xcopy "$(TargetDir)$(TargetFileName)" "C:\ProgramData\BHoM\Assemblies" /Y
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions MidasCivil_oM/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.0.0.0")]
[assembly: AssemblyFileVersion("6.3.0.0")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]



39 changes: 39 additions & 0 deletions MidasCivil_oM/Settings/MidasCivilSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2023, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using BH.oM.Adapter;
using System.ComponentModel;

namespace BH.oM.Adapters.MidasCivil
{
public class MidasCivilSettings : AdapterSettings
{
/***************************************************/
/**** Public Properties ****/
/***************************************************/

[Description("The version of MidasCivil to be used by the adapter.")]
public virtual string Version { get; set; } = "";

/***************************************************/
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ Grab the [latest installer](https://bhom.xyz/) and a selection of [sample script
## Getting Started for Developers 🤖

If you want to build the BHoM and the Toolkits from source, it's hopefully easy! 😄
Do take a look at our specific wiki pages here: [Getting Started for Developers](https://github.com/BHoM/documentation/wiki/Getting-started-for-developers)
Do take a look at our specific wiki pages here: [Getting Started for Developers](https://bhom.xyz/documentation/Contributing/Getting-started-for-developers/)


## Want to Contribute? ##

BHoM is an open-source project and would be nothing without its community. Take a look at our contributing guidelines and tips [here](https://github.com/BHoM/BHoM/blob/master/CONTRIBUTING.md).
BHoM is an open-source project and would be nothing without its community. Take a look at our contributing guidelines and tips [here](https://github.com/BHoM/BHoM/blob/main/CONTRIBUTING.md).


## Licence ##

BHoM is free software licenced under GNU Lesser General Public Licence - [https://www.gnu.org/licenses/lgpl-3.0.html](https://www.gnu.org/licenses/lgpl-3.0.html)
Each contributor holds copyright over their respective contributions.
The project versioning (Git) records all such contribution source information.
See [LICENSE](https://github.com/BHoM/BHoM/blob/master/LICENSE) and [COPYRIGHT_HEADER](https://github.com/BHoM/BHoM/blob/master/COPYRIGHT_HEADER.txt).
See [LICENSE](https://github.com/BHoM/BHoM/blob/main/LICENSE) and [COPYRIGHT_HEADER](https://github.com/BHoM/BHoM/blob/main/COPYRIGHT_HEADER.txt).

0 comments on commit bfb9e78

Please sign in to comment.