Skip to content

Commit 615a846

Browse files
authored
8.2 Deployment (#406)
2 parents 36216e9 + 4a113d5 commit 615a846

File tree

9 files changed

+256
-192
lines changed

9 files changed

+256
-192
lines changed

MidasCivil_Adapter/AdapterActions/Execute.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
using System.Runtime.InteropServices;
3333
using System.Threading.Tasks;
3434
using System.Net.Http;
35+
using System.Net.NetworkInformation;
3536

3637
namespace BH.Adapter.MidasCivil
3738
{
@@ -319,6 +320,52 @@ public async Task<bool> RunCommand(Analyse command)
319320
}
320321

321322
/***************************************************/
323+
public async Task<bool> RunCommand(ImportFile command)
324+
{
325+
if (m_midasCivilVersion == "9.5.0.nx")
326+
{
327+
string endpoint = "";
328+
string filePath = command.FilePath;
329+
330+
if (File.Exists(filePath))
331+
{
332+
string extension = Path.GetExtension(filePath).ToLower();
333+
334+
if (extension == ".mct" || extension == ".mgt" || extension == ".txt")
335+
endpoint = "doc/IMPORTMXT";
336+
337+
else if (extension == ".json")
338+
endpoint = "doc/IMPORT";
339+
340+
else
341+
{
342+
Engine.Base.Compute.RecordError("The given file type is not supported by this Adapter.");
343+
return false;
344+
}
345+
346+
}
347+
348+
else
349+
{
350+
Engine.Base.Compute.RecordError("The given file path does not exist.");
351+
return false;
352+
}
353+
354+
filePath = filePath.Replace("\\", "\\\\");
355+
356+
string jsonPayload = "{\"Argument\": \"" + filePath + "\"}";
357+
358+
await SendRequestAsync(endpoint, HttpMethod.Post, jsonPayload).ConfigureAwait(false);
359+
360+
return true;
361+
}
362+
363+
else
364+
{
365+
Engine.Base.Compute.RecordWarning($"The command {command.GetType().Name} is not supported by this Adapter version.");
366+
return false;
367+
}
368+
}
322369

323370
public bool RunCommand(AnalyseLoadCases command)
324371
{

MidasCivil_Adapter/Convert/ToBHoM/Elements/ToRigidLink.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static RigidLink ToRigidLink(string rigidLink, Dictionary<string, Node> n
5454
case "9.4.0":
5555
case "9.4.5":
5656
case "9.5.0":
57+
case "9.5.0.nx":
5758
primaryId = delimitted[0].Trim();
5859
fixity = delimitted[1].Replace(" ", "");
5960
secondaryIds = delimitted[2].Split(' ').Where(m => !string.IsNullOrWhiteSpace(m)).ToList();

MidasCivil_Adapter/Convert/ToMidasCivil/Elements/FromRigidLink.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
using BH.oM.Adapters.MidasCivil;
2424
using BH.Engine.Adapter;
2525
using BH.oM.Structure.Elements;
26+
using BH.oM.Structure.Constraints;
27+
using System;
2628

2729
namespace BH.Adapter.Adapters.MidasCivil
2830
{
@@ -34,6 +36,11 @@ public static partial class Convert
3436

3537
public static string FromRigidLink(this RigidLink link, string version)
3638
{
39+
LinkConstraint con = link.Constraint;
40+
41+
if (con.XtoYY || con.XtoZZ || con.YtoXX || con.YtoZZ || con.ZtoXX || con.ZtoYY)
42+
Engine.Base.Compute.RecordError("Imposed rotations due to translations are not supported in this Adapter.");
43+
3744
string midasLink = "";
3845

3946
string primaryId = link.PrimaryNode.AdapterId<string>(typeof(MidasCivilId));
@@ -44,12 +51,12 @@ public static string FromRigidLink(this RigidLink link, string version)
4451
secondaryId = secondaryId + " " + secondaryNode.AdapterId<string>(typeof(MidasCivilId));
4552
}
4653

47-
string fixity = BoolToFixity(link.Constraint.XtoX) +
48-
BoolToFixity(link.Constraint.YtoY) +
49-
BoolToFixity(link.Constraint.ZtoZ) +
50-
BoolToFixity(link.Constraint.XXtoXX) +
51-
BoolToFixity(link.Constraint.YYtoYY) +
52-
BoolToFixity(link.Constraint.ZZtoZZ);
54+
string fixity = BoolToFixity(con.XtoX) +
55+
BoolToFixity(con.YtoY) +
56+
BoolToFixity(con.ZtoZ) +
57+
BoolToFixity(con.XXtoXX) +
58+
BoolToFixity(con.YYtoYY) +
59+
BoolToFixity(con.ZZtoZZ);
5360

5461
switch (version)
5562
{
@@ -58,6 +65,7 @@ public static string FromRigidLink(this RigidLink link, string version)
5865
case "9.4.0":
5966
case "9.4.5":
6067
case "9.5.0":
68+
case "9.5.0.nx":
6169
midasLink = primaryId + "," + fixity + "," + secondaryId + "," + link.Name;
6270
break;
6371
default:

MidasCivil_Adapter/Convert/ToMidasCivil/Loads/FromAreaUniformlyDistributedLoad.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public static string FromAreaUniformlyDistributedLoad(this AreaUniformlyDistribu
4848
case "9.1.0":
4949
case "9.4.5":
5050
case "9.5.0":
51+
case "9.5.0.nx":
52+
5153
midasFEMeshLoad = assignedFEMesh + ", PRES, PLATE, FACE, " + FromLoadAxis(femeshLoad.Axis) + direction +
5254
", 0, 0, 0, " + FromLoadProjection(femeshLoad.Projected) + ", " +
5355
FromVectorDirection(femeshLoad.Pressure, direction).PressureFromSI(forceUnit, lengthUnit).ToString() +

MidasCivil_Adapter/Convert/ToMidasCivil/Loads/FromLoadCombination.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public static List<string> FromLoadCombination(this LoadCombination loadCombinat
4444
case "8.6.5":
4545
line1 = "NAME=" + loadCombination.Name + ", GEN, ACTIVE, 0, 0, , 0, 0";
4646
break;
47+
case "9.4.5":
48+
case "9.5.0":
49+
case "9.5.0.nx":
50+
line1 = "NAME=" + loadCombination.Name + ", GEN, ACTIVE, 0, 0, , 0, 0, 0, 1";
51+
break;
4752
default:
4853
line1 = "NAME=" + loadCombination.Name + ", GEN, ACTIVE, 0, 0, , 0, 0, 0";
4954
break;

MidasCivil_Adapter/Convert/ToMidasCivil/Loads/FromPointForce.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public static string FromPointLoad(this PointLoad pointLoad, string assignedNode
4141
case "9.1.0":
4242
case "9.4.5":
4343
case "9.5.0":
44+
case "9.5.0.nx":
4445
midasPointLoad = assignedNode + "," + pointLoad.Force.X.ForceFromSI(forceUnit).ToString() +
4546
"," + pointLoad.Force.Y.ForceFromSI(forceUnit).ToString() +
4647
"," + pointLoad.Force.Z.ForceFromSI(forceUnit).ToString() +
Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
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 System.Reflection;
24-
using System.Runtime.CompilerServices;
25-
using System.Runtime.InteropServices;
26-
27-
// General Information about an assembly is controlled through the following
28-
// set of attributes. Change these attribute values to modify the information
29-
// associated with an assembly.
30-
[assembly: AssemblyTitle("MidasCivil_Adapter")]
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 System.Reflection;
24+
using System.Runtime.CompilerServices;
25+
using System.Runtime.InteropServices;
26+
27+
// General Information about an assembly is controlled through the following
28+
// set of attributes. Change these attribute values to modify the information
29+
// associated with an assembly.
30+
[assembly: AssemblyTitle("MidasCivil_Adapter")]
3131
[assembly: AssemblyDescription("https://github.com/BHoM/MidasCivil_Toolkit")]
32-
[assembly: AssemblyConfiguration("")]
33-
[assembly: AssemblyCompany("")]
34-
[assembly: AssemblyProduct("MidasCivil_Adapter")]
35-
[assembly: AssemblyCopyright("Copyright © https://github.com/BHoM")]
36-
[assembly: AssemblyTrademark("")]
37-
[assembly: AssemblyCulture("")]
38-
39-
// Setting ComVisible to false makes the types in this assembly not visible
40-
// to COM components. If you need to access a type in this assembly from
41-
// COM, set the ComVisible attribute to true on that type.
42-
[assembly: ComVisible(false)]
43-
44-
// The following GUID is for the ID of the typelib if this project is exposed to COM
45-
[assembly: Guid("8c94bf09-84e2-4300-a13f-8a3a1552fb71")]
46-
47-
// Version information for an assembly consists of the following four values:
48-
//
49-
// Major Version
50-
// Minor Version
51-
// Build Number
52-
// Revision
53-
//
54-
// You can specify all the values or you can default the Build and Revision Numbers
55-
// by using the '*' as shown below:
56-
// [assembly: AssemblyVersion("1.0.*")]
57-
[assembly: AssemblyVersion("8.0.0.0")]
58-
[assembly: AssemblyFileVersion("8.1.0.0")]
59-
60-
61-
62-
63-
32+
[assembly: AssemblyConfiguration("")]
33+
[assembly: AssemblyCompany("")]
34+
[assembly: AssemblyProduct("MidasCivil_Adapter")]
35+
[assembly: AssemblyCopyright("Copyright © https://github.com/BHoM")]
36+
[assembly: AssemblyTrademark("")]
37+
[assembly: AssemblyCulture("")]
38+
39+
// Setting ComVisible to false makes the types in this assembly not visible
40+
// to COM components. If you need to access a type in this assembly from
41+
// COM, set the ComVisible attribute to true on that type.
42+
[assembly: ComVisible(false)]
43+
44+
// The following GUID is for the ID of the typelib if this project is exposed to COM
45+
[assembly: Guid("8c94bf09-84e2-4300-a13f-8a3a1552fb71")]
46+
47+
// Version information for an assembly consists of the following four values:
48+
//
49+
// Major Version
50+
// Minor Version
51+
// Build Number
52+
// Revision
53+
//
54+
// You can specify all the values or you can default the Build and Revision Numbers
55+
// by using the '*' as shown below:
56+
// [assembly: AssemblyVersion("1.0.*")]
57+
[assembly: AssemblyVersion("8.0.0.0")]
58+
[assembly: AssemblyFileVersion("8.2.0.0")]
59+
60+
61+
62+
63+
Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
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 System.Reflection;
24-
using System.Runtime.CompilerServices;
25-
using System.Runtime.InteropServices;
26-
27-
// General Information about an assembly is controlled through the following
28-
// set of attributes. Change these attribute values to modify the information
29-
// associated with an assembly.
30-
[assembly: AssemblyTitle("MidasCivil_Engine")]
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 System.Reflection;
24+
using System.Runtime.CompilerServices;
25+
using System.Runtime.InteropServices;
26+
27+
// General Information about an assembly is controlled through the following
28+
// set of attributes. Change these attribute values to modify the information
29+
// associated with an assembly.
30+
[assembly: AssemblyTitle("MidasCivil_Engine")]
3131
[assembly: AssemblyDescription("https://github.com/BHoM/MidasCivil_Toolkit")]
32-
[assembly: AssemblyConfiguration("")]
33-
[assembly: AssemblyCompany("")]
34-
[assembly: AssemblyProduct("MidasCivil_Engine")]
35-
[assembly: AssemblyCopyright("Copyright © https://github.com/BHoM")]
36-
[assembly: AssemblyTrademark("")]
37-
[assembly: AssemblyCulture("")]
38-
39-
// Setting ComVisible to false makes the types in this assembly not visible
40-
// to COM components. If you need to access a type in this assembly from
41-
// COM, set the ComVisible attribute to true on that type.
42-
[assembly: ComVisible(false)]
43-
44-
// The following GUID is for the ID of the typelib if this project is exposed to COM
45-
[assembly: Guid("bc0a8eff-4277-49e9-bbdc-66ffa11e5258")]
46-
47-
// Version information for an assembly consists of the following four values:
48-
//
49-
// Major Version
50-
// Minor Version
51-
// Build Number
52-
// Revision
53-
//
54-
// You can specify all the values or you can default the Build and Revision Numbers
55-
// by using the '*' as shown below:
56-
// [assembly: AssemblyVersion("1.0.*")]
57-
[assembly: AssemblyVersion("8.0.0.0")]
58-
[assembly: AssemblyFileVersion("8.1.0.0")]
59-
60-
61-
62-
63-
32+
[assembly: AssemblyConfiguration("")]
33+
[assembly: AssemblyCompany("")]
34+
[assembly: AssemblyProduct("MidasCivil_Engine")]
35+
[assembly: AssemblyCopyright("Copyright © https://github.com/BHoM")]
36+
[assembly: AssemblyTrademark("")]
37+
[assembly: AssemblyCulture("")]
38+
39+
// Setting ComVisible to false makes the types in this assembly not visible
40+
// to COM components. If you need to access a type in this assembly from
41+
// COM, set the ComVisible attribute to true on that type.
42+
[assembly: ComVisible(false)]
43+
44+
// The following GUID is for the ID of the typelib if this project is exposed to COM
45+
[assembly: Guid("bc0a8eff-4277-49e9-bbdc-66ffa11e5258")]
46+
47+
// Version information for an assembly consists of the following four values:
48+
//
49+
// Major Version
50+
// Minor Version
51+
// Build Number
52+
// Revision
53+
//
54+
// You can specify all the values or you can default the Build and Revision Numbers
55+
// by using the '*' as shown below:
56+
// [assembly: AssemblyVersion("1.0.*")]
57+
[assembly: AssemblyVersion("8.0.0.0")]
58+
[assembly: AssemblyFileVersion("8.2.0.0")]
59+
60+
61+
62+
63+

0 commit comments

Comments
 (0)