Kerry this is quite a bit faster than test2 (having adjusted yours to accept a fixed normal Vector3d normal = Vector3d.ZAxis;)
Why it should be faster, I don't know.(Perhaps the deleting process must be cleaner in its own transaction.)
public class ConvertPoints
{
[AcRx.CommandMethod("Test1")]
static public void Test1()
{
DateTime timeStart = DateTime.Now;
Editor ed = acadApp.DocumentManager.MdiActiveDocument.Editor;
Database db = HostApplicationServices.WorkingDatabase;
DBPoint pt;
PromptSelectionResult psr=ed.SelectAll();
if (psr.Status != PromptStatus.OK) return;
SelectionSet ss = psr.Value;
ObjectIdCollection ids = new ObjectIdCollection(ss.GetObjectIds());
Point3dCollection pts = new Point3dCollection();
Vector3d normal = Vector3d.ZAxis;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
foreach (ObjectId id in ids)
{
pt = tr.GetObject(id, OpenMode.ForWrite) as DBPoint;
if (pt != null)
{
pts.Add(pt.Position);
}
pt.Erase();
}
tr.Commit();
}
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord modelspace = tr.GetObject
(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
foreach (Point3d pt3d in pts)
{
Circle c = new Circle(pt3d, normal, 15.0);
modelspace.AppendEntity(c);
tr.AddNewlyCreatedDBObject(c, true);
}
tr.Commit();
}
TimeSpan TimeDuration = (DateTime.Now - timeStart);
ed.WriteMessage("Ellapsed time: {0} seconds", (TimeDuration.TotalSeconds));
}