/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static Bar FromRFEM(this rf.Member member, rf.Line line, ISectionProperty sectionProperty) { rf.Point3D sPt = line.ControlPoints.First(); rf.Point3D ePt = line.ControlPoints.Last(); BH.oM.Geometry.Line ln = new oM.Geometry.Line() { Start = new oM.Geometry.Point() { X = sPt.X, Y = sPt.Y, Z = sPt.Z }, End = new oM.Geometry.Point() { X = ePt.X, Y = ePt.Y, Z = ePt.Z } }; Bar bhBar = BH.Engine.Structure.Create.Bar(ln, sectionProperty, member.Rotation.Angle); bhBar.SetAdapterId(typeof(RFEMId), member.No); return(bhBar); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private List <RigidLink> ReadLinks(List <string> ids = null) { List <RigidLink> linkList = new List <RigidLink>(); rf.Line line; if (ids == null) { rf.Member[] allLinks = modelData.GetMembers().Where(x => (x.Type == rf.MemberType.Rigid) | (x.Type == rf.MemberType.CouplingHingeHinge) | (x.Type == rf.MemberType.CouplingHingeRigid) | (x.Type == rf.MemberType.CouplingRigidHinge) | (x.Type == rf.MemberType.CouplingRigidRigid)).ToArray(); foreach (rf.Member link in allLinks) { line = modelData.GetLine(link.LineNo, rf.ItemAt.AtNo).GetData(); rf.Point3D sPt = line.ControlPoints.First(); rf.Point3D ePt = line.ControlPoints.Last(); Node startNode = new Node { Position = new oM.Geometry.Point() { X = sPt.X, Y = sPt.Y, Z = sPt.Z } }; Node endNode = new Node { Position = new oM.Geometry.Point() { X = ePt.X, Y = ePt.Y, Z = ePt.Z } }; RigidLink bhLink = new RigidLink { PrimaryNode = startNode, SecondaryNodes = new List <Node> { endNode } }; if (link.StartHingeNo == 0 && link.EndHingeNo == 0) { //no hinges set, then all fixed bhLink.Constraint = Engine.Structure.Create.LinkConstraintFixed(); } else { Engine.Base.Compute.RecordWarning("Hinges on Rigid links are not supported. See member No. " + link.No.ToString()); } bhLink.SetAdapterId(typeof(RFEMId), link.No); linkList.Add(bhLink); } } else { foreach (string id in ids) { rf.Member link = modelData.GetMember(Int32.Parse(id), rf.ItemAt.AtNo).GetData(); if (link.Type != rf.MemberType.Rigid | link.Type != rf.MemberType.CouplingHingeHinge | link.Type != rf.MemberType.CouplingHingeRigid | link.Type != rf.MemberType.CouplingRigidHinge | link.Type != rf.MemberType.CouplingRigidRigid) { continue; } line = modelData.GetLine(link.LineNo, rf.ItemAt.AtNo).GetData(); rf.Point3D sPt = line.ControlPoints.First(); rf.Point3D ePt = line.ControlPoints.Last(); Node startNode = new Node { Position = new oM.Geometry.Point() { X = sPt.X, Y = sPt.Y, Z = sPt.Z } }; Node endNode = new Node { Position = new oM.Geometry.Point() { X = ePt.X, Y = ePt.Y, Z = ePt.Z } }; RigidLink bhLink = new RigidLink { PrimaryNode = startNode, SecondaryNodes = new List <Node> { endNode } }; if (link.StartHingeNo == 0 && link.EndHingeNo == 0) { //no hinges set, then all fixed bhLink.Constraint.XtoX = true; bhLink.Constraint.YtoY = true; bhLink.Constraint.ZtoZ = true; bhLink.Constraint.XXtoXX = true; bhLink.Constraint.YYtoYY = true; bhLink.Constraint.ZZtoZZ = true; } else { Engine.Base.Compute.RecordWarning("Hinges on Rigid links are not supported. See member No. " + link.No.ToString()); } bhLink.SetAdapterId(typeof(RFEMId), link.No); linkList.Add(bhLink); } } return(linkList); }