From 4eb69e3b49919a36e152e61fa4cde270361f9c73 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Mon, 3 Nov 2025 19:25:21 +0000 Subject: [PATCH 01/14] Add Unique Name Assignment in Push/Pull of Bars --- Etabs_Adapter/CRUD/Create/Bar.cs | 35 +++++++++++++++++++++++++++++--- Etabs_Adapter/CRUD/Read/Bar.cs | 3 ++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Bar.cs b/Etabs_Adapter/CRUD/Create/Bar.cs index b85ce405..585c7258 100644 --- a/Etabs_Adapter/CRUD/Create/Bar.cs +++ b/Etabs_Adapter/CRUD/Create/Bar.cs @@ -95,15 +95,18 @@ private bool CreateObject(Bar bhBar) string story = ""; string guid = null; - ETABSId etabsIdFragment = new ETABSId { Id = name }; + // Assign the Unique Name to the ETABS Element + if (SetUniqueName(bhBar, name) == false) return false; - if (m_model.FrameObj.GetLabelFromName(name, ref label, ref story) == 0) + ETABSId etabsIdFragment = new ETABSId { Id = bhBar.Name }; + + if (m_model.FrameObj.GetLabelFromName(bhBar.Name, ref label, ref story) == 0) { etabsIdFragment.Label = label; etabsIdFragment.Story = story; } - if (m_model.AreaObj.GetGUID(name, ref guid) == 0) + if (m_model.FrameObj.GetGUID(bhBar.Name, ref guid) == 0) etabsIdFragment.PersistentId = guid; bhBar.SetAdapterId(etabsIdFragment); @@ -215,6 +218,32 @@ private bool SetObject(Bar bhBar) /***************************************************/ + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Bar Name to get the Unique Name to assign to the ETABS Element.")] + private bool SetUniqueName(Bar bhBar, string name) { + + int ret01, ret02; + string guid = null; + + ret01 = m_model.FrameObj.GetGUID(name, ref guid); + + if (bhBar.Name == "") + { + bhBar.Name = guid.Substring(guid.Length - 7); + } + else + { + bhBar.Name = guid.Substring(guid.Length - 7) + "::" + bhBar.Name; + } + + ret02 = m_model.FrameObj.ChangeName(name, bhBar.Name); + + if (!(ret01 == 0 && ret02 == 0)) return false; + + return true; + } + + /***************************************************/ + #if Debug16 || Release16 [Description("Returns a bar where the endpoints have been flipped without cloning the object")] diff --git a/Etabs_Adapter/CRUD/Read/Bar.cs b/Etabs_Adapter/CRUD/Read/Bar.cs index a677320c..3627e0c7 100644 --- a/Etabs_Adapter/CRUD/Read/Bar.cs +++ b/Etabs_Adapter/CRUD/Read/Bar.cs @@ -66,7 +66,8 @@ private List ReadBar(List ids = null) try { - Bar bhBar = new Bar(); + Bar bhBar = new Bar() { Name = id }; + string startId = ""; string endId = ""; m_model.FrameObj.GetPoints(id, ref startId, ref endId); From 73a8ff24d888201573bcc441e1a21087bbac6b92 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Mon, 3 Nov 2025 19:26:25 +0000 Subject: [PATCH 02/14] Add Unique Name Assignment in Push/Pull of Nodes --- Etabs_Adapter/CRUD/Create/Node.cs | 50 ++++++++++++++++++++++++++----- Etabs_Adapter/CRUD/Read/Node.cs | 2 +- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Node.cs b/Etabs_Adapter/CRUD/Create/Node.cs index 3bd54f38..e0ac651f 100644 --- a/Etabs_Adapter/CRUD/Create/Node.cs +++ b/Etabs_Adapter/CRUD/Create/Node.cs @@ -20,15 +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.Structure; +using BH.oM.Adapters.ETABS; +using BH.oM.Analytical.Elements; using BH.oM.Geometry; +using BH.oM.Structure.Elements; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; namespace BH.Adapter.ETABS { @@ -52,7 +55,11 @@ private bool CreateObject(Node bhNode) oM.Geometry.Point position = bhNode.Position; if (m_model.PointObj.AddCartesian(position.X, position.Y, position.Z, ref name) == 0) { - etabsid.Id = name; + + // Assign the Unique Name to the ETABS Element + if (SetUniqueName(bhNode, name) == false) return false; + + etabsid.Id = bhNode.Name; //Label and story string label = ""; @@ -64,11 +71,11 @@ private bool CreateObject(Node bhNode) } string guid = null; - if (m_model.PointObj.GetGUID(name, ref guid) == 0) + if (m_model.PointObj.GetGUID(bhNode.Name, ref guid) == 0) etabsid.PersistentId = guid; bhNode.SetAdapterId(etabsid); - SetObject(bhNode, name); + SetObject(bhNode, bhNode.Name); } return true; @@ -106,6 +113,33 @@ private bool SetObject(Node bhNode, string name) } /***************************************************/ + + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Node Name to get the Unique Name to assign to the ETABS Element.")] + private bool SetUniqueName(Node bhNode, string name) + { + + int ret01, ret02; + string guid = null; + + ret01 = m_model.PointObj.GetGUID(name, ref guid); + + if (bhNode.Name == "") + { + bhNode.Name = guid.Substring(guid.Length - 7); + } + else + { + bhNode.Name = guid.Substring(guid.Length - 7) + "::" + bhNode.Name; + } + + ret02 = m_model.PointObj.ChangeName(name, bhNode.Name); + + if (!(ret01 == 0 && ret02 == 0)) return false; + + return true; + } + + /***************************************************/ } } diff --git a/Etabs_Adapter/CRUD/Read/Node.cs b/Etabs_Adapter/CRUD/Read/Node.cs index 7e31c9c4..2d35f018 100644 --- a/Etabs_Adapter/CRUD/Read/Node.cs +++ b/Etabs_Adapter/CRUD/Read/Node.cs @@ -72,7 +72,7 @@ private List ReadNode(List ids = null) Constraint6DOF support = GetConstraint6DOF(restraint, spring); - Node bhNode = new Node { Position = new oM.Geometry.Point() { X = x, Y = y, Z = z }, Support = support }; + Node bhNode = new Node { Name = id, Position = new oM.Geometry.Point() { X = x, Y = y, Z = z }, Support = support }; //Label and story string label = ""; From a236136e1490e0242aacbe8e2afb9392ebaf0902 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Mon, 3 Nov 2025 19:26:55 +0000 Subject: [PATCH 03/14] Add Unique Name Assignment in Push/Pull of Panels --- Etabs_Adapter/CRUD/Create/Panel.cs | 59 +++++++++++++++++++++++------- Etabs_Adapter/CRUD/Read/Panel.cs | 2 +- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Panel.cs b/Etabs_Adapter/CRUD/Create/Panel.cs index 3868fefb..9c586efc 100644 --- a/Etabs_Adapter/CRUD/Create/Panel.cs +++ b/Etabs_Adapter/CRUD/Create/Panel.cs @@ -20,17 +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.Structure.Elements; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; namespace BH.Adapter.ETABS @@ -88,21 +90,25 @@ private bool CreateObject(Panel bhPanel) } retA = m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref name, propertyName); + + // Assign the Unique Name to the ETABS Element + if (SetUniqueName(bhPanel, name) == false) return false; + ETABSId etabsid = new ETABSId(); - etabsid.Id = name; + etabsid.Id = bhPanel.Name; //Label and story string label = ""; string story = ""; string guid = null; - if (m_model.AreaObj.GetLabelFromName(name, ref label, ref story) == 0) + if (m_model.AreaObj.GetLabelFromName(bhPanel.Name, ref label, ref story) == 0) { etabsid.Label = label; etabsid.Story = story; } - if (m_model.AreaObj.GetGUID(name, ref guid) == 0) + if (m_model.AreaObj.GetGUID(bhPanel.Name, ref guid) == 0) etabsid.PersistentId = guid; bhPanel.SetAdapterId(etabsid); @@ -145,7 +151,7 @@ private bool CreateObject(Panel bhPanel) z[j] = boundaryPoints[j].Z; } - string openingName = name + "_Opening_" + i; + string openingName = bhPanel.Name + "_Opening_" + i; m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref openingName, "");//<-- setting panel property to empty string, verify that this is correct m_model.AreaObj.SetOpening(openingName, true); @@ -155,7 +161,7 @@ private bool CreateObject(Panel bhPanel) //Set local orientations: Basis orientation = bhPanel.LocalOrientation(); - m_model.AreaObj.SetLocalAxes(name, Convert.ToEtabsPanelOrientation(orientation.Z, orientation.Y)); + m_model.AreaObj.SetLocalAxes(bhPanel.Name, Convert.ToEtabsPanelOrientation(orientation.Z, orientation.Y)); Pier pier = bhPanel.Pier(); Spandrel spandrel = bhPanel.Spandrel(); @@ -164,17 +170,18 @@ private bool CreateObject(Panel bhPanel) if (pier != null) { int ret = m_model.PierLabel.SetPier(pier.Name); - ret = m_model.AreaObj.SetPier(name, pier.Name); + ret = m_model.AreaObj.SetPier(bhPanel.Name, pier.Name); } if (spandrel != null) { int ret = m_model.SpandrelLabel.SetSpandrel(spandrel.Name, false); - ret = m_model.AreaObj.SetSpandrel(name, spandrel.Name); + ret = m_model.AreaObj.SetSpandrel(bhPanel.Name, spandrel.Name); } if (diaphragm != null) { - m_model.AreaObj.SetDiaphragm(name, diaphragm.Name); + m_model.AreaObj.SetDiaphragm(bhPanel.Name, diaphragm.Name); } + return success; } @@ -198,6 +205,30 @@ private static void NonLinearEdgesCheck(List edges) } + + /***************************************************/ + + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Panel Name to get the Unique Name to assign to the ETABS Element.")] + private bool SetUniqueName(Panel bhPanel, string name) + { + int ret01, ret02; + string guid = null; + + ret01 = m_model.AreaObj.GetGUID(name, ref guid); + + if (bhPanel.Name=="") { + bhPanel.Name = guid.Substring(guid.Length - 7); + } else { + bhPanel.Name = guid.Substring(guid.Length - 7) + "::" + bhPanel.Name; + } + + ret02 = m_model.AreaObj.ChangeName(name, bhPanel.Name); + + if (!(ret01 == 0 && ret02 == 0)) return false; + + return true; + } + /***************************************************/ } diff --git a/Etabs_Adapter/CRUD/Read/Panel.cs b/Etabs_Adapter/CRUD/Read/Panel.cs index ba0dc67f..fcd42a36 100644 --- a/Etabs_Adapter/CRUD/Read/Panel.cs +++ b/Etabs_Adapter/CRUD/Read/Panel.cs @@ -86,7 +86,7 @@ private List ReadPanel(List ids = null) panelProperty = bhomProperties[propertyName]; } - Panel panel = new Panel(); + Panel panel = new Panel() { Name = id }; Polyline pl = GetPanelPerimeter(id); panel.ExternalEdges = pl.SubParts().Select(x => new Edge { Curve = x }).ToList(); From c6de4c6a2bffa21b9ff9a4a4a1f36fb0b8e94835 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Mon, 3 Nov 2025 19:27:45 +0000 Subject: [PATCH 04/14] Add Unique Name Assignment in Push/Pull of Openings --- Etabs_Adapter/CRUD/Create/Opening.cs | 54 ++++++++++++++++++++++------ Etabs_Adapter/CRUD/Read/Opening.cs | 2 +- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Opening.cs b/Etabs_Adapter/CRUD/Create/Opening.cs index 245aa63e..1ed4f31e 100644 --- a/Etabs_Adapter/CRUD/Create/Opening.cs +++ b/Etabs_Adapter/CRUD/Create/Opening.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.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.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Xml.Linq; namespace BH.Adapter.ETABS @@ -84,31 +86,61 @@ private bool CreateObject(Opening bhOpening) string openingName = GetAdapterId(bhOpening); retA = m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref openingName, "Default"); + + // Assign the Unique Name to the ETABS Element + if (SetUniqueName(bhOpening, openingName) == false) return false; + ETABSId etabsid = new ETABSId(); - etabsid.Id = openingName; + etabsid.Id = bhOpening.Name; //Label and story string label = ""; string story = ""; string guid = null; - if (m_model.AreaObj.GetLabelFromName(openingName, ref label, ref story) == 0) + if (m_model.AreaObj.GetLabelFromName(bhOpening.Name, ref label, ref story) == 0) { etabsid.Label = label; etabsid.Story = story; } - if (m_model.AreaObj.GetGUID(openingName, ref guid) == 0) + if (m_model.AreaObj.GetGUID(bhOpening.Name, ref guid) == 0) etabsid.PersistentId = guid; bhOpening.SetAdapterId(etabsid); - m_model.AreaObj.SetOpening(openingName, true); + m_model.AreaObj.SetOpening(bhOpening.Name, true); return success; } /***************************************************/ + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Opening Name to get the Unique Name to assign to the ETABS Element.")] + private bool SetUniqueName(Opening bhOpening, string name) + { + int ret01, ret02; + string guid = null; + + ret01 = m_model.AreaObj.GetGUID(name, ref guid); + + if (bhOpening.Name == "") + { + bhOpening.Name = guid.Substring(guid.Length - 7); + } + else + { + bhOpening.Name = guid.Substring(guid.Length - 7) + "::" + bhOpening.Name; + } + + ret02 = m_model.AreaObj.ChangeName(name, bhOpening.Name); + + if (!(ret01 == 0 && ret02 == 0)) return false; + + return true; + } + + /***************************************************/ + } } diff --git a/Etabs_Adapter/CRUD/Read/Opening.cs b/Etabs_Adapter/CRUD/Read/Opening.cs index 2cb44820..b732e466 100644 --- a/Etabs_Adapter/CRUD/Read/Opening.cs +++ b/Etabs_Adapter/CRUD/Read/Opening.cs @@ -76,7 +76,7 @@ private List ReadOpening(List ids = null) ETABSId etabsId = new ETABSId(); etabsId.Id = id; - Opening opening = new Opening(); + Opening opening = new Opening() { Name = id }; Polyline pl = GetOpeningOutline(id); opening.Edges = pl.SubParts().Select(x => new Edge { Curve = x }).ToList(); From b04ffee3ee3634a34c1e250eedfd754e00619c52 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 4 Nov 2025 17:13:18 +0000 Subject: [PATCH 05/14] Fix bug in unique names assignment for bars, panels, openings and nodes --- Etabs_Adapter/CRUD/Create/Bar.cs | 25 +++++++++++---------- Etabs_Adapter/CRUD/Create/Node.cs | 25 +++++++++++---------- Etabs_Adapter/CRUD/Create/Opening.cs | 26 ++++++++++++---------- Etabs_Adapter/CRUD/Create/Panel.cs | 33 +++++++++++++++------------- 4 files changed, 61 insertions(+), 48 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Bar.cs b/Etabs_Adapter/CRUD/Create/Bar.cs index 585c7258..750a7277 100644 --- a/Etabs_Adapter/CRUD/Create/Bar.cs +++ b/Etabs_Adapter/CRUD/Create/Bar.cs @@ -96,17 +96,19 @@ private bool CreateObject(Bar bhBar) string guid = null; // Assign the Unique Name to the ETABS Element - if (SetUniqueName(bhBar, name) == false) return false; + string newName = SetUniqueName(bhBar, name); - ETABSId etabsIdFragment = new ETABSId { Id = bhBar.Name }; + if (newName == null) return false; - if (m_model.FrameObj.GetLabelFromName(bhBar.Name, ref label, ref story) == 0) + ETABSId etabsIdFragment = new ETABSId { Id = newName }; + + if (m_model.FrameObj.GetLabelFromName(newName, ref label, ref story) == 0) { etabsIdFragment.Label = label; etabsIdFragment.Story = story; } - if (m_model.FrameObj.GetGUID(bhBar.Name, ref guid) == 0) + if (m_model.FrameObj.GetGUID(newName, ref guid) == 0) etabsIdFragment.PersistentId = guid; bhBar.SetAdapterId(etabsIdFragment); @@ -219,27 +221,28 @@ private bool SetObject(Bar bhBar) /***************************************************/ [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Bar Name to get the Unique Name to assign to the ETABS Element.")] - private bool SetUniqueName(Bar bhBar, string name) { + private string SetUniqueName(Bar bhBar, string name) { int ret01, ret02; string guid = null; - + string tempBarName = ""; + ret01 = m_model.FrameObj.GetGUID(name, ref guid); if (bhBar.Name == "") { - bhBar.Name = guid.Substring(guid.Length - 7); + tempBarName = guid.Substring(guid.Length - 7); } else { - bhBar.Name = guid.Substring(guid.Length - 7) + "::" + bhBar.Name; + tempBarName = guid.Substring(guid.Length - 7) + "::" + bhBar.Name; } - ret02 = m_model.FrameObj.ChangeName(name, bhBar.Name); + ret02 = m_model.FrameObj.ChangeName(name, tempBarName); - if (!(ret01 == 0 && ret02 == 0)) return false; + if (!(ret01 == 0 && ret02 == 0)) return null; - return true; + return tempBarName; } /***************************************************/ diff --git a/Etabs_Adapter/CRUD/Create/Node.cs b/Etabs_Adapter/CRUD/Create/Node.cs index e0ac651f..7ef15feb 100644 --- a/Etabs_Adapter/CRUD/Create/Node.cs +++ b/Etabs_Adapter/CRUD/Create/Node.cs @@ -57,25 +57,27 @@ private bool CreateObject(Node bhNode) { // Assign the Unique Name to the ETABS Element - if (SetUniqueName(bhNode, name) == false) return false; + string newName = SetUniqueName(bhNode, name); - etabsid.Id = bhNode.Name; + if (newName == null) return false; + + etabsid.Id = newName; //Label and story string label = ""; string story = ""; - if (m_model.PointObj.GetLabelFromName(name, ref label, ref story) == 0) + if (m_model.PointObj.GetLabelFromName(newName, ref label, ref story) == 0) { etabsid.Label = label; etabsid.Story = story; } string guid = null; - if (m_model.PointObj.GetGUID(bhNode.Name, ref guid) == 0) + if (m_model.PointObj.GetGUID(newName, ref guid) == 0) etabsid.PersistentId = guid; bhNode.SetAdapterId(etabsid); - SetObject(bhNode, bhNode.Name); + SetObject(bhNode, newName); } return true; @@ -115,28 +117,29 @@ private bool SetObject(Node bhNode, string name) /***************************************************/ [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Node Name to get the Unique Name to assign to the ETABS Element.")] - private bool SetUniqueName(Node bhNode, string name) + private string SetUniqueName(Node bhNode, string name) { int ret01, ret02; string guid = null; + string tempNodeName = ""; ret01 = m_model.PointObj.GetGUID(name, ref guid); if (bhNode.Name == "") { - bhNode.Name = guid.Substring(guid.Length - 7); + tempNodeName = guid.Substring(guid.Length - 7); } else { - bhNode.Name = guid.Substring(guid.Length - 7) + "::" + bhNode.Name; + tempNodeName = guid.Substring(guid.Length - 7) + "::" + bhNode.Name; } - ret02 = m_model.PointObj.ChangeName(name, bhNode.Name); + ret02 = m_model.PointObj.ChangeName(name, tempNodeName); - if (!(ret01 == 0 && ret02 == 0)) return false; + if (!(ret01 == 0 && ret02 == 0)) return null; - return true; + return tempNodeName; } /***************************************************/ diff --git a/Etabs_Adapter/CRUD/Create/Opening.cs b/Etabs_Adapter/CRUD/Create/Opening.cs index 1ed4f31e..782289da 100644 --- a/Etabs_Adapter/CRUD/Create/Opening.cs +++ b/Etabs_Adapter/CRUD/Create/Opening.cs @@ -28,6 +28,7 @@ using BH.oM.Adapters.ETABS; using BH.oM.Adapters.ETABS.Elements; using BH.oM.Analytical.Elements; +using BH.oM.Data.Collections; using BH.oM.Geometry; using BH.oM.Structure.Elements; using System.Collections.Generic; @@ -88,28 +89,30 @@ private bool CreateObject(Opening bhOpening) retA = m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref openingName, "Default"); // Assign the Unique Name to the ETABS Element - if (SetUniqueName(bhOpening, openingName) == false) return false; + string newName = SetUniqueName(bhOpening, openingName); + + if (newName == null) return false; ETABSId etabsid = new ETABSId(); - etabsid.Id = bhOpening.Name; + etabsid.Id = newName; //Label and story string label = ""; string story = ""; string guid = null; - if (m_model.AreaObj.GetLabelFromName(bhOpening.Name, ref label, ref story) == 0) + if (m_model.AreaObj.GetLabelFromName(newName, ref label, ref story) == 0) { etabsid.Label = label; etabsid.Story = story; } - if (m_model.AreaObj.GetGUID(bhOpening.Name, ref guid) == 0) + if (m_model.AreaObj.GetGUID(newName, ref guid) == 0) etabsid.PersistentId = guid; bhOpening.SetAdapterId(etabsid); - m_model.AreaObj.SetOpening(bhOpening.Name, true); + m_model.AreaObj.SetOpening(newName, true); return success; } @@ -117,27 +120,28 @@ private bool CreateObject(Opening bhOpening) /***************************************************/ [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Opening Name to get the Unique Name to assign to the ETABS Element.")] - private bool SetUniqueName(Opening bhOpening, string name) + private string SetUniqueName(Opening bhOpening, string name) { int ret01, ret02; string guid = null; + string tempOpeningName = ""; ret01 = m_model.AreaObj.GetGUID(name, ref guid); if (bhOpening.Name == "") { - bhOpening.Name = guid.Substring(guid.Length - 7); + tempOpeningName = guid.Substring(guid.Length - 7); } else { - bhOpening.Name = guid.Substring(guid.Length - 7) + "::" + bhOpening.Name; + tempOpeningName = guid.Substring(guid.Length - 7) + "::" + bhOpening.Name; } - ret02 = m_model.AreaObj.ChangeName(name, bhOpening.Name); + ret02 = m_model.AreaObj.ChangeName(name, tempOpeningName); - if (!(ret01 == 0 && ret02 == 0)) return false; + if (!(ret01 == 0 && ret02 == 0)) return null; - return true; + return tempOpeningName; } /***************************************************/ diff --git a/Etabs_Adapter/CRUD/Create/Panel.cs b/Etabs_Adapter/CRUD/Create/Panel.cs index 9c586efc..7f792543 100644 --- a/Etabs_Adapter/CRUD/Create/Panel.cs +++ b/Etabs_Adapter/CRUD/Create/Panel.cs @@ -92,23 +92,25 @@ private bool CreateObject(Panel bhPanel) retA = m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref name, propertyName); // Assign the Unique Name to the ETABS Element - if (SetUniqueName(bhPanel, name) == false) return false; + string newName = SetUniqueName(bhPanel, name); + + if (newName == null) return false; ETABSId etabsid = new ETABSId(); - etabsid.Id = bhPanel.Name; + etabsid.Id = newName; //Label and story string label = ""; string story = ""; string guid = null; - if (m_model.AreaObj.GetLabelFromName(bhPanel.Name, ref label, ref story) == 0) + if (m_model.AreaObj.GetLabelFromName(newName, ref label, ref story) == 0) { etabsid.Label = label; etabsid.Story = story; } - if (m_model.AreaObj.GetGUID(bhPanel.Name, ref guid) == 0) + if (m_model.AreaObj.GetGUID(newName, ref guid) == 0) etabsid.PersistentId = guid; bhPanel.SetAdapterId(etabsid); @@ -161,7 +163,7 @@ private bool CreateObject(Panel bhPanel) //Set local orientations: Basis orientation = bhPanel.LocalOrientation(); - m_model.AreaObj.SetLocalAxes(bhPanel.Name, Convert.ToEtabsPanelOrientation(orientation.Z, orientation.Y)); + m_model.AreaObj.SetLocalAxes(newName, Convert.ToEtabsPanelOrientation(orientation.Z, orientation.Y)); Pier pier = bhPanel.Pier(); Spandrel spandrel = bhPanel.Spandrel(); @@ -170,16 +172,16 @@ private bool CreateObject(Panel bhPanel) if (pier != null) { int ret = m_model.PierLabel.SetPier(pier.Name); - ret = m_model.AreaObj.SetPier(bhPanel.Name, pier.Name); + ret = m_model.AreaObj.SetPier(newName, pier.Name); } if (spandrel != null) { int ret = m_model.SpandrelLabel.SetSpandrel(spandrel.Name, false); - ret = m_model.AreaObj.SetSpandrel(bhPanel.Name, spandrel.Name); + ret = m_model.AreaObj.SetSpandrel(newName, spandrel.Name); } if (diaphragm != null) { - m_model.AreaObj.SetDiaphragm(bhPanel.Name, diaphragm.Name); + m_model.AreaObj.SetDiaphragm(newName, diaphragm.Name); } return success; @@ -209,24 +211,25 @@ private static void NonLinearEdgesCheck(List edges) /***************************************************/ [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Panel Name to get the Unique Name to assign to the ETABS Element.")] - private bool SetUniqueName(Panel bhPanel, string name) + private string SetUniqueName(Panel bhPanel, string name) { int ret01, ret02; string guid = null; + string tempPanelName = ""; ret01 = m_model.AreaObj.GetGUID(name, ref guid); - if (bhPanel.Name=="") { - bhPanel.Name = guid.Substring(guid.Length - 7); + if (bhPanel.Name=="") { + tempPanelName = guid.Substring(guid.Length - 7); } else { - bhPanel.Name = guid.Substring(guid.Length - 7) + "::" + bhPanel.Name; + tempPanelName = guid.Substring(guid.Length - 7) + "::" + bhPanel.Name; } - ret02 = m_model.AreaObj.ChangeName(name, bhPanel.Name); + ret02 = m_model.AreaObj.ChangeName(name, tempPanelName); - if (!(ret01 == 0 && ret02 == 0)) return false; + if (!(ret01 == 0 && ret02 == 0)) return null; - return true; + return tempPanelName; } /***************************************************/ From 8beed97eb370d3cb9c9be8305b5a3a1bc3d3cd83 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 4 Nov 2025 17:14:16 +0000 Subject: [PATCH 06/14] Add Unique Name Assignment in Push/Pull of Rigid Links --- Etabs_Adapter/CRUD/Create/Link.cs | 56 +++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Link.cs b/Etabs_Adapter/CRUD/Create/Link.cs index 50a790d1..35ef1945 100644 --- a/Etabs_Adapter/CRUD/Create/Link.cs +++ b/Etabs_Adapter/CRUD/Create/Link.cs @@ -20,14 +20,17 @@ * 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.Analytical.Elements; using BH.oM.Structure.Constraints; -using BH.Engine.Structure; -using BH.Engine.Adapters.ETABS; +using BH.oM.Structure.Elements; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Xml.Linq; namespace BH.Adapter.ETABS @@ -67,7 +70,12 @@ private bool CreateObject(RigidLink bhLink) linkIds.Add(name); } - multiId.Id = linkIds; + // Assign the Unique Name to the ETABS Element + List newLinkNames = SetUniqueName(bhLink, linkIds); + + if (newLinkNames == null) return false; + + multiId.Id = newLinkNames; bhLink.SetAdapterId(multiId); return success; @@ -106,6 +114,42 @@ private bool CreateObject(LinkConstraint bhLinkConstraint) } /***************************************************/ + + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Link Name to get the Unique Name to assign to the ETABS Element.")] + private List SetUniqueName(RigidLink bhLink, List names) + { + + int ret01, ret02; + string guid = null; + string tempLinkName = ""; + List newLinkNames = new List(); + + foreach (string name in names) { + + tempLinkName = ""; + ret01 = m_model.LinkObj.GetGUID(name, ref guid); + + if (bhLink.Name == "") + { + tempLinkName = guid.Substring(guid.Length - 7); + } + else + { + tempLinkName = guid.Substring(guid.Length - 7) + "::" + bhLink.Name; + } + + ret02 = m_model.LinkObj.ChangeName(name, tempLinkName); + + newLinkNames.Add(tempLinkName); + + if (!(ret01 == 0 && ret02 == 0)) return null; + + } + + return newLinkNames; + } + + /***************************************************/ } } From 5e57408e7fc8b9aae8cbb044fe6624ac6aa2c56f Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 4 Nov 2025 18:07:47 +0000 Subject: [PATCH 07/14] Add utility method GetBhomNameFromEtabsId() in Pull Methods for Bars, Links, Nodes, Panels and Openings --- Etabs_Adapter/CRUD/Read/Bar.cs | 4 +++- Etabs_Adapter/CRUD/Read/Link.cs | 5 ++++- Etabs_Adapter/CRUD/Read/Node.cs | 14 ++++++++------ Etabs_Adapter/CRUD/Read/Opening.cs | 4 +++- Etabs_Adapter/CRUD/Read/Panel.cs | 4 +++- Etabs_Adapter/CRUD/Read/_Read.cs | 14 ++++++++++++++ 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Etabs_Adapter/CRUD/Read/Bar.cs b/Etabs_Adapter/CRUD/Read/Bar.cs index 3627e0c7..4ba8d382 100644 --- a/Etabs_Adapter/CRUD/Read/Bar.cs +++ b/Etabs_Adapter/CRUD/Read/Bar.cs @@ -66,7 +66,9 @@ private List ReadBar(List ids = null) try { - Bar bhBar = new Bar() { Name = id }; + string bhomName = GetBhomNameFromEtabsId(id); + + Bar bhBar = new Bar() { Name = bhomName }; string startId = ""; string endId = ""; diff --git a/Etabs_Adapter/CRUD/Read/Link.cs b/Etabs_Adapter/CRUD/Read/Link.cs index 7b69c087..8054e6df 100644 --- a/Etabs_Adapter/CRUD/Read/Link.cs +++ b/Etabs_Adapter/CRUD/Read/Link.cs @@ -87,7 +87,10 @@ private List ReadRigidLink(List ids = null) foreach (KeyValuePair> kvp in idDict) { - RigidLink bhLink = new RigidLink(); + string bhomName = GetBhomNameFromEtabsId(kvp.Key); + + RigidLink bhLink = new RigidLink() { Name = bhomName}; + SetAdapterId(bhLink, kvp.Key); if (kvp.Value == null) diff --git a/Etabs_Adapter/CRUD/Read/Node.cs b/Etabs_Adapter/CRUD/Read/Node.cs index 2d35f018..d5af9e3f 100644 --- a/Etabs_Adapter/CRUD/Read/Node.cs +++ b/Etabs_Adapter/CRUD/Read/Node.cs @@ -20,17 +20,18 @@ * along with this code. If not, see . */ -using System; using BH.Engine.Adapter; using BH.oM.Adapters.ETABS; +using BH.oM.Base; +using BH.oM.Structure.Constraints; +using BH.oM.Structure.Elements; +using System; using System.Collections; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; -using BH.oM.Base; -using BH.oM.Structure.Elements; -using BH.oM.Structure.Constraints; namespace BH.Adapter.ETABS @@ -72,7 +73,9 @@ private List ReadNode(List ids = null) Constraint6DOF support = GetConstraint6DOF(restraint, spring); - Node bhNode = new Node { Name = id, Position = new oM.Geometry.Point() { X = x, Y = y, Z = z }, Support = support }; + string bhomName = GetBhomNameFromEtabsId(id); + + Node bhNode = new Node { Name = bhomName, Position = new oM.Geometry.Point() { X = x, Y = y, Z = z }, Support = support }; //Label and story string label = ""; @@ -117,7 +120,6 @@ public static Constraint6DOF GetConstraint6DOF(bool[] restraint, double[] spring return bhConstraint; } - /***************************************************/ } } diff --git a/Etabs_Adapter/CRUD/Read/Opening.cs b/Etabs_Adapter/CRUD/Read/Opening.cs index b732e466..934ad493 100644 --- a/Etabs_Adapter/CRUD/Read/Opening.cs +++ b/Etabs_Adapter/CRUD/Read/Opening.cs @@ -76,7 +76,9 @@ private List ReadOpening(List ids = null) ETABSId etabsId = new ETABSId(); etabsId.Id = id; - Opening opening = new Opening() { Name = id }; + string bhomName = GetBhomNameFromEtabsId(id); + + Opening opening = new Opening() { Name = bhomName }; Polyline pl = GetOpeningOutline(id); opening.Edges = pl.SubParts().Select(x => new Edge { Curve = x }).ToList(); diff --git a/Etabs_Adapter/CRUD/Read/Panel.cs b/Etabs_Adapter/CRUD/Read/Panel.cs index fcd42a36..99331084 100644 --- a/Etabs_Adapter/CRUD/Read/Panel.cs +++ b/Etabs_Adapter/CRUD/Read/Panel.cs @@ -86,7 +86,9 @@ private List ReadPanel(List ids = null) panelProperty = bhomProperties[propertyName]; } - Panel panel = new Panel() { Name = id }; + string bhomName = GetBhomNameFromEtabsId(id); + + Panel panel = new Panel() { Name = bhomName }; Polyline pl = GetPanelPerimeter(id); panel.ExternalEdges = pl.SubParts().Select(x => new Edge { Curve = x }).ToList(); diff --git a/Etabs_Adapter/CRUD/Read/_Read.cs b/Etabs_Adapter/CRUD/Read/_Read.cs index 1f706111..a493e5e9 100644 --- a/Etabs_Adapter/CRUD/Read/_Read.cs +++ b/Etabs_Adapter/CRUD/Read/_Read.cs @@ -186,6 +186,20 @@ private static List FilterIds(IEnumerable ids, IEnumerable Date: Mon, 24 Nov 2025 15:33:45 +0000 Subject: [PATCH 08/14] Add Unique Name Assignment in Update of Bars --- Etabs_Adapter/CRUD/Update/Bar.cs | 42 +++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/Etabs_Adapter/CRUD/Update/Bar.cs b/Etabs_Adapter/CRUD/Update/Bar.cs index 04df5ec6..97ab44be 100644 --- a/Etabs_Adapter/CRUD/Update/Bar.cs +++ b/Etabs_Adapter/CRUD/Update/Bar.cs @@ -20,11 +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 System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Reflection.Emit; +using System.Xml.Linq; namespace BH.Adapter.ETABS @@ -77,7 +81,7 @@ private bool UpdateObjects(IEnumerable bhBars) } #endif - if (SetObject(bhBar)) + if (SetObject(bhBar) && UpdateUniqueName(bhBar)) ret++; } @@ -97,6 +101,38 @@ private bool UpdateObjects(IEnumerable bhBars) /***************************************************/ + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Bar Name to get the Unique Name to assign to the ETABS Element.")] + private bool UpdateUniqueName(Bar bhBar) + { + int ret01, ret02; + string guid = null; + string tempBarName = ""; + + string uniqueName = GetAdapterId(bhBar); + + ret01 = m_model.FrameObj.GetGUID(uniqueName, ref guid); + + if (bhBar.Name == "") + { + tempBarName = guid.Substring(guid.Length - 7); + } + else + { + tempBarName = guid.Substring(guid.Length - 7) + "::" + bhBar.Name; + } + + ret02 = m_model.FrameObj.ChangeName(uniqueName, tempBarName); + + if (!(ret01 == 0 && ret02 == 0)) return false; + + ETABSId etabsIdFragment = new ETABSId { Id = tempBarName }; + + bhBar.SetAdapterId(etabsIdFragment); + + return true; + } + + /***************************************************/ } } From 1bd48f623f699b75da1189f1590c2f3bd684fe2d Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:48:15 +0000 Subject: [PATCH 09/14] Add Assignment of UniqueName in Update of Nodes --- Etabs_Adapter/CRUD/Update/Node.cs | 142 +++++++++++++++++++----------- 1 file changed, 93 insertions(+), 49 deletions(-) diff --git a/Etabs_Adapter/CRUD/Update/Node.cs b/Etabs_Adapter/CRUD/Update/Node.cs index 5ade95c4..87897abb 100644 --- a/Etabs_Adapter/CRUD/Update/Node.cs +++ b/Etabs_Adapter/CRUD/Update/Node.cs @@ -20,14 +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.oM.Structure.Constraints; using BH.Engine.Adapters.ETABS; +using BH.Engine.Structure; +using BH.oM.Adapters.ETABS; using BH.oM.Physical.Elements; +using BH.oM.Structure.Constraints; +using BH.oM.Structure.Elements; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Xml.Linq; namespace BH.Adapter.ETABS { @@ -53,85 +58,124 @@ private bool UpdateObjects(IEnumerable nodes) Engine.Structure.NodeDistanceComparer comparer = AdapterComparers[typeof(Node)] // θ(1) as Engine.Structure.NodeDistanceComparer; - Dictionary> dx = new Dictionary>(); // θ(1) - Dictionary> dy = new Dictionary>(); // θ(1) - Dictionary> dz = new Dictionary>(); // θ(1) - - // 1. GROUP NODES BY RELATIVE MOVEMENT IN X/Y/Z DIRECTION - ** HASH TABLES ** foreach (Node bhNode in nodes) // n*θ(1) + θ(1) { string name = GetAdapterId(bhNode); // θ(1) + success = UpdatePosition(name, comparer, bhNode); // θ(1) + success = UpdateUniqueName(bhNode); // θ(1) + } - // Update position - double x = 0; // θ(1) - double y = 0; // θ(1) - double z = 0; // θ(1) + return success; // θ(1) + } - if (m_model.PointObj.GetCoordCartesian(name, ref x, ref y, ref z) == 0) // θ(1) - { - oM.Geometry.Point p = new oM.Geometry.Point() { X = x, Y = y, Z = z }; // θ(1) - - if (!comparer.Equals(bhNode, (Node)p)) // θ(1) - { - // Get BHoM vs ETABS differences in nodes coordinates - x = bhNode.Position.X - x; // θ(1) - y = bhNode.Position.Y - y; // θ(1) - z = bhNode.Position.Z - z; // θ(1) - - // Add Node name and corresponding dX in dx Hash Table - if (dx.ContainsKey(x)) dx[x].Add(name); // θ(1) - else dx.Add(x, new List() {name}); // θ(1) - // Add Node name and corresponding dY in dy Hash Table - if (dy.ContainsKey(y)) dy[y].Add(name); // θ(1) - else dy.Add(y, new List() {name}); // θ(1) - // Add Node name and corresponding dZ in dz Hash Table - if (dz.ContainsKey(z)) dz[z].Add(name); // θ(1) - else dz.Add(z, new List() {name}); // θ(1) - - } - } - } + + private bool UpdatePosition(string name, NodeDistanceComparer comparer, Node bhNode) + { + Dictionary> dx = new Dictionary>(); // θ(1) + Dictionary> dy = new Dictionary>(); // θ(1) + Dictionary> dz = new Dictionary>(); // θ(1) + + // Update position + double x = 0; // θ(1) + double y = 0; // θ(1) + double z = 0; // θ(1) + + if (m_model.PointObj.GetCoordCartesian(name, ref x, ref y, ref z) == 0) // θ(1) + { + oM.Geometry.Point p = new oM.Geometry.Point() { X = x, Y = y, Z = z }; // θ(1) + if (!comparer.Equals(bhNode, (Node)p)) // θ(1) + { + // Get BHoM vs ETABS differences in nodes coordinates + x = bhNode.Position.X - x; // θ(1) + y = bhNode.Position.Y - y; // θ(1) + z = bhNode.Position.Z - z; // θ(1) + + // Add Node name and corresponding dX in dx Hash Table + if (dx.ContainsKey(x)) dx[x].Add(name); // θ(1) + else dx.Add(x, new List() { name }); // θ(1) + // Add Node name and corresponding dY in dy Hash Table + if (dy.ContainsKey(y)) dy[y].Add(name); // θ(1) + else dy.Add(y, new List() { name }); // θ(1) + // Add Node name and corresponding dZ in dz Hash Table + if (dz.ContainsKey(z)) dz[z].Add(name); // θ(1) + else dz.Add(z, new List() { name }); // θ(1) + } + } + // 2. MOVE NODES GROUP-BY-GROUP - ** STREAMS ** // dX Movement dx.ToList().ForEach(kvp => // θ(n) - { + { // 1. Select all nodes belonging to same group kvp.Value.ForEach(pplbl => m_model.PointObj.SetSelected(pplbl.ToString(), true)); // 2. Move all selected nodes by same dX m_model.EditGeneral.Move((double)kvp.Key, 0, 0); // 3. Deselect all selected nodes kvp.Value.ForEach(pplbl => m_model.PointObj.SetSelected(pplbl.ToString(), false)); - }); + }); - // dY Movement - dy.ToList().ForEach(kvp => // θ(n) - { + // dY Movement + dy.ToList().ForEach(kvp => // θ(n) + { // 1. Select all nodes belonging to same group kvp.Value.ForEach(pplbl => m_model.PointObj.SetSelected(pplbl.ToString(), true)); // 2. Move all selected nodes by same dY m_model.EditGeneral.Move(0, (double)kvp.Key, 0); // 3. Deselect all selected nodes kvp.Value.ForEach(pplbl => m_model.PointObj.SetSelected(pplbl.ToString(), false)); - }); + }); - // dZ Movement - dz.ToList().ForEach(kvp => // θ(n) - { + // dZ Movement + dz.ToList().ForEach(kvp => // θ(n) + { // 1. Select all nodes belonging to same group kvp.Value.ForEach(pplbl => m_model.PointObj.SetSelected(pplbl.ToString(), true)); // 2. Move all selected nodes by same dZ m_model.EditGeneral.Move(0, 0, (double)kvp.Key); // 3. Deselect all selected nodes kvp.Value.ForEach(pplbl => m_model.PointObj.SetSelected(pplbl.ToString(), false)); - }); + }); + + return true; + } + + /***************************************************/ + + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Node Name to get the Unique Name to assign to the ETABS Element.")] + private bool UpdateUniqueName(Node bhNode) + { + int ret01, ret02; + string guid = null; + string tempNodeName = ""; + + string uniqueName = GetAdapterId(bhNode); + + ret01 = m_model.PointObj.GetGUID(uniqueName, ref guid); + + if (bhNode.Name == "") + { + tempNodeName = guid.Substring(guid.Length - 7); + } + else + { + tempNodeName = guid.Substring(guid.Length - 7) + "::" + bhNode.Name; + } + + ret02 = m_model.PointObj.ChangeName(uniqueName, tempNodeName); + + if (!(ret01 == 0 && ret02 == 0)) return false; + + ETABSId etabsIdFragment = new ETABSId { Id = tempNodeName }; + + bhNode.SetAdapterId(etabsIdFragment); - return success; + return true; } /***************************************************/ From a289dd938e6c4e9532859a13d88f8f1d994df358 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:48:34 +0000 Subject: [PATCH 10/14] Add Assignment of UniqueName in Update of Panels --- Etabs_Adapter/CRUD/Update/Panel.cs | 49 ++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/Etabs_Adapter/CRUD/Update/Panel.cs b/Etabs_Adapter/CRUD/Update/Panel.cs index 2b7158a2..a520f855 100644 --- a/Etabs_Adapter/CRUD/Update/Panel.cs +++ b/Etabs_Adapter/CRUD/Update/Panel.cs @@ -20,16 +20,17 @@ * 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.Adapters.ETABS; -using BH.oM.Adapters.ETABS.Elements; +using BH.Engine.Structure; using BH.oM.Adapter; +using BH.oM.Adapters.ETABS; +using BH.oM.Adapters.ETABS.Elements; using BH.oM.Geometry; -using BH.Engine.Structure; +using BH.oM.Structure.Elements; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; namespace BH.Adapter.ETABS { @@ -85,6 +86,9 @@ private bool UpdateObjects(IEnumerable bhPanels) { m_model.AreaObj.SetDiaphragm(name, diaphragm.Name); } + + //Update Unique Name + UpdateUniqueName(bhPanel); } //Force refresh to make sure panel local orientation are set correctly @@ -95,6 +99,39 @@ private bool UpdateObjects(IEnumerable bhPanels) /***************************************************/ + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Panel Name to get the Unique Name to assign to the ETABS Element.")] + private bool UpdateUniqueName(Panel bhPanel) + { + int ret01, ret02; + string guid = null; + string tempPanelName = ""; + + string uniqueName = GetAdapterId(bhPanel); + + ret01 = m_model.AreaObj.GetGUID(uniqueName, ref guid); + + if (bhPanel.Name == "") + { + tempPanelName = guid.Substring(guid.Length - 7); + } + else + { + tempPanelName = guid.Substring(guid.Length - 7) + "::" + bhPanel.Name; + } + + ret02 = m_model.AreaObj.ChangeName(uniqueName, tempPanelName); + + if (!(ret01 == 0 && ret02 == 0)) return false; + + ETABSId etabsIdFragment = new ETABSId { Id = tempPanelName }; + + bhPanel.SetAdapterId(etabsIdFragment); + + return true; + } + + /***************************************************/ + } } From c617659013833fb188b7db45514fba2ac3f5d1a5 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 9 Dec 2025 11:16:23 +0000 Subject: [PATCH 11/14] Refactor the SetUniqueName() Method in the Create/ folder. Replace all the SetUniqueName private methods defined for bars, nodes, panels and openings with a single method taking as input a BHoMObject. Taking advantage of polymorphism, we can minimize the repetition of code within the Toolkit. --- Etabs_Adapter/CRUD/Create/Bar.cs | 27 -------------- Etabs_Adapter/CRUD/Create/Link.cs | 4 +++ Etabs_Adapter/CRUD/Create/Node.cs | 27 -------------- Etabs_Adapter/CRUD/Create/Opening.cs | 27 -------------- Etabs_Adapter/CRUD/Create/Panel.cs | 24 ------------- Etabs_Adapter/CRUD/Create/_Create.cs | 53 +++++++++++++++++++++++++--- 6 files changed, 53 insertions(+), 109 deletions(-) diff --git a/Etabs_Adapter/CRUD/Create/Bar.cs b/Etabs_Adapter/CRUD/Create/Bar.cs index 750a7277..33a8d56a 100644 --- a/Etabs_Adapter/CRUD/Create/Bar.cs +++ b/Etabs_Adapter/CRUD/Create/Bar.cs @@ -220,33 +220,6 @@ private bool SetObject(Bar bhBar) /***************************************************/ - [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Bar Name to get the Unique Name to assign to the ETABS Element.")] - private string SetUniqueName(Bar bhBar, string name) { - - int ret01, ret02; - string guid = null; - string tempBarName = ""; - - ret01 = m_model.FrameObj.GetGUID(name, ref guid); - - if (bhBar.Name == "") - { - tempBarName = guid.Substring(guid.Length - 7); - } - else - { - tempBarName = guid.Substring(guid.Length - 7) + "::" + bhBar.Name; - } - - ret02 = m_model.FrameObj.ChangeName(name, tempBarName); - - if (!(ret01 == 0 && ret02 == 0)) return null; - - return tempBarName; - } - - /***************************************************/ - #if Debug16 || Release16 [Description("Returns a bar where the endpoints have been flipped without cloning the object")] diff --git a/Etabs_Adapter/CRUD/Create/Link.cs b/Etabs_Adapter/CRUD/Create/Link.cs index 35ef1945..9670ee89 100644 --- a/Etabs_Adapter/CRUD/Create/Link.cs +++ b/Etabs_Adapter/CRUD/Create/Link.cs @@ -126,9 +126,11 @@ private List SetUniqueName(RigidLink bhLink, List names) foreach (string name in names) { + /* 1. GET THE ETABS ELEMENT GUID */ tempLinkName = ""; ret01 = m_model.LinkObj.GetGUID(name, ref guid); + /* 2. CREATE THE NEW UNIQUE NAME */ if (bhLink.Name == "") { tempLinkName = guid.Substring(guid.Length - 7); @@ -138,8 +140,10 @@ private List SetUniqueName(RigidLink bhLink, List names) tempLinkName = guid.Substring(guid.Length - 7) + "::" + bhLink.Name; } + /* 3. ASSIGN THE NEW UNIQUE NAME TO THE ETABS ELEMENT */ ret02 = m_model.LinkObj.ChangeName(name, tempLinkName); + /* 4. ADD THE NEW NAME TO THE LIST */ newLinkNames.Add(tempLinkName); if (!(ret01 == 0 && ret02 == 0)) return null; diff --git a/Etabs_Adapter/CRUD/Create/Node.cs b/Etabs_Adapter/CRUD/Create/Node.cs index 7ef15feb..f9266f7e 100644 --- a/Etabs_Adapter/CRUD/Create/Node.cs +++ b/Etabs_Adapter/CRUD/Create/Node.cs @@ -116,33 +116,6 @@ private bool SetObject(Node bhNode, string name) /***************************************************/ - [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Node Name to get the Unique Name to assign to the ETABS Element.")] - private string SetUniqueName(Node bhNode, string name) - { - - int ret01, ret02; - string guid = null; - string tempNodeName = ""; - - ret01 = m_model.PointObj.GetGUID(name, ref guid); - - if (bhNode.Name == "") - { - tempNodeName = guid.Substring(guid.Length - 7); - } - else - { - tempNodeName = guid.Substring(guid.Length - 7) + "::" + bhNode.Name; - } - - ret02 = m_model.PointObj.ChangeName(name, tempNodeName); - - if (!(ret01 == 0 && ret02 == 0)) return null; - - return tempNodeName; - } - - /***************************************************/ } } diff --git a/Etabs_Adapter/CRUD/Create/Opening.cs b/Etabs_Adapter/CRUD/Create/Opening.cs index 782289da..bd2c1bcf 100644 --- a/Etabs_Adapter/CRUD/Create/Opening.cs +++ b/Etabs_Adapter/CRUD/Create/Opening.cs @@ -119,32 +119,5 @@ private bool CreateObject(Opening bhOpening) /***************************************************/ - [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Opening Name to get the Unique Name to assign to the ETABS Element.")] - private string SetUniqueName(Opening bhOpening, string name) - { - int ret01, ret02; - string guid = null; - string tempOpeningName = ""; - - ret01 = m_model.AreaObj.GetGUID(name, ref guid); - - if (bhOpening.Name == "") - { - tempOpeningName = guid.Substring(guid.Length - 7); - } - else - { - tempOpeningName = guid.Substring(guid.Length - 7) + "::" + bhOpening.Name; - } - - ret02 = m_model.AreaObj.ChangeName(name, tempOpeningName); - - if (!(ret01 == 0 && ret02 == 0)) return null; - - return tempOpeningName; - } - - /***************************************************/ - } } diff --git a/Etabs_Adapter/CRUD/Create/Panel.cs b/Etabs_Adapter/CRUD/Create/Panel.cs index 7f792543..549525b5 100644 --- a/Etabs_Adapter/CRUD/Create/Panel.cs +++ b/Etabs_Adapter/CRUD/Create/Panel.cs @@ -210,30 +210,6 @@ private static void NonLinearEdgesCheck(List edges) /***************************************************/ - [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Panel Name to get the Unique Name to assign to the ETABS Element.")] - private string SetUniqueName(Panel bhPanel, string name) - { - int ret01, ret02; - string guid = null; - string tempPanelName = ""; - - ret01 = m_model.AreaObj.GetGUID(name, ref guid); - - if (bhPanel.Name=="") { - tempPanelName = guid.Substring(guid.Length - 7); - } else { - tempPanelName = guid.Substring(guid.Length - 7) + "::" + bhPanel.Name; - } - - ret02 = m_model.AreaObj.ChangeName(name, tempPanelName); - - if (!(ret01 == 0 && ret02 == 0)) return null; - - return tempPanelName; - } - - /***************************************************/ - } } diff --git a/Etabs_Adapter/CRUD/Create/_Create.cs b/Etabs_Adapter/CRUD/Create/_Create.cs index 33340a73..8fdff387 100644 --- a/Etabs_Adapter/CRUD/Create/_Create.cs +++ b/Etabs_Adapter/CRUD/Create/_Create.cs @@ -20,13 +20,14 @@ * 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.Elements; using BH.oM.Base; +using BH.oM.Structure.Elements; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; namespace BH.Adapter.ETABS { @@ -109,6 +110,50 @@ private bool CreateObject(IBHoMObject obj) /***************************************************/ + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the BHoM Object Name to get the Unique Name to assign to the ETABS Element.")] + private string SetUniqueName(BHoMObject obj, string name) + { + /* 1. CHECK OBJECT TYPE IS ACCEPTABLE */ + if (!(obj.GetType() == typeof(Node) || + obj.GetType() == typeof(Bar) || + obj.GetType() == typeof(Panel) || + obj.GetType() == typeof(Opening))) + { + return null; + } + + /* 2. GET THE ETABS ELEMENT GUID */ + int ret01 = 1; + int ret02 = 1; + string guid = null; + string tempObjName = ""; + + if (obj.GetType() == typeof(Node)) ret01 = m_model.PointObj.GetGUID(name, ref guid); + if (obj.GetType()== typeof(Bar)) ret01 = m_model.FrameObj.GetGUID(name, ref guid); + if (obj.GetType() == typeof(Panel) || obj.GetType() == typeof(Opening)) ret01 = m_model.AreaObj.GetGUID(name, ref guid); + + /* 3. CREATE THE NEW UNIQUE NAME */ + if (obj.Name == "") + { + tempObjName = guid.Substring(guid.Length - 7); + } + else + { + tempObjName = guid.Substring(guid.Length - 7) + "::" + obj.Name; + } + + /* 4. ASSIGN THE NEW UNIQUE NAME TO THE ETABS ELEMENT */ + if (obj.GetType() == typeof(Node)) ret02 = m_model.PointObj.ChangeName(name, tempObjName); + if (obj.GetType() == typeof(Bar)) ret02 = m_model.FrameObj.ChangeName(name, tempObjName); + if (obj.GetType() == typeof(Panel) || obj.GetType() == typeof(Opening)) ret02 = m_model.AreaObj.ChangeName(name, tempObjName); + + if (!(ret01 == 0 && ret02 == 0)) return null; + + return tempObjName; + } + + /***************************************************/ + } } From 2529a92a125d29a3ef43d564d3c2e39afd98be23 Mon Sep 17 00:00:00 2001 From: GCRA101 <126593217+GCRA101@users.noreply.github.com> Date: Tue, 9 Dec 2025 11:45:43 +0000 Subject: [PATCH 12/14] Refactor the UpdateUniqueName() Method in the Update/ folder. Replace all the UpdateUniqueName private methods defined for bars, nodes, panels and openings with a single method taking as input a BHoMObject. Taking advantage of polymorphism, we can minimize the repetition of code within the Toolkit. --- Etabs_Adapter/CRUD/Update/Bar.cs | 32 ---------------- Etabs_Adapter/CRUD/Update/Node.cs | 32 ---------------- Etabs_Adapter/CRUD/Update/Panel.cs | 33 ---------------- Etabs_Adapter/CRUD/Update/_Update.cs | 56 ++++++++++++++++++++++++---- 4 files changed, 49 insertions(+), 104 deletions(-) diff --git a/Etabs_Adapter/CRUD/Update/Bar.cs b/Etabs_Adapter/CRUD/Update/Bar.cs index 97ab44be..52a79693 100644 --- a/Etabs_Adapter/CRUD/Update/Bar.cs +++ b/Etabs_Adapter/CRUD/Update/Bar.cs @@ -101,38 +101,6 @@ private bool UpdateObjects(IEnumerable bhBars) /***************************************************/ - [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Bar Name to get the Unique Name to assign to the ETABS Element.")] - private bool UpdateUniqueName(Bar bhBar) - { - int ret01, ret02; - string guid = null; - string tempBarName = ""; - - string uniqueName = GetAdapterId(bhBar); - - ret01 = m_model.FrameObj.GetGUID(uniqueName, ref guid); - - if (bhBar.Name == "") - { - tempBarName = guid.Substring(guid.Length - 7); - } - else - { - tempBarName = guid.Substring(guid.Length - 7) + "::" + bhBar.Name; - } - - ret02 = m_model.FrameObj.ChangeName(uniqueName, tempBarName); - - if (!(ret01 == 0 && ret02 == 0)) return false; - - ETABSId etabsIdFragment = new ETABSId { Id = tempBarName }; - - bhBar.SetAdapterId(etabsIdFragment); - - return true; - } - - /***************************************************/ } } diff --git a/Etabs_Adapter/CRUD/Update/Node.cs b/Etabs_Adapter/CRUD/Update/Node.cs index 87897abb..51e4718a 100644 --- a/Etabs_Adapter/CRUD/Update/Node.cs +++ b/Etabs_Adapter/CRUD/Update/Node.cs @@ -147,38 +147,6 @@ private bool UpdatePosition(string name, NodeDistanceComparer comparer, Node bhN /***************************************************/ - [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Node Name to get the Unique Name to assign to the ETABS Element.")] - private bool UpdateUniqueName(Node bhNode) - { - int ret01, ret02; - string guid = null; - string tempNodeName = ""; - - string uniqueName = GetAdapterId(bhNode); - - ret01 = m_model.PointObj.GetGUID(uniqueName, ref guid); - - if (bhNode.Name == "") - { - tempNodeName = guid.Substring(guid.Length - 7); - } - else - { - tempNodeName = guid.Substring(guid.Length - 7) + "::" + bhNode.Name; - } - - ret02 = m_model.PointObj.ChangeName(uniqueName, tempNodeName); - - if (!(ret01 == 0 && ret02 == 0)) return false; - - ETABSId etabsIdFragment = new ETABSId { Id = tempNodeName }; - - bhNode.SetAdapterId(etabsIdFragment); - - return true; - } - - /***************************************************/ } } diff --git a/Etabs_Adapter/CRUD/Update/Panel.cs b/Etabs_Adapter/CRUD/Update/Panel.cs index a520f855..d38af68e 100644 --- a/Etabs_Adapter/CRUD/Update/Panel.cs +++ b/Etabs_Adapter/CRUD/Update/Panel.cs @@ -99,39 +99,6 @@ private bool UpdateObjects(IEnumerable bhPanels) /***************************************************/ - [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Panel Name to get the Unique Name to assign to the ETABS Element.")] - private bool UpdateUniqueName(Panel bhPanel) - { - int ret01, ret02; - string guid = null; - string tempPanelName = ""; - - string uniqueName = GetAdapterId(bhPanel); - - ret01 = m_model.AreaObj.GetGUID(uniqueName, ref guid); - - if (bhPanel.Name == "") - { - tempPanelName = guid.Substring(guid.Length - 7); - } - else - { - tempPanelName = guid.Substring(guid.Length - 7) + "::" + bhPanel.Name; - } - - ret02 = m_model.AreaObj.ChangeName(uniqueName, tempPanelName); - - if (!(ret01 == 0 && ret02 == 0)) return false; - - ETABSId etabsIdFragment = new ETABSId { Id = tempPanelName }; - - bhPanel.SetAdapterId(etabsIdFragment); - - return true; - } - - /***************************************************/ - } } diff --git a/Etabs_Adapter/CRUD/Update/_Update.cs b/Etabs_Adapter/CRUD/Update/_Update.cs index b993a14e..57fdefb8 100644 --- a/Etabs_Adapter/CRUD/Update/_Update.cs +++ b/Etabs_Adapter/CRUD/Update/_Update.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.Engine.Adapters.ETABS; +using BH.oM.Adapter; using BH.oM.Adapters.ETABS; +using BH.oM.Adapters.ETABS.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.Collections.Generic; +using System.ComponentModel; +using System.Linq; namespace BH.Adapter.ETABS { @@ -60,6 +61,47 @@ private bool UpdateObjects(IEnumerable objects) } /***************************************************/ + + [Description("Concatenates the last 7 characters of the ETABS Element GUID and the Node Name to get the Unique Name to assign to the ETABS Element.")] + private bool UpdateUniqueName(BHoMObject obj) + { + int ret01 = 1; + int ret02 = 1; + string guid = null; + string tempObjName = ""; + + /* 1. GET THE ETABS ELEMENT GUID */ + string uniqueName = GetAdapterId(obj); + + if (obj.GetType() == typeof(Node)) ret01 = m_model.PointObj.GetGUID(uniqueName, ref guid); + if (obj.GetType() == typeof(Bar)) ret01 = m_model.FrameObj.GetGUID(uniqueName, ref guid); + if (obj.GetType() == typeof(Panel) || obj.GetType() == typeof(Opening)) ret01 = m_model.AreaObj.GetGUID(uniqueName, ref guid); + + /* 2. CREATE THE NEW UNIQUE NAME */ + if (obj.Name == "") + { + tempObjName = guid.Substring(guid.Length - 7); + } + else + { + tempObjName = guid.Substring(guid.Length - 7) + "::" + obj.Name; + } + + /* 3. ASSIGN THE NEW UNIQUE NAME TO THE ETABS ELEMENT */ + if (obj.GetType() == typeof(Node)) ret02 = m_model.PointObj.ChangeName(uniqueName, tempObjName); + if (obj.GetType() == typeof(Bar)) ret02 = m_model.FrameObj.ChangeName(uniqueName, tempObjName); + if (obj.GetType() == typeof(Panel) || obj.GetType() == typeof(Opening)) ret02 = m_model.AreaObj.ChangeName(uniqueName, tempObjName); + + if (!(ret01 == 0 && ret02 == 0)) return false; + + ETABSId etabsIdFragment = new ETABSId { Id = tempObjName }; + + obj.SetAdapterId(etabsIdFragment); + + return true; + } + + /***************************************************/ } } From 9066116e697dc0c2cbff40e2f7f501d6acec37ef Mon Sep 17 00:00:00 2001 From: BHoMBot Date: Tue, 7 Apr 2026 10:00:03 -0400 Subject: [PATCH 13/14] Update assembly file version to 9.2.0.0 --- ETABS_Engine/ETABS_Engine.csproj | 2 +- ETABS_oM/ETABS_oM.csproj | 2 +- Etabs_Adapter/Etabs_Adapter.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ETABS_Engine/ETABS_Engine.csproj b/ETABS_Engine/ETABS_Engine.csproj index abe16165..8c2311a2 100644 --- a/ETABS_Engine/ETABS_Engine.csproj +++ b/ETABS_Engine/ETABS_Engine.csproj @@ -9,7 +9,7 @@ ETABS_Engine Copyright � https://github.com/BHoM 9.0.0.0 - 9.1.0.0 + 9.2.0.0 diff --git a/ETABS_oM/ETABS_oM.csproj b/ETABS_oM/ETABS_oM.csproj index da4fd991..08635ebb 100644 --- a/ETABS_oM/ETABS_oM.csproj +++ b/ETABS_oM/ETABS_oM.csproj @@ -9,7 +9,7 @@ ETABS_oM Copyright � https://github.com/BHoM 9.0.0.0 - 9.1.0.0 + 9.2.0.0 diff --git a/Etabs_Adapter/Etabs_Adapter.csproj b/Etabs_Adapter/Etabs_Adapter.csproj index b060f4b0..4fa7d3a7 100644 --- a/Etabs_Adapter/Etabs_Adapter.csproj +++ b/Etabs_Adapter/Etabs_Adapter.csproj @@ -12,7 +12,7 @@ ETABS_Adapter Copyright � https://github.com/BHoM 9.0.0.0 - 9.1.0.0 + 9.2.0.0 From 70300efb6d208db59eb43ee4df1e0264ae926d5d Mon Sep 17 00:00:00 2001 From: "g.albieri" <126593217+GCRA101@users.noreply.github.com> Date: Mon, 11 May 2026 15:20:40 +0100 Subject: [PATCH 14/14] Fix syntax error in _Update.cs --- Etabs_Adapter/CRUD/Update/_Update.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Etabs_Adapter/CRUD/Update/_Update.cs b/Etabs_Adapter/CRUD/Update/_Update.cs index c14b1f14..1ffba326 100644 --- a/Etabs_Adapter/CRUD/Update/_Update.cs +++ b/Etabs_Adapter/CRUD/Update/_Update.cs @@ -104,8 +104,6 @@ private bool UpdateUniqueName(BHoMObject obj) } /***************************************************/ - } -} #if !(Debug16 || Release16 || Debug17 || Release17) private bool UpdateGroup(BHoMObject obj)