示例#1
0
        public static void PrintNumTitle(Database db, Point3d PaperOrigenPoint, Bridge theBridge)
        {
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                TextStyleTable   st       = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                BlockTable       blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                BlockTableRecord recorder = tr.GetObject(blockTbl[BlockTableRecord.PaperSpace], OpenMode.ForWrite) as BlockTableRecord;

                // 右上角标号
                for (int j = 0; j < 2; j++)
                {
                    for (int i = 0; i <= 1; i++)
                    {
                        DBText num = new DBText();

                        num.Height = 3.5;
                        if (i == 0)
                        {
                            num.TextString = (j + 1).ToString();
                            num.Position   = PaperOrigenPoint.Convert3D(387.5 + j * 420, 283);
                        }
                        else
                        {
                            num.TextString = "2";
                            num.Position   = PaperOrigenPoint.Convert3D(402.5 + j * 420, 283);
                        }
                        num.HorizontalMode = TextHorizontalMode.TextCenter;
                        num.VerticalMode   = TextVerticalMode.TextVerticalMid;
                        num.AlignmentPoint = num.Position;
                        num.Layer          = "标注";
                        num.TextStyleId    = st["仿宋"];
                        recorder.AppendEntity(num);
                        tr.AddNewlyCreatedDBObject(num, true);
                    }
                }


                // 标题
                for (int j = 0; j < 2; j++)
                {
                    DBText title = new DBText();
                    if (j == 0)
                    {
                        title.TextString = "桥梁总体布置图(一)";
                        title.Position   = PaperOrigenPoint.Convert3D(167.5, 15);
                    }
                    else
                    {
                        title.TextString = "桥梁总体布置图(二)";
                        title.Position   = PaperOrigenPoint.Convert3D(167.5 + 420, 15);
                    }
                    title.Height         = 4.5;
                    title.HorizontalMode = TextHorizontalMode.TextCenter;
                    title.VerticalMode   = TextVerticalMode.TextVerticalMid;
                    title.AlignmentPoint = title.Position;
                    title.Layer          = "标注";
                    title.TextStyleId    = st["仿宋"];
                    title.WidthFactor    = 0.8;
                    recorder.AppendEntity(title);
                    tr.AddNewlyCreatedDBObject(title, true);
                }


                tr.Commit();
            }
            return;
        }
示例#2
0
        public static void PrintFName(Database db, Point3d InsertPoint, Bridge bridge)
        {
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                TextStyleTable   st       = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                BlockTable       blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                BlockTableRecord recorder = tr.GetObject(blockTbl[BlockTableRecord.PaperSpace], OpenMode.ForWrite) as BlockTableRecord;

                DBText title = new DBText();
                title.TextString     = bridge.Name;
                title.Position       = InsertPoint.Convert3D(108.3735, 17.5);
                title.Height         = 3;
                title.HorizontalMode = TextHorizontalMode.TextCenter;
                title.VerticalMode   = TextVerticalMode.TextVerticalMid;
                title.AlignmentPoint = title.Position;
                title.Layer          = "标注";
                title.TextStyleId    = st["仿宋"];
                title.WidthFactor    = 0.8;
                recorder.AppendEntity(title);
                tr.AddNewlyCreatedDBObject(title, true);

                title                = new DBText();
                title.TextString     = string.Format("{0}-{1}", bridge.BS, bridge.ES);
                title.Position       = InsertPoint.Convert3D(108.3735, 17.5 - 5);
                title.Height         = 3;
                title.HorizontalMode = TextHorizontalMode.TextCenter;
                title.VerticalMode   = TextVerticalMode.TextVerticalMid;
                title.AlignmentPoint = title.Position;
                title.Layer          = "标注";
                title.TextStyleId    = st["仿宋"];
                title.WidthFactor    = 0.8;
                recorder.AppendEntity(title);
                tr.AddNewlyCreatedDBObject(title, true);


                title                = new DBText();
                title.TextString     = bridge.Name;
                title.Position       = InsertPoint.Convert3D(108.3735 + 420, 17.5);
                title.Height         = 3;
                title.HorizontalMode = TextHorizontalMode.TextCenter;
                title.VerticalMode   = TextVerticalMode.TextVerticalMid;
                title.AlignmentPoint = title.Position;
                title.Layer          = "标注";
                title.TextStyleId    = st["仿宋"];
                title.WidthFactor    = 0.8;
                recorder.AppendEntity(title);
                tr.AddNewlyCreatedDBObject(title, true);

                title.TextString     = string.Format("{0}-{1}", bridge.BS, bridge.ES);
                title.Position       = InsertPoint.Convert3D(108.3735 + 420, 17.5 - 5);
                title.Height         = 3;
                title.HorizontalMode = TextHorizontalMode.TextCenter;
                title.VerticalMode   = TextVerticalMode.TextVerticalMid;
                title.AlignmentPoint = title.Position;
                title.Layer          = "标注";
                title.TextStyleId    = st["仿宋"];
                title.WidthFactor    = 0.8;
                recorder.AppendEntity(title);
                tr.AddNewlyCreatedDBObject(title, true);

                tr.Commit();
            }
            return;
        }