public static List <ICurve> Visualize(this PointDisplacement pointDisplacement, double scaleFactor = 1.0, bool displayTranslations = true, bool displayRotations = true, bool asResultants = true) { if (pointDisplacement.IsNull()) { return(null); } List <ICurve> arrows = new List <ICurve>(); Vector forceVec = pointDisplacement.Translation * scaleFactor * 1000; Vector momentVec = pointDisplacement.Rotation * scaleFactor * 1000; foreach (Node node in pointDisplacement.Objects.Elements) { if (displayTranslations) { arrows.AddRange(Arrows(node.Position, forceVec, true, asResultants)); } if (displayRotations) { arrows.AddRange(Arrows(node.Position, momentVec, false, asResultants)); } } return(arrows); }
/***************************************************/ private bool CreateLoad(PointDisplacement bhLoad) { List <Node> nodes = bhLoad.Objects.Elements.ToList(); string loadPat = GetAdapterId <string>(bhLoad.Loadcase); string cSys = bhLoad.Axis.ToCSI(); double[] val = { bhLoad.Translation.X, bhLoad.Translation.Y, bhLoad.Translation.Z, bhLoad.Rotation.X, bhLoad.Rotation.Y, bhLoad.Rotation.Z, }; bool replace = SAPPushConfig.ReplaceLoads; foreach (Node bhNode in nodes) { if (m_model.PointObj.SetLoadDispl(GetAdapterId <string>(bhNode), loadPat, ref val, replace, cSys, eItemType.Objects) != 0) { CreateElementError("Point Displacement", bhLoad.Name); } } SetAdapterId(bhLoad, null); return(true); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static PointDisplacement ToPointDisplacement(IFLoading lusasPrescribedDisplacement, IEnumerable <IFAssignment> lusasAssignments, Dictionary <string, Node> nodes) { IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset(); Loadcase loadcase = ToLoadcase(assignedLoadcase); IEnumerable <Node> assignedNodes = GetPointAssignments(lusasAssignments, nodes); Vector translationVector = new Vector { X = lusasPrescribedDisplacement.getValue("U"), Y = lusasPrescribedDisplacement.getValue("V"), Z = lusasPrescribedDisplacement.getValue("W") }; Vector rotationVector = new Vector { X = lusasPrescribedDisplacement.getValue("THX"), Y = lusasPrescribedDisplacement.getValue("THY"), Z = lusasPrescribedDisplacement.getValue("THZ") }; PointDisplacement pointDisplacement = BH.Engine.Structure.Create.PointDisplacement( loadcase, assignedNodes, translationVector, rotationVector, LoadAxis.Global, GetName(lusasPrescribedDisplacement)); int adapterNameId = lusasPrescribedDisplacement.getID(); pointDisplacement.SetAdapterId(typeof(LusasId), adapterNameId); // Needs to be a bit here that determines whether it is global or local - actually this cannot be done as the //attribute is applied to a group, and within the group the axis could local or global return(pointDisplacement); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private IFPrescribedDisplacementLoad CreatePrescribedDisplacement(PointDisplacement pointDisplacement, object[] lusasPoints) { IFPrescribedDisplacementLoad lusasPrescribedDisplacement; IFLoadcase assignedLoadcase = (IFLoadcase)d_LusasData.getLoadset(pointDisplacement.Loadcase.AdapterId <int>(typeof(LusasId))); if (d_LusasData.existsAttribute("Loading", pointDisplacement.Name)) { lusasPrescribedDisplacement = (IFPrescribedDisplacementLoad)d_LusasData.getAttribute("Loading", pointDisplacement.Name); } else { List <string> valueNames = new List <string> { "u", "v", "w", "thx", "thy", "thz" }; List <string> boolCheck = new List <string> { "haveDispX", "haveDispY", "haveDispZ", "haveRotX", "haveRotY", "haveRotZ" }; List <double> displacements = new List <double> { pointDisplacement.Translation.X, pointDisplacement.Translation.Y, pointDisplacement.Translation.Z, pointDisplacement.Rotation.X, pointDisplacement.Rotation.Y, pointDisplacement.Rotation.Z }; lusasPrescribedDisplacement = d_LusasData.createPrescribedDisplacementLoad( pointDisplacement.Name, "Total"); for (int i = 0; i < valueNames.Count(); i++) { if (!(displacements[i] == 0)) { lusasPrescribedDisplacement.setValue(boolCheck[i], true); lusasPrescribedDisplacement.setValue(valueNames[i], displacements[i]); } else { lusasPrescribedDisplacement.setValue(boolCheck[i], false); } } } IFAssignment lusasAssignment = m_LusasApplication.assignment(); lusasAssignment.setLoadset(assignedLoadcase); lusasPrescribedDisplacement.assignTo(lusasPoints, lusasAssignment); int adapterIdName = lusasPrescribedDisplacement.getID(); pointDisplacement.SetAdapterId(typeof(LusasId), adapterIdName); return(lusasPrescribedDisplacement); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private List <ILoad> ReadPointDisplacements(List <string> ids = null) { List <ILoad> pointDisplacements = new List <ILoad>(); object[] lusasPrescribedDisplacements = d_LusasData.getAttributes("Prescribed Load"); if (!(lusasPrescribedDisplacements.Count() == 0)) { List <Node> nodesList = ReadNodes(); Dictionary <string, Node> nodes = nodesList.ToDictionary( x => x.AdapterId <string>(typeof(LusasId))); List <IFLoadcase> allLoadcases = new List <IFLoadcase>(); for (int i = 0; i < lusasPrescribedDisplacements.Count(); i++) { IFLoading lusasPrescribedDisplacement = (IFLoading)lusasPrescribedDisplacements[i]; IEnumerable <IGrouping <string, IFAssignment> > groupedByLoadcases = GetLoadAssignments(lusasPrescribedDisplacement); foreach (IEnumerable <IFAssignment> groupedAssignment in groupedByLoadcases) { PointDisplacement pointDisplacement = Adapters.Lusas.Convert.ToPointDisplacement( lusasPrescribedDisplacement, groupedAssignment, nodes); List <string> analysisName = new List <string> { lusasPrescribedDisplacement.getAttributeType() }; pointDisplacement.Tags = new HashSet <string>(analysisName); pointDisplacements.Add(pointDisplacement); } } } return(pointDisplacements); }
public static LoadType LoadType(this PointDisplacement load) { return(oM.Structure.Loads.LoadType.PointDisplacement); }