Jig操作拖动墙块
用的是2018+vs2015写的代码详见:
AutoCad 二次开发 Jig操作之墙块的拖动
jig操作拖动墙块
代码在这个地址里:
https://www.cnblogs.com/HelloQLQ/p/12148343.html 楼主加油啊,多出好作品! 楼主大神,少了tospace函数,能否上传上来给大家学习?谢谢!
我去找找看
public static ObjectId ToSpace(this Entity ent, Database db = null, string space = null)
{
db = db ?? Application.DocumentManager.MdiActiveDocument.Database;
var id = ObjectId.Null;
using (var trans = db.TransactionManager.StartTransaction())
{
var blkTbl = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
var mdlSpc = trans.GetObject(blkTbl,
OpenMode.ForWrite) as BlockTableRecord;
id = mdlSpc.AppendEntity(ent);
trans.AddNewlyCreatedDBObject(ent, true);
trans.Commit();
}
return id;
}
///
/// 将实体集合添加到特定空间。
///
///
///
///
///
public static ObjectIdCollection ToSpace(this IEnumerable ents,
Database db = null, string space = null)
{
db = db ?? Application.DocumentManager.MdiActiveDocument.Database;
var ids = new ObjectIdCollection();
using (var trans = db.TransactionManager.StartTransaction())
{
var blkTbl = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
var mdlSpc = trans.GetObject(blkTbl,
OpenMode.ForWrite) as BlockTableRecord;
foreach (var ent in ents)
{
ids.Add(mdlSpc.AppendEntity(ent));
trans.AddNewlyCreatedDBObject(ent, true);
}
trans.Commit();
}
return ids;
}
数据库扩展类
已经上传了,你自己看一下,是扩展方法。
页:
[1]