From d67a0fdf2d85bd938968fc1b637107c6e95c489e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:46:53 +0000 Subject: [PATCH 01/20] Initial plan From f50a1a8c672b1da22403d47a466981d89c0e26a4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:54:58 +0000 Subject: [PATCH 02/20] Implement proper update functionality for LoadCombinations Co-authored-by: Chrisshort92 <38885832+Chrisshort92@users.noreply.github.com> --- .../CRUD/Update/Loads/LoadCombinations.cs | 68 ++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index 357de43a..18a4d7ec 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -20,6 +20,7 @@ * along with this code. If not, see . */ +using System; using System.Collections.Generic; using BH.oM.Base; using BH.oM.Structure.Elements; @@ -29,6 +30,7 @@ using BH.oM.Structure.Loads; using BH.oM.Physical.Materials; using BH.oM.Adapter; +using BH.Engine.Base; using RobotOM; namespace BH.Adapter.Robot @@ -42,7 +44,71 @@ public partial class RobotAdapter protected bool Update(IEnumerable loadCombinations) { bool success = true; - success = ICreate(loadCombinations); + + m_RobotApplication.Project.Structure.Cases.BeginMultiOperation(); + + foreach (LoadCombination lComb in loadCombinations) + { + //Check combination itself is not null + if (!CheckNotNull(lComb)) + continue; + + int combinationId; + + // Extract the adapter ID (combination number) from the BHoM object + if (!CheckInputObjectAndExtractAdapterIdInt(lComb, out combinationId, oM.Base.Debugging.EventType.Error, null, true)) + continue; + + // Check if the combination exists in Robot + if (m_RobotApplication.Project.Structure.Cases.Exist(combinationId) == -1) + { + Engine.Base.Compute.RecordWarning("Could not find a load combination with the number " + combinationId.ToString() + " in Robot. Load combination could not be updated!"); + success = false; + continue; + } + + // Get the existing combination from Robot + IRobotCase robotCase = m_RobotApplication.Project.Structure.Cases.Get(combinationId) as IRobotCase; + if (robotCase == null || robotCase.Type != IRobotCaseType.I_CT_COMBINATION) + { + Engine.Base.Compute.RecordWarning("Case with number " + combinationId.ToString() + " is not a load combination in Robot. Load combination could not be updated!"); + success = false; + continue; + } + + RobotCaseCombination rCaseCombination = robotCase as RobotCaseCombination; + if (rCaseCombination == null) + { + Engine.Base.Compute.RecordWarning("Failed to cast case with number " + combinationId.ToString() + " to RobotCaseCombination. Load combination could not be updated!"); + success = false; + continue; + } + + // Update the combination name if provided + if (!string.IsNullOrWhiteSpace(lComb.Name)) + rCaseCombination.Name = lComb.Name; + + // Clear existing case factors + rCaseCombination.CaseFactors.Clear(); + + // Add new case factors from the BHoM LoadCombination + for (int i = 0; i < lComb.LoadCases.Count; i++) + { + //Check tuple as well as case not null + if (CheckNotNull(lComb.LoadCases[i], oM.Base.Debugging.EventType.Error, typeof(LoadCombination)) && + CheckNotNull(lComb.LoadCases[i].Item2, oM.Base.Debugging.EventType.Error, typeof(LoadCombination))) + { + System.Tuple loadcase = lComb.LoadCases[i]; + rCaseCombination.CaseFactors.New(lComb.LoadCases[i].Item2.Number, lComb.LoadCases[i].Item1); + } + } + + // Set the adapter ID to maintain the connection between BHoM and Robot objects + this.SetAdapterId(lComb, lComb.Number); + } + + m_RobotApplication.Project.Structure.Cases.EndMultiOperation(); + return success; } From 76a6e23f3f78c309fd4b04e8512f123f163a27a1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:58:03 +0000 Subject: [PATCH 03/20] Add null check and warning for empty LoadCases in update method Co-authored-by: Chrisshort92 <38885832+Chrisshort92@users.noreply.github.com> --- .../CRUD/Update/Loads/LoadCombinations.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index 18a4d7ec..c0c46f4e 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -92,16 +92,23 @@ protected bool Update(IEnumerable loadCombinations) rCaseCombination.CaseFactors.Clear(); // Add new case factors from the BHoM LoadCombination - for (int i = 0; i < lComb.LoadCases.Count; i++) + if (lComb.LoadCases != null && lComb.LoadCases.Count > 0) { - //Check tuple as well as case not null - if (CheckNotNull(lComb.LoadCases[i], oM.Base.Debugging.EventType.Error, typeof(LoadCombination)) && - CheckNotNull(lComb.LoadCases[i].Item2, oM.Base.Debugging.EventType.Error, typeof(LoadCombination))) + for (int i = 0; i < lComb.LoadCases.Count; i++) { - System.Tuple loadcase = lComb.LoadCases[i]; - rCaseCombination.CaseFactors.New(lComb.LoadCases[i].Item2.Number, lComb.LoadCases[i].Item1); + //Check tuple as well as case not null + if (CheckNotNull(lComb.LoadCases[i], oM.Base.Debugging.EventType.Error, typeof(LoadCombination)) && + CheckNotNull(lComb.LoadCases[i].Item2, oM.Base.Debugging.EventType.Error, typeof(LoadCombination))) + { + System.Tuple loadcase = lComb.LoadCases[i]; + rCaseCombination.CaseFactors.New(lComb.LoadCases[i].Item2.Number, lComb.LoadCases[i].Item1); + } } } + else + { + Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " has no load cases. The combination has been cleared of all case factors."); + } // Set the adapter ID to maintain the connection between BHoM and Robot objects this.SetAdapterId(lComb, lComb.Number); From bfb10087b276ae2ea1d485d721a3ecfb6121ed19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 Aug 2025 11:34:39 +0000 Subject: [PATCH 04/20] Fix compilation error: Replace CaseFactors.Clear() with individual Delete() calls Co-authored-by: Chrisshort92 <38885832+Chrisshort92@users.noreply.github.com> --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index c0c46f4e..29e68989 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -88,8 +88,12 @@ protected bool Update(IEnumerable loadCombinations) if (!string.IsNullOrWhiteSpace(lComb.Name)) rCaseCombination.Name = lComb.Name; - // Clear existing case factors - rCaseCombination.CaseFactors.Clear(); + // Clear existing case factors by deleting them individually + // Note: Robot API requires deleting case factors in reverse order to avoid index shifting + for (int i = rCaseCombination.CaseFactors.Count; i >= 1; i--) + { + rCaseCombination.CaseFactors.Delete(i); + } // Add new case factors from the BHoM LoadCombination if (lComb.LoadCases != null && lComb.LoadCases.Count > 0) From ed3ac69e2d74fa52e5fa002995092036477c9e32 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 Aug 2025 12:27:19 +0000 Subject: [PATCH 05/20] Fix update method to use Number property and add fallback to Create for non-existent combinations Co-authored-by: Chrisshort92 <38885832+Chrisshort92@users.noreply.github.com> --- .../CRUD/Update/Loads/LoadCombinations.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index 29e68989..a896bb09 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -53,17 +53,21 @@ protected bool Update(IEnumerable loadCombinations) if (!CheckNotNull(lComb)) continue; - int combinationId; + // Use the Number property directly (consistent with Create method) + int combinationId = lComb.Number; - // Extract the adapter ID (combination number) from the BHoM object - if (!CheckInputObjectAndExtractAdapterIdInt(lComb, out combinationId, oM.Base.Debugging.EventType.Error, null, true)) - continue; - // Check if the combination exists in Robot if (m_RobotApplication.Project.Structure.Cases.Exist(combinationId) == -1) { - Engine.Base.Compute.RecordWarning("Could not find a load combination with the number " + combinationId.ToString() + " in Robot. Load combination could not be updated!"); - success = false; + Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " does not exist in Robot. Creating new combination instead of updating."); + + // Fall back to create if the combination doesn't exist + List singleCombination = new List { lComb }; + if (!ICreate(singleCombination)) + { + Engine.Base.Compute.RecordWarning("Failed to create load combination with number " + combinationId.ToString() + " during update fallback."); + success = false; + } continue; } From 3a19af371a4352e1898a683825c469a98511c98e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 Aug 2025 13:08:01 +0000 Subject: [PATCH 06/20] Fix Create method logic and remove fallback behavior from Update method Co-authored-by: Chrisshort92 <38885832+Chrisshort92@users.noreply.github.com> --- Robot_Adapter/CRUD/Create/Loads/LoadCombination.cs | 2 +- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Robot_Adapter/CRUD/Create/Loads/LoadCombination.cs b/Robot_Adapter/CRUD/Create/Loads/LoadCombination.cs index aeffb48a..4bc12fa0 100644 --- a/Robot_Adapter/CRUD/Create/Loads/LoadCombination.cs +++ b/Robot_Adapter/CRUD/Create/Loads/LoadCombination.cs @@ -41,7 +41,7 @@ private bool CreateCollection(IEnumerable lComabinations) if (!CheckNotNull(lComb)) continue; - if (m_RobotApplication.Project.Structure.Cases.Exist(lComb.Number)!=-1) + if (m_RobotApplication.Project.Structure.Cases.Exist(lComb.Number)==-1) { RobotCaseCombination rCaseCombination = m_RobotApplication.Project.Structure.Cases.CreateCombination(lComb.Number, lComb.Name, IRobotCombinationType.I_CBT_ULS, IRobotCaseNature.I_CN_PERMANENT, IRobotCaseAnalizeType.I_CAT_COMB); for (int i = 0; i < lComb.LoadCases.Count; i++) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index a896bb09..31ced608 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -59,15 +59,8 @@ protected bool Update(IEnumerable loadCombinations) // Check if the combination exists in Robot if (m_RobotApplication.Project.Structure.Cases.Exist(combinationId) == -1) { - Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " does not exist in Robot. Creating new combination instead of updating."); - - // Fall back to create if the combination doesn't exist - List singleCombination = new List { lComb }; - if (!ICreate(singleCombination)) - { - Engine.Base.Compute.RecordWarning("Failed to create load combination with number " + combinationId.ToString() + " during update fallback."); - success = false; - } + Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " does not exist in Robot. Load combination could not be updated!"); + success = false; continue; } From ff4fa7378f15a2f08f5ca59e94202a060c89dcbc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 Aug 2025 13:27:27 +0000 Subject: [PATCH 07/20] Revert Create method logic and simplify Update method lookup Co-authored-by: Chrisshort92 <38885832+Chrisshort92@users.noreply.github.com> --- .../CRUD/Create/Loads/LoadCombination.cs | 2 +- .../CRUD/Update/Loads/LoadCombinations.cs | 24 ++++--------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/Robot_Adapter/CRUD/Create/Loads/LoadCombination.cs b/Robot_Adapter/CRUD/Create/Loads/LoadCombination.cs index 4bc12fa0..aeffb48a 100644 --- a/Robot_Adapter/CRUD/Create/Loads/LoadCombination.cs +++ b/Robot_Adapter/CRUD/Create/Loads/LoadCombination.cs @@ -41,7 +41,7 @@ private bool CreateCollection(IEnumerable lComabinations) if (!CheckNotNull(lComb)) continue; - if (m_RobotApplication.Project.Structure.Cases.Exist(lComb.Number)==-1) + if (m_RobotApplication.Project.Structure.Cases.Exist(lComb.Number)!=-1) { RobotCaseCombination rCaseCombination = m_RobotApplication.Project.Structure.Cases.CreateCombination(lComb.Number, lComb.Name, IRobotCombinationType.I_CBT_ULS, IRobotCaseNature.I_CN_PERMANENT, IRobotCaseAnalizeType.I_CAT_COMB); for (int i = 0; i < lComb.LoadCases.Count; i++) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index 31ced608..f4cd47a7 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -53,30 +53,14 @@ protected bool Update(IEnumerable loadCombinations) if (!CheckNotNull(lComb)) continue; - // Use the Number property directly (consistent with Create method) + // Use the Number property directly and try to get the combination int combinationId = lComb.Number; - // Check if the combination exists in Robot - if (m_RobotApplication.Project.Structure.Cases.Exist(combinationId) == -1) - { - Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " does not exist in Robot. Load combination could not be updated!"); - success = false; - continue; - } - - // Get the existing combination from Robot - IRobotCase robotCase = m_RobotApplication.Project.Structure.Cases.Get(combinationId) as IRobotCase; - if (robotCase == null || robotCase.Type != IRobotCaseType.I_CT_COMBINATION) - { - Engine.Base.Compute.RecordWarning("Case with number " + combinationId.ToString() + " is not a load combination in Robot. Load combination could not be updated!"); - success = false; - continue; - } - - RobotCaseCombination rCaseCombination = robotCase as RobotCaseCombination; + // Get the existing combination from Robot (following pattern from Loadcases Update method) + RobotCaseCombination rCaseCombination = m_RobotApplication.Project.Structure.Cases.Get(combinationId) as RobotCaseCombination; if (rCaseCombination == null) { - Engine.Base.Compute.RecordWarning("Failed to cast case with number " + combinationId.ToString() + " to RobotCaseCombination. Load combination could not be updated!"); + Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " does not exist in Robot. Load combination could not be updated!"); success = false; continue; } From 204ade82fd48525d005f1582cf6937e9062c7657 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:12:03 +0000 Subject: [PATCH 08/20] Initial plan From 1ced695b02efcd426394b62fefa54da69dffffd7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:17:29 +0000 Subject: [PATCH 09/20] Add RobotId and Number validation to LoadCombination update Co-authored-by: staintono <62057195+staintono@users.noreply.github.com> --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index f4cd47a7..f24ef2be 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -56,6 +56,13 @@ protected bool Update(IEnumerable loadCombinations) // Use the Number property directly and try to get the combination int combinationId = lComb.Number; + // Check if the RobotId matches the LoadCombination Number + int robotId = GetAdapterId(lComb); + if (robotId != 0 && robotId != combinationId) + { + Engine.Base.Compute.RecordWarning($"Load combination has mismatched IDs: RobotId = {robotId}, Number = {combinationId}. Using Number property for update."); + } + // Get the existing combination from Robot (following pattern from Loadcases Update method) RobotCaseCombination rCaseCombination = m_RobotApplication.Project.Structure.Cases.Get(combinationId) as RobotCaseCombination; if (rCaseCombination == null) From c9e9b24b9dbd1876a3c1a1781fafe00c5a6b617a Mon Sep 17 00:00:00 2001 From: Oliver Stainton Date: Thu, 13 Nov 2025 11:31:56 +0000 Subject: [PATCH 10/20] Changed to error instead of warning --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index f24ef2be..ff1d87f5 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -60,7 +60,7 @@ protected bool Update(IEnumerable loadCombinations) int robotId = GetAdapterId(lComb); if (robotId != 0 && robotId != combinationId) { - Engine.Base.Compute.RecordWarning($"Load combination has mismatched IDs: RobotId = {robotId}, Number = {combinationId}. Using Number property for update."); + Engine.Base.Compute.RecordError($"Load combination has mismatched IDs: RobotId = {robotId}, Number = {combinationId}. Using Number property for update."); } // Get the existing combination from Robot (following pattern from Loadcases Update method) From f2e3614ef7eeb7e23522c681f7ea510247bf9e03 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:37:19 +0000 Subject: [PATCH 11/20] Initial plan From 05ec678df5eb83b143f672eb2a0aeabf9aaa37de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:32:16 +0000 Subject: [PATCH 12/20] Initial plan From 3bde84e47bd1961cad6f90335e85e56d934074b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:36:18 +0000 Subject: [PATCH 13/20] Assign RobotId from LoadCombinationNumber when RobotId is 0 Co-authored-by: staintono <62057195+staintono@users.noreply.github.com> --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index ff1d87f5..bed3bbb2 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -58,7 +58,14 @@ protected bool Update(IEnumerable loadCombinations) // Check if the RobotId matches the LoadCombination Number int robotId = GetAdapterId(lComb); - if (robotId != 0 && robotId != combinationId) + + // If the LoadCombination doesn't have a RobotId, assign it from the Number + if (robotId == 0) + { + this.SetAdapterId(lComb, combinationId); + robotId = combinationId; + } + else if (robotId != combinationId) { Engine.Base.Compute.RecordError($"Load combination has mismatched IDs: RobotId = {robotId}, Number = {combinationId}. Using Number property for update."); } From 72779ff885dcf5d830280d3215008e6dad398977 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:53:04 +0000 Subject: [PATCH 14/20] Add informative message when RobotId is assigned from LoadCombination number Co-authored-by: staintono <62057195+staintono@users.noreply.github.com> --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index bed3bbb2..37638304 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -64,6 +64,7 @@ protected bool Update(IEnumerable loadCombinations) { this.SetAdapterId(lComb, combinationId); robotId = combinationId; + Engine.Base.Compute.RecordNote($"LoadCombination with number {combinationId} did not have a RobotId. RobotId has been set to the LoadCombination number."); } else if (robotId != combinationId) { From ef8c8728c6d51de0206f7bf6e4a40cfea29bf1e6 Mon Sep 17 00:00:00 2001 From: Christopher Short Date: Fri, 12 Dec 2025 13:35:55 +0000 Subject: [PATCH 15/20] Update Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs Co-authored-by: Peter Nugent --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index 37638304..23c7b858 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -57,7 +57,7 @@ protected bool Update(IEnumerable loadCombinations) int combinationId = lComb.Number; // Check if the RobotId matches the LoadCombination Number - int robotId = GetAdapterId(lComb); + int robotId = Query.HasAdapterIdFragment(lComb, typeof(RobotId)) ? GetAdapterId(lComb) : 0; // If the LoadCombination doesn't have a RobotId, assign it from the Number if (robotId == 0) From 72d31d432a544a3a921151d853f4c8b3d53ba491 Mon Sep 17 00:00:00 2001 From: Christopher Short Date: Fri, 12 Dec 2025 13:36:11 +0000 Subject: [PATCH 16/20] Update Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs Co-authored-by: Peter Nugent --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index 23c7b858..2c5fb5b8 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -64,7 +64,7 @@ protected bool Update(IEnumerable loadCombinations) { this.SetAdapterId(lComb, combinationId); robotId = combinationId; - Engine.Base.Compute.RecordNote($"LoadCombination with number {combinationId} did not have a RobotId. RobotId has been set to the LoadCombination number."); + Engine.Base.Compute.RecordWarning($"LoadCombination with number {combinationId} did not have a RobotId. RobotId has been set to the LoadCombination number."); } else if (robotId != combinationId) { From 33592c85549a449f925d5135e602e371aa7a614b Mon Sep 17 00:00:00 2001 From: Christopher Short Date: Fri, 12 Dec 2025 13:36:30 +0000 Subject: [PATCH 17/20] Update Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs Co-authored-by: Peter Nugent --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index 2c5fb5b8..cddf9d20 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -75,9 +75,8 @@ protected bool Update(IEnumerable loadCombinations) RobotCaseCombination rCaseCombination = m_RobotApplication.Project.Structure.Cases.Get(combinationId) as RobotCaseCombination; if (rCaseCombination == null) { - Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " does not exist in Robot. Load combination could not be updated!"); - success = false; - continue; + Engine.Base.Compute.RecordError("Load combination with number " + combinationId.ToString() + " does not exist in Robot. Load combination could not be updated!"); + return false; } // Update the combination name if provided From e7f4bcc22def900dd1f90551761de8fddc0ccadd Mon Sep 17 00:00:00 2001 From: Christopher Short Date: Fri, 12 Dec 2025 13:37:04 +0000 Subject: [PATCH 18/20] Update Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs Co-authored-by: Peter Nugent --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index cddf9d20..e074e20b 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -106,7 +106,7 @@ protected bool Update(IEnumerable loadCombinations) } else { - Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " has no load cases. The combination has been cleared of all case factors."); + Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " has no load cases."); } // Set the adapter ID to maintain the connection between BHoM and Robot objects From b13b29c0205b96bdb9b3dfcbf4b7233f148516ac Mon Sep 17 00:00:00 2001 From: Christopher Short Date: Fri, 12 Dec 2025 13:37:15 +0000 Subject: [PATCH 19/20] Update Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs Co-authored-by: Peter Nugent --- Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index e074e20b..507e70d8 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -68,7 +68,7 @@ protected bool Update(IEnumerable loadCombinations) } else if (robotId != combinationId) { - Engine.Base.Compute.RecordError($"Load combination has mismatched IDs: RobotId = {robotId}, Number = {combinationId}. Using Number property for update."); + Engine.Base.Compute.RecordWarning($"Load combination has mismatched IDs: RobotId = {robotId}, Number = {combinationId}. Using Number property for update."); } // Get the existing combination from Robot (following pattern from Loadcases Update method) From 407027026567f6ae38b682f2c13885492c4131f5 Mon Sep 17 00:00:00 2001 From: Christopher Short Date: Fri, 12 Dec 2025 15:21:13 +0000 Subject: [PATCH 20/20] Update to compliance checks --- .../CRUD/Update/Loads/LoadCombinations.cs | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs index 507e70d8..de05b250 100644 --- a/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs +++ b/Robot_Adapter/CRUD/Update/Loads/LoadCombinations.cs @@ -22,15 +22,13 @@ using System; using System.Collections.Generic; -using BH.oM.Base; -using BH.oM.Structure.Elements; -using BH.oM.Structure.SectionProperties; -using BH.oM.Structure.SurfaceProperties; -using BH.oM.Structure.Constraints; using BH.oM.Structure.Loads; -using BH.oM.Physical.Materials; -using BH.oM.Adapter; using BH.Engine.Base; +using BH.oM.Base; +using BH.oM.Structure; +using BH.oM.Adapters.Robot; +using BH.Engine.Adapter; +using BH.oM.Base.Debugging; using RobotOM; namespace BH.Adapter.Robot @@ -50,32 +48,35 @@ protected bool Update(IEnumerable loadCombinations) foreach (LoadCombination lComb in loadCombinations) { //Check combination itself is not null - if (!CheckNotNull(lComb)) - continue; + if(!CheckNotNull(lComb)) +{ + Compute.RecordError("LoadCombination is null."); + return false; + } // Use the Number property directly and try to get the combination int combinationId = lComb.Number; // Check if the RobotId matches the LoadCombination Number - int robotId = Query.HasAdapterIdFragment(lComb, typeof(RobotId)) ? GetAdapterId(lComb) : 0; + int robotId = Engine.Adapter.Query.HasAdapterIdFragment(lComb, typeof(RobotId)) ? GetAdapterId(lComb) : 0; // If the LoadCombination doesn't have a RobotId, assign it from the Number if (robotId == 0) { this.SetAdapterId(lComb, combinationId); robotId = combinationId; - Engine.Base.Compute.RecordWarning($"LoadCombination with number {combinationId} did not have a RobotId. RobotId has been set to the LoadCombination number."); + Compute.RecordWarning($"LoadCombination with number {combinationId} did not have a RobotId. RobotId has been set to the LoadCombination number."); } else if (robotId != combinationId) { - Engine.Base.Compute.RecordWarning($"Load combination has mismatched IDs: RobotId = {robotId}, Number = {combinationId}. Using Number property for update."); + Compute.RecordWarning($"Load combination has mismatched IDs: RobotId = {robotId}, Number = {combinationId}. Using Number property for update."); } // Get the existing combination from Robot (following pattern from Loadcases Update method) RobotCaseCombination rCaseCombination = m_RobotApplication.Project.Structure.Cases.Get(combinationId) as RobotCaseCombination; if (rCaseCombination == null) { - Engine.Base.Compute.RecordError("Load combination with number " + combinationId.ToString() + " does not exist in Robot. Load combination could not be updated!"); + Compute.RecordError("Load combination with number " + combinationId.ToString() + " does not exist in Robot. Load combination could not be updated!"); return false; } @@ -93,11 +94,15 @@ protected bool Update(IEnumerable loadCombinations) // Add new case factors from the BHoM LoadCombination if (lComb.LoadCases != null && lComb.LoadCases.Count > 0) { + for (int i = rCaseCombination.CaseFactors.Count; i >= 1; i--) + { + rCaseCombination.CaseFactors.Delete(i); + } for (int i = 0; i < lComb.LoadCases.Count; i++) { //Check tuple as well as case not null - if (CheckNotNull(lComb.LoadCases[i], oM.Base.Debugging.EventType.Error, typeof(LoadCombination)) && - CheckNotNull(lComb.LoadCases[i].Item2, oM.Base.Debugging.EventType.Error, typeof(LoadCombination))) + if (CheckNotNull(lComb.LoadCases[i], EventType.Error, typeof(LoadCombination)) && + CheckNotNull(lComb.LoadCases[i].Item2, EventType.Error, typeof(LoadCombination))) { System.Tuple loadcase = lComb.LoadCases[i]; rCaseCombination.CaseFactors.New(lComb.LoadCases[i].Item2.Number, lComb.LoadCases[i].Item1); @@ -106,11 +111,9 @@ protected bool Update(IEnumerable loadCombinations) } else { - Engine.Base.Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " has no load cases."); + Compute.RecordWarning("Load combination with number " + combinationId.ToString() + " has no load cases."); } - // Set the adapter ID to maintain the connection between BHoM and Robot objects - this.SetAdapterId(lComb, lComb.Number); } m_RobotApplication.Project.Structure.Cases.EndMultiOperation();