- UID
- 34921
- 积分
- 99
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-3-11
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
void chgEntLayer(ads_name sel,long lenSS;)
{
ads_name ssEntName;
int rc,i;
char* lyrname = "line";
AcDbLayerTable *pLyrTable;
Adesk::Boolean current = TRUE;
AcDbLayerTableRecord *pLyrTblRecord;
AcDbObjectId layerId,entId;
AcDbEntity *pEnt;
AcDbDatabase *pCurDb = NULL;
pCurDb = acdbHostApplicationServices()->workingDatabase();
pCurDb->getLayerTable(pLyrTable, AcDb::kForRead);
// Check to see if the layer name exists
if(pLyrTable->has(lyrname))
{
pLyrTable->getAt(lyrname, pLyrTblRecord, AcDb::kForWrite, Adesk::kFalse);
// pLyrTblRecord now points at the layer table record
// which was opened for write
pLyrTblRecord->setIsFrozen(Adesk::kFalse);
}
else
{
// Note how we can change the open mode
// of the layer table from AcDb::kForRead
// to AcDb::kForWrite
pLyrTable->upgradeOpen();
pLyrTblRecord = new AcDbLayerTableRecord;
pLyrTblRecord->setName(lyrname);
pLyrTable->add(pLyrTblRecord);
}
// Get the layer Table ObjectId
layerId = pLyrTblRecord->objectId();
acedSSLength(sel,&lenSS);
for(i = 0; i<lenSS; i++)
{
rc = acedSSName(sel,i,ssEntName);
if(rc != RTNORM)
{
break;
}
acdbGetObjectId(entId,ssEntName);
acdbOpenAcDbEntity(pEnt,entId,AcDb::kForWrite);
pEnt->setLayer(layerId);//这个地方不能将layerId所代表的图层设为pEnt的图层
pEnt->close();
}
pLyrTblRecord->close();
pLyrTable->close();
使图层为当前图层
if(current
{
pCurDb->setClayer(recId);
}
}
我调了很长时间,也没有效果,请帮帮忙 |
|