cad.net 图元延迟显示,动画效果,编辑器延迟发送提示.

时间:2021-08-12 05:17:54
    using Acap = Autodesk.AutoCAD.ApplicationServices.Application; 
public class Command_test
{
[CommandMethod("tt", CommandFlags.Modal | CommandFlags.UsePickSet | CommandFlags.Redraw)]
public static void tt()
{
Database db = HostApplicationServices.WorkingDatabase;//当前的数据库
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
int aa = ;
for (int i = ; i < ; i++)
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
//新建圆
var ent = EntityAdd.AddCircleToEntity(new Point3d(aa++, , ), 0.5);
EntityAdd.AddEntityToMsPs(tr, db, ent);
//刷新内容
Acap.UpdateScreen();
tr.Commit();
} ed.WriteMessage(aa++.ToString()+"\n");//这两种不同感觉
//ed.WriteMessage(aa++.ToString()+"\r");//这两种不同感觉 //高版本要加这句令命令栏立即执行
System.Windows.Forms.Application.DoEvents();
//阻塞
System.Threading.Thread.Sleep();
}
}
}

代码效果:

cad.net 图元延迟显示,动画效果,编辑器延迟发送提示.

cad.net 图元延迟显示,动画效果,编辑器延迟发送提示.