循环读取PromptSelectionResult 时的问题
取得选择集(选中多个)PromptSelectionResult resEnt = ...;
for (int ii = 0; ii < resEnt.Value.Count - 1; ii++)
{
ObjectId resEntObjectId1 = resEnt.Value.ObjectId;
ObjectId resEntObjectId2 = resEnt.Value.ObjectId;
//----------------
Entity e1 = (Entity)trans.GetObject(resEntObjectId1, OpenMode.ForRead);//第二次循环报错?而且try-catch也捕捉不到?!
........
调试:
trans.GetObject(resEntObjectId1, OpenMode.ForRead);//
对象的当前状态使该操作无效。
调试:
resEntObjectId1
{(2130329952)}
Database: {Autodesk.AutoCAD.DatabaseServices.Database}
Handle: {144}
IsEffectivelyErased: false
IsErased: false
IsNull: false
IsValid: true
NonForwardedHandle: {144}
ObjectLeftOnDisk: false
OldId: 2130329952
OriginalDatabase: {Autodesk.AutoCAD.DatabaseServices.Database}
仔细看你的循环语句 你为什么要写两个呢,一个循环里写一个不就可以了吗?? ObjectId resEntObjectId2 = resEnt.Value.ObjectId;
用到了吗???下次循环的时候第一个就是它了啊
页:
[1]