Пример #1
0
        public void E_Raud_Init_test3()
        {
            G.Point start  = new G.Point(6.0, 2.0);
            G.Point mainp  = start.move(5, new G.Vector(1, -1));
            G.Point side1p = start.move(10, new G.Vector(1, 0));
            G.Point side2p = mainp.move(15, new G.Vector(1, 0));

            G.Line main  = new G.Line(start, mainp);
            G.Line side1 = new G.Line(side1p, start);
            G.Line side2 = new G.Line(mainp, side2p);

            R.E_Raud reinf = new R.E_Raud(main, side1, side2, 2, 8, "B500B");

            Assert.AreEqual(reinf.StartPoint.X, 6.0, 0.001);
            Assert.AreEqual(reinf.StartPoint.Y, 2.0, 0.001);
            Assert.AreEqual(reinf.Rotation, Math.PI + 3 * Math.PI / 4, 0.001);

            Assert.AreEqual(reinf.A, 10, 0.001);
            Assert.AreEqual(reinf.B, 5, 0.001);
            Assert.AreEqual(reinf.C, 15, 0.001);
            Assert.AreEqual(reinf.U, 3 * Math.PI / 4, 0.001);
            Assert.AreEqual(reinf.V, Math.PI / 4, 0.001);
            Assert.AreEqual(reinf.X, 7.071, 0.001);
            Assert.AreEqual(reinf.Y, 10.606, 0.001);

            Assert.AreEqual(reinf.Length, 30, 0.001);
            Assert.AreEqual(reinf.Diameter, 8, 0.001);
            Assert.AreEqual(reinf.Materjal, "B500B");
        }
Пример #2
0
        public static E_Raud mergeTwoRebar_long(C_Raud one, C_Raud two)
        {
            G.Point a = one._SidePoint;
            G.Point b = one.StartPoint;
            G.Point c = two.StartPoint;
            G.Point d = two._EndPoint;

            G.Line temp1 = new G.Line(a, b);
            G.Line main  = new G.Line(b, c);
            G.Line temp2 = new G.Line(c, d);

            double s1  = temp1.Length();
            double s2  = temp2.Length();
            double max = Math.Max(s1, s2);

            G.Vector v1 = (-1) * temp1.getDirectionVector();
            G.Vector v2 = temp2.getDirectionVector();

            G.Point new_a = b.move(max, v1);
            G.Point new_d = c.move(max, v2);

            G.Line side1 = new G.Line(new_a, b);
            G.Line side2 = new G.Line(c, new_d);

            E_Raud raud = new E_Raud(main, side1, side2, one.Number, one.Diameter, one.Materjal);

            return(raud);
        }
Пример #3
0
        public static E_Raud mergeTwoRebar(C_Raud one, C_Raud two)
        {
            G.Point a = one._SidePoint;
            G.Point b = one.StartPoint;
            G.Point c = two.StartPoint;
            G.Point d = two._EndPoint;

            G.Line side1 = new G.Line(a, b);
            G.Line main  = new G.Line(b, c);
            G.Line side2 = new G.Line(c, d);

            E_Raud raud = new E_Raud(main, side1, side2, one.Number, one.Diameter, one.Materjal);

            return(raud);
        }
Пример #4
0
        public void E_Raud_class_test()
        {
            G.Point start  = new G.Point(0.0, 0.0);
            G.Point mainp  = start.move(5, new G.Vector(1, 0));
            G.Point side1p = start.move(10.0, new G.Vector(0, 1));
            G.Point side2p = mainp.move(15, new G.Vector(0, 1));

            G.Line main  = new G.Line(start, mainp);
            G.Line side1 = new G.Line(side1p, start);
            G.Line side2 = new G.Line(mainp, side2p);

            R.E_Raud reinf = new R.E_Raud(main, side1, side2, 2, 8, "B500B");

            Assert.IsTrue(reinf is R.Raud);
            Assert.IsTrue(reinf is R.E_Raud);
        }
Пример #5
0
        public bool Equals(E_Raud other)
        {
            if (other == null)
            {
                return(false);
            }

            bool alfa = (this.A == other.A &&
                         this.B2 == other.B2 && // parand magic
                         this.C == other.C &&
                         this.Diameter == other.Diameter &&
                         this.Materjal == other.Materjal);

            bool a1 = (int)Math.Round(G.Converter.ToDeg(this.U), 0) == (int)Math.Round(G.Converter.ToDeg(this.U), 0) && (int)Math.Round(G.Converter.ToDeg(this.V), 0) == (int)Math.Round(G.Converter.ToDeg(this.V), 0);
            bool a2 = (int)Math.Round(G.Converter.ToDeg(this.U), 0) == (int)Math.Round(G.Converter.ToDeg(this.V), 0) && (int)Math.Round(G.Converter.ToDeg(this.V), 0) == (int)Math.Round(G.Converter.ToDeg(this.U), 0);

            bool tot = alfa && (a1 || a2);

            return(tot);
        }
Пример #6
0
        private void setBendingBlockParameters(_Db.AttributeReference ar, R.Raud _ALFA_)
        {
            if (ar != null)
            {
                if (ar.Tag == "Teraseklass")
                {
                    ar.TextString = _ALFA_.Materjal.ToString();
                }
                if (ar.Tag == "Positsioon")
                {
                    ar.TextString = _ALFA_.ToStringNoCount();
                }

                if (_ALFA_ is R.A_Raud)
                {
                    R.A_Raud _BETA_ = _ALFA_ as R.A_Raud;
                    if (ar.Tag == "A")
                    {
                        ar.TextString = _BETA_.A.ToString();
                    }
                }

                if (_ALFA_ is R.B_Raud)
                {
                    R.B_Raud _BETA_ = _ALFA_ as R.B_Raud;
                    if (ar.Tag == "A")
                    {
                        ar.TextString = _BETA_.A.ToString();
                    }
                    else if (ar.Tag == "B")
                    {
                        ar.TextString = _BETA_.B.ToString();
                    }
                }

                if (_ALFA_ is R.C_Raud)
                {
                    R.C_Raud _BETA_ = _ALFA_ as R.C_Raud;
                    if (ar.Tag == "A")
                    {
                        ar.TextString = _BETA_.A.ToString();
                    }
                    else if (ar.Tag == "B")
                    {
                        ar.TextString = _BETA_.B.ToString();
                    }
                    else if (ar.Tag == "U")
                    {
                        ar.TextString = ((int)Math.Round(G.Converter.ToDeg(_BETA_.U), 0)).ToString();
                    }
                }

                if (_ALFA_ is R.D_Raud)
                {
                    R.D_Raud _BETA_ = _ALFA_ as R.D_Raud;
                    if (ar.Tag == "A")
                    {
                        ar.TextString = _BETA_.A.ToString();
                    }
                    else if (ar.Tag == "B")
                    {
                        ar.TextString = _BETA_.B2.ToString(); // parand magic
                    }
                    else if (ar.Tag == "C")
                    {
                        ar.TextString = _BETA_.C.ToString();
                    }
                }

                if (_ALFA_ is R.E_Raud)
                {
                    R.E_Raud _BETA_ = _ALFA_ as R.E_Raud;
                    if (ar.Tag == "A")
                    {
                        ar.TextString = _BETA_.A.ToString();
                    }
                    else if (ar.Tag == "B")
                    {
                        ar.TextString = _BETA_.B2.ToString(); // parand magic
                    }
                    else if (ar.Tag == "C")
                    {
                        ar.TextString = _BETA_.C.ToString();
                    }
                    else if (ar.Tag == "U")
                    {
                        ar.TextString = ((int)Math.Round(G.Converter.ToDeg(_BETA_.U), 0)).ToString();
                    }
                    else if (ar.Tag == "V")
                    {
                        ar.TextString = ((int)Math.Round(G.Converter.ToDeg(_BETA_.V), 0)).ToString();
                    }
                    else if (ar.Tag == "X")
                    {
                        ar.TextString = ((int)_BETA_.X).ToString();
                    }
                    else if (ar.Tag == "Y")
                    {
                        ar.TextString = ((int)_BETA_.Y).ToString();
                    }
                }

                if (_ALFA_ is R.U_Raud)
                {
                    R.U_Raud _BETA_ = _ALFA_ as R.U_Raud;
                    if (ar.Tag == "A")
                    {
                        ar.TextString = _BETA_.A.ToString();
                    }
                    else if (ar.Tag == "B")
                    {
                        ar.TextString = _BETA_.B.ToString();
                    }
                    else if (ar.Tag == "C")
                    {
                        ar.TextString = _BETA_.C.ToString();
                    }
                }
            }
        }
Пример #7
0
        private void setReinforcementBlockParameters(_Db.BlockReference newBlockReference, R.Raud _ALFA_)
        {
            _Db.DynamicBlockReferencePropertyCollection aa = newBlockReference.DynamicBlockReferencePropertyCollection;
            foreach (_Db.DynamicBlockReferenceProperty a in aa)
            {
                if (a != null)
                {
                    if (_ALFA_ is R.A_Raud)
                    {
                        R.A_Raud _BETA_ = _ALFA_ as R.A_Raud;
                        if (a.PropertyName == "A")
                        {
                            a.Value = _BETA_.A;
                        }
                    }

                    else if (_ALFA_ is R.B_Raud)
                    {
                        R.B_Raud _BETA_ = _ALFA_ as R.B_Raud;
                        if (a.PropertyName == "A")
                        {
                            a.Value = _BETA_.A;
                        }
                        else if (a.PropertyName == "B")
                        {
                            a.Value = _BETA_.B;
                        }
                    }

                    else if (_ALFA_ is R.C_Raud)
                    {
                        R.C_Raud _BETA_ = _ALFA_ as R.C_Raud;
                        if (a.PropertyName == "A")
                        {
                            a.Value = _BETA_.A;
                        }
                        else if (a.PropertyName == "B")
                        {
                            a.Value = _BETA_.B;
                        }
                        else if (a.PropertyName == "U")
                        {
                            a.Value = Math.PI - _BETA_.U;                             // HERE
                        }
                    }

                    else if (_ALFA_ is R.D_Raud)
                    {
                        R.D_Raud _BETA_ = _ALFA_ as R.D_Raud;
                        if (a.PropertyName == "A")
                        {
                            a.Value = _BETA_.A;
                        }
                        else if (a.PropertyName == "B")
                        {
                            a.Value = _BETA_.B;
                        }
                        else if (a.PropertyName == "C")
                        {
                            a.Value = _BETA_.C;
                        }

                        else if (a.PropertyName == "A/C")
                        {
                            a.Value = _BETA_.A;
                        }
                    }

                    else if (_ALFA_ is R.E_Raud)
                    {
                        R.E_Raud _BETA_ = _ALFA_ as R.E_Raud;

                        if (a.PropertyName == "A")
                        {
                            a.Value = _BETA_.A;
                        }
                        else if (a.PropertyName == "B")
                        {
                            a.Value = _BETA_.B;
                        }
                        else if (a.PropertyName == "C")
                        {
                            a.Value = _BETA_.C;
                        }
                        else if (a.PropertyName == "U")
                        {
                            a.Value = Math.PI - _BETA_.U;                             // HERE
                        }
                        else if (a.PropertyName == "V")
                        {
                            if (_BETA_.B > 6000)
                            {
                                a.Value = _BETA_.V + Math.PI;
                            }
                            else
                            {
                                a.Value = _BETA_.V;
                            }
                        }
                        else if (a.PropertyName == "X")
                        {
                            a.Value = _BETA_.X;
                        }
                        else if (a.PropertyName == "Y")
                        {
                            a.Value = _BETA_.Y;
                        }
                    }
                    else if (_ALFA_ is R.U_Raud)
                    {
                        R.U_Raud _BETA_ = _ALFA_ as R.U_Raud;
                        if (a.PropertyName == "A")
                        {
                            a.Value = _BETA_.A;
                        }
                        else if (a.PropertyName == "B")
                        {
                            a.Value = _BETA_.B;
                        }
                        else if (a.PropertyName == "C")
                        {
                            a.Value = _BETA_.C;
                        }
                    }
                }
            }
        }
        //D HANDLE
        private bool D_vs_E_handler(G.Point mainPoint, G.Point mainEnd, G.Point side1Start, G.Point side2End, G.Edge e, G.Corner c1, G.Corner c2, int parand, G.Edge other = null, G.Edge other2 = null)
        {
            G.Line main  = new G.Line(mainPoint, mainEnd);
            G.Line side1 = new G.Line(side1Start, mainPoint);
            G.Line side2 = new G.Line(mainEnd, side2End);

            if (main.Length() < _V_.Y_REINFORCEMENT_MAIN_RADIUS * 1.99)
            {
                return(false);
            }

            //reinf_geometry_debug.Add(main);
            //reinf_geometry_debug.Add(side1);
            //reinf_geometry_debug.Add(side2);

            G.Vector v1 = main.getDirectionVector();
            G.Vector v2 = side1.getDirectionVector();
            G.Vector v3 = side2.getDirectionVector();

            double ang1 = G.Converter.AngleDeltaCW(v1, v2);
            double ang2 = G.Converter.AngleDeltaCW(v1, v3);

            bool d1 = Math.Abs(ang1 - Math.PI / 2) < _V_.M_B_BAR_TOLERANCE;
            bool d2 = Math.Abs(ang2 - 3 * Math.PI / 2) < _V_.M_B_BAR_TOLERANCE;

            if (d1 && d2)
            {
                R.D_Raud reinf = new R.D_Raud(main, side1, side2, _V_.X_REINFORCEMENT_NUMBER, _V_.X_REINFORCEMENT_MAIN_DIAMETER, _V_.X_REINFORCEMENT_MARK, parand);

                if (denier(reinf.makeMainLine()))
                {
                    return(false);
                }
                if (denier(reinf.makeSide1Line()))
                {
                    return(false);
                }
                if (denier(reinf.makeSide2Line()))
                {
                    return(false);
                }

                keep(reinf, e, c1, c2);
                keep_double(reinf, other);
                keep_double(reinf, other2);
            }
            else
            {
                R.E_Raud reinf = new R.E_Raud(main, side1, side2, _V_.X_REINFORCEMENT_NUMBER, _V_.X_REINFORCEMENT_MAIN_DIAMETER, _V_.X_REINFORCEMENT_MARK, parand);

                if (denier(reinf.makeMainLine()))
                {
                    return(false);
                }
                if (denier(reinf.makeSide1Line()))
                {
                    return(false);
                }
                if (denier(reinf.makeSide2Line()))
                {
                    return(false);
                }

                keep(reinf, e, c1, c2);
                keep_double(reinf, other);
                keep_double(reinf, other2);
            }

            return(true);
        }
        private bool C_handler_replace(R.C_Raud a, R.C_Raud b)
        {
            R.E_Raud new_reinf_long = R.C_Raud.mergeTwoRebar_long(a, b);

            bool longD = true;

            if (denier(new_reinf_long.makeMainLine()))
            {
                longD = false;
            }
            if (denier(new_reinf_long.makeSide1Line()))
            {
                longD = false;
            }
            if (denier(new_reinf_long.makeSide2Line()))
            {
                longD = false;
            }

            if (new_reinf_long.A < _V_.Y_REINFORCEMENT_MAIN_RADIUS)
            {
                longD = false;
            }
            if (new_reinf_long.B2 < _V_.Y_REINFORCEMENT_MAIN_RADIUS * 1.99)
            {
                longD = false;
            }
            if (new_reinf_long.C < _V_.Y_REINFORCEMENT_MAIN_RADIUS)
            {
                longD = false;
            }
            if (new_reinf_long.Length > _V_.X_REINFORCEMENT_MAX_D_LENGTH)
            {
                longD = false;
            }

            if (longD == true)
            {
                keep_replace(new_reinf_long, a, b);
                return(true);
            }

            R.E_Raud new_reinf = R.C_Raud.mergeTwoRebar(a, b);

            if (denier(new_reinf.makeMainLine()))
            {
                return(false);
            }
            if (denier(new_reinf.makeSide1Line()))
            {
                return(false);
            }
            if (denier(new_reinf.makeSide2Line()))
            {
                return(false);
            }

            if (new_reinf.A < _V_.Y_REINFORCEMENT_MAIN_RADIUS)
            {
                return(false);
            }
            if (new_reinf.B2 < _V_.Y_REINFORCEMENT_MAIN_RADIUS * 1.99)
            {
                return(false);
            }
            if (new_reinf.C < _V_.Y_REINFORCEMENT_MAIN_RADIUS)
            {
                return(false);
            }
            if (new_reinf_long.Length > _V_.X_REINFORCEMENT_MAX_D_LENGTH)
            {
                return(false);
            }

            keep_replace(new_reinf, a, b);

            return(true);
        }