- 积分
- 381
- 明经币
- 个
- 注册时间
- 2013-9-13
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
try
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
DocumentLock docLock = doc.LockDocument();
ObjectId LastId = new ObjectId();
string SelectId = dg_data.Rows[e.RowIndex].Cells[0].Value.ToString();
string Rid = SelectId.Replace("(", "").Replace(")", "");
Int64 Fid = Int64.Parse(Rid);
IntPtr Sid = (IntPtr)Fid;
ObjectId Id = new ObjectId(Sid);
Database extDatabase = new Database(false,false);
using (Transaction trans = extDatabase.TransactionManager.StartTransaction())
{
try
{
if (LastId != null)
{
Entity Ent = trans.GetObject(LastId, OpenMode.ForRead) as Entity;
Ent.Unhighlight();
}
}
catch { }
Entity ent = trans.GetObject(Id, OpenMode.ForRead) as Entity;
if (ent.GetType().Name == "Line")
{
ent.Highlight();
//Line line = ent as Line;
//if (line != null)
//{
// line.StartPoint = new Point3d(0.0,0.0,0.0);
// line.EndPoint = new Point3d(0.0, 0.0, 0.0);
//}
}
LastId = Id;
//ent.TransformBy(Matrix3d.Displacement(new Vector3d(0, 0, 3)));//移动整个实体
trans.Commit();
}
docLock.Dispose();
}
catch { }
红色报错 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。 请高手帮忙看下~我想让实体闪烁Highlight
而且我想修改直线的 line.StartPoint = new Point3d(0.0,0.0,0.0);
// line.EndPoint = new Point3d(0.0, 0.0, 0.0);
不知道这样可不可以 求高手!!!
|
|