使用工具==CAD2019+VS2022
主要作用==可以同时添加点、圆、直线、多段线等实体到CAD中
代码
public static void AddEntitysToModelSpace(this Database db,Entity[] entitys)
{
using (Transaction trans = db.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
foreach (Entity enty in entitys)
{
btr.AppendEntity(enty);
trans.AddNewlyCreatedDBObject(enty, true);
}
trans.Commit();
}