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/CRUD/Create/Bar.cs b/Etabs_Adapter/CRUD/Create/Bar.cs
index b5c8aaa3..35e7433a 100644
--- a/Etabs_Adapter/CRUD/Create/Bar.cs
+++ b/Etabs_Adapter/CRUD/Create/Bar.cs
@@ -95,15 +95,20 @@ private bool CreateObject(Bar bhBar)
string story = "";
string guid = null;
- ETABSId etabsIdFragment = new ETABSId { Id = name };
+ // Assign the Unique Name to the ETABS Element
+ string newName = SetUniqueName(bhBar, name);
- if (m_model.FrameObj.GetLabelFromName(name, ref label, ref story) == 0)
+ if (newName == null) return false;
+
+ 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.AreaObj.GetGUID(name, ref guid) == 0)
+ if (m_model.FrameObj.GetGUID(newName, ref guid) == 0)
etabsIdFragment.PersistentId = guid;
bhBar.SetAdapterId(etabsIdFragment);
diff --git a/Etabs_Adapter/CRUD/Create/Link.cs b/Etabs_Adapter/CRUD/Create/Link.cs
index b15ffc8a..0c807754 100644
--- a/Etabs_Adapter/CRUD/Create/Link.cs
+++ b/Etabs_Adapter/CRUD/Create/Link.cs
@@ -24,11 +24,13 @@
using BH.Engine.Adapters.ETABS;
using BH.Engine.Structure;
using BH.oM.Adapters.ETABS;
+using BH.oM.Analytical.Elements;
using BH.oM.Structure.Constraints;
using BH.oM.Structure.Elements;
-using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
+using System.Xml.Linq;
namespace BH.Adapter.ETABS
@@ -68,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);
SetGroup(bhLink);
@@ -110,6 +117,45 @@ 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) {
+
+ /* 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);
+ }
+ else
+ {
+ 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;
+
+ }
+
+ return newLinkNames;
+ }
+
+ /***************************************************/
}
}
diff --git a/Etabs_Adapter/CRUD/Create/Node.cs b/Etabs_Adapter/CRUD/Create/Node.cs
index 1a1c4a83..de4dea26 100644
--- a/Etabs_Adapter/CRUD/Create/Node.cs
+++ b/Etabs_Adapter/CRUD/Create/Node.cs
@@ -25,10 +25,12 @@
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
@@ -53,23 +55,29 @@ 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
+ string newName = SetUniqueName(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(name, ref guid) == 0)
+ if (m_model.PointObj.GetGUID(newName, ref guid) == 0)
etabsid.PersistentId = guid;
bhNode.SetAdapterId(etabsid);
- SetObject(bhNode, name);
+ SetObject(bhNode, newName);
SetGroup(bhNode);
}
diff --git a/Etabs_Adapter/CRUD/Create/Opening.cs b/Etabs_Adapter/CRUD/Create/Opening.cs
index a5c18939..11681f65 100644
--- a/Etabs_Adapter/CRUD/Create/Opening.cs
+++ b/Etabs_Adapter/CRUD/Create/Opening.cs
@@ -28,11 +28,13 @@
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;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
+using System.Xml.Linq;
namespace BH.Adapter.ETABS
@@ -85,26 +87,32 @@ 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
+ string newName = SetUniqueName(bhOpening, openingName);
+
+ if (newName == null) return false;
+
ETABSId etabsid = new ETABSId();
- etabsid.Id = openingName;
+ etabsid.Id = newName;
//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(newName, 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(newName, ref guid) == 0)
etabsid.PersistentId = guid;
bhOpening.SetAdapterId(etabsid);
- m_model.AreaObj.SetOpening(openingName, true);
+ m_model.AreaObj.SetOpening(newName, true);
//Set Groups Assignment
SetGroup(bhOpening);
diff --git a/Etabs_Adapter/CRUD/Create/Panel.cs b/Etabs_Adapter/CRUD/Create/Panel.cs
index 53e090af..077b68f1 100644
--- a/Etabs_Adapter/CRUD/Create/Panel.cs
+++ b/Etabs_Adapter/CRUD/Create/Panel.cs
@@ -31,6 +31,7 @@
using BH.oM.Structure.Elements;
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
@@ -89,21 +90,27 @@ 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
+ string newName = SetUniqueName(bhPanel, name);
+
+ if (newName == null) return false;
+
ETABSId etabsid = new ETABSId();
- etabsid.Id = name;
+ etabsid.Id = newName;
//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(newName, 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(newName, ref guid) == 0)
etabsid.PersistentId = guid;
bhPanel.SetAdapterId(etabsid);
@@ -146,7 +153,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);
@@ -156,7 +163,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(newName, Convert.ToEtabsPanelOrientation(orientation.Z, orientation.Y));
Pier pier = bhPanel.Pier();
Spandrel spandrel = bhPanel.Spandrel();
@@ -165,16 +172,16 @@ 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(newName, 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(newName, spandrel.Name);
}
if (diaphragm != null)
{
- m_model.AreaObj.SetDiaphragm(name, diaphragm.Name);
+ m_model.AreaObj.SetDiaphragm(newName, diaphragm.Name);
}
//Set Groups Assignment
@@ -203,6 +210,7 @@ private static void NonLinearEdgesCheck(List edges)
}
+
/***************************************************/
}
diff --git a/Etabs_Adapter/CRUD/Create/_Create.cs b/Etabs_Adapter/CRUD/Create/_Create.cs
index e6bae5a9..3e657002 100644
--- a/Etabs_Adapter/CRUD/Create/_Create.cs
+++ b/Etabs_Adapter/CRUD/Create/_Create.cs
@@ -22,8 +22,13 @@
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 System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using BH.oM.Adapters.ETABS;
using BH.oM.Analytical.Elements;
using BH.oM.Analytical.Results;
using BH.oM.Base;
@@ -119,6 +124,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;
+ }
+
+ /***************************************************/
+
private bool SetGroup(BHoMObject obj)
{
int ret = 0;
diff --git a/Etabs_Adapter/CRUD/Read/Bar.cs b/Etabs_Adapter/CRUD/Read/Bar.cs
index 3f2177ec..ff562332 100644
--- a/Etabs_Adapter/CRUD/Read/Bar.cs
+++ b/Etabs_Adapter/CRUD/Read/Bar.cs
@@ -66,7 +66,10 @@ private List ReadBar(List ids = null)
try
{
- Bar bhBar = new Bar();
+ string bhomName = GetBhomNameFromEtabsId(id);
+
+ Bar bhBar = new Bar() { Name = bhomName };
+
string startId = "";
string endId = "";
m_model.FrameObj.GetPoints(id, ref startId, ref endId);
diff --git a/Etabs_Adapter/CRUD/Read/Link.cs b/Etabs_Adapter/CRUD/Read/Link.cs
index 351b2ae0..34a04521 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 1b483e5f..f96d04d4 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 { 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 = "";
@@ -128,7 +131,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 4bdb5d7f..74871734 100644
--- a/Etabs_Adapter/CRUD/Read/Opening.cs
+++ b/Etabs_Adapter/CRUD/Read/Opening.cs
@@ -77,7 +77,9 @@ private List ReadOpening(List ids = null)
ETABSId etabsId = new ETABSId();
etabsId.Id = id;
- Opening opening = new Opening();
+ 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 0bab1ca2..67f0dbd4 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();
+ 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 aadb798b..74944ed5 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.
*/
-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
@@ -76,11 +80,12 @@ 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))
+ if (SetObject(bhBar) && UpdateGroup(bhBar) && UpdateUniqueName(bhBar))
ret++;
#endif
diff --git a/Etabs_Adapter/CRUD/Update/Node.cs b/Etabs_Adapter/CRUD/Update/Node.cs
index 4b64ce61..c0ba5c96 100644
--- a/Etabs_Adapter/CRUD/Update/Node.cs
+++ b/Etabs_Adapter/CRUD/Update/Node.cs
@@ -22,12 +22,17 @@
using BH.Engine.Adapter;
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;
+using System.Collections;
using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Xml.Linq;
+using System;
using System.IO;
using System.Linq;
@@ -63,6 +68,7 @@ private bool UpdateObjects(IEnumerable nodes)
Engine.Structure.NodeDistanceComparer comparer = AdapterComparers[typeof(Node)] // θ(1)
as Engine.Structure.NodeDistanceComparer;
+ // 1. GROUP NODES BY RELATIVE MOVEMENT IN X/Y/Z DIRECTION - ** HASH TABLES **
Dictionary> dx = new Dictionary>(); // θ(1)
Dictionary> dy = new Dictionary>(); // θ(1)
Dictionary> dz = new Dictionary>(); // θ(1)
@@ -73,74 +79,87 @@ private bool UpdateObjects(IEnumerable nodes)
foreach (Node bhNode in nodes) // n*θ(1) + θ(1)
{
string name = GetAdapterId(bhNode); // θ(1)
+ success = UpdatePosition(name, comparer, bhNode); // θ(1)
+ success = UpdateUniqueName(bhNode); // θ(1)
+ }
+
+ return success; // θ(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)
+
+ 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)
{
- 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)
-
- }
+ // 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.2 Move Nodes Group-By-Group - ** STREAMS **
+
+ // 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 success;
- }
+ return true;
+ }
/***************************************************/
diff --git a/Etabs_Adapter/CRUD/Update/Panel.cs b/Etabs_Adapter/CRUD/Update/Panel.cs
index 5018d314..49515ea6 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,10 @@ private bool UpdateObjects(IEnumerable bhPanels)
{
m_model.AreaObj.SetDiaphragm(name, diaphragm.Name);
}
+
+ //Update Unique Name
+ UpdateUniqueName(bhPanel);
+
#if !(Debug16 || Release16 || Debug17 || Release17)
//Update Groups Assignment
if (!UpdateGroup(bhPanel)) success = false;
diff --git a/Etabs_Adapter/CRUD/Update/_Update.cs b/Etabs_Adapter/CRUD/Update/_Update.cs
index 7832525f..1ffba326 100644
--- a/Etabs_Adapter/CRUD/Update/_Update.cs
+++ b/Etabs_Adapter/CRUD/Update/_Update.cs
@@ -31,8 +31,9 @@
using BH.oM.Structure.MaterialFragments;
using BH.oM.Structure.SectionProperties;
using BH.oM.Structure.SurfaceProperties;
-using System;
using System.Collections.Generic;
+using System.ComponentModel;
+using System;
using System.Linq;
namespace BH.Adapter.ETABS
@@ -63,6 +64,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;
+ }
+
+ /***************************************************/
+
#if !(Debug16 || Release16 || Debug17 || Release17)
private bool UpdateGroup(BHoMObject obj)
{
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