diff --git a/MidasCivil_Adapter/CRUD/Read/Results/NodeResults.cs b/MidasCivil_Adapter/CRUD/Read/Results/NodeResults.cs index 355de7f9..8485daef 100644 --- a/MidasCivil_Adapter/CRUD/Read/Results/NodeResults.cs +++ b/MidasCivil_Adapter/CRUD/Read/Results/NodeResults.cs @@ -51,7 +51,23 @@ public IEnumerable ReadResults(NodeResultRequest request, ActionConfig case "9.5.5.nx": List loadCasesNX = Task.Run(() => AppendCaseTypes(request)).Result; if (loadCasesNX != null) - results = Task.Run(() => ReadResult(request.ResultType.ToString(), objectIds, loadCasesNX)).Result.ToList(); + { + results = Task.Run(() => ReadResult(request.ResultType.ToString() + request.Axis.ToString(), objectIds, loadCasesNX)).Result.ToList(); + + if (request.Axis == LoadAxis.Local) + { + List resultsGlobal = Task.Run(() => ReadResult(request.ResultType.ToString() + LoadAxis.Global.ToString(), objectIds, loadCasesNX)).Result.ToList(); + foreach (IResult resultLocal in results) + { + int globalIndex = resultsGlobal.FindIndex(x => ((NodeResult)x).ObjectId.CompareTo(((NodeResult)resultLocal).ObjectId) == 0); + if (globalIndex >= 0) + { + resultsGlobal[globalIndex] = resultLocal; + } + } + results = resultsGlobal; + } + } break; default: List loadCases = GetLoadcaseIDs(request); diff --git a/MidasCivil_Adapter/PrivateHelpers/AppendCaseTypes.cs b/MidasCivil_Adapter/PrivateHelpers/AppendCaseTypes.cs index 634a2fcc..3e07d1b0 100644 --- a/MidasCivil_Adapter/PrivateHelpers/AppendCaseTypes.cs +++ b/MidasCivil_Adapter/PrivateHelpers/AppendCaseTypes.cs @@ -83,7 +83,12 @@ private List GetCaseName(string response, List filters, string l Dictionary combData = item.Value.PropertyValue("CustomData") as Dictionary; string name = combData["NAME"].ToString(); if (filters.Contains(name)) - filteredNames.Add(name + ending); + { + if (combData.ContainsKey("bCB") && combData["bCB"].ToString() == "True" && ending == "(CB)") // Checks whether the LoadCombination represents an envelope + filteredNames.AddRange(new List { name + "(CB:all)", name + "(CB:max)", name + "(CB:min)" }); + else + filteredNames.Add(name + ending); + } } } return filteredNames; diff --git a/MidasCivil_Adapter/PrivateHelpers/ReadResult.cs b/MidasCivil_Adapter/PrivateHelpers/ReadResult.cs index 1b3ca551..0ec22aba 100644 --- a/MidasCivil_Adapter/PrivateHelpers/ReadResult.cs +++ b/MidasCivil_Adapter/PrivateHelpers/ReadResult.cs @@ -65,15 +65,27 @@ private async Task> ReadResult(string resultType, List switch (resultType) { case "NodeReaction": + case "NodeReactionGlobal": tableName = "\"TABLE_NAME\": \"Reaction(Global)\", "; tableType = "\"TABLE_TYPE\": \"REACTIONG\", "; components = "\"COMPONENTS\": [\"Node\", \"Load\", \"FX\", \"FY\", \"FZ\", \"MX\", \"MY\", \"MZ\"], "; break; case "NodeDisplacement": + case "NodeDisplacementGlobal": tableName = "\"TABLE_NAME\": \"Displacements(Global)\", "; tableType = "\"TABLE_TYPE\": \"DISPLACEMENTG\", "; components = "\"COMPONENTS\": [\"Node\", \"Load\", \"DX\", \"DY\", \"DZ\", \"RX\", \"RY\", \"RZ\"], "; break; + case "NodeReactionLocal": + tableName = "\"TABLE_NAME\": \"Reaction(Local)\", "; + tableType = "\"TABLE_TYPE\": \"REACTIONL\", "; + components = "\"COMPONENTS\": [\"Node\", \"Load\", \"FX\", \"FY\", \"FZ\", \"MX\", \"MY\", \"MZ\"], "; + break; + case "NodeDisplacementLocal": + tableName = "\"TABLE_NAME\": \"Displacements(Local)\", "; + tableType = "\"TABLE_TYPE\": \"DISPLACEMENTL\", "; + components = "\"COMPONENTS\": [\"Node\", \"Load\", \"DX\", \"DY\", \"DZ\", \"RX\", \"RY\", \"RZ\"], "; + break; case "BarForce": tableName = "\"TABLE_NAME\": \"BeamForce\", "; tableType = "\"TABLE_TYPE\": \"BEAMFORCE\", "; @@ -127,6 +139,7 @@ private async Task> ReadResult(string resultType, List switch (resultType) { case "NodeReaction": + case "NodeReactionGlobal": switch (m_midasCivilVersion) { case "9.5.0.nx": @@ -144,6 +157,7 @@ private async Task> ReadResult(string resultType, List results.Add(Adapters.MidasCivil.Convert.ToNodeReaction(item)); break; case "NodeDisplacement": + case "NodeDisplacementGlobal": switch (m_midasCivilVersion) { case "9.5.0.nx": @@ -154,9 +168,46 @@ private async Task> ReadResult(string resultType, List break; } resultItems = data as List>; - foreach (List item in resultItems) + if (resultItems.IsNullOrEmpty()) + Engine.Base.Compute.RecordError($"No NodeDisplacement could be found for the selected Node/Nodes."); + else + foreach (List item in resultItems) results.Add(Adapters.MidasCivil.Convert.ToNodeDisplacement(item)); break; + case "NodeReactionLocal": + switch (m_midasCivilVersion) + { + case "9.5.0.nx": + data = parsedJson.PropertyValue("CustomData")?.PropertyValue("Reaction(Local)")?.PropertyValue("DATA"); + break; + default: + data = parsedJson.PropertyValue("CustomData")?.PropertyValue("ReactionLocal")?.PropertyValue("DATA"); + break; + } + resultItems = data as List>; + if (resultItems.IsNullOrEmpty()) + Engine.Base.Compute.RecordError($"No NodeReaction could be found for the selected Node/Nodes."); + else + foreach (List item in resultItems) + results.Add(Adapters.MidasCivil.Convert.ToNodeReaction(item)); + break; + case "NodeDisplacementLocal": + switch (m_midasCivilVersion) + { + case "9.5.0.nx": + data = parsedJson.PropertyValue("CustomData")?.PropertyValue("Displacements(Local)")?.PropertyValue("DATA"); + break; + default: + data = parsedJson.PropertyValue("CustomData")?.PropertyValue("DisplacementsLocal")?.PropertyValue("DATA"); + break; + } + resultItems = data as List>; + if (resultItems.IsNullOrEmpty()) + Engine.Base.Compute.RecordError($"No NodeDisplacement could be found for the selected Node/Nodes."); + else + foreach (List item in resultItems) + results.Add(Adapters.MidasCivil.Convert.ToNodeDisplacement(item)); + break; case "BarForce": data = parsedJson.PropertyValue("CustomData")?.PropertyValue("BeamForce")?.PropertyValue("DATA"); resultItems = data as List>;