ARX添加新的图形对象到当前数据库空间ObjectARX PostCurrentSpace

static Acad::ErrorStatus PostCurrentSpace(AcDbObjectId &objId,AcDbEntity *pEnt)
	{	
		Acad::ErrorStatus es=Acad::eNullObjectId;
		AcDbObjectId blkRcdId=acdbHostApplicationServices()->workingDatabase()->currentSpaceId();
		if (AcDbObjectId::kNull != blkRcdId)
		{
			AcDbBlockTableRecordPointer pBlkTblRcd(blkRcdId,AcDb::kForWrite);	
			es=pBlkTblRcd.openStatus();
			if	(Acad::eOk == es)
			{
				es= pBlkTblRcd->appendAcDbEntity(objId, pEnt);
				if (Acad::eOk == es)
				{
					pEnt->close();
				}			
			}				
		}	
		if (Acad::eOk!=es)
		{
			if (pEnt!=NULL)
			{
				delete pEnt;
				pEnt=NULL;
			}
		}
		return es;
	}

  

posted @ 2018-06-09 12:02  edata  阅读(652)  评论(0编辑  收藏  举报