Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Set Get Point Displacement Loads #467

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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