From c7faf7ca94c1d7834a473c744b4a3eef4f51a8a5 Mon Sep 17 00:00:00 2001 From: GCRA101 Date: Wed, 14 Aug 2024 07:27:00 +0100 Subject: [PATCH 1/2] Add SetLoad Method for Point Displacement Load --- Etabs_Adapter/CRUD/Create/Load.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Etabs_Adapter/CRUD/Create/Load.cs b/Etabs_Adapter/CRUD/Create/Load.cs index 2d1b4a0d..47785357 100644 --- a/Etabs_Adapter/CRUD/Create/Load.cs +++ b/Etabs_Adapter/CRUD/Create/Load.cs @@ -320,6 +320,22 @@ public void SetLoad(GravityLoad gravityLoad, bool replace) BH.Engine.Base.Compute.RecordWarning("ETABS handles gravity loads via loadcases, why only one gravity load per loadcase can be used. THis gravity load will be applied to all objects"); } + /***************************************************/ + + public void SetLoad(PointDisplacement pointDisplacementLoad, bool replace) + { + double[] pdValues = new double[] { pointDisplacementLoad.Translation.X, pointDisplacementLoad.Translation.Y, pointDisplacementLoad.Translation.Z, + pointDisplacementLoad.Rotation.X, pointDisplacementLoad.Rotation.Y, pointDisplacementLoad.Rotation.Z}; + int ret = 0; + + foreach (Node node in pointDisplacementLoad.Objects.Elements) + { + string caseName = GetAdapterId(pointDisplacementLoad.Loadcase); + string nodeName = GetAdapterId(node); + ret = m_model.PointObj.SetLoadDispl(nodeName, caseName, ref pdValues, replace); + } + } + /***************************************************/ /**** Helper Methods ****/ From a65971d988cdf10efbf0a186877a6f9ad5f64aef Mon Sep 17 00:00:00 2001 From: GCRA101 Date: Wed, 14 Aug 2024 07:46:36 +0100 Subject: [PATCH 2/2] Add Getter method for Point Displacement Load --- Etabs_Adapter/CRUD/Read/Load.cs | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/Etabs_Adapter/CRUD/Read/Load.cs b/Etabs_Adapter/CRUD/Read/Load.cs index c922317d..6304d26b 100644 --- a/Etabs_Adapter/CRUD/Read/Load.cs +++ b/Etabs_Adapter/CRUD/Read/Load.cs @@ -176,6 +176,55 @@ private List ReadPointLoad(List loadcases) /***************************************************/ + private List ReadPointDisplacementLoad(List loadcases) + { + List bhDisplLoads = new List(); + + Dictionary bhomNodes = GetCachedOrReadAsDictionary(); + + string[] names = null; + string[] loadcase = null; + string[] CSys = null; + int[] step = null; + int nameCount = 0; + double[] u1 = null; + double[] u2 = null; + double[] u3 = null; + double[] r1 = null; + double[] r2 = null; + double[] r3 = null; + + if (m_model.PointObj.GetLoadDispl("All", ref nameCount, ref names, ref loadcase, ref step, ref CSys, ref u1, ref u2, ref u3, ref r1, ref r2, ref r3, eItemType.Group) != 0) + return bhDisplLoads; + + for (int i = 0; i < nameCount; i++) + { + if (CSys[i] != "Global") + Engine.Base.Compute.RecordWarning($"The coordinate system: {CSys[i]} was not read. The PointLoads defined in the coordinate system: {CSys[i]} were set as Global"); + + Loadcase bhLoadcase = loadcases.FirstOrDefault(x => x.Name == loadcase[i]); + + if (bhLoadcase == null) + continue; + + PointDisplacement bhDisplLoad = new PointDisplacement() + { + Translation = new Vector() { X = u1[i], Y = u2[i], Z = u3[i] }, + Rotation = new Vector() { X = r1[i], Y = r2[i], Z = r3[i] }, + Loadcase = bhLoadcase, + Objects = new BHoMGroup() { Elements = { bhomNodes[names[i]] } } + }; + + bhDisplLoads.Add(bhDisplLoad); + } + + return bhDisplLoads; + + } + + /***************************************************/ + + private List ReadBarLoad(List loadcases) { List bhLoads = new List();