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

Fix bug for BarRelease that did not pull correctly #366

Merged
merged 1 commit into from
Sep 13, 2023
Merged
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
42 changes: 37 additions & 5 deletions Lusas_Adapter/Convert/ToBHoM/Elements/ToBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,23 @@ public static Tuple<bool, double, BarRelease, BarFEAType> GetMeshProperties(IFLi

private static BarRelease GetBarRelease(IFMeshLine lusasLineMesh)
{
Constraint6DOF startConstraint = null;
Constraint6DOF endConstraint = null;

#if Debug200 || Release200

startConstraint = GetConstraint(lusasLineMesh, "Start");
endConstraint = GetConstraint(lusasLineMesh, "End");
#else
object[] startReleases = lusasLineMesh.getValue("start");
object[] endReleases = lusasLineMesh.getValue("end");
List<DOFType> startReleaseType = GetConstraints(startReleases);
List<DOFType> endReleaseType = GetConstraints(endReleases);

Constraint6DOF startConstraint = SetConstraint(startReleaseType);
Constraint6DOF endConstraint = SetConstraint(endReleaseType);
List<DOFType> startReleaseType = GetReleases(startReleases);
List<DOFType> endReleaseType = GetReleases(endReleases);

startConstraint = SetConstraint(startReleaseType);
endConstraint = SetConstraint(endReleaseType);
#endif

BarRelease barRelease = new BarRelease
{
Expand Down Expand Up @@ -198,7 +208,7 @@ private static Constraint6DOF SetConstraint(List<DOFType> releaseType)

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

private static List<DOFType> GetConstraints(object[] releases)
private static List<DOFType> GetReleases(object[] releases)
{

List<DOFType> releaseType = new List<DOFType>();
Expand Down Expand Up @@ -291,6 +301,28 @@ private static BarFEAType GetFEAType(object type)

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

// This method is required for Lusas v200 because the default method no longer works due to API changes, so each DOF must be requested individually
private static Constraint6DOF GetConstraint(IFMeshLine mesh, string location)
{
List<string> freedoms = new List<string>() { "U", "V", "W", "THX", "THY", "THZ" };
List<DOFType> dofs = new List<DOFType>();

foreach(string freedom in freedoms)
{
if (mesh.getEndRelease(location, freedom) == 0)
dofs.Add(DOFType.Free);
else
dofs.Add(DOFType.Fixed);
}

Constraint6DOF constraint = SetConstraint(dofs);

return constraint;
}


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

}
}

Expand Down