Exemplo n.º 1
0
        public ElementRAZ(Project _project, int _id, LineRAZ _line, CrossSection _crossSection, string _groupname, int _numberInHierarchy, double _rotationLCS)

        {
            this.project = _project;
            _project.elementRAZs.Add(this);
            this.id                = _id;
            this.line              = _line;
            this.crossSection      = _crossSection;
            this.groupname         = _groupname;
            this.numberInHierarchy = _numberInHierarchy;
            this.rotationLCS       = _rotationLCS;
        }
Exemplo n.º 2
0
        public ConnectingMember(ElementRAZ _elementRAZ, VectorRAZ _distancevector, bool _isStartPoint, LineRAZ _idealine, double _localEccentricity)
        {
            this.ElementRAZ     = _elementRAZ;
            this.distanceVector = _distancevector;
            this.isStartPoint   = _isStartPoint;
            this.ideaLine       = _idealine;

            this.localEccentricity = _localEccentricity;
        }
Exemplo n.º 3
0
        public BearingMember(ElementRAZ _elementRAZ, VectorRAZ _distancevector, bool _isStartPoint, LineRAZ _idealine, Nullable <bool> _isSingle = null)
        {
            this.ElementRAZ     = _elementRAZ;
            this.distanceVector = _distancevector;
            this.isStartPoint   = _isStartPoint;
            this.ideaLine       = _idealine;

            this.isSingle = _isSingle;
        }
Exemplo n.º 4
0
 public static int ShouldEccentricityBeAssumedPOSOrNEG(double tol, PointRAZ point, LineRAZ line)
 {
     if (PointRAZ.ArePointsEqual(tol, point, line.End) == true)
     {
         LineRAZ lijn2 = LineRAZ.FlipLineIfPointNotEqualStartPoint(tol, point, line);
         if (lijn2.vector.Z > 0)
         {
             return(-1);
         }
         else
         {
             return(1);
         }
     }
     else
     {
         if (line.vector.Z > 0)
         {
             return(-1);
         }
         else
         {
             return(1);
         }
     }
 }
Exemplo n.º 5
0
 public static LineRAZ FlipLine(LineRAZ line)
 {
     return(new LineRAZ(line.id, line.End, line.Start));
 }
Exemplo n.º 6
0
 /// <summary>
 /// In this method the startpoint of the line is compared to the point. IF ther are equal the original line is returned.
 /// If not the line will be flipped. Where startpoint and endpoint
 /// </summary>
 /// <param name="tol"></param>
 /// <param name="point"></param>
 /// <param name="line"></param>
 /// <returns></returns>
 public static LineRAZ FlipLineIfPointNotEqualStartPoint(double tol, PointRAZ point, LineRAZ line)
 {
     if (PointRAZ.ArePointsEqual(tol, point, line.Start) == true)
     {
         return(line);
     }
     else
     {
         return(new LineRAZ(line.id, line.End, line.Start));
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// All data is inventised and converted to seperate data needed to calculate individual joints
        /// </summary>
        /// <param name="tol">tolerance</param>
        /// <param name="eccentricity">eccentricity if specified</param>
        /// <param name="points">points in project</param>
        /// <param name="elementRAZs">elements of project</param>
        /// <param name="hierarchy">hierarchy if specified</param>
        public void CreateJoints(double tol, double eccentricity, List <PointRAZ> points, List <ElementRAZ> elementRAZs, List <Hierarchy> hierarchy)
        {
            double       tolbox = tol + eccentricity;
            List <Joint> joints = new List <Joint>();

            //iterate over all the points that represent centerpoints of the joint
            for (int i = 0; i < points.Count; i++)
            {
                PointRAZ         centerpoint         = points[i];
                List <VectorRAZ> eccentricityVectors = new List <VectorRAZ>();
                List <int>       elementIDs          = new List <int>();
                List <LineRAZ>   linesatcenter       = new List <LineRAZ>();

                List <AttachedMember> attachedMemTemp = new List <AttachedMember>();
                List <AttachedMember> attachedMembers = new List <AttachedMember>();

                //1. DEFINE JOINTS
                //iterate over all lines in project
                foreach (ElementRAZ element in elementRAZs)
                {
                    //STARTPoints
                    //If fromPoints or startPoints of line fall in the tolerancebox than add lines.
                    if (PointRAZ.ArePointsEqual(tolbox, centerpoint, element.line.Start) && element.line.vector.length > tolbox)
                    {
                        LineRAZ   line             = element.line;
                        VectorRAZ distancevector   = new VectorRAZ(0.0, 0.0, 0.0);
                        double    localEccnetricty = 0.0;

                        ConnectingMember connectingMember = new ConnectingMember(element, distancevector, true, line, localEccnetricty);

                        elementIDs.Add(elementRAZs.IndexOf(element));
                        attachedMemTemp.Add(connectingMember);
                    }
                    //ENDPoints
                    //If toPoints or endPoints of line fall in the tolerancebox than add lines.
                    if (PointRAZ.ArePointsEqual(tolbox, centerpoint, element.line.End) && element.line.vector.length > tolbox)
                    {
                        LineRAZ   idealine         = LineRAZ.FlipLine(element.line);//in this case of endpoint line needs to be flipped
                        VectorRAZ distancevector   = new VectorRAZ(0.0, 0.0, 0.0);
                        double    localEccnetricty = 0.0;

                        ConnectingMember connectingMember = new ConnectingMember(element, distancevector, false, idealine, localEccnetricty);

                        elementIDs.Add(elementRAZs.IndexOf(element));
                        attachedMemTemp.Add(connectingMember);
                    }
                }


                //2. ORDER ATTACHEDMEMBERS ACCORDING TO HIERARCHY

                bool IsContinues = true;
                //Redistribute attachedMemTemp over BearingMember and ConnectingMember
                //iterate over hierarchy rank to make sure list is created in a orded way
                if (!hierarchy.Any())
                {
                    //no hierarchy, first member found is an ended bearing member
                    IsContinues = false;
                    //First member is bearing
                    AttachedMember w       = attachedMemTemp.First();
                    BearingMember  bearing = new BearingMember(w.ElementRAZ, w.distanceVector, w.isStartPoint, w.ideaLine);
                    attachedMembers.Add(bearing);
                    //Rest of members are connecting members
                    for (int b = 1; b < attachedMemTemp.Count; b++)
                    {
                        attachedMembers.Add(attachedMemTemp[b]);
                    }
                }
                else
                {
                    //hierarchy determined, list will be build based on hierarchy
                    //TODE add code
                    //If only one hierarchy entry defined
                    if (hierarchy.Count == 1)
                    {
                        IsContinues = false;
                        //First member is bearing
                        AttachedMember w       = attachedMemTemp.First();
                        BearingMember  bearing = new BearingMember(w.ElementRAZ, w.distanceVector, w.isStartPoint, w.ideaLine);
                        attachedMembers.Add(bearing);
                        //Rest of members are connecting members
                        for (int b = 1; b < attachedMemTemp.Count; b++)
                        {
                            attachedMembers.Add(attachedMemTemp[b]);
                        }
                    }
                    else
                    {
                        for (int rank = 0; rank < 1 + hierarchy.Max(a => a.numberInHierarchy); rank++)
                        {
                            //iterate over attachedMembers of every joint
                            //List<AttachedMember> templist = new List<AttachedMember>();

                            for (int ibb = 0; ibb < attachedMemTemp.Count; ibb++)
                            {
                                AttachedMember w = attachedMemTemp[ibb];
                                //if hierarchy if the highest occuring
                                if (w.ElementRAZ.numberInHierarchy == rank && rank == attachedMemTemp.Min(a => a.ElementRAZ.numberInHierarchy))
                                {
                                    BearingMember bearing = new BearingMember(w.ElementRAZ, w.distanceVector, w.isStartPoint, w.ideaLine);
                                    attachedMembers.Add(bearing);
                                }
                                if (w.ElementRAZ.numberInHierarchy == rank && rank != attachedMemTemp.Min(a => a.ElementRAZ.numberInHierarchy))
                                {
                                    attachedMembers.Add(w);
                                    //temp
                                    //templist.Add(attachedMemTemp[ibb]);
                                }
                            }
                        }
                    }


                    //If there is more than one Bearing Member, IsContinues joint
                    List <BearingMember> BM = attachedMembers.OfType <BearingMember>().ToList();

                    if (BM.Count == 1)
                    {
                        IsContinues = false;
                    }
                }

                //3. ADD JOINTS TO PROJECT
                //CREATE JOINT ADD TO PROJECT
                //Joint id starts from one, because IDEA counts from one
                double    maxGlobalEccentricity = 0.0;
                bool      WEJ = false;
                VectorRAZ bearingMemberUnitVector = new VectorRAZ(1.0, 0.0, 0.0);
                Joint     joint = new Joint(this, i + 1, elementIDs, attachedMembers, centerpoint, maxGlobalEccentricity, WEJ, bearingMemberUnitVector, IsContinues);
                this.joints.Add(joint);
            }
        }