protected override SamplerStatus Sampler(JigPrompts Prompts)
        {
            PromptPointResult promptPointResult = Prompts.AcquirePoint(new JigPromptPointOptions("\r\n请指定下一点:")
            {
                Cursor       = 3,
                BasePoint    = this.point3d_0,
                UseBasePoint = true
            });
            Point3d       value = promptPointResult.Value;
            SamplerStatus result;

            if (value != this.point3d_1)
            {
                Point3d point3d  = this.point3d_0;
                Point3d point3d2 = value;
                if (point3d.X > point3d2.X)
                {
                    Point3d point3d3 = point3d;
                    point3d  = point3d2;
                    point3d2 = point3d3;
                }
                else if (point3d.X == point3d2.X & point3d.Y > point3d2.Y)
                {
                    Point3d point3d4 = point3d;
                    point3d  = point3d2;
                    point3d2 = point3d4;
                }
                double   num         = CAD.P2P_Angle(point3d, point3d2);
                Point3d  pointAngle  = CAD.GetPointAngle(point3d, 200.0 * this.double_0, num * 180.0 / 3.1415926535897931 + 45.0);
                Point3d  pointAngle2 = CAD.GetPointAngle(point3d2, 200.0 * this.double_0, num * 180.0 / 3.1415926535897931 + 135.0);
                Polyline polyline    = new Polyline();
                polyline.SetDatabaseDefaults();
                Polyline polyline2 = polyline;
                int      num2      = 0;
                Point2d  point2d;
                point2d..ctor(pointAngle.get_Coordinate(0), pointAngle.get_Coordinate(1));
                polyline2.AddVertexAt(num2, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                Polyline polyline3 = polyline;
                int      num3      = 1;
                point2d..ctor(point3d.get_Coordinate(0), point3d.get_Coordinate(1));
                polyline3.AddVertexAt(num3, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                Polyline polyline4 = polyline;
                int      num4      = 2;
                point2d..ctor(point3d2.get_Coordinate(0), point3d2.get_Coordinate(1));
                polyline4.AddVertexAt(num4, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                Polyline polyline5 = polyline;
                int      num5      = 3;
                point2d..ctor(pointAngle2.get_Coordinate(0), pointAngle2.get_Coordinate(1));
                polyline5.AddVertexAt(num5, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                polyline.Layer   = "正筋";
                this.entity_0[0] = polyline;
                this.point3d_1   = value;
                result           = 0;
            }
            else
            {
                result = 1;
            }
            return(result);
        }
        public void TcZhuShi3()
        {
            CAD.CreateLayer("注释", 1, "continuous", 30, false, false);
            Application.SetSystemVariable("LWDISPLAY", 1);
            Database workingDatabase = HostApplicationServices.WorkingDatabase;
            Editor   editor          = Application.DocumentManager.MdiActiveDocument.Editor;

            this.point3d_0 = CAD.GetPoint("箭头起始点:");
            Point3d point3d;

            if (this.point3d_0 != point3d)
            {
                PromptResult promptResult = editor.Drag(this);
                if (promptResult.Status == 5100)
                {
                    this.point3d_0 = this.point3d_1;
                    this.bool_0    = false;
                }
                promptResult = editor.Drag(this);
                if (promptResult.Status == 5100)
                {
                    CAD.AddEnt(this.entity_0[0]);
                    this.bool_0 = true;
                }
            }
        }
Example #3
0
        public void Should_compare_with_null_instance(decimal value)
        {
            var instance = new CAD(value);

            Assert.IsFalse(instance.Equals(null), "Equals");
            Assert.AreEqual(1, instance.CompareTo(null), "CompareTo");
        }
Example #4
0
        public void TcDDX2()
        {
            this.double_0  = CAD.GetScale();
            this.point3d_0 = CAD.GetPoint("选择插入点: ");
            Point3d point3d;

            if (!(this.point3d_0 == point3d))
            {
                ObjectId[]   array           = new ObjectId[7];
                Database     workingDatabase = HostApplicationServices.WorkingDatabase;
                Editor       editor          = Application.DocumentManager.MdiActiveDocument.Editor;
                PromptResult promptResult    = editor.Drag(this);
                if (promptResult.Status == 5100)
                {
                    array[0] = CAD.AddEnt(this.entity_0[0]).ObjectId;
                    array[1] = CAD.AddEnt(this.entity_0[1]).ObjectId;
                    array[2] = CAD.AddEnt(this.entity_0[2]).ObjectId;
                    array[3] = CAD.AddEnt(this.entity_0[3]).ObjectId;
                    array[4] = CAD.AddEnt(this.entity_0[4]).ObjectId;
                    array[5] = CAD.AddEnt(this.entity_0[5]).ObjectId;
                    array[6] = CAD.AddEnt(this.entity_0[6]).ObjectId;
                    Class36.smethod_55(array);
                }
            }
        }
Example #5
0
        protected override SamplerStatus Sampler(JigPrompts Prompts)
        {
            PromptPointResult promptPointResult = Prompts.AcquirePoint(new JigPromptPointOptions("\r\n请指定下一点:")
            {
                Cursor       = 6,
                BasePoint    = this.point3d_0,
                UseBasePoint = true
            });
            Point3d       value = promptPointResult.Value;
            SamplerStatus result;

            if (value != this.point3d_1)
            {
                double  num         = CAD.P2P_Angle(this.point3d_0, value);
                Point3d pointAngle  = CAD.GetPointAngle(this.point3d_0, this.double_0 / 6.0, num * 180.0 / 3.1415926535897931 + 90.0);
                Point3d pointAngle2 = CAD.GetPointAngle(value, this.double_0 / 6.0, num * 180.0 / 3.1415926535897931 + 90.0);
                this.entity_0[0] = new Line(pointAngle, pointAngle2);
                pointAngle       = CAD.GetPointAngle(this.point3d_0, this.double_0 / 2.0, num * 180.0 / 3.1415926535897931 + 90.0);
                pointAngle2      = CAD.GetPointAngle(value, this.double_0 / 2.0, num * 180.0 / 3.1415926535897931 + 90.0);
                this.entity_0[1] = new Line(pointAngle, pointAngle2);
                pointAngle       = CAD.GetPointAngle(this.point3d_0, this.double_0 / 2.0, num * 180.0 / 3.1415926535897931 - 90.0);
                pointAngle2      = CAD.GetPointAngle(value, this.double_0 / 2.0, num * 180.0 / 3.1415926535897931 - 90.0);
                this.entity_0[2] = new Line(pointAngle, pointAngle2);
                pointAngle       = CAD.GetPointAngle(this.point3d_0, this.double_0 / 6.0, num * 180.0 / 3.1415926535897931 - 90.0);
                pointAngle2      = CAD.GetPointAngle(value, this.double_0 / 6.0, num * 180.0 / 3.1415926535897931 - 90.0);
                this.entity_0[3] = new Line(pointAngle, pointAngle2);
                this.point3d_1   = value;
                result           = 0;
            }
            else
            {
                result = 1;
            }
            return(result);
        }
Example #6
0
        public void Should_initialize_instance(decimal value)
        {
            var actual = new CAD(value);

            Assert.IsAssignableFrom <CAD>(actual);
            Assert.AreEqual(value, actual.Value, nameof(actual.Value));
        }
Example #7
0
        public void Should_cast_from_decimal(decimal value)
        {
            var expected = new CAD(value);

            var actual = (CAD)value;

            Assert.AreEqual(expected, actual);
        }
Example #8
0
        public void Should_compare_with_another_type_of_instance(decimal value)
        {
            var    instance1 = new CAD(value);
            object instance2 = value;

            Assert.IsFalse(instance1.Equals(instance2), "Equals");
            Assert.Throws <ArgumentException>(() => instance1.CompareTo(instance2), "CompareTo");
        }
Example #9
0
        public void Should_throw_exception_on_division_by_zero(decimal value)
        {
            var instance = new CAD(value);

            Assert.Throws <DivideByZeroException>(() => {
                var unused = instance / 0;
            });
        }
Example #10
0
        public void Should_cast_to_decimal(decimal value)
        {
            var instance = new CAD(value);

            var actual = (decimal)instance;

            Assert.AreEqual(value, actual);
        }
Example #11
0
        public void Should_convert_to_string(decimal value)
        {
            var expected = $"C$ {value:0.00}";

            var instance = new CAD(value);
            var actual   = instance.ToString();

            Assert.AreEqual(expected, actual);
        }
Example #12
0
        public void Should_roundvalue_withMode(MidpointRounding mode, double value, double expectedValue)
        {
            var expected = new CAD((decimal)expectedValue);

            var instance = new CAD((decimal)value);
            var actual   = instance.Round(mode);

            Assert.AreEqual(expected, actual);
        }
Example #13
0
        public void Should_round_value_withDigit(double value, double expectedValue)
        {
            var expected = new CAD((decimal)expectedValue);

            var instance = new CAD((decimal)value);
            var actual   = instance.Round(1);

            Assert.AreEqual(expected, actual);
        }
Example #14
0
        public void Should_divide_instance_by_decimal(double leftValue, double rightValue, double expectedValue)
        {
            var expected = new CAD((decimal)expectedValue);

            var instance = new CAD((decimal)leftValue);
            var actual   = instance / (decimal)rightValue;

            Assert.AreEqual(expected, actual);
        }
Example #15
0
        public void Should_floor_value(double value, double expectedValue)
        {
            var expected = new CAD((decimal)expectedValue);

            var instance = new CAD((decimal)value);
            var actual   = instance.Floor();

            Assert.AreEqual(expected, actual);
        }
Example #16
0
        public void Should_format_string(string format, string mask)
        {
            var expected = string.Format(Consts.CultureEnUS, mask, 1.7578m);

            var instance = new CAD(1.7578m);
            var actual   = instance.ToString(format, Consts.CultureEnUS);

            Assert.AreEqual(expected, actual);
        }
Example #17
0
        public void Should_own_a_HashCode(decimal value)
        {
            var expected = value.GetHashCode();

            var instance = new CAD(value);
            var actual   = instance.GetHashCode();

            Assert.AreEqual(expected, actual);
        }
Example #18
0
        public Entity CG(double B, double H, double D, double T, double R)
        {
            Point3d point3d;

            point3d..ctor(0.0, 0.0, 0.0);
            double  num  = T - (B - D) / 2.0 / 10.0;
            double  num2 = num / Math.Tan(1.5707963267948966 - (1.5707963267948966 + Math.Atan(0.1)) / 2.0);
            double  num3 = num2 * (1.0 - Math.Cos(Math.Atan(10.0)));
            double  num4 = num2 * (double)Math.Sign(Math.Atan(10.0));
            double  num5 = R / Math.Tan((1.5707963267948966 + Math.Atan(0.1)) / 2.0);
            Point2d point2d;

            point2d..ctor(point3d.get_Coordinate(0), point3d.get_Coordinate(1));
            Point2d point2d2;

            point2d2..ctor(point3d.get_Coordinate(0) + B, point3d.get_Coordinate(1));
            Point2d point2d3;

            point2d3..ctor(point3d.get_Coordinate(0) + B - num3, point3d.get_Coordinate(1) + num4);
            Point2d point2d4;

            point2d4..ctor(point2d3.X - (B - D - num3 - num5 * Math.Cos(Math.Atan(0.1))), point2d3.Y + (B - D - num3 - num5 * Math.Cos(Math.Atan(0.1))) / 10.0);
            Point2d point2d5;

            point2d5..ctor(point2d4.X - num5 * Math.Cos(Math.Atan(0.1)), point2d4.Y + num5 * Math.Sin(Math.Atan(0.1)) + num5);
            Point2d point2d6;

            point2d6..ctor(point2d5.X, point2d5.Y + (H - (point2d5.Y - point2d.Y) * 2.0));
            Point2d point2d7;

            point2d7..ctor(point2d4.X, point2d6.Y + num5 + num5 * Math.Sin(Math.Atan(0.1)));
            Point2d point2d8;

            point2d8..ctor(point3d.get_Coordinate(0) + B - num3, point3d.get_Coordinate(1) + H - num4);
            Point2d point2d9;

            point2d9..ctor(point3d.get_Coordinate(0) + B, point3d.get_Coordinate(1) + H);
            Point2d point2d10;

            point2d10..ctor(point3d.get_Coordinate(0), point3d.get_Coordinate(1) + H);
            Polyline polyline = new Polyline();

            polyline.AddVertexAt(0, point2d, 0.0, 0.0, 0.0);
            polyline.AddVertexAt(1, point2d2, Math.Tan((1.5707963267948966 - Math.Atan(0.1)) / 4.0), 0.0, 0.0);
            polyline.AddVertexAt(2, point2d3, 0.0, 0.0, 0.0);
            polyline.AddVertexAt(3, point2d4, -Math.Tan((1.5707963267948966 - Math.Atan(0.1)) / 4.0), 0.0, 0.0);
            polyline.AddVertexAt(4, point2d5, 0.0, 0.0, 0.0);
            polyline.AddVertexAt(5, point2d6, -Math.Tan((1.5707963267948966 - Math.Atan(0.1)) / 4.0), 0.0, 0.0);
            polyline.AddVertexAt(6, point2d7, 0.0, 0.0, 0.0);
            polyline.AddVertexAt(7, point2d8, Math.Tan((1.5707963267948966 - Math.Atan(0.1)) / 4.0), 0.0, 0.0);
            polyline.AddVertexAt(8, point2d9, 0.0, 0.0, 0.0);
            polyline.AddVertexAt(9, point2d10, 0.0, 0.0, 0.0);
            polyline.Closed = true;
            CAD.AddEnt(polyline);
            return(polyline);
        }
Example #19
0
        public void Should_subtract_two_instances(double leftValue, double rightValue, double expectedValue)
        {
            var expected = new CAD((decimal)expectedValue);

            var leftInstance  = new CAD((decimal)leftValue);
            var rightInstance = new CAD((decimal)rightValue);
            var actual        = leftInstance - rightInstance;

            Assert.AreEqual(expected, actual);
        }
Example #20
0
        public void Should_multiply_decimal_by_instance(double leftValue, double rightValue, double expectedValue)
        {
            var expected = new CAD((decimal)expectedValue);

            var instance = new CAD((decimal)rightValue);

            var actual = (decimal)leftValue * instance;

            Assert.AreEqual(expected, actual);
        }
Example #21
0
        public String DECODIFICA(String cadena, int valor)
        {
            int    ciclo, posic, val_n, val_an;
            String carac, CAD;

            cadena = cadena.Trim();
            CAD    = "";
            val_n  = 0; val_an = 0;
            for (ciclo = 1; ciclo <= cadena.Length; ciclo++)
            {
                carac = cadena.Substring(ciclo - 1, 1);
                posic = ciclo % 7;
                switch (posic)
                {
                case 0:
                    val_n = Asc(carac) / 2;
                    break;

                case 1:
                    val_n = Asc(carac) + valor;
                    break;

                case 2:
                    val_n  = Asc(carac) + (ciclo * 2);
                    val_an = Asc(carac);
                    break;

                case 3:
                    if (val_an > 10)
                    {
                        val_an = val_an - (Convert.ToInt32(val_an / 10) * 10);
                    }
                    val_n = Asc(carac) + valor - val_an;
                    break;

                case 4:
                    val_n = Asc(carac) + ciclo;
                    break;

                case 5:
                    if (val_an > 10)
                    {
                        val_an = val_an - (Convert.ToInt32(val_an / 10) * 10);
                    }
                    val_n = Asc(carac) + valor - val_an;
                    break;

                case 6:
                    val_n = Asc(carac);
                    break;
                }
                CAD = CAD + Convert.ToChar(val_n);
            }
            return(CAD.ToUpper());
        }
Example #22
0
        public void ChengTai3()
        {
            ObjectIdCollection objectIdCollection = new ObjectIdCollection();
            Point3d            point = CAD.GetPoint("选择插入点: ");
            Point3d            point3d;

            if (!(point == point3d))
            {
                objectIdCollection.Add(CAD.AddPoint(point));
                long    num        = Conversions.ToLong(Interaction.InputBox("输入桩直径或边长", "三桩承台", "400", -1, -1));
                long    num2       = Conversions.ToLong(Interaction.InputBox("输入桩中心距(mm)", "三桩承台", "1400", -1, -1));
                Point3d pointAngle = CAD.GetPointAngle(point, (double)num2 * Math.Sqrt(3.0) / 3.0, 90.0);
                objectIdCollection.Add(CAD.AddPoint(pointAngle));
                Point3d pointAngle2 = CAD.GetPointAngle(point, (double)num2 * Math.Sqrt(3.0) / 3.0, 210.0);
                objectIdCollection.Add(CAD.AddPoint(pointAngle2));
                Point3d pointAngle3 = CAD.GetPointAngle(point, (double)num2 * Math.Sqrt(3.0) / 3.0, -30.0);
                objectIdCollection.Add(CAD.AddPoint(pointAngle3));
                double   r           = 2.0 * Math.Sqrt(3.0) / 3.0 * (double)num;
                Point3d  pointAngle4 = CAD.GetPointAngle(pointAngle, r, 60.0);
                Point3d  pointAngle5 = CAD.GetPointAngle(pointAngle, r, 120.0);
                Point3d  pointAngle6 = CAD.GetPointAngle(pointAngle2, r, 180.0);
                Point3d  pointAngle7 = CAD.GetPointAngle(pointAngle2, r, 240.0);
                Point3d  pointAngle8 = CAD.GetPointAngle(pointAngle3, r, 300.0);
                Point3d  pointAngle9 = CAD.GetPointAngle(pointAngle3, r, 360.0);
                Polyline polyline    = new Polyline();
                Polyline polyline2   = polyline;
                int      num3        = 0;
                Point2d  point2d;
                point2d..ctor(pointAngle4.X, pointAngle4.Y);
                polyline2.AddVertexAt(num3, point2d, 0.0, 0.0, 0.0);
                Polyline polyline3 = polyline;
                int      num4      = 1;
                point2d..ctor(pointAngle5.X, pointAngle5.Y);
                polyline3.AddVertexAt(num4, point2d, 0.0, 0.0, 0.0);
                Polyline polyline4 = polyline;
                int      num5      = 2;
                point2d..ctor(pointAngle6.X, pointAngle6.Y);
                polyline4.AddVertexAt(num5, point2d, 0.0, 0.0, 0.0);
                Polyline polyline5 = polyline;
                int      num6      = 3;
                point2d..ctor(pointAngle7.X, pointAngle7.Y);
                polyline5.AddVertexAt(num6, point2d, 0.0, 0.0, 0.0);
                Polyline polyline6 = polyline;
                int      num7      = 4;
                point2d..ctor(pointAngle8.X, pointAngle8.Y);
                polyline6.AddVertexAt(num7, point2d, 0.0, 0.0, 0.0);
                Polyline polyline7 = polyline;
                int      num8      = 5;
                point2d..ctor(pointAngle9.X, pointAngle9.Y);
                polyline7.AddVertexAt(num8, point2d, 0.0, 0.0, 0.0);
                polyline.Closed = true;
                objectIdCollection.Add(CAD.AddEnt(polyline).ObjectId);
                Class36.smethod_18(objectIdCollection);
            }
        }
Example #23
0
        public void TcDuanMianByLine()
        {
            Point3d p;
            Point3d p2;

            Class36.smethod_31(ref p, ref p2, "选择插入点:");
            Line   line = CAD.AddLine(p, p2, "0");
            string text = Interaction.InputBox("直接距离" + Conversions.ToString(checked ((long)Math.Round(line.Length))) + ",请输入分布的钢筋根数", "", "2", -1, -1);

            if (Operators.CompareString(text, "", false) != 0)
            {
                double num  = line.Length / (Conversions.ToDouble(text) + 1.0);
                double num2 = Class36.double_0 / 2.0;
                double num3 = num2;
                short  num4;
                short  num6;
                short  num7;
                checked
                {
                    if (num3 == 1.0)
                    {
                        num4 = (short)Math.Round(unchecked (35.0 * num2));
                    }
                    else if (num3 == 1.25)
                    {
                        num4 = (short)Math.Round(unchecked (30.0 * num2));
                    }
                    else if (num3 == 2.0)
                    {
                        num4 = (short)Math.Round(unchecked (25.0 * num2));
                    }
                    else if (num3 == 2.5)
                    {
                        num4 = (short)Math.Round(unchecked (25.0 * num2));
                    }
                    short num5 = 1;
                    num6 = Conversions.ToShort(text);
                    num7 = num5;
                }
                for (;;)
                {
                    short num8 = num7;
                    short num9 = num6;
                    if (num8 > num9)
                    {
                        break;
                    }
                    Point3d pointAtDist = line.GetPointAtDist(num * (double)num7);
                    Class36.smethod_16(pointAtDist, (double)num4, "墙柱纵筋");
                    num7 += 1;
                }
                Class36.smethod_64(line.ObjectId);
            }
        }
Example #24
0
 public override void Input(CAD cstingDevice)
 {
     if (Soul.Signil.Mana >= (MathMana(Stone) + MathMana(Fire) + MathManaMix(2, MathMass(Stone, Fire)) + MathManaImpuls(MathMass(Stone, Fire))))
     {
         cstingDevice.Cast(Stone);
         cstingDevice.Cast(Fire);
         cstingDevice.Mixing(Infernum);
         cstingDevice.Impuls(Forward);
     }
     base.Input(cstingDevice);
 }
Example #25
0
        public void TcGangJin()
        {
            this.double_0 = CAD.GetScale();
            CAD.CreateLayer("钢筋", 14, "continuous", -1, false, true);
            this.point2dCollection_0 = new Point2dCollection();
            this.point3d_1           = CAD.GetPoint("选择插入点: ");
            Point3d point3d;

            if (!(this.point3d_1 == point3d))
            {
                Point2dCollection point2dCollection = this.point2dCollection_0;
                Point2d           point2d;
                point2d..ctor(this.point3d_1.X, this.point3d_1.Y);
                point2dCollection.Add(point2d);
                Polyline polyline  = new Polyline();
                ObjectId objectId_ = default(ObjectId);
                for (;;)
                {
                    short num = checked ((short)(this.point2dCollection_0.Count - 1));
                    if (num >= 1)
                    {
                        Class36.smethod_64(objectId_);
                        polyline = new Polyline();
                        polyline.SetDatabaseDefaults();
                        short num2 = 0;
                        short num3 = num;
                        short num4 = num2;
                        for (;;)
                        {
                            short num5 = num4;
                            short num6 = num3;
                            if (num5 > num6)
                            {
                                break;
                            }
                            polyline.AddVertexAt((int)num4, this.point2dCollection_0[(int)num4], 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                            num4 += 1;
                        }
                        polyline.Layer = "钢筋";
                        objectId_      = Class36.smethod_92(polyline);
                    }
                    short num7 = this.GangJin();
                    if (num7 != 1)
                    {
                        break;
                    }
                    this.point3d_1 = this.point3d_2;
                    Point2dCollection point2dCollection2 = this.point2dCollection_0;
                    point2d..ctor(this.point3d_2.X, this.point3d_2.Y);
                    point2dCollection2.Add(point2d);
                }
            }
        }
Example #26
0
        private void Button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.point3d_0 = CAD.GetPoint("选择插入点: ");
            Point3d point3d;

            if (!(this.point3d_0 == point3d))
            {
                this.Label1.Text = Conversions.ToString(this.point3d_0.X) + " / " + Conversions.ToString(this.point3d_0.Y);
                this.Show();
            }
        }
Example #27
0
 private ObjectId method_1(Point3d point3d_0, string string_0, double double_0, double double_1 = 0.0)
 {
     return(CAD.AddEnt(new DBText
     {
         VerticalMode = 3,
         HorizontalMode = 1,
         AlignmentPoint = point3d_0,
         Rotation = double_1,
         TextString = string_0,
         TextStyleId = CAD.CreateTextStyle("宋体", "宋体", "", 0.7),
         Height = double_0
     }).ObjectId);
 }
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            PromptPointResult promptPointResult = prompts.AcquirePoint(new JigPromptPointOptions("\r\n请指定下一点:")
            {
                Cursor       = 2,
                BasePoint    = CAD.GetPointAngle(this.point3d_0, this.double_1 / 2.0, (double)(checked (-90 * this.short_0))),
                UseBasePoint = true
            });
            Point3d       value = promptPointResult.Value;
            SamplerStatus result;

            if (value != this.point3d_1)
            {
                this.short_0 = 1;
                if (value.Y > this.point3d_0.Y)
                {
                    this.short_0 = -1;
                }
                Point2d point2d;
                point2d..ctor(value.X, value.Y);
                Point2d point2d2;
                point2d2..ctor(this.point3d_0.X - this.double_0 / 10.0, this.point3d_0.Y - (double)this.short_0 * this.double_1 / 2.0);
                Point2d point2d3;
                point2d3..ctor(this.point3d_0.X - this.double_0 / 2.0, this.point3d_0.Y - (double)this.short_0 * this.double_1 / 2.0);
                Point2d point2d4;
                point2d4..ctor(this.point3d_0.X - this.double_0 / 2.0, this.point3d_0.Y + (double)this.short_0 * this.double_1 / 2.0);
                Point2d point2d5;
                point2d5..ctor(this.point3d_0.X + this.double_0 / 2.0, this.point3d_0.Y + (double)this.short_0 * this.double_1 / 2.0);
                Point2d point2d6;
                point2d6..ctor(this.point3d_0.X + this.double_0 / 2.0, this.point3d_0.Y - (double)this.short_0 * this.double_1 / 2.0);
                Point2d point2d7;
                point2d7..ctor(this.point3d_0.X + this.double_0 / 10.0, this.point3d_0.Y - (double)this.short_0 * this.double_1 / 2.0);
                this.polyline_0 = new Polyline();
                this.polyline_0.AddVertexAt(0, point2d, 0.0, 0.0, 0.0);
                this.polyline_0.AddVertexAt(1, point2d2, 0.0, 0.0, 0.0);
                this.polyline_0.AddVertexAt(2, point2d3, 0.0, 0.0, 0.0);
                this.polyline_0.AddVertexAt(3, point2d4, 0.0, 0.0, 0.0);
                this.polyline_0.AddVertexAt(4, point2d5, 0.0, 0.0, 0.0);
                this.polyline_0.AddVertexAt(5, point2d6, 0.0, 0.0, 0.0);
                this.polyline_0.AddVertexAt(6, point2d7, 0.0, 0.0, 0.0);
                this.polyline_0.Closed = true;
                this.entity_0[0]       = this.polyline_0;
                this.point3d_1         = value;
                result = 0;
            }
            else
            {
                result = 1;
            }
            return(result);
        }
Example #29
0
        public CAD.MessageLine[] AnalyzeRDFEResourceURI(string subscriptions, string tenantName, string virtualMachines)
        {
            var vminfo = new CAD(Id, subscriptions, tenantName, virtualMachines);

            if (vminfo.Results.Length == 0)
            {
                throw new Exception(String.Format(
                                        "Kusto query for Deployment {0}//{1}//{2} returned empty results", subscriptions, tenantName, virtualMachines));
            }

            SALsA.GetInstance(Id)?.ICM.QueueICMDiscussion(vminfo.HTMLResults, htmlfy: false);
            Log.Information(vminfo.Results);
            return(vminfo.Results);
        }
Example #30
0
        protected override SamplerStatus Sampler(JigPrompts Prompts)
        {
            PromptPointResult promptPointResult = Prompts.AcquirePoint(new JigPromptPointOptions("\r\n请指定下一点:")
            {
                Cursor       = 3,
                BasePoint    = this.point3d_0,
                UseBasePoint = true
            });
            SamplerStatus result;

            if (promptPointResult.Status != -5002)
            {
                Point3d value = promptPointResult.Value;
                if (value != this.point3d_1)
                {
                    Point3d  p           = this.point3d_0;
                    Point3d  point3d     = value;
                    double   num         = p.GetVectorTo(point3d).AngleOnPlane(new Plane());
                    short    num2        = checked ((short)Class36.GetKeyState(160L));
                    Point3d  pointAngle  = CAD.GetPointAngle(p, 100.0 * this.double_0, num * 180.0 / 3.1415926535897931 + (double)-90f);
                    Point3d  pointAngle2 = CAD.GetPointAngle(pointAngle, 141.0 * this.double_0, num * 180.0 / 3.1415926535897931);
                    Polyline polyline    = new Polyline();
                    polyline.SetDatabaseDefaults();
                    double   num3      = Math.Tan(Math.Atan(1.0) * 4.0 / 4.0);
                    Polyline polyline2 = polyline;
                    int      num4      = 0;
                    Point2d  point2d;
                    point2d..ctor(p.get_Coordinate(0), p.get_Coordinate(1));
                    polyline2.AddVertexAt(num4, point2d, -num3, 45.0 * this.double_0, 45.0 * this.double_0);
                    Polyline polyline3 = polyline;
                    int      num5      = 1;
                    point2d..ctor(pointAngle.get_Coordinate(0), pointAngle.get_Coordinate(1));
                    polyline3.AddVertexAt(num5, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                    Polyline polyline4 = polyline;
                    int      num6      = 2;
                    point2d..ctor(pointAngle2.get_Coordinate(0), pointAngle2.get_Coordinate(1));
                    polyline4.AddVertexAt(num6, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                    CAD.CreateLayer("钢筋", 10, "continuous", -1, false, true);
                    polyline.Layer   = "钢筋";
                    this.entity_0[0] = polyline;
                    this.point3d_1   = value;
                    result           = 0;
                }
                else
                {
                    result = 1;
                }
            }
            return(result);
        }
        protected override void AddAnalysisToXMLOutput(CAD.AssemblyType cadassembly)
        {
            base.AddAnalysisToXMLOutput(cadassembly);
            CAD.AnalysesType cadanalysis = GetCADAnalysis(cadassembly);

            CAD.BallisticType ballisticanalysis = new CAD.BallisticType();
            ballisticanalysis._id = UtilityHelpers.MakeUdmID();
            ballisticanalysis.AnalysisID = AnalysisID;

            if (referencePlaneType != Survivability.ReferencePlaneTypeEnum.None)
            {
                CAD.ReferencePlaneType refplane = new CAD.ReferencePlaneType();
                refplane._id = UtilityHelpers.MakeUdmID();
                refplane.Type = referencePlaneType.ToString();
                ballisticanalysis.ReferencePlane = refplane;
            }

            if (customShotlineList.Any())
            {
                CAD.ShotlinesType cadshotlinesuite = new CAD.ShotlinesType();
                cadshotlinesuite._id = UtilityHelpers.MakeUdmID();
                List<CAD.ShotlineType> shotlineList = new List<CAD.ShotlineType>();
                foreach (var shotline in customShotlineList)
                {
                    CAD.ShotlineType cadshotline = new CAD.ShotlineType();
                    cadshotline._id = UtilityHelpers.MakeUdmID();
                    cadshotline.Azimuth = shotline.Azimuth;
                    cadshotline.Elevation = shotline.Elevation;
                    cadshotline.BallisticThreatRef = shotline.BallisticThreatRef;
                    cadshotline.ComponentID = shotline.ComponentID;
                    cadshotline.DatumPoint = shotline.DatumPoint;
                    cadshotline.ShotlineName = shotline.ShotlineName;
                    shotlineList.Add(cadshotline);
                }

                cadshotlinesuite.Shotline = shotlineList.ToArray();
                ballisticanalysis.Shotlines = cadshotlinesuite;
            }


            List<CAD.MetricType> metrics = MetricsToCADXMLOutput(Computations, cadassembly.ConfigurationID);
            if (metrics.Count > 0)
            {
                ballisticanalysis.Metrics = new CAD.MetricsType();
                ballisticanalysis.Metrics._id = UtilityHelpers.MakeUdmID();
                ballisticanalysis.Metrics.Metric = metrics.ToArray();
            }

            if (ballisticanalysis.Metrics != null || ballisticanalysis.ReferencePlane != null || ballisticanalysis.Shotlines != null)
            {
                cadanalysis.Ballistic = new CAD.BallisticType[] { ballisticanalysis };
            }
        }
Example #32
0
        public FormMain() {
            InitializeComponent();
            setupQueuedMessages(); //error handling

            Do_Upgrade();

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            // setup objects
            Cnc = new CNC(this);
            CNC.SquareCorrection = Properties.Settings.Default.CNC_SquareCorrection;

            Needle = new NeedleClass(this);
            Tapes = new TapesClass(Tapes_dataGridView, Needle, Cnc, this);
            Cad = new CAD(this);
            Locations = new LocationManager();

            Global.Instance.cnc = Cnc;
            Global.Instance.needle = Needle;
            Global.Instance.mainForm = this;
            Global.Instance.Locations = Locations;

            // open camera form
            // show the camera view stuff right away
            cameraView = new CameraView();
            cameraView.Show();
            cameraView.SetDownCameraDefaults();
            cameraView.SetUpCameraDefaults();
            cameraView.downClickDelegate = DownClickDelegate;
            cameraView.upClickDelegate = UpClickDelegate;

            //setup location jumps
            UpdateGoToPulldownMenu();
            Locations.GetList().ListChanged += delegate { 
                UpdateGoToPulldownMenu();
                Locations.Save();
            }; //update if list changed
            Locations.LocationChangeEvent += (s, e) => {
                if (e.PropertyName.Equals("Name")) UpdateGoToPulldownMenu();
                Locations.Save();
            }; //update if name on list changes

            //setup table entry dragging
            componentDrag = new DataGridDrag(CadData_GridView);
            locationDrag = new DataGridDrag(locations_dataGridView);
            tapeDrag = new DataGridDrag(Tapes_dataGridView);
            jobDrag = new DataGridDrag(JobData_GridView);

            //setup table bindings
            CadData_GridView.DataSource = Cad.ComponentData;
            locations_dataGridView.DataSource = Locations.GetList();            
            Tapes_dataGridView.DataSource = Tapes.tapeObjs;
            OriginalPartOrientation.DataSource = TapeObj.Orientation;
            OriginalTapeOrientation.DataSource = TapeObj.Orientation;
            UpdateTapeTypesBinding();
            PartType.DataSource = Enum.GetNames(typeof(ComponentType));

            //jobs table
            JobData_GridView.DataSource = Cad.JobData;
            methodDataGridViewComboBoxColumn.DataSource = new[] {"?", "Place", "LoosePlace", "Change Needle", "Recalibrate", "Ignore", "Pause", "Fiducial", "Place With UpCam"};
            // apply changes to multiple placement types at once
            JobData_GridView.CellValueChanged += (o, e) => {
                if (e.ColumnIndex != 3) return;
                for (int i = 0; i < JobData_GridView.SelectedCells.Count; i++) {
                    if (JobData_GridView.SelectedCells[i].ColumnIndex == 3) {
                        ((JobData)JobData_GridView.SelectedCells[i].OwningRow.DataBoundItem).Method =
                            ((JobData)JobData_GridView.Rows[e.RowIndex].DataBoundItem).Method;

                    }
                }
            };

            // right click context menu
            CadData_GridView.CellMouseDown += CadData_CellMouseDown;
            JobData_GridView.CellMouseDown += JobData_CellMouseDown;
            Tapes_dataGridView.CellMouseDown += Tapes_CellMouseDown;

            // setup key handling
            KeyPreview = true;
            SetupCursorNavigation(Controls);
            KeyUp += My_KeyUp;

            instructions_label.Text = "";
            instructions_label.Visible = false;

            // setup a bunch of stuff on the forms
            LightPlacerFormsSetup();
        }
        protected override void AddAnalysisToXMLOutput(CAD.AssemblyType cadassembly)
        {
            base.AddAnalysisToXMLOutput(cadassembly);
            CAD.AnalysesType cadanalysis = GetCADAnalysis(cadassembly);

            CAD.BlastType blastanalysis = new CAD.BlastType();
            blastanalysis._id = UtilityHelpers.MakeUdmID();
            blastanalysis.AnalysisID = blastConfig.analysis.ID;
            if (referencePlaneType != Survivability.ReferencePlaneTypeEnum.None)
            {
                CAD.ReferencePlaneType refplane = new CAD.ReferencePlaneType();
                refplane._id = UtilityHelpers.MakeUdmID();
                refplane.Type = referencePlaneType.ToString();
                blastanalysis.ReferencePlane = new CAD.ReferencePlaneType[1];            // cardinality should be changed to have 0..1 in CAD_Uml.xme
                blastanalysis.ReferencePlane[0] = refplane;                      
            }

            List<CAD.MetricType> metrics = MetricsToCADXMLOutput(cadassembly.ConfigurationID);
            if (metrics.Count > 0)
            {
                blastanalysis.Metrics = new CAD.MetricsType();
                blastanalysis.Metrics._id = UtilityHelpers.MakeUdmID();
                blastanalysis.Metrics.Metric = metrics.ToArray();
            }

            if (blastanalysis.ReferencePlane != null || blastanalysis.Metrics != null)
            {
                cadanalysis.Blast = new CAD.BlastType[] { blastanalysis };
            }
        }
Example #34
0
        protected override void AddAnalysisToXMLOutput(CAD.AssemblyType cadassembly)
        {
            base.AddAnalysisToXMLOutput(cadassembly);
            CAD.AnalysesType cadanalysis = GetCADAnalysis(cadassembly);
            
            CAD.CFDType cfdanalysis = new CAD.CFDType();
            cfdanalysis._id = UtilityHelpers.MakeUdmID();
            cfdanalysis.AnalysisID = AnalysisID;

            List<CAD.MetricType> metrics = MetricsToCADXMLOutput(Computations, cadassembly.ConfigurationID);
            if (metrics.Count > 0)
            {
                cfdanalysis.Metrics = new CAD.MetricsType();
                cfdanalysis.Metrics._id = UtilityHelpers.MakeUdmID();
                cfdanalysis.Metrics.Metric = metrics.ToArray();
            }

            // Hydrostatics solver setting will go to the CadAssembly.xml as it is interpreted by CadCreateAssembly.exe
            foreach (var config in cfdConfigs.Where(cfg => cfg is CFDConfig.HydrostaticsSolverSettings))
            {
                CFDConfig.HydrostaticsSolverSettings hconfig = config as CFDConfig.HydrostaticsSolverSettings;
                cfdanalysis.HydrostaticsSolverSettings = new CAD.HydrostaticsSolverSettingsType[1];
                cfdanalysis.HydrostaticsSolverSettings[0] = new CAD.HydrostaticsSolverSettingsType()
                {
                    VehicleVelocity = 1,
                    FluidMaterial = hconfig.FluidMaterial.ToString(),
                    FluidTemperature = hconfig.FluidTemperature,
                    PitchAngleStart = hconfig.PitchAngleStart,
                    PitchAngleEnd = hconfig.PitchAngleEnd,
                    PitchAngleStepSize = hconfig.PitchAngleStep,
                    RollAngleStart = hconfig.RollAngleStart,
                    RollAngleEnd = hconfig.RollAngleEnd,
                    RollAngleStepSize = hconfig.RollAngleStep
                };
            }

            cadanalysis.CFD = new CAD.CFDType[] { cfdanalysis };

            AddStaticAnalysisMetrics(cadassembly);
        }
        // This code is copy/pasted from TestBench. Since this class is not a subclass of TestBench,
        // it can't be re-used. Can this code be re-used from there by moving it to TestBenchBase?
        private void AddComputations(CAD.AssemblyType assemblyRoot)
        {
            if (Computations.Any())
            {
                CAD.AnalysesType cadanalysis = GetCADAnalysis(assemblyRoot);

                CAD.StaticType staticanalysis = new CAD.StaticType();
                staticanalysis._id = UtilityHelpers.MakeUdmID();
                staticanalysis.AnalysisID = AnalysisID;

                List<CAD.MetricType> metriclist = new List<CAD.MetricType>();
                foreach (var item in Computations)
                {
                    if (item.ComputationType == "PointCoordinates")
                    {
                        CAD.MetricType ptout = new CAD.MetricType();
                        ptout._id = UtilityHelpers.MakeUdmID();
                        ptout.ComponentID = item.ComponentID;
                        ptout.MetricID = item.MetricID;
                        ptout.MetricType1 = item.ComputationType;
                        ptout.RequestedValueType = item.RequestedValueType;
                        ptout.Details = item.FeatureDatumName;
                        ptout.ComponentID = String.IsNullOrEmpty(item.ComponentID) ? "" : item.ComponentID;     // PointCoordinate metric is tied to a specific Component  
                        metriclist.Add(ptout);
                    }
                    else
                    {
                        CAD.MetricType metric = new CAD.MetricType();
                        metric._id = UtilityHelpers.MakeUdmID();
                        metric.MetricID = item.MetricID;
                        metric.MetricType1 = item.ComputationType;
                        metric.RequestedValueType = item.RequestedValueType;
                        metric.ComponentID = assemblyRoot.ConfigurationID;
                        metric.Details = "";
                        metriclist.Add(metric);
                    }
                }

                staticanalysis.Metrics = new CAD.MetricsType();
                staticanalysis.Metrics._id = UtilityHelpers.MakeUdmID();
                staticanalysis.Metrics.Metric = metriclist.ToArray();

                cadanalysis.Static = new CAD.StaticType[] { staticanalysis };
            }
        }
Example #36
0
        public void AddDataExchangeFormatToXMLOutput(CAD.AssembliesType assembliesRoot)
        {
            if (DataExchangeFormats.Count > 0 || STLDataExchangeFormats.Count > 0 || SpecialDataFormatInstructions.Count > 0)
            {
                CAD.DataExchangeType dataexchangeout = new CAD.DataExchangeType();
                dataexchangeout._id = UtilityHelpers.MakeUdmID();

                List<CAD.STEPFormatType> exchangelist = new List<CAD.STEPFormatType>();
                foreach (var item in DataExchangeFormats)
                {
                    CAD.STEPFormatType formatout = new CAD.STEPFormatType();
                    formatout._id = UtilityHelpers.MakeUdmID();
                    formatout.Name = item;
                    exchangelist.Add(formatout);    
                }

                List<CAD.NonSTEPFormatType> stllist = new List<CAD.NonSTEPFormatType>();
                foreach (var item in STLDataExchangeFormats)
                {
                    CAD.NonSTEPFormatType formatout = new CAD.NonSTEPFormatType();
                    formatout._id = UtilityHelpers.MakeUdmID();

                    if (item == "Inventor" || item == "Parasolid")
                    {
                        formatout.FormatType = item;
                        formatout.FormatSubType = "";
                    }
                    else
                    {
                        formatout.FormatType = "Stereolithography";
                        formatout.FormatSubType = item.ToUpper();
                    }

                    stllist.Add(formatout);
                }

                List<CAD.SpecialDataFormatInstructionType> specialInst = new List<CAD.SpecialDataFormatInstructionType>();
                foreach (var item in SpecialDataFormatInstructions)
                {
                    CAD.SpecialDataFormatInstructionType formatout = new CAD.SpecialDataFormatInstructionType();
                    formatout._id = UtilityHelpers.MakeUdmID();
                    formatout.Instruction = item;
                    specialInst.Add(formatout);
                }

                if (exchangelist.Count > 0)
                    dataexchangeout.STEPFormat = exchangelist.ToArray();
                if (stllist.Count > 0)
                    dataexchangeout.NonSTEPFormat = stllist.ToArray();
                if (specialInst.Count > 0)
                    dataexchangeout.SpecialDataFormatInstruction = specialInst.ToArray();
                assembliesRoot.DataExchange = dataexchangeout;
            }
        }
Example #37
0
 protected CAD.AnalysesType GetCADAnalysis(CAD.AssemblyType assembly)
 {
     CAD.AnalysesType analysis;
     if (assembly.Analyses == null)
     {
         analysis = new CAD.AnalysesType()
         {
             _id = UtilityHelpers.MakeUdmID()
         };
         assembly.Analyses = analysis;
     }
     else
     {
         analysis = assembly.Analyses;
     }
     return analysis;
 }
Example #38
0
        protected CAD.StaticType GetStaticAnalysis(CAD.AnalysesType analyses)
        {
            CAD.StaticType staticAnalysis;
            if (analyses.Static == null)
            {
                analyses.Static = new CAD.StaticType[1] 
                {
                    new CAD.StaticType()
                    {
                        _id = UtilityHelpers.MakeUdmID(),
                        AnalysisID = AnalysisID
                    }
                };

                staticAnalysis = analyses.Static[0];              
            }
            else
            {
                staticAnalysis = analyses.Static.FirstOrDefault();
            }

            return staticAnalysis;
        }
Example #39
0
        protected virtual void AddAnalysisToXMLOutput(CAD.AssemblyType assembly)
        {

            // R.O. 1/26/2015, InterferenceCheck deprecated. Now interference check is specified by adding a InterferenceCount to
            // a CADComputationComponent
            //if (InterferenceCheck)
            //{
            //    CAD.AnalysesType cadanalysis = GetCADAnalysis(assembly);
            //    CAD.InterferenceType intfanalysis = new CAD.InterferenceType();
            //    intfanalysis._id = UtilityHelpers.MakeUdmID();
            //    intfanalysis.AnalysisID = AnalysisID;
            //    cadanalysis.Interference = new CAD.InterferenceType[] { intfanalysis };
            //}
        }
Example #40
0
        protected void AddStaticAnalysisMetrics(CAD.AssemblyType assemblyRoot)
        { 
            if (ExportComponentPoints && cadDataContainer.PointCoordinatesList.Any())
            {
                StaticAnalysisMetrics.AddRange(cadDataContainer.PointCoordinatesList.Where(x => !StaticAnalysisMetrics.Exists( r=> r.MetricID == x.MetricID)));
            }

            if (StaticAnalysisMetrics.Any())
            {
                CAD.AnalysesType cadanalysis = GetCADAnalysis(assemblyRoot);
                CAD.StaticType staticanalysis = GetStaticAnalysis(cadanalysis);           //CAD.StaticType staticanalysis = new CAD.StaticType();

                List<CAD.MetricType> metriclist = MetricsToCADXMLOutput(StaticAnalysisMetrics);
                staticanalysis.Metrics = new CAD.MetricsType();
                staticanalysis.Metrics._id = UtilityHelpers.MakeUdmID();
                staticanalysis.Metrics.Metric = metriclist.ToArray();

                cadanalysis.Static = new CAD.StaticType[] { staticanalysis };
            }
        } 
Example #41
0
        protected override void AddAnalysisToXMLOutput(CAD.AssemblyType assembly)
        {
            base.AddAnalysisToXMLOutput(assembly);
            CAD.AnalysesType cadanalysis = GetCADAnalysis(assembly);

            CAD.FEAType feaanalysis = new CAD.FEAType();
            feaanalysis._id = UtilityHelpers.MakeUdmID();
            feaanalysis.AnalysisID = AnalysisID;
            feaanalysis.Type = FEAAnalysisType;
            feaanalysis.MaxAdaptiveIterations = MaxAdaptiveIterations;
            feaanalysis.MaxElementSize = this.CyphyTestBenchRef.Attributes.MaximumElementSize;
            // solvers
            CAD.SolversType solversType = new CAD.SolversType();
            solversType._id = UtilityHelpers.MakeUdmID();
            CAD.SolverType solver = new CAD.SolverType();
            solver._id = UtilityHelpers.MakeUdmID();
            solver.ElementShapeType = ElementType;
            solver.MeshType = MeshType;
            solver.ShellElementType = ShellType;
            if (SolverType == "CALCULIX")
            {
                solver.Type = "NASTRAN";
            }
            else
            {
                solver.Type = SolverType;
            }
            
            solversType.Solver = new CAD.SolverType[1];
            solversType.Solver[0] = solver;
            feaanalysis.Solvers = solversType;

            // loads
            if (Loads.Count > 0)
            {
                List<CAD.LoadType> loadList = new List<CAD.LoadType>();
                foreach (var item in Loads)
                {
                    loadList.Add(item.ToCADXMLOutput());
                }

                feaanalysis.Loads = new CAD.LoadsType();
                feaanalysis.Loads._id = UtilityHelpers.MakeUdmID();
                feaanalysis.Loads.Load = loadList.ToArray();
            }

            // constraints
            if (Constraints.Count > 0)
            {
                List<CAD.AnalysisConstraintType> constraintList = new List<CAD.AnalysisConstraintType>();
                foreach (var item in Constraints)
                {
                    constraintList.Add(item.ToCADXMLOutput());
                }
                feaanalysis.AnalysisConstraints = new CAD.AnalysisConstraintsType();
                feaanalysis.AnalysisConstraints._id = UtilityHelpers.MakeUdmID();
                feaanalysis.AnalysisConstraints.AnalysisConstraint = constraintList.ToArray();
            }
            
            // thermal
            List<CAD.ThermalElementType> thermalOutList = new List<CAD.ThermalElementType>();
            if (ThermalElements.Count > 0)
            {
                foreach (var thermalLoad in ThermalElements)
                {
                    CAD.ThermalElementType thermalOut = new CAD.ThermalElementType();
                    thermalOut._id = UtilityHelpers.MakeUdmID();
                    thermalOut.LoadType = thermalLoad.Type;
                    thermalOut.Unit = thermalLoad.Unit;
                    thermalOut.Value = thermalLoad.LoadValue;

                    if (thermalLoad.Geometry == null)
                    {
                        CAD.ComponentType component = new CAD.ComponentType();
                        component._id = UtilityHelpers.MakeUdmID();
                        component.ComponentID = thermalLoad.ComponentID;
                        component.InfiniteCycle = false;
                        thermalOut.Component = new CAD.ComponentType[] { component };
                    }
                    else
                    {
                        thermalOut.Geometry = new CAD.GeometryType[] { thermalLoad.Geometry.ToCADXMLOutput() };
                    }

                    thermalOutList.Add(thermalOut);
                }
                feaanalysis.ThermalElements = new CAD.ThermalElementsType();
                feaanalysis.ThermalElements._id = UtilityHelpers.MakeUdmID();
                feaanalysis.ThermalElements.ThermalElement = thermalOutList.ToArray();
                
            }
             
            // metrics
            List<CAD.MetricType> metriclist = new List<CAD.MetricType>();
            foreach (var item in Computations)
            {
                CAD.MetricType metric = new CAD.MetricType();
                metric._id = UtilityHelpers.MakeUdmID();
                metric.ComponentID = item.ComponentID;
                metric.MetricID = item.MetricID;
                metric.RequestedValueType = item.RequestedValueType;
                metric.MetricType1 = item.ComputationType.ToString();
                metric.Details = "";
                metric.MetricName = item.MetricName;
                metriclist.Add(metric);
            }
            if (metriclist.Any())
            {
                feaanalysis.Metrics = new CAD.MetricsType();
                feaanalysis.Metrics._id = UtilityHelpers.MakeUdmID();
                feaanalysis.Metrics.Metric = metriclist.ToArray();
            }

            cadanalysis.FEA = new CAD.FEAType[] { feaanalysis };

            AddStaticAnalysis(assembly, StaticComputations);

        }
Example #42
0
        public FormMain() {
            InitializeComponent();
            setupQueuedMessages(); //error handling

            Do_Upgrade();

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            // setup objects
            Cnc = new CNC(this);
            CNC.SquareCorrection = Properties.Settings.Default.CNC_SquareCorrection;

            Needle = new NeedleClass(this);
            Tapes = new TapesClass(Tapes_dataGridView, Needle, Cnc, this);
            Cad = new CAD(this);
            Locations = new LocationManager();

            Global.Instance.cnc = Cnc;
            Global.Instance.needle = Needle;
            Global.Instance.mainForm = this;
            Global.Instance.Locations = Locations;

            // open camera form
            // show the camera view stuff right away
            cameraView = new CameraView();
            cameraView.Show();
            cameraView.SetDownCameraDefaults();
            cameraView.SetUpCameraDefaults();
            cameraView.downClickDelegate = DownClickDelegate;
            cameraView.upClickDelegate = UpClickDelegate;

            nozzleChanger = new NozzleChanger();
            nozzleChanger.InitializeObject(dataGridNozzes, datagridLoadSequence, Needle, Cnc, this);
            //listNozzles.DataSource = nozzleChanger.nozzles;
            nozzleChanger.ReLoad();
            dataGridNozzes.DataSource = nozzleChanger.nozzles;
            textBoxNozzleSpeed.Text = nozzleChanger.Speed;

            (dataGridNozzes.Columns[2] as DataGridViewComboBoxColumn).DataSource =
                new BindingSource { DataSource = cameraView.upSet.GetNames() };
            Needle.nozzleChanger = nozzleChanger;
            nozzleChangerEnabled.Checked = nozzleChanger.Enabled;

            //setup location jumps
            UpdateGoToPulldownMenu();
            Locations.GetList().ListChanged += delegate { 
                UpdateGoToPulldownMenu();
                Locations.Save();
            }; //update if list changed
            Locations.LocationChangeEvent += (s, e) => {
                if (e.PropertyName.Equals("Name")) UpdateGoToPulldownMenu();
                Locations.Save();
            }; //update if name on list changes

            //setup table entry dragging
            componentDrag = new DataGridDrag(CadData_GridView);
            locationDrag = new DataGridDrag(locations_dataGridView);
            tapeDrag = new DataGridDrag(Tapes_dataGridView);
            jobDrag = new DataGridDrag(JobData_GridView);

            //setup table bindings
            CadData_GridView.DataSource = Cad.ComponentData;
            locations_dataGridView.DataSource = Locations.GetList();            
            Tapes_dataGridView.DataSource = Tapes.tapeObjs;
            OriginalPartOrientation.DataSource = TapeObj.Orientation;
            OriginalTapeOrientation.DataSource = TapeObj.Orientation;
            UpdateTapeTypesBinding();
            PartType.DataSource = Enum.GetNames(typeof(ComponentType));

            (Tapes_dataGridView.Columns["Nozzle"] as DataGridViewComboBoxColumn).DataSource =
                new BindingSource { DataSource = nozzleChanger.getIDs() };

            //jobs table
            JobData_GridView.DataSource = Cad.JobData;
            methodDataGridViewComboBoxColumn.DataSource = new[] {"?", "Place", "LoosePlace", "Change Needle", "Recalibrate", "Ignore", "Pause", "Fiducial", "Place With UpCam", "Change nozzle", "ERROR" };
            // apply changes to multiple placement types at once
            JobData_GridView.CellValueChanged += (o, e) => {
                if (e.ColumnIndex != 3) return;
                for (int i = 0; i < JobData_GridView.SelectedCells.Count; i++) {
                    if (JobData_GridView.SelectedCells[i].ColumnIndex == 3) {
                        ((JobData)JobData_GridView.SelectedCells[i].OwningRow.DataBoundItem).Method =
                            ((JobData)JobData_GridView.Rows[e.RowIndex].DataBoundItem).Method;

                    }
                }
            };

            // right click context menu
            CadData_GridView.CellMouseDown += CadData_CellMouseDown;
            JobData_GridView.CellMouseDown += JobData_CellMouseDown;
            Tapes_dataGridView.CellMouseDown += Tapes_CellMouseDown;

            // setup key handling
            KeyPreview = true;
            SetupCursorNavigation(Controls);
            KeyUp += My_KeyUp;

            instructions_label.Text = "";
            instructions_label.Visible = false;

            // setup a bunch of stuff on the forms
            LightPlacerFormsSetup();

            VisibilityGraph = new visibilitygraph();
            VisibilityGraph = VisibilityGraph.ReLoad();
            if (VisibilityGraph == null) { VisibilityGraph = new visibilitygraph(); }
            VisibilityGraph.drawingSurface = this.pictureBox1;
            VisibilityGraph.setBounds(0, 0, Locations.GetLocation("Max Machine").X, Locations.GetLocation("Max Machine").Y);
            /*
            VisibilityGraph.insertGuard(50, 0, 50, 50);
            VisibilityGraph.insertGuard(50, 50, Locations.GetLocation("Max Machine").X, 50);

            VisibilityGraph.insertGuard(200, 200, 200, 150);
            VisibilityGraph.insertGuard(200, 150, 500, 150);
            VisibilityGraph.insertGuard(500, 150, 500, 200);
            VisibilityGraph.insertGuard(500, 200, 200, 200);
            */
            dataGridGuards.DataSource = VisibilityGraph.Guards;
            checkBoxUseGuards.Checked = VisibilityGraph.Enabled;
            updateDataGridGuard();

            Cnc.RawWrite("{\"gc\":\"G1 F100 Y0\"}");
            Thread.Sleep(100);
            Cnc.RawWrite("!%");
            
        }
Example #43
0
        // META-2262: Modify orientation here instead of in CADData.cs
        private void ModifyRootComponentOrientation(CAD.CADComponentType componentParent,
                                                    string assemblyID)
        {
            List<string> orientations = new List<string>();
            orientations.Add("ASM_TOP");
            orientations.Add("ASM_RIGHT");
            orientations.Add("ASM_FRONT");

            // Not doing recursive right now, just changing it at the first level
            //foreach (var aComponent in componentParent.CADComponent)
            if (componentParent.CADComponent != null)
            {
                foreach (var aComponent in componentParent.CADComponent)
                {
                    if (aComponent.Constraint != null)
                    {
                        foreach (var constraint in aComponent.Constraint)
                        {
                            if (constraint.Pair != null)
                            {
                                foreach (var pair in constraint.Pair)
                                {
                                    if (pair.ConstraintFeature != null)
                                    {
                                        foreach (var feature in pair.ConstraintFeature)
                                        {
                                            if (feature.ComponentID == assemblyID)
                                            {
                                                if (feature.FeatureName == "ASM_TOP")
                                                {
                                                    feature.FeatureName = "ASM_FRONT";
                                                    orientations.Remove("ASM_TOP");
                                                    if (!orientations.Any())
                                                        return;
                                                }
                                                else if (feature.FeatureName == "ASM_RIGHT")
                                                {
                                                    feature.FeatureName = "ASM_TOP";
                                                    orientations.Remove("ASM_RIGHT");
                                                    if (!orientations.Any())
                                                        return;
                                                }
                                                else if (feature.FeatureName == "ASM_FRONT")
                                                {
                                                    feature.FeatureName = "ASM_RIGHT";
                                                    orientations.Remove("ASM_FRONT");
                                                    if (!orientations.Any())
                                                        return;
                                                }
                                            }
                                        }
                                    }
                                }
                            }                    
                        }
                    }
                }
            }


        }
 protected virtual void AddAnalysisToXMLOutput(CAD.AssemblyType assembly)
 {
     if (InterferenceCheck)
     {
         CAD.AnalysesType cadanalysis = GetCADAnalysis(assembly);
         CAD.InterferenceType intfanalysis = new CAD.InterferenceType();
         intfanalysis._id = UtilityHelpers.MakeUdmID();
         intfanalysis.AnalysisID = AnalysisID;
         cadanalysis.Interference = new CAD.InterferenceType[] { intfanalysis };
     }
 }