- UID
- 468619
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2006-7-18
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我是这样写的,可是运行错
Acad::ErrorStatus ConversionAttlay(CString layName,CString oldName)
{
Acad::ErrorStatus es;
AcDbObjectId objId;
AcDbObject *pObj;
AcDbEntity *pEn;
ads_name ssName;
struct resbuf eb;
eb.restype=0;
eb.resval.rstring="insert";
eb.rbnext=NULL;
if(RTNORM ==acedSSGet("X",NULL,NULL,&eb,ssName))
{
long i;
acedSSLength(ssName,&i);
for(int j=0;j<i;j++)
{
AcDbBlockTableRecord *pBlockDef;
AcDbBlockTableRecordIterator *pIt;
AcDbEntity *pEn;
ads_name ent;
if (RTNORM !=acedSSName(ssName, j, ent))
{
acedSSFree(ssName);
return Acad::eNotAnEntity;
}
es = acdbGetObjectId( objId, ent );
if(es!=Acad::eOk){
acedSSFree(ssName);
return es;
}
es = acdbOpenObject(pObj, objId, AcDb::kForRead);
if(es!=Acad::eOk){
acedSSFree(ssName);
return es;
}
if(pObj->isKindOf(AcDbBlockTableRecord::desc())==Adesk::kTrue)
{
pBlockDef=AcDbBlockTableRecord::cast(pObj);
}
es=pBlockDef->newIterator(pIt);
if(es!=Acad::eOk){
acedSSFree(ssName);
pBlockDef->close();
return es;
}
for(pIt->start();!pIt->done();pIt->step())
{
pIt->getEntity(pEn,AcDb::kForWrite);
if(pEn->layer()==oldName)
{
es=pEn->setLayer(layName);
if(es!=Acad::eOk){
acedSSFree(ssName);
delete pIt;
pEn->close();
return es;
}
}
es=pEn->close();
if(es!=Acad::eOk){
acedSSFree(ssName);
delete pIt;
pEn->close();
pBlockDef->close();
pObj->close();
return es;
}
delete pIt;
es=pEn->close();
if(es!=Acad::eOk){
acedSSFree(ssName);
pBlockDef->close();
pObj->close();
return es;
}
}
es=pBlockDef->close();
if(es!=Acad::eOk){
acedSSFree(ssName);
pObj->close();
return es;
}
es=pObj->close();
if(es!=Acad::eOk){
acedSSFree(ssName);
pObj->close();
return es;
}
}
}
acedSSFree (ssName);
return Acad::eOk;
} |
|