From 497757c1763db5377f7422f94e57afd87834b509 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:08:03 +0000 Subject: [PATCH 01/23] Create ETABSGroup.cs class in ETABS_oM --- ETABS_oM/ETABS_oM.csproj | 1 + ETABS_oM/Elements/ETABSGroup.cs | 49 +++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 ETABS_oM/Elements/ETABSGroup.cs diff --git a/ETABS_oM/ETABS_oM.csproj b/ETABS_oM/ETABS_oM.csproj index 665755e4..601601bc 100644 --- a/ETABS_oM/ETABS_oM.csproj +++ b/ETABS_oM/ETABS_oM.csproj @@ -67,6 +67,7 @@ + diff --git a/ETABS_oM/Elements/ETABSGroup.cs b/ETABS_oM/Elements/ETABSGroup.cs new file mode 100644 index 00000000..4596fcce --- /dev/null +++ b/ETABS_oM/Elements/ETABSGroup.cs @@ -0,0 +1,49 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2025, 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 . + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BH.oM.Base; +using BH.oM.Structure.Elements; + +namespace BH.oM.Adapters.ETABS.Elements +{ + public class ETABSGroup : BHoMObject, IFragment + { + /***************************************************/ + /**** Public Properties ****/ + /***************************************************/ + + public virtual List elements { get; set; } + + /***************************************************/ + } +} + + + + + + From 4dd775ace38e06e0d5d3a5276c962242a55b10ff Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:40:46 +0000 Subject: [PATCH 02/23] Delete ETABSGroup.cs Unnecessary since groupname information is going to be stored in tags. --- ETABS_oM/ETABS_oM.csproj | 1 - ETABS_oM/Elements/ETABSGroup.cs | 49 --------------------------------- 2 files changed, 50 deletions(-) delete mode 100644 ETABS_oM/Elements/ETABSGroup.cs diff --git a/ETABS_oM/ETABS_oM.csproj b/ETABS_oM/ETABS_oM.csproj index 601601bc..665755e4 100644 --- a/ETABS_oM/ETABS_oM.csproj +++ b/ETABS_oM/ETABS_oM.csproj @@ -67,7 +67,6 @@ - diff --git a/ETABS_oM/Elements/ETABSGroup.cs b/ETABS_oM/Elements/ETABSGroup.cs deleted file mode 100644 index 4596fcce..00000000 --- a/ETABS_oM/Elements/ETABSGroup.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2025, 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 . - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using BH.oM.Base; -using BH.oM.Structure.Elements; - -namespace BH.oM.Adapters.ETABS.Elements -{ - public class ETABSGroup : BHoMObject, IFragment - { - /***************************************************/ - /**** Public Properties ****/ - /***************************************************/ - - public virtual List elements { get; set; } - - /***************************************************/ - } -} - - - - - - From 915b00ffd9baf5f2257e04f3fb3634cdfee4a418 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:46:35 +0000 Subject: [PATCH 03/23] Add SetGroup Method to Create/Bar.cs Add feature allowing to assign pushed bars to corresponding groups. --- Etabs_Adapter/CRUD/Create/Bar.cs | 44 +++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/Etabs_Adapter/CRUD/Create/Bar.cs b/Etabs_Adapter/CRUD/Create/Bar.cs index b85ce405..1411f3a8 100644 --- a/Etabs_Adapter/CRUD/Create/Bar.cs +++ b/Etabs_Adapter/CRUD/Create/Bar.cs @@ -108,7 +108,7 @@ private bool CreateObject(Bar bhBar) bhBar.SetAdapterId(etabsIdFragment); - return SetObject(bhBar); + return SetObject(bhBar) && SetGroup(bhBar); } /***************************************************/ @@ -215,6 +215,48 @@ private bool SetObject(Bar bhBar) /***************************************************/ + private bool SetGroup(Bar bhBar) + { + int ret = 0; + /* Get the ETABS name of the Bar */ + string name = GetAdapterId(bhBar); + + try { + /* Get the list of unique groupNames assigned to the BHoM Bar */ + List groupNames = bhBar.Tags.Distinct().ToList(); + /* Get the list of existing group names in the ETABS model */ + int modelNumGroups = 0; + string[] modelGroupNames = null; + m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); + + /* Create any groups that do not already exist in the ETABS model */ + foreach (string groupName in groupNames) + { + if (!modelGroupNames.Contains(groupName)) + { + ret = m_model.GroupDef.SetGroup_1(groupName); + if (ret != 0) + { + Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Bar. Group not created."); + return false; + } + } + } + + /* Assign the Bar to each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.FrameObj.SetGroupAssign(name, groupName)); + } + catch (Exception e) + { + Engine.Base.Compute.RecordError("Could not assign input groups to the bar. Bar not created."); + return false; + } + + return true; + } + + /***************************************************/ + #if Debug16 || Release16 [Description("Returns a bar where the endpoints have been flipped without cloning the object")] From c63a3ab9792f7fbe9a6dfb4adb6d497e7ad35418 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:47:41 +0000 Subject: [PATCH 04/23] Add Support for Group Feature for Push/Pull of Nodes --- Etabs_Adapter/CRUD/Create/Node.cs | 55 ++++++++++++++++++++++++++++--- Etabs_Adapter/CRUD/Read/Node.cs | 13 +++++++- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Node.cs b/Etabs_Adapter/CRUD/Create/Node.cs index 3bd54f38..6fdb953d 100644 --- a/Etabs_Adapter/CRUD/Create/Node.cs +++ b/Etabs_Adapter/CRUD/Create/Node.cs @@ -20,15 +20,16 @@ * along with this code. If not, see . */ -using System.Collections.Generic; -using System.Linq; using BH.Engine.Adapter; -using BH.oM.Adapters.ETABS; -using BH.oM.Structure.Elements; -using BH.Engine.Structure; using BH.Engine.Adapters.ETABS; using BH.Engine.Geometry; +using BH.Engine.Structure; +using BH.oM.Adapters.ETABS; using BH.oM.Geometry; +using BH.oM.Structure.Elements; +using System; +using System.Collections.Generic; +using System.Linq; namespace BH.Adapter.ETABS { @@ -69,6 +70,7 @@ private bool CreateObject(Node bhNode) bhNode.SetAdapterId(etabsid); SetObject(bhNode, name); + SetGroup(bhNode); } return true; @@ -106,6 +108,49 @@ private bool SetObject(Node bhNode, string name) } /***************************************************/ + + private bool SetGroup(Node bhNode) + { + int ret = 0; + /* Get the ETABS name of the Node */ + string name = GetAdapterId(bhNode); + + try + { + /* Get the list of unique groupNames assigned to the BHoM Node */ + List groupNames = bhNode.Tags.Distinct().ToList(); + /* Get the list of existing group names in the ETABS model */ + int modelNumGroups = 0; + string[] modelGroupNames = null; + m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); + + /* Create any groups that do not already exist in the ETABS model */ + foreach (string groupName in groupNames) + { + if (!modelGroupNames.Contains(groupName)) + { + ret = m_model.GroupDef.SetGroup_1(groupName); + if (ret != 0) + { + Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Node. Group not created."); + return false; + } + } + } + + /* Assign the Node to each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.PointObj.SetGroupAssign(name, groupName)); + } + catch (Exception e) + { + Engine.Base.Compute.RecordError("Could not assign input groups to the node. Groups not assigned."); + return false; + } + + return true; + } + + /***************************************************/ } } diff --git a/Etabs_Adapter/CRUD/Read/Node.cs b/Etabs_Adapter/CRUD/Read/Node.cs index 7e31c9c4..5ff5ae85 100644 --- a/Etabs_Adapter/CRUD/Read/Node.cs +++ b/Etabs_Adapter/CRUD/Read/Node.cs @@ -84,7 +84,18 @@ private List ReadNode(List ids = null) etabsIdFragment.Story = story; } - if(m_model.PointObj.GetGUID(id, ref guid) == 0) + + // Get the groups the bar is assigned to + int numGroups = 0; + string[] groupNames = new string[0]; + if (m_model.PointObj.GetGroupAssign(id, ref numGroups, ref groupNames) == 0) + { + foreach (string grpName in groupNames) + bhNode.Tags.Add(grpName); + } + + + if (m_model.PointObj.GetGUID(id, ref guid) == 0) etabsIdFragment.PersistentId = guid; bhNode.SetAdapterId(etabsIdFragment); From 49a09c9ef39b2cff29f1ce91f2fce43d335aea45 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:48:00 +0000 Subject: [PATCH 05/23] Add Support for Group Feature for Push of Bars --- Etabs_Adapter/CRUD/Create/Bar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Etabs_Adapter/CRUD/Create/Bar.cs b/Etabs_Adapter/CRUD/Create/Bar.cs index 1411f3a8..0297759b 100644 --- a/Etabs_Adapter/CRUD/Create/Bar.cs +++ b/Etabs_Adapter/CRUD/Create/Bar.cs @@ -248,7 +248,7 @@ private bool SetGroup(Bar bhBar) } catch (Exception e) { - Engine.Base.Compute.RecordError("Could not assign input groups to the bar. Bar not created."); + Engine.Base.Compute.RecordError("Could not assign input groups to the bar. Groups not assigned."); return false; } From bed45c9ec8f42e0b035e21b26234f60ac6a78367 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:48:13 +0000 Subject: [PATCH 06/23] Add Support for Group Feature for Push/Pull of Links --- Etabs_Adapter/CRUD/Create/Link.cs | 56 ++++++++++++++++++++++++++++--- Etabs_Adapter/CRUD/Read/Link.cs | 12 +++++++ 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Link.cs b/Etabs_Adapter/CRUD/Create/Link.cs index 50a790d1..492f67cb 100644 --- a/Etabs_Adapter/CRUD/Create/Link.cs +++ b/Etabs_Adapter/CRUD/Create/Link.cs @@ -20,14 +20,15 @@ * along with this code. If not, see . */ -using System.Collections.Generic; -using System.Linq; using BH.Engine.Adapter; +using BH.Engine.Adapters.ETABS; +using BH.Engine.Structure; using BH.oM.Adapters.ETABS; -using BH.oM.Structure.Elements; using BH.oM.Structure.Constraints; -using BH.Engine.Structure; -using BH.Engine.Adapters.ETABS; +using BH.oM.Structure.Elements; +using System; +using System.Collections.Generic; +using System.Linq; namespace BH.Adapter.ETABS @@ -70,6 +71,8 @@ private bool CreateObject(RigidLink bhLink) multiId.Id = linkIds; bhLink.SetAdapterId(multiId); + SetGroup(bhLink); + return success; } @@ -106,6 +109,49 @@ private bool CreateObject(LinkConstraint bhLinkConstraint) } /***************************************************/ + + private bool SetGroup(RigidLink bhLink) + { + int ret = 0; + /* Get the ETABS name of the Link */ + string name = GetAdapterId(bhLink); + + try + { + /* Get the list of unique groupNames assigned to the BHoM Link */ + List groupNames = bhLink.Tags.Distinct().ToList(); + /* Get the list of existing group names in the ETABS model */ + int modelNumGroups = 0; + string[] modelGroupNames = null; + m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); + + /* Create any groups that do not already exist in the ETABS model */ + foreach (string groupName in groupNames) + { + if (!modelGroupNames.Contains(groupName)) + { + ret = m_model.GroupDef.SetGroup_1(groupName); + if (ret != 0) + { + Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Link. Group not created."); + return false; + } + } + } + + /* Assign the Link to each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.LinkObj.SetGroupAssign(name, groupName)); + } + catch (Exception e) + { + Engine.Base.Compute.RecordError("Could not assign input groups to the link. Groups not assigned."); + return false; + } + + return true; + } + + /***************************************************/ } } diff --git a/Etabs_Adapter/CRUD/Read/Link.cs b/Etabs_Adapter/CRUD/Read/Link.cs index 7b69c087..fc8548fa 100644 --- a/Etabs_Adapter/CRUD/Read/Link.cs +++ b/Etabs_Adapter/CRUD/Read/Link.cs @@ -125,6 +125,18 @@ private List ReadRigidLink(List ids = null) bhLink.Constraint = new LinkConstraint { Name = propName }; //Dummy constraint to be populated in later loop + /* Get the ETABS name of the Rigid Link */ + string name = GetAdapterId(bhLink); + + // Get the groups the link is assigned to + int numGroups = 0; + string[] groupNames = new string[0]; + if (m_model.LinkObj.GetGroupAssign(name, ref numGroups, ref groupNames) == 0) + { + foreach (string grpName in groupNames) + bhLink.Tags.Add(grpName); + } + linkList.Add(bhLink); } From e7a1d78ba60c161718739c1bd2bdb5565c9e0501 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:48:24 +0000 Subject: [PATCH 07/23] Add Support for Group Feature for Push/Pull of Panels --- Etabs_Adapter/CRUD/Create/Panel.cs | 56 ++++++++++++++++++++++++++---- Etabs_Adapter/CRUD/Read/Panel.cs | 9 +++++ 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Panel.cs b/Etabs_Adapter/CRUD/Create/Panel.cs index 3868fefb..64a437f2 100644 --- a/Etabs_Adapter/CRUD/Create/Panel.cs +++ b/Etabs_Adapter/CRUD/Create/Panel.cs @@ -20,17 +20,18 @@ * along with this code. If not, see . */ -using System.Collections.Generic; -using System.Linq; using BH.Engine.Adapter; -using BH.oM.Adapters.ETABS; -using BH.oM.Structure.Elements; -using BH.Engine.Structure; +using BH.Engine.Adapters.ETABS; using BH.Engine.Geometry; using BH.Engine.Spatial; -using BH.Engine.Adapters.ETABS; +using BH.Engine.Structure; +using BH.oM.Adapters.ETABS; using BH.oM.Adapters.ETABS.Elements; using BH.oM.Geometry; +using BH.oM.Structure.Elements; +using System; +using System.Collections.Generic; +using System.Linq; namespace BH.Adapter.ETABS @@ -200,6 +201,49 @@ private static void NonLinearEdgesCheck(List edges) /***************************************************/ + private bool SetGroup(Panel bhPanel) + { + int ret = 0; + /* Get the ETABS name of the Panel */ + string name = GetAdapterId(bhPanel); + + try + { + /* Get the list of unique groupNames assigned to the BHoM Panel */ + List groupNames = bhPanel.Tags.Distinct().ToList(); + /* Get the list of existing group names in the ETABS model */ + int modelNumGroups = 0; + string[] modelGroupNames = null; + m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); + + /* Create any groups that do not already exist in the ETABS model */ + foreach (string groupName in groupNames) + { + if (!modelGroupNames.Contains(groupName)) + { + ret = m_model.GroupDef.SetGroup_1(groupName); + if (ret != 0) + { + Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Panel. Group not created."); + return false; + } + } + } + + /* Assign the Panel to each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(name, groupName)); + } + catch (Exception e) + { + Engine.Base.Compute.RecordError("Could not assign input groups to the panel. Groups not assigned."); + return false; + } + + return true; + } + + /***************************************************/ + } } diff --git a/Etabs_Adapter/CRUD/Read/Panel.cs b/Etabs_Adapter/CRUD/Read/Panel.cs index ba0dc67f..404a2596 100644 --- a/Etabs_Adapter/CRUD/Read/Panel.cs +++ b/Etabs_Adapter/CRUD/Read/Panel.cs @@ -115,6 +115,15 @@ private List ReadPanel(List ids = null) etabsId.Story = story; } + // Get the groups the panel is assigned to + int numGroups = 0; + string[] groupNames = new string[0]; + if (m_model.AreaObj.GetGroupAssign(id, ref numGroups, ref groupNames) == 0) + { + foreach (string grpName in groupNames) + panel.Tags.Add(grpName); + } + if (m_model.AreaObj.GetGUID(id, ref guid) == 0) etabsId.PersistentId = guid; From c12c00fc2d2554eaa6bfd4afc040561c2d68c8d0 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:48:36 +0000 Subject: [PATCH 08/23] Add Support for Group Feature for Push/Pull of Openings --- Etabs_Adapter/CRUD/Create/Opening.cs | 58 ++++++++++++++++++++++++---- Etabs_Adapter/CRUD/Read/Opening.cs | 28 +++++++++----- 2 files changed, 70 insertions(+), 16 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Opening.cs b/Etabs_Adapter/CRUD/Create/Opening.cs index 245aa63e..a9ad3a30 100644 --- a/Etabs_Adapter/CRUD/Create/Opening.cs +++ b/Etabs_Adapter/CRUD/Create/Opening.cs @@ -20,18 +20,19 @@ * along with this code. If not, see . */ -using System.Collections.Generic; -using System.Linq; using BH.Engine.Adapter; -using BH.oM.Adapters.ETABS; -using BH.oM.Structure.Elements; -using BH.Engine.Structure; +using BH.Engine.Adapters.ETABS; using BH.Engine.Geometry; using BH.Engine.Spatial; -using BH.Engine.Adapters.ETABS; +using BH.Engine.Structure; +using BH.oM.Adapters.ETABS; using BH.oM.Adapters.ETABS.Elements; -using BH.oM.Geometry; using BH.oM.Analytical.Elements; +using BH.oM.Geometry; +using BH.oM.Structure.Elements; +using System; +using System.Collections.Generic; +using System.Linq; namespace BH.Adapter.ETABS @@ -110,5 +111,48 @@ private bool CreateObject(Opening bhOpening) /***************************************************/ + private bool SetGroup(Opening bhOpening) + { + int ret = 0; + /* Get the ETABS name of the Opening */ + string name = GetAdapterId(bhOpening); + + try + { + /* Get the list of unique groupNames assigned to the BHoM Opening */ + List groupNames = bhOpening.Tags.Distinct().ToList(); + /* Get the list of existing group names in the ETABS model */ + int modelNumGroups = 0; + string[] modelGroupNames = null; + m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); + + /* Create any groups that do not already exist in the ETABS model */ + foreach (string groupName in groupNames) + { + if (!modelGroupNames.Contains(groupName)) + { + ret = m_model.GroupDef.SetGroup_1(groupName); + if (ret != 0) + { + Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Opening. Group not created."); + return false; + } + } + } + + /* Assign the Opening to each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(name, groupName)); + } + catch (Exception e) + { + Engine.Base.Compute.RecordError("Could not assign input groups to the openings. Groups not assigned."); + return false; + } + + return true; + } + + /***************************************************/ + } } diff --git a/Etabs_Adapter/CRUD/Read/Opening.cs b/Etabs_Adapter/CRUD/Read/Opening.cs index 2cb44820..4fdeedbc 100644 --- a/Etabs_Adapter/CRUD/Read/Opening.cs +++ b/Etabs_Adapter/CRUD/Read/Opening.cs @@ -20,22 +20,23 @@ * along with this code. If not, see . */ -using System; using BH.Engine.Adapter; +using BH.Engine.Adapters.ETABS; +using BH.Engine.Geometry; +using BH.Engine.Spatial; +using BH.Engine.Structure; using BH.oM.Adapters.ETABS; +using BH.oM.Adapters.ETABS.Elements; +using BH.oM.Analytical.Elements; +using BH.oM.Geometry; +using BH.oM.Structure.Elements; +using BH.oM.Structure.SurfaceProperties; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using BH.oM.Structure.Elements; -using BH.oM.Structure.SurfaceProperties; -using BH.Engine.Adapters.ETABS; -using BH.oM.Geometry; -using BH.Engine.Geometry; -using BH.oM.Adapters.ETABS.Elements; -using BH.Engine.Structure; -using BH.Engine.Spatial; namespace BH.Adapter.ETABS @@ -91,6 +92,15 @@ private List ReadOpening(List ids = null) etabsId.Story = story; } + // Get the groups the opening is assigned to + int numGroups = 0; + string[] groupNames = new string[0]; + if (m_model.AreaObj.GetGroupAssign(id, ref numGroups, ref groupNames) == 0) + { + foreach (string grpName in groupNames) + opening.Tags.Add(grpName); + } + if (m_model.AreaObj.GetGUID(id, ref guid) == 0) etabsId.PersistentId = guid; From fc85629159c15a0bc03fc39d2f07ad0e7b535a9c Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 21:27:49 +0000 Subject: [PATCH 09/23] Fix Support of Group feature in Push for Links, Openings and Panels --- Etabs_Adapter/CRUD/Create/Link.cs | 10 ++++++---- Etabs_Adapter/CRUD/Create/Opening.cs | 3 +++ Etabs_Adapter/CRUD/Create/Panel.cs | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Link.cs b/Etabs_Adapter/CRUD/Create/Link.cs index 492f67cb..89026232 100644 --- a/Etabs_Adapter/CRUD/Create/Link.cs +++ b/Etabs_Adapter/CRUD/Create/Link.cs @@ -113,8 +113,8 @@ private bool CreateObject(LinkConstraint bhLinkConstraint) private bool SetGroup(RigidLink bhLink) { int ret = 0; - /* Get the ETABS name of the Link */ - string name = GetAdapterId(bhLink); + /* Get the ETABS names of all the Links */ + List names = ((ETABSId)bhLink.Fragments[0]).Id as List; try { @@ -139,8 +139,10 @@ private bool SetGroup(RigidLink bhLink) } } - /* Assign the Link to each group in the list */ - groupNames.ToList().ForEach(groupName => m_model.LinkObj.SetGroupAssign(name, groupName)); + /* Assign the Links to each group in the list */ + foreach (string name in names) { + groupNames.ToList().ForEach(groupName => m_model.LinkObj.SetGroupAssign(name, groupName)); + } } catch (Exception e) { diff --git a/Etabs_Adapter/CRUD/Create/Opening.cs b/Etabs_Adapter/CRUD/Create/Opening.cs index a9ad3a30..dbd78293 100644 --- a/Etabs_Adapter/CRUD/Create/Opening.cs +++ b/Etabs_Adapter/CRUD/Create/Opening.cs @@ -106,6 +106,9 @@ private bool CreateObject(Opening bhOpening) m_model.AreaObj.SetOpening(openingName, true); + //Set Groups Assignment + SetGroup(bhOpening); + return success; } diff --git a/Etabs_Adapter/CRUD/Create/Panel.cs b/Etabs_Adapter/CRUD/Create/Panel.cs index 64a437f2..ee55231a 100644 --- a/Etabs_Adapter/CRUD/Create/Panel.cs +++ b/Etabs_Adapter/CRUD/Create/Panel.cs @@ -176,6 +176,10 @@ private bool CreateObject(Panel bhPanel) { m_model.AreaObj.SetDiaphragm(name, diaphragm.Name); } + + //Set Groups Assignment + SetGroup(bhPanel); + return success; } From 16139fbc95a91a24197f384b9183a95b7622b8c7 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 21:42:50 +0000 Subject: [PATCH 10/23] Add UpdateGroup Feature for Bars --- Etabs_Adapter/CRUD/Update/Bar.cs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Etabs_Adapter/CRUD/Update/Bar.cs b/Etabs_Adapter/CRUD/Update/Bar.cs index 04df5ec6..56f5f9b3 100644 --- a/Etabs_Adapter/CRUD/Update/Bar.cs +++ b/Etabs_Adapter/CRUD/Update/Bar.cs @@ -77,7 +77,7 @@ private bool UpdateObjects(IEnumerable bhBars) } #endif - if (SetObject(bhBar)) + if (SetObject(bhBar) && UpdateGroup(bhBar)) ret++; } @@ -97,6 +97,31 @@ private bool UpdateObjects(IEnumerable bhBars) /***************************************************/ + private bool UpdateGroup(Bar bhBar) + { + return ResetGroup(bhBar) && SetGroup(bhBar); + } + + /***************************************************/ + + private bool ResetGroup(Bar bhBar) + { + /* Get the ETABS name of the Bar */ + string name = GetAdapterId(bhBar); + + /* Get the names of all groups currently assigned to the bar */ + int numGroups = 0; + string[] groupNames = null; + m_model.FrameObj.GetGroupAssign(name, ref numGroups, ref groupNames); + + /* Remove the Bar from each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.FrameObj.SetGroupAssign(name, groupName, true)); + + return true; + } + + /***************************************************/ + } } From 4c1647764eba4977b3d9e5bdf47687d8ac019f96 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 21:43:10 +0000 Subject: [PATCH 11/23] Add UpdateGroup feature for Nodes --- Etabs_Adapter/CRUD/Update/Node.cs | 48 +++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/Etabs_Adapter/CRUD/Update/Node.cs b/Etabs_Adapter/CRUD/Update/Node.cs index 5ade95c4..2d9c4ae0 100644 --- a/Etabs_Adapter/CRUD/Update/Node.cs +++ b/Etabs_Adapter/CRUD/Update/Node.cs @@ -20,14 +20,15 @@ * along with this code. If not, see . */ -using System.Collections.Generic; -using System.Linq; using BH.Engine.Adapter; -using BH.oM.Adapters.ETABS; -using BH.oM.Structure.Elements; -using BH.oM.Structure.Constraints; using BH.Engine.Adapters.ETABS; +using BH.oM.Adapters.ETABS; using BH.oM.Physical.Elements; +using BH.oM.Structure.Constraints; +using BH.oM.Structure.Elements; +using System; +using System.Collections.Generic; +using System.Linq; namespace BH.Adapter.ETABS { @@ -48,6 +49,12 @@ private bool UpdateObjects(IEnumerable nodes) bool success = true; // θ(1) m_model.SelectObj.ClearSelection(); // θ(1) + // 1. UPDATE GROUP ASSIGNMENT + nodes.ToList().ForEach(node => UpdateGroup(node)); // n*θ(1) + θ(1) + + + // 2. UDPATE LOCATION + double factor = DatabaseLengthUnitFactor(); // θ(1) Engine.Structure.NodeDistanceComparer comparer = AdapterComparers[typeof(Node)] // θ(1) @@ -58,7 +65,7 @@ private bool UpdateObjects(IEnumerable nodes) Dictionary> dz = new Dictionary>(); // θ(1) - // 1. GROUP NODES BY RELATIVE MOVEMENT IN X/Y/Z DIRECTION - ** HASH TABLES ** + // 2.1 Group Nodes by Relative Movement in X/Y/Z Direction - ** HASH TABLES ** foreach (Node bhNode in nodes) // n*θ(1) + θ(1) { @@ -94,9 +101,7 @@ private bool UpdateObjects(IEnumerable nodes) } } - - - // 2. MOVE NODES GROUP-BY-GROUP - ** STREAMS ** + // 2.2 Move Nodes Group-By-Group - ** STREAMS ** // dX Movement dx.ToList().ForEach(kvp => // θ(n) @@ -135,6 +140,31 @@ private bool UpdateObjects(IEnumerable nodes) } /***************************************************/ + + private bool UpdateGroup(Node bhNode) + { + return ResetGroup(bhNode) && SetGroup(bhNode); + } + + /***************************************************/ + + private bool ResetGroup(Node bhNode) + { + /* Get the ETABS name of the Node */ + string name = GetAdapterId(bhNode); + + /* Get the names of all groups currently assigned to the node */ + int numGroups = 0; + string[] groupNames = null; + m_model.PointObj.GetGroupAssign(name, ref numGroups, ref groupNames); + + /* Remove the Node from each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.PointObj.SetGroupAssign(name, groupName,true)); + + return true; + } + + /***************************************************/ } } From 781c2d95e486b4e3572cf2e54c66c08e32c52408 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 21:43:26 +0000 Subject: [PATCH 12/23] Add UpdateGroup feature for Panels --- Etabs_Adapter/CRUD/Update/Panel.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Etabs_Adapter/CRUD/Update/Panel.cs b/Etabs_Adapter/CRUD/Update/Panel.cs index 2b7158a2..8cf12c2c 100644 --- a/Etabs_Adapter/CRUD/Update/Panel.cs +++ b/Etabs_Adapter/CRUD/Update/Panel.cs @@ -85,6 +85,10 @@ private bool UpdateObjects(IEnumerable bhPanels) { m_model.AreaObj.SetDiaphragm(name, diaphragm.Name); } + + //Update Groups Assignment + UpdateGroup(bhPanel); + } //Force refresh to make sure panel local orientation are set correctly @@ -95,6 +99,31 @@ private bool UpdateObjects(IEnumerable bhPanels) /***************************************************/ + private bool UpdateGroup(Panel bhPanel) + { + return ResetGroup(bhPanel) && SetGroup(bhPanel); + } + + /***************************************************/ + + private bool ResetGroup(Panel bhPanel) + { + /* Get the ETABS name of the Panel */ + string name = GetAdapterId(bhPanel); + + /* Get the names of all groups currently assigned to the panel */ + int numGroups = 0; + string[] groupNames = null; + m_model.AreaObj.GetGroupAssign(name, ref numGroups, ref groupNames); + + /* Remove the Panel from each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(name, groupName, true)); + + return true; + } + + /***************************************************/ + } } From 6118b7601be563bd072d1123a14af10280271c32 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 22:14:27 +0000 Subject: [PATCH 13/23] Add UpdateGroup Feature for Links --- Etabs_Adapter/CRUD/Update/Link.cs | 145 ++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Etabs_Adapter/CRUD/Update/Link.cs diff --git a/Etabs_Adapter/CRUD/Update/Link.cs b/Etabs_Adapter/CRUD/Update/Link.cs new file mode 100644 index 00000000..112898cb --- /dev/null +++ b/Etabs_Adapter/CRUD/Update/Link.cs @@ -0,0 +1,145 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2025, 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 . + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using BH.Engine.Adapter; +using BH.oM.Adapters.ETABS; +using BH.oM.Structure.Elements; + +namespace BH.Adapter.ETABS +{ +#if Debug16 || Release16 + public partial class ETABS2016Adapter : BHoMAdapter +#elif Debug17 || Release17 + public partial class ETABS17Adapter : BHoMAdapter +#else + public partial class ETABSAdapter : BHoMAdapter +#endif + { + /***************************************************/ + /**** Update Rigid Links ****/ + /***************************************************/ + + private bool UpdateObjects(IEnumerable bhLinks) + { + bool success = true; + + int nameCount = 0; + string[] names = { }; + m_model.LinkObj.GetNameList(ref nameCount, ref names); + + foreach (RigidLink bhLink in bhLinks) + { + // Get underlying ETABS names for this BHoM Link + List etabsNames = GetEtabsNamesForLink(bhLink); + + if (etabsNames == null || !etabsNames.Any()) + { + Engine.Base.Compute.RecordWarning("The Link must have an ETABS adapter id to be updated."); + continue; + } + + // Ensure at least one of the underlying link names exists in the model + if (!etabsNames.Any(n => names.Contains(n))) + { + Engine.Base.Compute.RecordWarning("The Link must be present in ETABS to be updated."); + continue; + } + + // ETABS does not support updating of link connectivity or constraints here - only group assignment + Engine.Base.Compute.RecordWarning("The Etabs API does not allow for updating of the geometry or constraint details of links. To change these, delete and recreate the link."); + + if (!UpdateGroup(bhLink)) + success = false; + } + + return success; + } + + /***************************************************/ + + private List GetEtabsNamesForLink(RigidLink bhLink) + { + if (bhLink == null) + return new List(); + + // Prefer explicit ETABS fragment id if present + var frag = bhLink.Fragments?.FirstOrDefault() as ETABSId; + if (frag != null && frag.Id != null) + { + switch (frag.Id) + { + case List list: + return list; + case string[] arr: + return arr.ToList(); + case IEnumerable ies: + return ies.ToList(); + case IEnumerable ieo: + return ieo.Select(o => o?.ToString()).Where(s => s != null).ToList(); + default: + return new List { frag.Id.ToString() }; + } + } + + // Fallback to AdapterId string (for single link cases) + string singleId = bhLink.AdapterId(typeof(ETABSId)) ?? GetAdapterId(bhLink); + if (!string.IsNullOrEmpty(singleId)) + return new List { singleId }; + + return new List(); + } + + /***************************************************/ + + private bool UpdateGroup(RigidLink bhLink) + { + return ResetGroup(bhLink) && SetGroup(bhLink); + } + + /***************************************************/ + + private bool ResetGroup(RigidLink bhLink) + { + List names = GetEtabsNamesForLink(bhLink); + + foreach (string name in names) + { + /* Get the names of all groups currently assigned to the link */ + int numGroups = 0; + string[] groupNames = null; + m_model.LinkObj.GetGroupAssign(name, ref numGroups, ref groupNames); + + /* Remove the Link from each group in the list */ + if (groupNames != null) + groupNames.ToList().ForEach(groupName => m_model.LinkObj.SetGroupAssign(name, groupName, true)); + } + + return true; + } + + /***************************************************/ + + } +} From ba206b3350b3b8e9fd68203f13cf40bb56036e27 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Wed, 29 Oct 2025 22:14:43 +0000 Subject: [PATCH 14/23] Add UpdateGroup Feature for Openings --- Etabs_Adapter/CRUD/Update/Openings.cs | 105 ++++++++++++++++++++++++++ Etabs_Adapter/Etabs_Adapter.csproj | 2 + 2 files changed, 107 insertions(+) create mode 100644 Etabs_Adapter/CRUD/Update/Openings.cs diff --git a/Etabs_Adapter/CRUD/Update/Openings.cs b/Etabs_Adapter/CRUD/Update/Openings.cs new file mode 100644 index 00000000..cb0272d8 --- /dev/null +++ b/Etabs_Adapter/CRUD/Update/Openings.cs @@ -0,0 +1,105 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2025, 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 . + */ + +using System.Collections.Generic; +using System.Linq; +using BH.Engine.Adapter; +using BH.oM.Adapters.ETABS; +using BH.oM.Structure.Elements; + + +namespace BH.Adapter.ETABS +{ +#if Debug16 || Release16 + public partial class ETABS2016Adapter : BHoMAdapter +#elif Debug17 || Release17 + public partial class ETABS17Adapter : BHoMAdapter +#else + public partial class ETABSAdapter : BHoMAdapter +#endif + { + /***************************************************/ + /**** Update Openings ****/ + /***************************************************/ + + private bool UpdateObjects(IEnumerable bhOpenings) + { + bool success = true; + + int nameCount = 0; + string[] names = { }; + m_model.AreaObj.GetNameList(ref nameCount, ref names); + + foreach (Opening bhOpening in bhOpenings) + { + string id = bhOpening.AdapterId(typeof(ETABSId)); + if (id == null) + { + Engine.Base.Compute.RecordWarning("The Opening must have an ETABS adapter id to be updated."); + continue; + } + + if (!names.Contains(id)) + { + Engine.Base.Compute.RecordWarning("The Opening must be present in ETABS to be updated."); + continue; + } + + // ETABS API does not allow updating of opening geometry. Only group assignment can be updated. + Engine.Base.Compute.RecordWarning("The Etabs API does not allow for updating of the geometry of openings. To change opening geometry delete and recreate the opening."); + + if (UpdateGroup(bhOpening)) + ; // nothing to count specifically + } + + return success; + } + + /***************************************************/ + + private bool UpdateGroup(Opening bhOpening) + { + return ResetGroup(bhOpening) && SetGroup(bhOpening); + } + + /***************************************************/ + + private bool ResetGroup(Opening bhOpening) + { + /* Get the ETABS name of the Opening */ + string name = GetAdapterId(bhOpening); + + /* Get the names of all groups currently assigned to the opening */ + int numGroups = 0; + string[] groupNames = null; + m_model.AreaObj.GetGroupAssign(name, ref numGroups, ref groupNames); + + /* Remove the Opening from each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(name, groupName, true)); + + return true; + } + + /***************************************************/ + + } +} diff --git a/Etabs_Adapter/Etabs_Adapter.csproj b/Etabs_Adapter/Etabs_Adapter.csproj index ce6419c3..aaa551e0 100644 --- a/Etabs_Adapter/Etabs_Adapter.csproj +++ b/Etabs_Adapter/Etabs_Adapter.csproj @@ -376,6 +376,8 @@ + + From 5bbdafed6e0e4d840661a3800cd43a9a74941aa3 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 4 Nov 2025 18:37:31 +0000 Subject: [PATCH 15/23] Prevent UpdateGroup() method form running with ETABS v16 and v17. The Method GetGroupAssign() is not supported in any ETABS API earlier than v18. --- Etabs_Adapter/CRUD/Update/Bar.cs | 9 ++++++++- Etabs_Adapter/CRUD/Update/Link.cs | 9 ++++++--- Etabs_Adapter/CRUD/Update/Node.cs | 6 +++++- Etabs_Adapter/CRUD/Update/Openings.cs | 10 +++++++--- Etabs_Adapter/CRUD/Update/Panel.cs | 8 +++++--- 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Etabs_Adapter/CRUD/Update/Bar.cs b/Etabs_Adapter/CRUD/Update/Bar.cs index 56f5f9b3..a1fc4953 100644 --- a/Etabs_Adapter/CRUD/Update/Bar.cs +++ b/Etabs_Adapter/CRUD/Update/Bar.cs @@ -76,9 +76,14 @@ private bool UpdateObjects(IEnumerable bhBars) "To update the connectivity or position of a Bar, delete the existing Bar you want to update and create a new one."); } #endif - +#if Debug16 || Release16 || Debug17 || Release17 + if SetObject(bhBar) + ret++; +#else if (SetObject(bhBar) && UpdateGroup(bhBar)) ret++; +#endif + } @@ -97,6 +102,7 @@ private bool UpdateObjects(IEnumerable bhBars) /***************************************************/ +#if !(Debug16 || Release16 || Debug17 || Release17) private bool UpdateGroup(Bar bhBar) { return ResetGroup(bhBar) && SetGroup(bhBar); @@ -121,6 +127,7 @@ private bool ResetGroup(Bar bhBar) } /***************************************************/ +#endif } } diff --git a/Etabs_Adapter/CRUD/Update/Link.cs b/Etabs_Adapter/CRUD/Update/Link.cs index 112898cb..15f48df9 100644 --- a/Etabs_Adapter/CRUD/Update/Link.cs +++ b/Etabs_Adapter/CRUD/Update/Link.cs @@ -69,9 +69,9 @@ private bool UpdateObjects(IEnumerable bhLinks) // ETABS does not support updating of link connectivity or constraints here - only group assignment Engine.Base.Compute.RecordWarning("The Etabs API does not allow for updating of the geometry or constraint details of links. To change these, delete and recreate the link."); - - if (!UpdateGroup(bhLink)) - success = false; +#if !(Debug16 || Release16 || Debug17 || Release17) + if (!UpdateGroup(bhLink)) success = false; +#endif } return success; @@ -113,6 +113,8 @@ private List GetEtabsNamesForLink(RigidLink bhLink) /***************************************************/ +#if !(Debug16 || Release16 || Debug17 || Release17) + private bool UpdateGroup(RigidLink bhLink) { return ResetGroup(bhLink) && SetGroup(bhLink); @@ -140,6 +142,7 @@ private bool ResetGroup(RigidLink bhLink) } /***************************************************/ +#endif } } diff --git a/Etabs_Adapter/CRUD/Update/Node.cs b/Etabs_Adapter/CRUD/Update/Node.cs index 2d9c4ae0..da560586 100644 --- a/Etabs_Adapter/CRUD/Update/Node.cs +++ b/Etabs_Adapter/CRUD/Update/Node.cs @@ -28,6 +28,7 @@ using BH.oM.Structure.Elements; using System; using System.Collections.Generic; +using System.IO; using System.Linq; namespace BH.Adapter.ETABS @@ -49,8 +50,10 @@ private bool UpdateObjects(IEnumerable nodes) bool success = true; // θ(1) m_model.SelectObj.ClearSelection(); // θ(1) +#if !(Debug16 || Release16 || Debug17 || Release17) // 1. UPDATE GROUP ASSIGNMENT nodes.ToList().ForEach(node => UpdateGroup(node)); // n*θ(1) + θ(1) +#endif // 2. UDPATE LOCATION @@ -140,7 +143,7 @@ private bool UpdateObjects(IEnumerable nodes) } /***************************************************/ - +#if !(Debug16 || Release16 || Debug17 || Release17) private bool UpdateGroup(Node bhNode) { return ResetGroup(bhNode) && SetGroup(bhNode); @@ -165,6 +168,7 @@ private bool ResetGroup(Node bhNode) } /***************************************************/ +#endif } } diff --git a/Etabs_Adapter/CRUD/Update/Openings.cs b/Etabs_Adapter/CRUD/Update/Openings.cs index cb0272d8..eff9b085 100644 --- a/Etabs_Adapter/CRUD/Update/Openings.cs +++ b/Etabs_Adapter/CRUD/Update/Openings.cs @@ -67,8 +67,11 @@ private bool UpdateObjects(IEnumerable bhOpenings) // ETABS API does not allow updating of opening geometry. Only group assignment can be updated. Engine.Base.Compute.RecordWarning("The Etabs API does not allow for updating of the geometry of openings. To change opening geometry delete and recreate the opening."); - if (UpdateGroup(bhOpening)) - ; // nothing to count specifically + #if !(Debug16 || Release16 || Debug17 || Release17) + if (!UpdateGroup(bhOpening)) success = false; + +#endif + } return success; @@ -76,6 +79,7 @@ private bool UpdateObjects(IEnumerable bhOpenings) /***************************************************/ +#if !(Debug16 || Release16 || Debug17 || Release17) private bool UpdateGroup(Opening bhOpening) { return ResetGroup(bhOpening) && SetGroup(bhOpening); @@ -100,6 +104,6 @@ private bool ResetGroup(Opening bhOpening) } /***************************************************/ - +#endif } } diff --git a/Etabs_Adapter/CRUD/Update/Panel.cs b/Etabs_Adapter/CRUD/Update/Panel.cs index 8cf12c2c..aab78a5c 100644 --- a/Etabs_Adapter/CRUD/Update/Panel.cs +++ b/Etabs_Adapter/CRUD/Update/Panel.cs @@ -85,10 +85,10 @@ private bool UpdateObjects(IEnumerable bhPanels) { m_model.AreaObj.SetDiaphragm(name, diaphragm.Name); } - +#if !(Debug16 || Release16 || Debug17 || Release17) //Update Groups Assignment - UpdateGroup(bhPanel); - + if (!UpdateGroup(bhPanel)) success = false; +#endif } //Force refresh to make sure panel local orientation are set correctly @@ -98,6 +98,7 @@ private bool UpdateObjects(IEnumerable bhPanels) } /***************************************************/ +#if !(Debug16 || Release16 || Debug17 || Release17) private bool UpdateGroup(Panel bhPanel) { @@ -121,6 +122,7 @@ private bool ResetGroup(Panel bhPanel) return true; } +#endif /***************************************************/ From d1a0f25a3e2cb905d17740ae3a2e6227a3263161 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 4 Nov 2025 21:30:39 +0000 Subject: [PATCH 16/23] Fix syntax error in Update/Bar.cs --- Etabs_Adapter/CRUD/Update/Bar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Etabs_Adapter/CRUD/Update/Bar.cs b/Etabs_Adapter/CRUD/Update/Bar.cs index a1fc4953..ee2650be 100644 --- a/Etabs_Adapter/CRUD/Update/Bar.cs +++ b/Etabs_Adapter/CRUD/Update/Bar.cs @@ -77,7 +77,7 @@ private bool UpdateObjects(IEnumerable bhBars) } #endif #if Debug16 || Release16 || Debug17 || Release17 - if SetObject(bhBar) + if (SetObject(bhBar)) ret++; #else if (SetObject(bhBar) && UpdateGroup(bhBar)) From 3246f234c96ac9c836c4f32fb135dc8c0ae881eb Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 4 Nov 2025 21:43:59 +0000 Subject: [PATCH 17/23] Add missing logic preventing UpdateGroup() method from running with ETABS v16 and v17 --- Etabs_Adapter/CRUD/Read/Link.cs | 3 ++- Etabs_Adapter/CRUD/Read/Node.cs | 4 ++-- Etabs_Adapter/CRUD/Read/Opening.cs | 2 ++ Etabs_Adapter/CRUD/Read/Panel.cs | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Etabs_Adapter/CRUD/Read/Link.cs b/Etabs_Adapter/CRUD/Read/Link.cs index fc8548fa..bdade003 100644 --- a/Etabs_Adapter/CRUD/Read/Link.cs +++ b/Etabs_Adapter/CRUD/Read/Link.cs @@ -128,6 +128,7 @@ private List ReadRigidLink(List ids = null) /* Get the ETABS name of the Rigid Link */ string name = GetAdapterId(bhLink); +#if !(Debug16 || Release16 || Debug17 || Release17) // Get the groups the link is assigned to int numGroups = 0; string[] groupNames = new string[0]; @@ -136,7 +137,7 @@ private List ReadRigidLink(List ids = null) foreach (string grpName in groupNames) bhLink.Tags.Add(grpName); } - +#endif linkList.Add(bhLink); } diff --git a/Etabs_Adapter/CRUD/Read/Node.cs b/Etabs_Adapter/CRUD/Read/Node.cs index 5ff5ae85..cdbe0bc7 100644 --- a/Etabs_Adapter/CRUD/Read/Node.cs +++ b/Etabs_Adapter/CRUD/Read/Node.cs @@ -84,7 +84,7 @@ private List ReadNode(List ids = null) etabsIdFragment.Story = story; } - +#if !(Debug16 || Release16 || Debug17 || Release17) // Get the groups the bar is assigned to int numGroups = 0; string[] groupNames = new string[0]; @@ -93,7 +93,7 @@ private List ReadNode(List ids = null) foreach (string grpName in groupNames) bhNode.Tags.Add(grpName); } - +#endif if (m_model.PointObj.GetGUID(id, ref guid) == 0) etabsIdFragment.PersistentId = guid; diff --git a/Etabs_Adapter/CRUD/Read/Opening.cs b/Etabs_Adapter/CRUD/Read/Opening.cs index 4fdeedbc..3e342a01 100644 --- a/Etabs_Adapter/CRUD/Read/Opening.cs +++ b/Etabs_Adapter/CRUD/Read/Opening.cs @@ -92,6 +92,7 @@ private List ReadOpening(List ids = null) etabsId.Story = story; } +#if !(Debug16 || Release16 || Debug17 || Release17) // Get the groups the opening is assigned to int numGroups = 0; string[] groupNames = new string[0]; @@ -100,6 +101,7 @@ private List ReadOpening(List ids = null) foreach (string grpName in groupNames) opening.Tags.Add(grpName); } +#endif if (m_model.AreaObj.GetGUID(id, ref guid) == 0) etabsId.PersistentId = guid; diff --git a/Etabs_Adapter/CRUD/Read/Panel.cs b/Etabs_Adapter/CRUD/Read/Panel.cs index 404a2596..dd8421c8 100644 --- a/Etabs_Adapter/CRUD/Read/Panel.cs +++ b/Etabs_Adapter/CRUD/Read/Panel.cs @@ -115,6 +115,7 @@ private List ReadPanel(List ids = null) etabsId.Story = story; } +#if !(Debug16 || Release16 || Debug17 || Release17) // Get the groups the panel is assigned to int numGroups = 0; string[] groupNames = new string[0]; @@ -123,6 +124,7 @@ private List ReadPanel(List ids = null) foreach (string grpName in groupNames) panel.Tags.Add(grpName); } +#endif if (m_model.AreaObj.GetGUID(id, ref guid) == 0) etabsId.PersistentId = guid; From fb0f89e1a0c6cb299663c7ca4dd70f42540b8924 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Thu, 20 Nov 2025 18:14:42 +0000 Subject: [PATCH 18/23] Fix bug panel.Tags.Add() with non perfectly vertical panels --- Etabs_Adapter/CRUD/Read/Panel.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Etabs_Adapter/CRUD/Read/Panel.cs b/Etabs_Adapter/CRUD/Read/Panel.cs index dd8421c8..4934b161 100644 --- a/Etabs_Adapter/CRUD/Read/Panel.cs +++ b/Etabs_Adapter/CRUD/Read/Panel.cs @@ -116,13 +116,16 @@ private List ReadPanel(List ids = null) } #if !(Debug16 || Release16 || Debug17 || Release17) - // Get the groups the panel is assigned to - int numGroups = 0; - string[] groupNames = new string[0]; - if (m_model.AreaObj.GetGroupAssign(id, ref numGroups, ref groupNames) == 0) - { - foreach (string grpName in groupNames) - panel.Tags.Add(grpName); + + if (panel != null) { + // Get the groups the panel is assigned to + int numGroups = 0; + string[] groupNames = new string[0]; + if (m_model.AreaObj.GetGroupAssign(id, ref numGroups, ref groupNames) == 0) + { + foreach (string grpName in groupNames) + panel.Tags.Add(grpName); + } } #endif From 497fa32830790b5fea50b4627c3642939e52ba63 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Mon, 8 Dec 2025 19:20:14 +0000 Subject: [PATCH 19/23] Replace type-specific SetGroup methods with one for generic BHoMObject type --- Etabs_Adapter/CRUD/Create/Bar.cs | 41 ----------------- Etabs_Adapter/CRUD/Create/Link.cs | 44 ------------------ Etabs_Adapter/CRUD/Create/Node.cs | 42 ----------------- Etabs_Adapter/CRUD/Create/Opening.cs | 43 ------------------ Etabs_Adapter/CRUD/Create/Panel.cs | 43 ------------------ Etabs_Adapter/CRUD/Create/_Create.cs | 68 +++++++++++++++++++++++++--- 6 files changed, 62 insertions(+), 219 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Bar.cs b/Etabs_Adapter/CRUD/Create/Bar.cs index 0297759b..35aa7f41 100644 --- a/Etabs_Adapter/CRUD/Create/Bar.cs +++ b/Etabs_Adapter/CRUD/Create/Bar.cs @@ -215,47 +215,6 @@ private bool SetObject(Bar bhBar) /***************************************************/ - private bool SetGroup(Bar bhBar) - { - int ret = 0; - /* Get the ETABS name of the Bar */ - string name = GetAdapterId(bhBar); - - try { - /* Get the list of unique groupNames assigned to the BHoM Bar */ - List groupNames = bhBar.Tags.Distinct().ToList(); - /* Get the list of existing group names in the ETABS model */ - int modelNumGroups = 0; - string[] modelGroupNames = null; - m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); - - /* Create any groups that do not already exist in the ETABS model */ - foreach (string groupName in groupNames) - { - if (!modelGroupNames.Contains(groupName)) - { - ret = m_model.GroupDef.SetGroup_1(groupName); - if (ret != 0) - { - Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Bar. Group not created."); - return false; - } - } - } - - /* Assign the Bar to each group in the list */ - groupNames.ToList().ForEach(groupName => m_model.FrameObj.SetGroupAssign(name, groupName)); - } - catch (Exception e) - { - Engine.Base.Compute.RecordError("Could not assign input groups to the bar. Groups not assigned."); - return false; - } - - return true; - } - - /***************************************************/ #if Debug16 || Release16 diff --git a/Etabs_Adapter/CRUD/Create/Link.cs b/Etabs_Adapter/CRUD/Create/Link.cs index 89026232..125ea62d 100644 --- a/Etabs_Adapter/CRUD/Create/Link.cs +++ b/Etabs_Adapter/CRUD/Create/Link.cs @@ -110,50 +110,6 @@ private bool CreateObject(LinkConstraint bhLinkConstraint) /***************************************************/ - private bool SetGroup(RigidLink bhLink) - { - int ret = 0; - /* Get the ETABS names of all the Links */ - List names = ((ETABSId)bhLink.Fragments[0]).Id as List; - - try - { - /* Get the list of unique groupNames assigned to the BHoM Link */ - List groupNames = bhLink.Tags.Distinct().ToList(); - /* Get the list of existing group names in the ETABS model */ - int modelNumGroups = 0; - string[] modelGroupNames = null; - m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); - - /* Create any groups that do not already exist in the ETABS model */ - foreach (string groupName in groupNames) - { - if (!modelGroupNames.Contains(groupName)) - { - ret = m_model.GroupDef.SetGroup_1(groupName); - if (ret != 0) - { - Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Link. Group not created."); - return false; - } - } - } - - /* Assign the Links to each group in the list */ - foreach (string name in names) { - groupNames.ToList().ForEach(groupName => m_model.LinkObj.SetGroupAssign(name, groupName)); - } - } - catch (Exception e) - { - Engine.Base.Compute.RecordError("Could not assign input groups to the link. Groups not assigned."); - return false; - } - - return true; - } - - /***************************************************/ } } diff --git a/Etabs_Adapter/CRUD/Create/Node.cs b/Etabs_Adapter/CRUD/Create/Node.cs index 6fdb953d..0616f0eb 100644 --- a/Etabs_Adapter/CRUD/Create/Node.cs +++ b/Etabs_Adapter/CRUD/Create/Node.cs @@ -109,48 +109,6 @@ private bool SetObject(Node bhNode, string name) /***************************************************/ - private bool SetGroup(Node bhNode) - { - int ret = 0; - /* Get the ETABS name of the Node */ - string name = GetAdapterId(bhNode); - - try - { - /* Get the list of unique groupNames assigned to the BHoM Node */ - List groupNames = bhNode.Tags.Distinct().ToList(); - /* Get the list of existing group names in the ETABS model */ - int modelNumGroups = 0; - string[] modelGroupNames = null; - m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); - - /* Create any groups that do not already exist in the ETABS model */ - foreach (string groupName in groupNames) - { - if (!modelGroupNames.Contains(groupName)) - { - ret = m_model.GroupDef.SetGroup_1(groupName); - if (ret != 0) - { - Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Node. Group not created."); - return false; - } - } - } - - /* Assign the Node to each group in the list */ - groupNames.ToList().ForEach(groupName => m_model.PointObj.SetGroupAssign(name, groupName)); - } - catch (Exception e) - { - Engine.Base.Compute.RecordError("Could not assign input groups to the node. Groups not assigned."); - return false; - } - - return true; - } - - /***************************************************/ } } diff --git a/Etabs_Adapter/CRUD/Create/Opening.cs b/Etabs_Adapter/CRUD/Create/Opening.cs index dbd78293..68a5ca50 100644 --- a/Etabs_Adapter/CRUD/Create/Opening.cs +++ b/Etabs_Adapter/CRUD/Create/Opening.cs @@ -114,48 +114,5 @@ private bool CreateObject(Opening bhOpening) /***************************************************/ - private bool SetGroup(Opening bhOpening) - { - int ret = 0; - /* Get the ETABS name of the Opening */ - string name = GetAdapterId(bhOpening); - - try - { - /* Get the list of unique groupNames assigned to the BHoM Opening */ - List groupNames = bhOpening.Tags.Distinct().ToList(); - /* Get the list of existing group names in the ETABS model */ - int modelNumGroups = 0; - string[] modelGroupNames = null; - m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); - - /* Create any groups that do not already exist in the ETABS model */ - foreach (string groupName in groupNames) - { - if (!modelGroupNames.Contains(groupName)) - { - ret = m_model.GroupDef.SetGroup_1(groupName); - if (ret != 0) - { - Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Opening. Group not created."); - return false; - } - } - } - - /* Assign the Opening to each group in the list */ - groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(name, groupName)); - } - catch (Exception e) - { - Engine.Base.Compute.RecordError("Could not assign input groups to the openings. Groups not assigned."); - return false; - } - - return true; - } - - /***************************************************/ - } } diff --git a/Etabs_Adapter/CRUD/Create/Panel.cs b/Etabs_Adapter/CRUD/Create/Panel.cs index ee55231a..3221f7fe 100644 --- a/Etabs_Adapter/CRUD/Create/Panel.cs +++ b/Etabs_Adapter/CRUD/Create/Panel.cs @@ -205,49 +205,6 @@ private static void NonLinearEdgesCheck(List edges) /***************************************************/ - private bool SetGroup(Panel bhPanel) - { - int ret = 0; - /* Get the ETABS name of the Panel */ - string name = GetAdapterId(bhPanel); - - try - { - /* Get the list of unique groupNames assigned to the BHoM Panel */ - List groupNames = bhPanel.Tags.Distinct().ToList(); - /* Get the list of existing group names in the ETABS model */ - int modelNumGroups = 0; - string[] modelGroupNames = null; - m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); - - /* Create any groups that do not already exist in the ETABS model */ - foreach (string groupName in groupNames) - { - if (!modelGroupNames.Contains(groupName)) - { - ret = m_model.GroupDef.SetGroup_1(groupName); - if (ret != 0) - { - Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Panel. Group not created."); - return false; - } - } - } - - /* Assign the Panel to each group in the list */ - groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(name, groupName)); - } - catch (Exception e) - { - Engine.Base.Compute.RecordError("Could not assign input groups to the panel. Groups not assigned."); - return false; - } - - return true; - } - - /***************************************************/ - } } diff --git a/Etabs_Adapter/CRUD/Create/_Create.cs b/Etabs_Adapter/CRUD/Create/_Create.cs index 33340a73..5c201409 100644 --- a/Etabs_Adapter/CRUD/Create/_Create.cs +++ b/Etabs_Adapter/CRUD/Create/_Create.cs @@ -20,13 +20,23 @@ * along with this code. If not, see . */ -using System.Collections.Generic; -using System.Linq; -using BH.oM.Structure.Elements; using BH.Engine.Adapters.ETABS; -using BH.oM.Adapters.ETABS.Elements; using BH.oM.Adapter; +using BH.oM.Adapters.ETABS; +using BH.oM.Adapters.ETABS.Elements; +using BH.oM.Analytical.Elements; +using BH.oM.Analytical.Results; using BH.oM.Base; +using BH.oM.Structure.Constraints; +using BH.oM.Structure.Elements; +using BH.oM.Structure.Loads; +using BH.oM.Structure.MaterialFragments; +using BH.oM.Structure.SectionProperties; +using BH.oM.Structure.SurfaceProperties; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; namespace BH.Adapter.ETABS { @@ -109,11 +119,57 @@ private bool CreateObject(IBHoMObject obj) /***************************************************/ - } -} + private bool SetGroup(BHoMObject obj) + { + int ret = 0; + Type type = obj.GetType(); + string objName = ""; + + /* 1. CHECK ASSIGNED GROUPS */ + /* Get the list of unique groupNames assigned to the BHoM Bar */ + List groupNames = obj.Tags.Distinct().ToList(); + /* Get the list of existing group names in the ETABS model */ + int modelNumGroups = 0; + string[] modelGroupNames = null; + m_model.GroupDef.GetNameList(ref modelNumGroups, ref modelGroupNames); + /* Create any groups that do not already exist in the ETABS model */ + foreach (string groupName in groupNames) + { + if (!modelGroupNames.Contains(groupName)) + { + ret = m_model.GroupDef.SetGroup_1(groupName); + if (ret != 0) + { + Engine.Base.Compute.RecordError("Could not create the Group <" + groupName + "> assigned to the Object. Group not created."); + return false; + } + } + } + + /* 2. ASSIGN OBJECT TO GROUPS */ + + if (type == typeof(RigidLink)) { + /* Get the ETABS names of all the Links */ + List names = ((ETABSId)obj.Fragments[0]).Id as List; + /* Assign the Links to each group in the list */ + foreach (string name in names) { groupNames.ToList().ForEach(groupName => m_model.LinkObj.SetGroupAssign(name, groupName)); } + } else { + /* Get the ETABS name of the Object */ + objName = GetAdapterId(obj); + /* Assign the Object to each group in the list */ + if (type == typeof(Node)) groupNames.ToList().ForEach(groupName => m_model.FrameObj.SetGroupAssign(objName, groupName)); + if (type == typeof(Bar)) groupNames.ToList().ForEach(groupName => m_model.PointObj.SetGroupAssign(objName, groupName)); + if (type == typeof(Panel) || type == typeof(Opening)) groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(objName, groupName)); + + } + return true; + } + /***************************************************/ + } +} From d7d3988ea341e754c35cba05f8c3a4b233381458 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Mon, 8 Dec 2025 19:42:17 +0000 Subject: [PATCH 20/23] Replace type-specific ResetGroup methods with one for generic BHoMObject type --- Etabs_Adapter/CRUD/Update/Bar.cs | 27 ---------- Etabs_Adapter/CRUD/Update/Link.cs | 31 ----------- Etabs_Adapter/CRUD/Update/Node.cs | 25 --------- Etabs_Adapter/CRUD/Update/Openings.cs | 26 ---------- Etabs_Adapter/CRUD/Update/Panel.cs | 27 ---------- Etabs_Adapter/CRUD/Update/_Update.cs | 75 +++++++++++++++++++++++---- 6 files changed, 66 insertions(+), 145 deletions(-) diff --git a/Etabs_Adapter/CRUD/Update/Bar.cs b/Etabs_Adapter/CRUD/Update/Bar.cs index ee2650be..0e1d9f59 100644 --- a/Etabs_Adapter/CRUD/Update/Bar.cs +++ b/Etabs_Adapter/CRUD/Update/Bar.cs @@ -102,33 +102,6 @@ private bool UpdateObjects(IEnumerable bhBars) /***************************************************/ -#if !(Debug16 || Release16 || Debug17 || Release17) - private bool UpdateGroup(Bar bhBar) - { - return ResetGroup(bhBar) && SetGroup(bhBar); - } - - /***************************************************/ - - private bool ResetGroup(Bar bhBar) - { - /* Get the ETABS name of the Bar */ - string name = GetAdapterId(bhBar); - - /* Get the names of all groups currently assigned to the bar */ - int numGroups = 0; - string[] groupNames = null; - m_model.FrameObj.GetGroupAssign(name, ref numGroups, ref groupNames); - - /* Remove the Bar from each group in the list */ - groupNames.ToList().ForEach(groupName => m_model.FrameObj.SetGroupAssign(name, groupName, true)); - - return true; - } - - /***************************************************/ -#endif - } } diff --git a/Etabs_Adapter/CRUD/Update/Link.cs b/Etabs_Adapter/CRUD/Update/Link.cs index 15f48df9..b4254766 100644 --- a/Etabs_Adapter/CRUD/Update/Link.cs +++ b/Etabs_Adapter/CRUD/Update/Link.cs @@ -113,36 +113,5 @@ private List GetEtabsNamesForLink(RigidLink bhLink) /***************************************************/ -#if !(Debug16 || Release16 || Debug17 || Release17) - - private bool UpdateGroup(RigidLink bhLink) - { - return ResetGroup(bhLink) && SetGroup(bhLink); - } - - /***************************************************/ - - private bool ResetGroup(RigidLink bhLink) - { - List names = GetEtabsNamesForLink(bhLink); - - foreach (string name in names) - { - /* Get the names of all groups currently assigned to the link */ - int numGroups = 0; - string[] groupNames = null; - m_model.LinkObj.GetGroupAssign(name, ref numGroups, ref groupNames); - - /* Remove the Link from each group in the list */ - if (groupNames != null) - groupNames.ToList().ForEach(groupName => m_model.LinkObj.SetGroupAssign(name, groupName, true)); - } - - return true; - } - - /***************************************************/ -#endif - } } diff --git a/Etabs_Adapter/CRUD/Update/Node.cs b/Etabs_Adapter/CRUD/Update/Node.cs index da560586..60a459a1 100644 --- a/Etabs_Adapter/CRUD/Update/Node.cs +++ b/Etabs_Adapter/CRUD/Update/Node.cs @@ -143,32 +143,7 @@ private bool UpdateObjects(IEnumerable nodes) } /***************************************************/ -#if !(Debug16 || Release16 || Debug17 || Release17) - private bool UpdateGroup(Node bhNode) - { - return ResetGroup(bhNode) && SetGroup(bhNode); - } - - /***************************************************/ - - private bool ResetGroup(Node bhNode) - { - /* Get the ETABS name of the Node */ - string name = GetAdapterId(bhNode); - /* Get the names of all groups currently assigned to the node */ - int numGroups = 0; - string[] groupNames = null; - m_model.PointObj.GetGroupAssign(name, ref numGroups, ref groupNames); - - /* Remove the Node from each group in the list */ - groupNames.ToList().ForEach(groupName => m_model.PointObj.SetGroupAssign(name, groupName,true)); - - return true; - } - - /***************************************************/ -#endif } } diff --git a/Etabs_Adapter/CRUD/Update/Openings.cs b/Etabs_Adapter/CRUD/Update/Openings.cs index eff9b085..6f971cb0 100644 --- a/Etabs_Adapter/CRUD/Update/Openings.cs +++ b/Etabs_Adapter/CRUD/Update/Openings.cs @@ -79,31 +79,5 @@ private bool UpdateObjects(IEnumerable bhOpenings) /***************************************************/ -#if !(Debug16 || Release16 || Debug17 || Release17) - private bool UpdateGroup(Opening bhOpening) - { - return ResetGroup(bhOpening) && SetGroup(bhOpening); - } - - /***************************************************/ - - private bool ResetGroup(Opening bhOpening) - { - /* Get the ETABS name of the Opening */ - string name = GetAdapterId(bhOpening); - - /* Get the names of all groups currently assigned to the opening */ - int numGroups = 0; - string[] groupNames = null; - m_model.AreaObj.GetGroupAssign(name, ref numGroups, ref groupNames); - - /* Remove the Opening from each group in the list */ - groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(name, groupName, true)); - - return true; - } - - /***************************************************/ -#endif } } diff --git a/Etabs_Adapter/CRUD/Update/Panel.cs b/Etabs_Adapter/CRUD/Update/Panel.cs index aab78a5c..40830a6f 100644 --- a/Etabs_Adapter/CRUD/Update/Panel.cs +++ b/Etabs_Adapter/CRUD/Update/Panel.cs @@ -97,33 +97,6 @@ private bool UpdateObjects(IEnumerable bhPanels) return success; } - /***************************************************/ -#if !(Debug16 || Release16 || Debug17 || Release17) - - private bool UpdateGroup(Panel bhPanel) - { - return ResetGroup(bhPanel) && SetGroup(bhPanel); - } - - /***************************************************/ - - private bool ResetGroup(Panel bhPanel) - { - /* Get the ETABS name of the Panel */ - string name = GetAdapterId(bhPanel); - - /* Get the names of all groups currently assigned to the panel */ - int numGroups = 0; - string[] groupNames = null; - m_model.AreaObj.GetGroupAssign(name, ref numGroups, ref groupNames); - - /* Remove the Panel from each group in the list */ - groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(name, groupName, true)); - - return true; - } -#endif - /***************************************************/ } diff --git a/Etabs_Adapter/CRUD/Update/_Update.cs b/Etabs_Adapter/CRUD/Update/_Update.cs index b993a14e..b9d4cb47 100644 --- a/Etabs_Adapter/CRUD/Update/_Update.cs +++ b/Etabs_Adapter/CRUD/Update/_Update.cs @@ -20,18 +20,20 @@ * along with this code. If not, see . */ -using System.Collections.Generic; -using System.Linq; using BH.Engine.Adapter; +using BH.Engine.Adapters.ETABS; +using BH.oM.Adapter; using BH.oM.Adapters.ETABS; +using BH.oM.Adapters.ETABS.Elements; +using BH.oM.Analytical.Elements; +using BH.oM.Base; using BH.oM.Structure.Elements; -using BH.oM.Structure.SectionProperties; using BH.oM.Structure.MaterialFragments; -using BH.Engine.Adapters.ETABS; -using BH.oM.Adapters.ETABS.Elements; -using BH.oM.Adapter; +using BH.oM.Structure.SectionProperties; using BH.oM.Structure.SurfaceProperties; -using BH.oM.Base; +using System; +using System.Collections.Generic; +using System.Linq; namespace BH.Adapter.ETABS { @@ -60,11 +62,66 @@ private bool UpdateObjects(IEnumerable objects) } /***************************************************/ - } -} +#if !(Debug16 || Release16 || Debug17 || Release17) + private bool UpdateGroup(BHoMObject obj) + { + return ResetGroup(obj) && SetGroup(obj); + } + + /***************************************************/ + + private bool ResetGroup(BHoMObject obj) + { + + Type type = obj.GetType(); + int numGroups = 0; + string[] groupNames = null; + + if (type == typeof(RigidLink)) { + /* Get the ETABS names of the Rigid Link */ + List names = GetEtabsNamesForLink((RigidLink)obj); + foreach (string name in names) + { + /* Get the names of all groups currently assigned to the link */ + m_model.LinkObj.GetGroupAssign(name, ref numGroups, ref groupNames); + /* Remove the Link from each group in the list */ + if (groupNames != null) + groupNames.ToList().ForEach(groupName => m_model.LinkObj.SetGroupAssign(name, groupName, true)); + } + } else { + /* Get the ETABS name of the Object */ + string name = GetAdapterId(obj); + if (type == typeof(Node)) + { + /* Get the names of all groups currently assigned to the node */ + m_model.PointObj.GetGroupAssign(name, ref numGroups, ref groupNames); + /* Remove the Node from each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.PointObj.SetGroupAssign(name, groupName, true)); + } + if (type == typeof(Bar)) + { + /* Get the names of all groups currently assigned to the object */ + m_model.FrameObj.GetGroupAssign(name, ref numGroups, ref groupNames); + /* Remove the Bar from each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.FrameObj.SetGroupAssign(name, groupName, true)); + } + if (type == typeof(Panel) || type == typeof(Opening)) + { + /* Get the names of all groups currently assigned to the object */ + m_model.AreaObj.GetGroupAssign(name, ref numGroups, ref groupNames); + /* Remove the Panel/Opening from each group in the list */ + groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(name, groupName, true)); + } + } + return true; + } + /***************************************************/ +#endif + } +} From aa299a2011ab89c650d8b11f7304baf1642c8b49 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Mon, 15 Dec 2025 11:47:12 +0000 Subject: [PATCH 21/23] Remove Distinct() from groupNames assignment --- Etabs_Adapter/CRUD/Create/_Create.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Etabs_Adapter/CRUD/Create/_Create.cs b/Etabs_Adapter/CRUD/Create/_Create.cs index 5c201409..019cea7b 100644 --- a/Etabs_Adapter/CRUD/Create/_Create.cs +++ b/Etabs_Adapter/CRUD/Create/_Create.cs @@ -128,7 +128,7 @@ private bool SetGroup(BHoMObject obj) /* 1. CHECK ASSIGNED GROUPS */ /* Get the list of unique groupNames assigned to the BHoM Bar */ - List groupNames = obj.Tags.Distinct().ToList(); + List groupNames = obj.Tags.ToList(); /* Get the list of existing group names in the ETABS model */ int modelNumGroups = 0; string[] modelGroupNames = null; From d5133e71f814717aebc3afb3ab5a2179c8f4cf6d Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 16 Dec 2025 10:52:06 +0000 Subject: [PATCH 22/23] Fix mistake group assigment to nodes/bars. --- Etabs_Adapter/CRUD/Create/_Create.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/_Create.cs b/Etabs_Adapter/CRUD/Create/_Create.cs index 019cea7b..8a69743f 100644 --- a/Etabs_Adapter/CRUD/Create/_Create.cs +++ b/Etabs_Adapter/CRUD/Create/_Create.cs @@ -159,8 +159,8 @@ private bool SetGroup(BHoMObject obj) /* Get the ETABS name of the Object */ objName = GetAdapterId(obj); /* Assign the Object to each group in the list */ - if (type == typeof(Node)) groupNames.ToList().ForEach(groupName => m_model.FrameObj.SetGroupAssign(objName, groupName)); - if (type == typeof(Bar)) groupNames.ToList().ForEach(groupName => m_model.PointObj.SetGroupAssign(objName, groupName)); + if (type == typeof(Node)) groupNames.ToList().ForEach(groupName => m_model.PointObj.SetGroupAssign(objName, groupName)); + if (type == typeof(Bar)) groupNames.ToList().ForEach(groupName => m_model.FrameObj.SetGroupAssign(objName, groupName)); if (type == typeof(Panel) || type == typeof(Opening)) groupNames.ToList().ForEach(groupName => m_model.AreaObj.SetGroupAssign(objName, groupName)); } From 81e1e84b28841546f033ed5ec0bf2676b13e5f07 Mon Sep 17 00:00:00 2001 From: BHoMBot Date: Wed, 7 Jan 2026 09:22:22 +0000 Subject: [PATCH 23/23] Resolve copyright compliance --- Etabs_Adapter/CRUD/Update/Link.cs | 3 ++- Etabs_Adapter/CRUD/Update/Openings.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Etabs_Adapter/CRUD/Update/Link.cs b/Etabs_Adapter/CRUD/Update/Link.cs index b4254766..171a4c94 100644 --- a/Etabs_Adapter/CRUD/Update/Link.cs +++ b/Etabs_Adapter/CRUD/Update/Link.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2025, the respective contributors. All rights reserved. + * Copyright (c) 2015 - 2026, the respective contributors. All rights reserved. * * Each contributor holds copyright over their respective contributions. * The project versioning (Git) records all such contribution source information. @@ -115,3 +115,4 @@ private List GetEtabsNamesForLink(RigidLink bhLink) } } + diff --git a/Etabs_Adapter/CRUD/Update/Openings.cs b/Etabs_Adapter/CRUD/Update/Openings.cs index 6f971cb0..5f749150 100644 --- a/Etabs_Adapter/CRUD/Update/Openings.cs +++ b/Etabs_Adapter/CRUD/Update/Openings.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2025, the respective contributors. All rights reserved. + * Copyright (c) 2015 - 2026, the respective contributors. All rights reserved. * * Each contributor holds copyright over their respective contributions. * The project versioning (Git) records all such contribution source information. @@ -81,3 +81,4 @@ private bool UpdateObjects(IEnumerable bhOpenings) } } +