为什么不考虑加入数据库呢,这样的效果又如何- [CommandMethod("t7")]
- public void Test7()
- {
- DBText testText = new DBText();
- testText.TextString = "WeltionTools";
- testText.Position = new Point3d(0, 0, 0);
-
- Transaction tr = Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction();
- using (tr)
- {
- BlockTableRecord space = tr.GetObject(HostApplicationServices.WorkingDatabase.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
- space.AppendEntity(testText);
- tr.AddNewlyCreatedDBObject(testText, false);
- Extents3d textExtents = testText.GeometricExtents;
- Line line = new Line();
- line.StartPoint = textExtents.MinPoint;
- line.EndPoint = textExtents.MaxPoint;
- space.AppendEntity(line);
- tr.AddNewlyCreatedDBObject(line, true);
-
- tr.Commit();
- }
- }
|