Skip to content

Commit

Permalink
Add new method to deal with BarRelease for Lusas200 using preprocesso…
Browse files Browse the repository at this point in the history
…r directives
  • Loading branch information
peterjamesnugent committed Sep 13, 2023
1 parent 99731ee commit ce23995
Showing 1 changed file with 37 additions and 5 deletions.
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

0 comments on commit ce23995

Please sign in to comment.