Skip to content

Commit

Permalink
Add Set Get Point Displacement Loads (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjamesnugent authored Sep 4, 2024
2 parents aebab56 + b5bd8e5 commit 2011ed3
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Etabs_Adapter/CRUD/Create/Load.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>(pointDisplacementLoad.Loadcase);
string nodeName = GetAdapterId<string>(node);
ret = m_model.PointObj.SetLoadDispl(nodeName, caseName, ref pdValues, replace);
}
}


/***************************************************/
/**** Helper Methods ****/
Expand Down
49 changes: 49 additions & 0 deletions Etabs_Adapter/CRUD/Read/Load.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,55 @@ private List<ILoad> ReadPointLoad(List<Loadcase> loadcases)

/***************************************************/

private List<ILoad> ReadPointDisplacementLoad(List<Loadcase> loadcases)
{
List<ILoad> bhDisplLoads = new List<ILoad>();

Dictionary<string, Node> bhomNodes = GetCachedOrReadAsDictionary<string, Node>();

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<Node>() { Elements = { bhomNodes[names[i]] } }
};

bhDisplLoads.Add(bhDisplLoad);
}

return bhDisplLoads;

}

/***************************************************/


private List<ILoad> ReadBarLoad(List<Loadcase> loadcases)
{
List<ILoad> bhLoads = new List<ILoad>();
Expand Down

0 comments on commit 2011ed3

Please sign in to comment.