コード例 #1
0
ファイル: BeamHelpers.cs プロジェクト: yuominae/STAADModel
        /// <summary>
        /// Gather beams which provide continuity with the specified beam
        /// </summary>
        /// <param name="Beam">The start beam around which to contruct the chain</param>
        /// <returns></returns>
        public static IEnumerable<Beam> GatherParallelBeams(Beam Beam, Node LastNode = null, bool MoveDownstream = false)
        {
            Node currentNode;
            Beam nextBeam;
            IEnumerable<Beam> connectedParallelBeams;
            HashSet<Beam> parallelBeams;

            parallelBeams = new HashSet<Beam>();
            if (MoveDownstream)
                parallelBeams.Add(Beam);

            // Determine which will be the next node depending on the beam orientation and direction of travel
            currentNode = BeamHelpers.DetermineNextNode(Beam, LastNode, MoveDownstream);

            // Check if the are any parallel beams among the connected beams and start gathering the beams depending on the direction of travel
            connectedParallelBeams = currentNode.ConnectedBeams.Where(b => b != null && b != Beam && b.DetermineBeamRelationship(Beam) == BEAMRELATION.PARALLEL);
            if (connectedParallelBeams.Any())
            {
                nextBeam = connectedParallelBeams.First();
                parallelBeams.UnionWith(GatherParallelBeams(nextBeam, currentNode, MoveDownstream));
            }
            else
            {
                if (!MoveDownstream)
                    parallelBeams.UnionWith(GatherParallelBeams(Beam, currentNode, true));
            }

            return parallelBeams;
        }
コード例 #2
0
ファイル: MemberHelpers.cs プロジェクト: yuominae/STAADModel
        /// <summary>
        /// Gather member which provide continuity with the specified member
        /// </summary>
        /// <param name="Member"></param>
        /// <returns></returns>
        public static IEnumerable<Member> GatherParallelMembers(Member Member, Node LastNode = null, bool MoveDownstream = false)
        {
            Node currentNode;
            Member nextMember;
            IEnumerable<Member> connectedParallelMembers;
            HashSet<Member> parallelMembers;

            parallelMembers = new HashSet<Member>();
            if (MoveDownstream)
                parallelMembers.Add(Member);

            // Determine which will be the next node
            currentNode = MemberHelpers.DetermineNextNode(Member, LastNode, MoveDownstream);

            connectedParallelMembers = currentNode.ConnectedBeams.Select(b => b.Member).Where(m => m != null && m != Member && m.DetermineMemberRelation(Member) == MEMBERRELATION.PARALLEL);
            if (connectedParallelMembers.Any())
            {
                nextMember = connectedParallelMembers.First();
                parallelMembers.UnionWith(GatherParallelMembers(nextMember, currentNode, MoveDownstream));
            }
            else
            {
                if (!MoveDownstream)
                    parallelMembers.UnionWith(GatherParallelMembers(Member, currentNode, true));
            }

            return parallelMembers;
        }
コード例 #3
0
ファイル: Beam.cs プロジェクト: yuominae/STAADModel
 public Beam(int Number, Node StartNode, Node EndNode)
     : this()
 {
     this.ID = Number;
     this.StartNode = StartNode;
     this.EndNode = EndNode;
     this.GenerateLocalAxes();
 }
コード例 #4
0
ファイル: Member.cs プロジェクト: yuominae/STAADModel
        public Member(int ID, Node StartNode, Node EndNode, List<Beam> Beams)
        {
            this.ID = ID;
            this.StartNode = StartNode;
            this.EndNode = EndNode;
            this.Type = MEMBERTYPE.OTHER;

            this.SortBeamsAndNodes(Beams);
            this.Beams.ForEach(b => b.Member = this);
        }
コード例 #5
0
ファイル: BeamHelpers.cs プロジェクト: yuominae/STAADModel
        /// <summary>
        /// Determine the next node to go to on the specified beam, depending on which the last node was
        /// </summary>
        /// <param name="Beam">The beam to inspect</param>
        /// <param name="LastNode">The previously visited node</param>
        /// <param name="MoveDownstream">The direction in which to move along the beam</param>
        /// <returns>The next node</returns>
        public static Node DetermineNextNode(Beam Beam, Node LastNode = null, bool MoveDownstream = false)
        {
            Node currentNode;

            // Determine which will be the next node depending on the beam orientation and direction of travel
            if (MoveDownstream)
            {
                currentNode = Beam.EndNode;
                if (LastNode != null && LastNode == Beam.EndNode)
                    currentNode = Beam.StartNode;
            }
            else
            {
                currentNode = Beam.StartNode;
                if (LastNode != null && LastNode == Beam.StartNode)
                    currentNode = Beam.EndNode;
            }

            return currentNode;
        }
コード例 #6
0
ファイル: Node.cs プロジェクト: yuominae/STAADModel
        public bool Equals(Node n)
        {
            if ((object)n == null)
                return false;

            return this.ID == n.ID;
        }
コード例 #7
0
        /// <summary>
        /// Gather all members within the specified chain which connect between two primary members, centred on the specified member
        /// </summary>
        /// <param name="Member">The member on which to base the chain</param>
        /// <param name="ParallelMembers">All the members which provide continuity with the specified member</param>
        /// <param name="LastNode">The last visited node (leave blank at the start)</param>
        /// <param name="MoveDownstream">The direction in which to move next (leave blank at start)</param>
        /// <returns>A list of parallel members spanning between two primary members</returns>
        private IEnumerable<Member> GatherMembersBetweenPrimaryMembers(Member Member, IEnumerable<Member> ParallelMembers, Node LastNode = null, bool MoveDownstream = false)
        {
            bool endHere;
            Node currentNode;
            Member nextMember;
            HashSet<Member> members;

            members = new HashSet<Member>() { Member };

            // Determine the next node depending on the beam orientation with regards to the direction of travel
            currentNode = MemberHelpers.DetermineNextNode(Member, LastNode, MoveDownstream);

            // Check if the member is connected to a primary member
            endHere = currentNode.ConnectedBeams.Any(b => this.PrimaryBeams.Contains(b));

            // Get the next member
            nextMember = null;
            if (!endHere)
            {
                if (!currentNode.ConnectedMembers.Intersect(ParallelMembers).Where(m => m != Member).Any())
                    nextMember = null;
                else
                    nextMember = currentNode.ConnectedMembers.Intersect(ParallelMembers).First(m => m != Member);
            }
            endHere = nextMember == null;

            if (endHere)
            {
                if (!MoveDownstream)
                    members.UnionWith(this.GatherMembersBetweenPrimaryMembers(Member, ParallelMembers, currentNode, true));
            }
            else
            {
                IEnumerable<Member> output = this.GatherMembersBetweenPrimaryMembers(nextMember, ParallelMembers, currentNode, MoveDownstream);
                if (MoveDownstream)
                    members.UnionWith(output);
            }

            return members;
        }
コード例 #8
0
        /// <summary>
        /// Gather member which provide continuity with the specified member, i.e. are parallel and unreleased, between columns.
        /// </summary>
        /// <param name="Member"></param>
        /// <returns></returns>
        private IEnumerable<Member> GatherMembersBetweenColumns(Member Member, IEnumerable<Member> ParallelMembers, Node LastNode = null, bool MoveDownstream = false)
        {
            bool endHere;
            Node currentNode;
            Beam nextBeam;
            Member nextMember;
            List<Member> members;

            members = new List<Member>() {Member};

            // Determine the next node depending on the beam orientation with regards to the direction of travel
            currentNode = MemberHelpers.DetermineNextNode(Member, LastNode, MoveDownstream);

            // Check if the member is released
            endHere = currentNode.ConnectedBeams.Intersect(Member.Beams).Any(b => b.HasReleases);

            // Get the next member
            nextMember = null;
            if (!endHere)
            {
                if (!currentNode.ConnectedMembers.Intersect(ParallelMembers).Where(m => m != Member).Any())
                    nextMember = null;
                else
                    nextMember = currentNode.ConnectedMembers.Intersect(ParallelMembers).First(m => m != Member);
            }
            endHere = nextMember == null;

            // Get the next beam
            nextBeam = nextMember == null ? null : currentNode.ConnectedBeams.Intersect(nextMember.Beams).First();

            // Check if the next Beam is released right after the current node
            if (!endHere)
                endHere = currentNode == nextBeam.StartNode ? nextBeam.StartRelease.IsReleased : nextBeam.EndRelease.IsReleased;

            // Check if the member connects to a column
            if (!endHere && currentNode.ConnectedMembers.Any(m => m.Type == MEMBERTYPE.COLUMN))
                if (nextBeam != null && nextBeam.SectionProperty != currentNode.ConnectedBeams.Intersect(Member.Beams).First().SectionProperty)
                    endHere = true;

            // Determine what to do depending on whether or not the chain stop here. if moving upstream, reverse and start gathering beams,
            // if moving upstream, return the chain.
            if (endHere)
            {
                if (!MoveDownstream)
                    members.AddRange(this.GatherMembersBetweenColumns(Member, ParallelMembers, currentNode, true));
            }
            else
            {
                IEnumerable<Member> output = this.GatherMembersBetweenColumns(nextMember, ParallelMembers, currentNode, MoveDownstream);
                if (MoveDownstream)
                    members.AddRange(output);
            }

            return new HashSet<Member>(members).ToList();
        }
コード例 #9
0
        /// <summary>
        /// Determine whether or not a brace is considered as restrained. A restrained brace is one that connects directly to a column or to a primary member.
        /// </summary>
        /// <param name="StartBrace">The brace from which to start the chain</param>
        /// <param name="CheckedNodes">The chain of nodes that have already been checked (leave null to start)</param>
        /// <param name="LastNode">The last checked node (leave null to start)</param>
        /// <param name="MoveDownstream">The direction in which to proceed with the checks (true to move away from end to start node of the first beam, false to move in teh other direction)</param>
        /// <returns>The chain of restrained braces</returns>
        public bool CheckBraceRestraint(Beam StartBrace, HashSet<Node> CheckedNodes = null, Node LastNode = null, bool MoveDownstream = false)
        {
            bool output;
            Node currentNode;

            if (CheckedNodes == null)
                CheckedNodes = new HashSet<Node>();

            // Determine which will be the next node depending on the beam orientation and direction of travel
            currentNode = BeamHelpers.DetermineNextNode(StartBrace, LastNode, MoveDownstream);

            output = false;

            if (!CheckedNodes.Contains(currentNode))
            {
                CheckedNodes.Add(currentNode);
                if (currentNode.ConnectedBeams.Any(b => this.PrimaryBeams.Contains(b))
                    || currentNode.ConnectedMembers.SelectMany(m => m.Nodes).Any(n => n.ConnectedMembers.Any(m => m.Type == MEMBERTYPE.COLUMN)))
                    output = true;
                else
                {
                    IEnumerable<Beam> nextBraces = currentNode.ConnectedBeams.Where(b => b != StartBrace && b.Spec == BEAMSPEC.MEMBERTRUSS);
                    if (nextBraces.Any())
                    {
                        foreach (Beam brace in nextBraces)
                        {
                            if (output = this.CheckBraceRestraint(brace, CheckedNodes, currentNode, MoveDownstream))
                                break;
                        }
                    }
                    else
                        if (!MoveDownstream)
                            output = this.CheckBraceRestraint(StartBrace, CheckedNodes, currentNode, true);
                }
            }

            return output;
        }
コード例 #10
0
ファイル: StaadModel.cs プロジェクト: yuominae/STAADModel
        private NodeDisplacements GetNodeDisplacements(Node Node, ILoadCase LoadCase)
        {
            NodeDisplacements nodeDisplacements;
            dynamic displacements;

            displacements = new double[6];
            this.Staad.Output.GetNodeDisplacements(Node.ID, LoadCase.ID, ref displacements);

            nodeDisplacements = new NodeDisplacements()
            {
                x = displacements[0],
                y = displacements[1],
                z = displacements[2],
                rx = displacements[3],
                ry = displacements[4],
                rz = displacements[5],
                Node = Node,
                LoadCase = LoadCase
            };

            return nodeDisplacements;
        }