Пример #1
0
        public void 任意多边形填充()
        {
            int    num;
            int    num10;
            object obj;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
                Point3d[] array = new Point3d[2];
IL_12:
                num2 = 3;
                Class36.smethod_32(ref array[0], ref array[1], "选择插入点:");
IL_2D:
                num2 = 4;
                short num3 = 1;
IL_31:
                num2 = 5;
                Polyline polyline = new Polyline();
                for (;;)
                {
IL_124:
                    num2 = 6;
                    short    num4;
                    Polyline polyline2;
                    short    num6;
                    checked
                    {
                        num3 += 1;
IL_3F:
                        num2  = 7;
                        array = (Point3d[])Utils.CopyArray((Array)array, new Point3d[(int)(num3 + 1)]);
IL_5A:
                        num2 = 10;
                        num4 = Class36.smethod_29(array[(int)(num3 - 1)], ref array[(int)num3], "选择下一点: ");
IL_7E:
                        num2 = 11;
                        if (num4 == 0)
                        {
                            break;
                        }
IL_8B:
                        num2 = 14;
IL_8E:
                        num2      = 15;
                        polyline2 = new Polyline();
IL_98:
                        num2 = 16;
                        short num5 = 0;
                        num6 = (short)Information.UBound(array, 1);
                        num4 = num5;
                    }
                    for (;;)
                    {
                        short num7 = num4;
                        short num8 = num6;
                        if (num7 > num8)
                        {
                            break;
                        }
IL_AA:
                        num2 = 17;
                        polyline2.AddVertexAt((int)num4, Class36.smethod_38(array[(int)num4]), 0.0, 0.0, 0.0);
IL_E3:
                        num2  = 18;
                        num4 += 1;
                    }
IL_F7:
                    num2             = 19;
                    polyline2.Closed = true;
IL_102:
                    num2 = 20;
                    CAD.AddEnt(polyline2);
IL_10D:
                    num2 = 21;
                    Class36.smethod_64(polyline.ObjectId);
IL_11D:
                    num2     = 22;
                    polyline = polyline2;
                }
IL_130:
                num2 = 25;
                Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
IL_13F:
                num2 = 26;
                Database database = mdiActiveDocument.Database;
IL_14B:
                num2 = 27;
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    BlockTable         blockTable         = (BlockTable)transaction.GetObject(database.BlockTableId, 0);
                    BlockTableRecord   blockTableRecord   = (BlockTableRecord)transaction.GetObject(blockTable[BlockTableRecord.ModelSpace], 1);
                    ObjectIdCollection objectIdCollection = new ObjectIdCollection();
                    objectIdCollection.Add(polyline.ObjectId);
                    Hatch hatch = new Hatch();
                    blockTableRecord.AppendEntity(hatch);
                    transaction.AddNewlyCreatedDBObject(hatch, true);
                    hatch.SetDatabaseDefaults();
                    hatch.PatternScale = 500.0;
                    hatch.SetHatchPattern(1, "grass");
                    hatch.Associative = true;
                    hatch.AppendLoop(16, objectIdCollection);
                    hatch.EvaluateHatch(true);
                    transaction.Commit();
                }
IL_218:
                num2 = 29;
                Class36.smethod_64(polyline.ObjectId);
IL_228:
                num2 = 30;
                if (Information.Err().Number <= 0)
                {
                    goto IL_24F;
                }
IL_23A:
                num2 = 31;
                Interaction.MsgBox(Information.Err().Description, MsgBoxStyle.OkOnly, null);
IL_24F:
                goto IL_331;
IL_254:
                int num9 = num10 + 1;
                num10    = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num9);
IL_2E8:
                goto IL_326;
IL_2EA:
                num10 = num2;
                if (num <= -2)
                {
                    goto IL_254;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_303 :;
            }
            catch when(endfilter(obj is Exception & num != 0 & num10 == 0))
            {
                Exception ex = (Exception)obj2;

                goto IL_2EA;
            }
IL_326:
            throw ProjectData.CreateProjectError(-2146828237);
IL_331:
            if (num10 != 0)
            {
                ProjectData.ClearProjectError();
            }
        }