Hi,all:
I just want to add some entities to the currentspace, I want they can be added visually, that means i want to added it before the trans commit.
can all these entities be added in one transaction?
best regards.
swaywood
Solved! Go to Solution.
Solved by cdinten. Go to Solution.
Solved by Hallex. Go to Solution.
I often use this way:
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; doc.TransactionManager.EnableGraphicsFlush(true); Point3dCollection pts= ...; using (Transaction tr = doc.TransactionManager.StartTransaction()) { BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); foreach (Point3d pt in pts) { DBText txt= new DBText(); txt.Position=pt; // some other options for text btr.AppendEntity(txt); tr.AddNewlyCreatedDBObject(txt,true); tr.TransactionManager.QueueForGraphicsFlush();// add this line after every object is added } doc.TransactionManager.FlushGraphics();// add this before of commiting a transaction tr.Commit(); }