- 积分
- 284
- 明经币
- 个
- 注册时间
- 2011-9-5
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2018-1-9 09:55:29
|
显示全部楼层
换成.net 模式解决。
tempDb.ReadDwgFile(curFileName, System.IO.FileShare.ReadWrite, true, null);
using (Transaction curTrans = tempDb.TransactionManager.StartTransaction())
{
BlockTable curBt = (BlockTable)curTrans.GetObject(tempDb.BlockTableId, OpenMode.ForRead);
int i = 1;
foreach (ObjectId acObjId in curBt)
{
BlockTableRecord br = curTrans.GetObject(acObjId, OpenMode.ForWrite) as BlockTableRecord;
if (br.Name.StartsWith("_OPEN") || br.Name.StartsWith("DimnDraft"))
{
br.Name = spStr[0].Remove(0, 3) + "-" + i.ToString();
i++;
}
}
// 以写模式打开块表记录ModelSpace(模型空间)
BlockTableRecord acBlkTblRec;
acBlkTblRec = curTrans.GetObject(curBt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
foreach (ObjectId acObjId in acBlkTblRec)
{
Entity cc = curTrans.GetObject(acObjId, OpenMode.ForWrite) as Entity;
if (cc.GetType().Name == "OrdinateDimension")
{
OrdinateDimension od = cc as OrdinateDimension;
od.DimensionText = "";
//od.UpgradeOpen();
}
if (cc.GetType().Name == "RotatedDimension")
{
RotatedDimension rd = cc as RotatedDimension;
rd.DimensionText = "";
//rd.UpgradeOpen();
}
}
curTrans.Commit();
} |
|