|
发表于 2018-1-9 09:55:00
|
显示全部楼层
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();
} |
|