Beispiel #1
0
        private bool CheckMemberRestraint(Member MemberToCheck, Beam StartBeam, MEMBERCLASS MemberClass)
        {
            bool output = false;

            // Gather all nodes connected to the beam to check or any beams parallel to it
            var nodes = new HashSet <Node>(BeamHelpers.GatherParallelBeams(StartBeam).SelectMany(b => new List <Node>()
            {
                b.StartNode, b.EndNode
            }));

            // Check if any of the connected members are class above the current member
            var connectedMembers = nodes.SelectMany(n => n.ConnectedMembers).Where(m => m != null && m != MemberToCheck);

            if (MemberClass == MEMBERCLASS.PRIMARY)
            {
                output = connectedMembers.Any(m => this.PrimaryMembers.Contains(m));
            }
            else if (MemberClass == MEMBERCLASS.SECONDARY)
            {
                output = connectedMembers.Any(m => this.PrimaryMembers.Contains(m) || this.SecondaryMembers.Contains(m));
            }
            else if (MemberClass == MEMBERCLASS.TERTIARY)
            {
                output = connectedMembers.Any(m => this.PrimaryMembers.Contains(m) || this.SecondaryMembers.Contains(m) || this.TertiaryMembers.Contains(m));
            }

            return(output);
        }
Beispiel #2
0
        /// <summary>
        /// Classify the beams in the model accordin to their specifications
        /// </summary>
        void ClassifyBeams()
        {
            const string   status = "Classifying beams...";
            int            beamsProcessed;
            int            totalBeamToProcess;
            HashSet <Beam> beamsToProcess;

            beamsToProcess     = new HashSet <Beam>(this.Beams);
            beamsProcessed     = 0;
            totalBeamToProcess = beamsToProcess.Count;

            // Any vertical beam attached directly to a support node is a column
            Parallel.ForEach(beamsToProcess.Where(b => (b.StartNode.IsSupport || b.EndNode.IsSupport) && (this.ZAxisUp ? b.IsParallelToZ : b.IsParallelToY)), beam =>
            {
                foreach (var parallelBeam in BeamHelpers.GatherParallelBeams(beam))
                {
                    parallelBeam.Type = BeamType.COLUMN;
                    this.OnModelBuildStatusUpdate(new ModelBuildStatusUpdateEventArgs(status, Interlocked.Increment(ref beamsProcessed), totalBeamToProcess));
                }
            });
            beamsToProcess.RemoveWhere(b => b.Type == BeamType.COLUMN);

            // Classify all remaining beams
            // If a beam is vertical and not a column, then it is a post, otehrwise it is a beam
            // All other beams are classified as braces
            Parallel.ForEach(beamsToProcess, beam =>
            {
                if (beam.Spec == BeamSpec.Unspecified)
                {
                    if ((this.ZAxisUp && beam.IsParallelToZ) || !this.ZAxisUp && beam.IsParallelToY)
                    {
                        beam.Type = BeamType.POST;
                    }
                    else
                    {
                        beam.Type = BeamType.BEAM;
                    }
                }
                else
                {
                    beam.Type = BeamType.BRACE;
                }

                this.OnModelBuildStatusUpdate(new ModelBuildStatusUpdateEventArgs(status, Interlocked.Increment(ref beamsProcessed), totalBeamToProcess));
            });
        }
Beispiel #3
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)
        {
            if (CheckedNodes == null)
            {
                CheckedNodes = new HashSet <Node>();
            }

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

            bool 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
                {
                    var nextBraces = currentNode.ConnectedBeams.Where(b => b != StartBrace && b.Spec == BeamSpec.MemberTruss);

                    if (nextBraces.Any())
                    {
                        foreach (var brace in nextBraces)
                        {
                            if (output = this.CheckBraceRestraint(brace, CheckedNodes, currentNode, MoveDownstream))
                            {
                                break;
                            }
                        }
                    }
                    else if (!MoveDownstream)
                    {
                        output = this.CheckBraceRestraint(StartBrace, CheckedNodes, currentNode, true);
                    }
                }
            }

            return(output);
        }