/***************************************************/ /**** Private Methods ****/ /***************************************************/ private IFAttribute CreateSupport(Constraint6DOF constraint) { if (!Engine.Adapters.Lusas.Query.CheckIllegalCharacters(constraint.DescriptionOrName())) { return(null); } IFAttribute lusasSupport = null; if (d_LusasData.existsAttribute("Support", constraint.DescriptionOrName())) { lusasSupport = d_LusasData.getAttribute("Support", constraint.DescriptionOrName()); } else { lusasSupport = d_LusasData.createSupportStructural(constraint.DescriptionOrName()); List <string> releaseNames = new List <string> { "U", "V", "W", "THX", "THY", "THZ" }; List <double> stiffness = new List <double> { constraint.TranslationalStiffnessX, constraint.TranslationalStiffnessY, constraint.TranslationalStiffnessZ, constraint.RotationalStiffnessX, constraint.RotationalStiffnessY, constraint.RotationalStiffnessZ }; bool[] fixities = constraint.Fixities(); for (int i = 0; i < releaseNames.Count(); i++) { if (fixities[i]) { lusasSupport.setValue(releaseNames[i], "R"); } else if (stiffness[i] == 0) { lusasSupport.setValue(releaseNames[i], "F"); } else { lusasSupport.setValue(releaseNames[i], "S"); lusasSupport.setValue(releaseNames[i] + "stiff", stiffness[i]); } } } if (lusasSupport != null) { int adapterIdName = lusasSupport.getID(); constraint.SetAdapterId(typeof(LusasId), adapterIdName); return(lusasSupport); } return(null); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static Constraint6DOF ToConstraint6DOF(this IFSupportStructural lusasAttribute) { List <string> releaseNames = new List <string> { "U", "V", "W", "THX", "THY", "THZ" }; List <bool> fixity = new List <bool>(); List <double> stiffness = new List <double>(); foreach (string releaseName in releaseNames) { string fixityValue = lusasAttribute.getValue(releaseName); if (fixityValue == "F") { fixity.Add(false); stiffness.Add(0.0); } else if (fixityValue == "R") { fixity.Add(true); stiffness.Add(0.0); } else if (fixityValue == "S") { fixity.Add(false); double stiffnessValue = lusasAttribute.getValue(releaseName + "stiff"); stiffness.Add(stiffnessValue); } } string attributeName = GetName(lusasAttribute); Constraint6DOF constraint6DOF = BH.Engine.Structure.Create.Constraint6DOF( attributeName, fixity, stiffness); int adapterNameId = lusasAttribute.getID(); constraint6DOF.SetAdapterId(typeof(LusasId), adapterNameId); return(constraint6DOF); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ //Add methods for converting to BHoM from the specific software types. //Only do this if possible to do without any com-calls or similar to the adapter public static Constraint6DOF FromRFEM(this rf.NodalSupport rfConstraint) { Constraint6DOF bhConstraint = new Constraint6DOF(); //Translation if (rfConstraint.SupportConstantX == 0) { bhConstraint.TranslationX = DOFType.Free; } if (rfConstraint.SupportConstantX == -1) { bhConstraint.TranslationX = DOFType.Fixed; } else { bhConstraint.TranslationalStiffnessX = rfConstraint.SupportConstantX; } if (rfConstraint.SupportConstantY == 0) { bhConstraint.TranslationY = DOFType.Free; } if (rfConstraint.SupportConstantY == -1) { bhConstraint.TranslationY = DOFType.Fixed; } else { bhConstraint.TranslationalStiffnessY = rfConstraint.SupportConstantY; } if (rfConstraint.SupportConstantZ == 0) { bhConstraint.TranslationZ = DOFType.Free; } if (rfConstraint.SupportConstantZ == -1) { bhConstraint.TranslationZ = DOFType.Fixed; } else { bhConstraint.TranslationalStiffnessZ = rfConstraint.SupportConstantZ; } //Rotation if (rfConstraint.RestraintConstantX == 0) { bhConstraint.RotationX = DOFType.Free; } if (rfConstraint.RestraintConstantX == -1) { bhConstraint.RotationX = DOFType.Fixed; } else { bhConstraint.RotationalStiffnessX = rfConstraint.RestraintConstantX; } if (rfConstraint.RestraintConstantY == 0) { bhConstraint.RotationY = DOFType.Free; } if (rfConstraint.RestraintConstantY == -1) { bhConstraint.RotationY = DOFType.Fixed; } else { bhConstraint.RotationalStiffnessY = rfConstraint.RestraintConstantY; } if (rfConstraint.RestraintConstantZ == 0) { bhConstraint.RotationZ = DOFType.Free; } if (rfConstraint.RestraintConstantZ == -1) { bhConstraint.RotationZ = DOFType.Fixed; } else { bhConstraint.RotationalStiffnessZ = rfConstraint.RestraintConstantZ; } bhConstraint.SetAdapterId(typeof(RFEMId), rfConstraint.No); return(bhConstraint); }