尝试读取或写入受保护的内存
try{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
DocumentLock docLock = doc.LockDocument();
ObjectId LastId = new ObjectId();
string SelectId = dg_data.Rows.Cells.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);
不知道这样可不可以求高手!!!
如果有错误 请大家提出来,或者那里要改的请告诉我一下,谢谢了~ 本帖最后由 ps122hb 于 2013-9-14 07:54 编辑
这个得在环境下调试
ps122hb 发表于 2013-9-14 07:51 static/image/common/back.gif
这个得在环境下调试
好的 ,谢谢~
页:
[1]