- UID
- 68456
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-7-30
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
如何得到以下代码的AcDbObjectID?
//////////////////////////
//set up new layers
//////////////////////////
Acad::ErrorStatus createNewLayer(char* layername,int color)
{
AcDbLayerTableRecord * pLayerTableRecord=new AcDbLayerTableRecord;
if(pLayerTableRecord==NULL)
{
return Acad::eOutOfMemory;
}
Acad::ErrorStatus es=pLayerTableRecord->setName(layername);
if(es!=Acad::eOk)
{
delete pLayerTableRecord;
return es;
}
AcCmColor acCmColor;
acCmColor.setColorIndex(color);
pLayerTableRecord->setColor(acCmColor);
//open layer table
AcDbLayerTable *pLayerTable;
es=acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pLayerTable,AcDb::kForWrite);
if(es!=Acad::eOk)
{
delete pLayerTableRecord;
return es;
}
//open linetype table
AcDbLinetypeTable *pLinetypeTbl;
es=acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pLinetypeTbl,AcDb::kForRead);
if(es!=Acad::eOk)
{
delete pLayerTableRecord;
es=pLayerTable->close();
if(es!=Acad::eOk)
{
acrx_abort("\nClose layer table fault,error: %d",
acadErrorStatusText(es));
}
return es;
}
//get "CONTINUOUS" linetype object's ID
AcDbObjectId ltypeObjId;
es=pLinetypeTbl->getAt("CONTINUOUS",ltypeObjId);
if(es!=Acad::eOk)
{
delete pLayerTableRecord;
es=pLayerTable->close();
if(es!=Acad::eOk)
{
acrx_abort("\nClose layer table fault,error: %d",
acadErrorStatusText(es));
}
return es;
}
//setup linetype for new layer
pLayerTableRecord->setLinetypeObjectId(ltypeObjId);
//
es=pLayerTable->add(pLayerTableRecord);
if(es!=Acad::eOk)
{
Acad::ErrorStatus es2=pLayerTable->close();
if(es2!=Acad::eOk)
{
acrx_abort("\nClose layer table fault,error: %d",
acadErrorStatusText(es2));
}
delete pLayerTableRecord;
return es;
}
//close layer table
es=pLayerTable->close();
if(es!=Acad::eOk)
{
acrx_abort("\nClose layer table fault,error: %d",
acadErrorStatusText(es));
}
//close layer table object
es=pLayerTableRecord->close();
if(es!=Acad::eOk)
{
acrx_abort("\nClose layer table fault,error: %d",
acadErrorStatusText(es));
}
//return state code
return es;
}
//////////////////////////////////
//不是写成一个类啊
///////////////////////////////// |
|