本文整理汇总了C++中AcDbBlockTable::close方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbBlockTable::close方法的具体用法?C++ AcDbBlockTable::close怎么用?C++ AcDbBlockTable::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbBlockTable
的用法示例。
在下文中一共展示了AcDbBlockTable::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acutPrintf
void
AsdkWblockReactor::otherWblock(AcDbDatabase* pDestDb,
AcDbIdMapping& idMap,
AcDbDatabase* pSrcDb)
{
AcDbBlockTable *pDestBlockTable;
AcDbBlockTableRecord *pDestBTR;
pDestDb->getSymbolTable(pDestBlockTable, AcDb::kForRead);
pDestBlockTable->getAt(ACDB_MODEL_SPACE,
pDestBTR, AcDb::kForRead);
pDestBlockTable->close();
// Now pDestBTR is pointing to pSrcDb database's Model
// Space not to the destination database's Model Space!
// The code above is not correct!
// END CODE APPEARING IN SDK DOCUMENT.
acutPrintf("\nIncorrect destination BTR's ObjectId is \t\t%Ld",
pDestBTR->objectId().asOldId());
pDestBTR->close();
AcDbBlockTable *pSrcBlockTable;
AcDbObjectId srcModelSpaceId;
pSrcDb->getSymbolTable(pSrcBlockTable, AcDb::kForRead);
pSrcBlockTable->getAt(ACDB_MODEL_SPACE,
srcModelSpaceId);
pSrcBlockTable->close();
acutPrintf("\nSource Database's Model Space BTR's ObjectId is \t%Ld",
srcModelSpaceId.asOldId());
}
示例2: acdbOpenAcDbObject
void
AsdkWblockReactor::otherWblock(AcDbDatabase* pDestDb,
AcDbIdMapping& idMap,
AcDbDatabase* pSrcDb)
{
// To find the destination Model Space, you must look
// it up in the ID map:
AcDbBlockTable *pSrcBlockTable;
pSrcDb->getSymbolTable(pSrcBlockTable, AcDb::kForRead);
AcDbObjectId srcModelSpaceId;
pSrcBlockTable->getAt(ACDB_MODEL_SPACE,
srcModelSpaceId);
pSrcBlockTable->close();
AcDbIdPair idPair;
idPair.setKey(srcModelSpaceId);
idMap.compute(idPair);
AcDbBlockTableRecord *pDestBTR;
acdbOpenAcDbObject((AcDbObject*&)pDestBTR,
idPair.value(), AcDb::kForRead, Adesk::kTrue);
// END CODE APPEARING IN SDK DOCUMENT.
acutPrintf("\nCorrect destination BTR's ObjectId is:\t\t%Ld",
pDestBTR->objectId().asOldId());
pDestBTR->close();
// Incorrect way done here so that the wrong value can be
// compared to the correct value
//
AcDbBlockTable *pDestBlockTable;
pDestDb->getSymbolTable(pDestBlockTable, AcDb::kForRead);
pDestBlockTable->getAt(ACDB_MODEL_SPACE,
pDestBTR, AcDb::kForRead);
pDestBlockTable->close();
acutPrintf("\nIncorrect destination BTR's ObjectId is \t\t%Ld",
pDestBTR->objectId().asOldId());
pDestBTR->close();
// source database Model Space BTR's ObjectId is shown to
// demonstrate that this is what the incorrect method gets
//
pSrcDb->getSymbolTable(pSrcBlockTable, AcDb::kForRead);
pSrcBlockTable->getAt(ACDB_MODEL_SPACE,
srcModelSpaceId);
pSrcBlockTable->close();
acutPrintf("\nSource Database's Model Space BTR's ObjectId is \t%Ld",
srcModelSpaceId.asOldId());
}
示例3: BlkHasRef
bool Additional_Class::BlkHasRef( CString RefName )
{
// 判断该名称的块定义是否存在
AcDbBlockTable *pBlkTbl;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlkTbl, AcDb::kForWrite);
CString strBlkDef;
strBlkDef.Format(_T("%s"), RefName);
if (pBlkTbl->has(strBlkDef) == true)
{
pBlkTbl->close();
return true;
}
pBlkTbl->close();
return false;
}
示例4: AcDbBlockTableRecord
void
makeABlock()
{
// Create and name a new block table record.
//
AcDbBlockTableRecord *pBlockTableRec
= new AcDbBlockTableRecord();
pBlockTableRec->setName("ASDK-NO-ATTR");
// Get the block table.
//
AcDbBlockTable *pBlockTable = NULL;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForWrite);
// Add the new block table record to the block table.
//
AcDbObjectId blockTableRecordId;
pBlockTable->add(blockTableRecordId, pBlockTableRec);
pBlockTable->close();
// Create and add a line entity to the component's
// block record.
//
AcDbLine *pLine = new AcDbLine();
AcDbObjectId lineId;
pLine->setStartPoint(AcGePoint3d(3, 3, 0));
pLine->setEndPoint(AcGePoint3d(6, 6, 0));
pLine->setColorIndex(3);
pBlockTableRec->appendAcDbEntity(lineId, pLine);
pLine->close();
pBlockTableRec->close();
}
示例5: createCircle
Acad::ErrorStatus createCircle(AcDbObjectId & idCircle)
{
CLogger::Print(L"*Call: createCircle()");
Acad::ErrorStatus es, esTmp;
AcDbBlockTable* pBlockTable = NULL;
es = acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead);
if (Acad::eOk != es) {
CLogger::Print(L"*Exit: createCircle() - Fail to get the BlockTable.");
return es;
}
AcDbBlockTableRecord* pModelSpace = NULL;
es = pBlockTable->getAt(ACDB_MODEL_SPACE, pModelSpace, AcDb::kForWrite);
if (Acad::eOk != (esTmp = pBlockTable->close())) {
CLogger::Print(L"Warn: Fail to close the BlockTable!");
acrx_abort(ACRX_T("\nThere is an error occured when close the BlockTable. Message: %s")
, acadErrorStatusText(esTmp));
}
if (Acad::eOk != es) {
CLogger::Print(L"*Exit: createCircle() - Fail to get the Model Space! Error: %s", acadErrorStatusText(es));
return es;
}
idCircle = AcDbObjectId::kNull;
AcGePoint3d pt3Center(9.0, 3.0, 0.0);
AcGeVector3d vt3Normal(0.0, 0.0, 1.0);
AcDbCircle* pCircle = new AcDbCircle(pt3Center, vt3Normal, 10.0);
if (!pCircle) {
if (Acad::eOk != (esTmp = pModelSpace->close())) {
CLogger::Print(L"Warn: Fail to create new circle object!");
acrx_abort(ACRX_T("\nThere is an error occured. Error: %s")
, acadErrorStatusText(esTmp));
}
return Acad::eOutOfMemory;
}
es = pModelSpace->appendAcDbEntity(idCircle, pCircle);
if (Acad::eOk != (esTmp = pModelSpace->close())) {
CLogger::Print(L"Warn: Fail to close the Model Space!");
acrx_abort(ACRX_T("\nThere is an error occured when close the Model Space! Error: %s")
, acadErrorStatusText(esTmp));
}
if (Acad::eOk != es) {
CLogger::Print(L"*Exit: createCircle() - Fail to append new circle in to Model Space!");
delete pCircle;
return es;
}
if (Acad::eOk != (esTmp = pCircle->close())) {
CLogger::Print(L"Warn: Fail to close the circle object.");
acrx_abort(ACRX_T("\nFail to close the circle entity!, Error: %s")
, acadErrorStatusText(esTmp));
}
CLogger::Print(L"*Exit: createCircle()");
return Acad::eOk;
}
示例6: getSymbolTable
Acad::ErrorStatus
postToDb(AcDbEntity* ent, AcDbObjectId& objId)
{
Acad::ErrorStatus es;
AcDbBlockTable* pBlockTable;
AcDbBlockTableRecord* pSpaceRecord;
if ((es = acdbHostApplicationServices()->workingDatabase()->
getSymbolTable(pBlockTable, AcDb::kForRead))
!= Acad::eOk) {
return es;
}
if ((es = pBlockTable->getAt(ACDB_MODEL_SPACE,
pSpaceRecord,
AcDb::kForWrite)) != Acad::eOk) {
return es;
}
if ((es = pBlockTable->close()) != Acad::eOk) {
return es;
}
if ((es = pSpaceRecord->appendAcDbEntity(objId, ent)) != Acad::eOk) {
return es;
}
if ((es = pSpaceRecord->close()) != Acad::eOk) {
return es;
}
return ent->close();
}
示例7: acdbHostApplicationServices
Acad::ErrorStatus
postToDatabase(/*[in]*/AcDbEntity* pEnt,/*[out]*/AcDbObjectId& idObj)
//Purpose:
// Adds an entity to the MODEL_SPACE of the CURRENT database.
//Note:
// It could be generalized to add it to any block table record of
// any database, but why complicate it...
//
{
Acad::ErrorStatus es;
AcDbBlockTable* pBlockTable;
AcDbBlockTableRecord* pSpaceRecord;
AcDbDatabase *pCurDwg = acdbHostApplicationServices()->workingDatabase();
if (pCurDwg==NULL)
return Acad::eNoDatabase;
//Get a pointer to the current drawing
//and get the drawing's block table. Open it for read.
if ((es = pCurDwg->getBlockTable(pBlockTable, AcDb::kForRead))==Acad::eOk){
//Get the Model Space record and open it for write. This will be the owner of the new line.
if ((es = pBlockTable->getAt(ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite))==Acad::eOk){
//Append pEnt to Model Space, then close it and the Model Space record.
if ((es = pSpaceRecord->appendAcDbEntity(idObj, pEnt))==Acad::eOk)
pEnt->close();
pSpaceRecord->close();
}
pBlockTable->close();
}
//it is good programming practice to return an error status
return es;
}
示例8: readDatabase
void readDatabase()
{
// Use kFalse to create an empty database.
AcDbDatabase *pDb = new AcDbDatabase(Adesk::kFalse);
// Use readDwgFile to load the DWG file.
acutPrintf(_T("\nRead file \"d:\\temp\\testfile.dwg\"."));
if(Acad::eOk != pDb->readDwgFile(_T("d:\\temp\\testfile.dwg")))
return;
// Get the BlockTable.
AcDbBlockTable *pBTable = NULL;
pDb->getSymbolTable(pBTable, AcDb::kForRead);
// Get the ModelSpace.
AcDbBlockTableRecord *pRecord = NULL;
pBTable->getAt(ACDB_MODEL_SPACE, pRecord, AcDb::kForRead);
pBTable->close();
// Get new iterator.
AcDbBlockTableRecordIterator *pItr = NULL;
pRecord->newIterator(pItr);
AcDbEntity *pEnt = NULL;
for (pItr->start(); !pItr->done(); pItr->step())
{
pItr->getEntity(pEnt, AcDb::kForRead);
acutPrintf(_T("\nclassname: %s"), (pEnt->isA())->name());
pEnt->close();
}
pRecord->close();
delete pItr;
delete pDb;
}
示例9: fillBlockList
void BlockDraw_ConfigDlg::fillBlockList()
{
// 清空
m_blockList.ResetContent();
// 填充块列表
AcDbBlockTable* pBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable( pBlockTable, AcDb::kForRead );
// Iterate through the block table and disaply the names in the list box.
AcString name;
AcDbBlockTableIterator* pBTItr;
if ( pBlockTable->newIterator( pBTItr ) == Acad::eOk )
{
while ( !pBTItr->done() )
{
AcDbBlockTableRecord* pRecord;
if ( pBTItr->getRecord( pRecord, AcDb::kForRead ) == Acad::eOk )
{
pRecord->getName( name );
// 排除默认的2个块定义(模型空间和图纸空间)
if( name.find( ACDB_MODEL_SPACE ) < 0 && name.find( ACDB_PAPER_SPACE ) < 0 )
{
m_blockList.AddString( name.kACharPtr() );
}
pRecord->close();
}
pBTItr->step();
}
}
pBlockTable->close();
}
示例10: Draw_Rectangle
AcDbObjectId Additional_Class::Draw_Rectangle( AcGePoint2d stPt, double length, double height )
{
AcDbPolyline *pPolyline = new AcDbPolyline(4);
AcGePoint2d stPt1, stPt2, stPt3, stPt4;
stPt1 = stPt;
pPolyline->addVertexAt(0, stPt1, 0, 0, 0);
stPt2.x = stPt.x +length;
stPt2.y = stPt.y;
pPolyline->addVertexAt(1, stPt2, 0, 0, 0);
stPt3.x = stPt2.x;
stPt3.y = stPt2.y + height;
pPolyline->addVertexAt(2, stPt3, 0, 0, 0);
stPt4.x = stPt3.x - length;
stPt4.y = stPt3.y;
pPolyline->addVertexAt(3, stPt4, 0, 0, 0);
pPolyline->setClosed(Adesk::kTrue);
AcDbBlockTable *pBlockTable = NULL;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
//this->Open_BlockTable(pBlockTable, NREADMODE);
AcDbBlockTableRecord *pBlockTableRecord = NULL;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
//acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
//this->Open_ModelTableRecord(pBlockTableRecord, pBlockTable, NWRITEMODE);
AcDbObjectId TempLineID;
pBlockTableRecord->appendAcDbEntity(TempLineID, pPolyline);
pPolyline->close();
pBlockTable->close();
pBlockTableRecord->close();
return TempLineID;
}
示例11: postToDatabase
Acad::ErrorStatus postToDatabase (/*[in]*/AcDbDatabase *pDb /*=NULL*/, AcDbEntity *pEnt, AcDbObjectId &idObj) {
//----- Purpose:
//----- Adds an entity to the MODEL_SPACE of the database given in argument.
//----- * pDb: pointer to the databse where to add the entity,
//----- if NULL, then the curretn database is used.
//----- * pEnt: pointer to an entity instance.
//----- * idObj: it will contain the assign ID to the object if successfully added to the database.
//----- Note:
//----- The entity object is closed while we return from that function. Only the idObj can be used after.
assert ( pEnt != NULL ) ;
if ( pDb == NULL )
pDb =acdbHostApplicationServices ()->workingDatabase () ;
//----- Get a pointer to the current drawing
//----- and get the drawing's block table. Open it for read.
Acad::ErrorStatus es ;
AcDbBlockTable *pBlockTable ;
if ( (es =pDb->getBlockTable (pBlockTable, AcDb::kForRead)) == Acad::eOk ) {
//----- Get the Model Space record and open it for write. This will be the owner of the new line.
AcDbBlockTableRecord *pSpaceRecord ;
if ( (es =pBlockTable->getAt (ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite)) == Acad::eOk ) {
//----- Append pEnt to Model Space, then close it and the Model Space record.
if ( (es =pSpaceRecord->appendAcDbEntity (idObj, pEnt)) == Acad::eOk )
pEnt->close () ;
pSpaceRecord->close () ;
}
pBlockTable->close () ;
}
//----- It is good programming practice to return an error status
return (es) ;
}
示例12:
Acad::ErrorStatus
ArxDbgUtils::defineNewAnonymousBlock(AcDbBlockTableRecord*& newBlkRec,
AcDbObjectId& newBlkRecId, AcDbDatabase* db)
{
ASSERT(db != NULL);
AcDbBlockTable* blkTbl;
Acad::ErrorStatus es = db->getSymbolTable(blkTbl, AcDb::kForWrite);
if (es != Acad::eOk)
return es;
newBlkRec = new AcDbBlockTableRecord;
newBlkRec->setPathName(AcadString::nullStr); // constructor doesn't do it properly
es = newBlkRec->setName(_T("*U"));
if (es == Acad::eOk)
es = blkTbl->add(newBlkRecId, newBlkRec);
if (es != Acad::eOk) { // make sure everything went ok
ArxDbgUtils::rxErrorMsg(es);
delete newBlkRec;
newBlkRec = NULL; // don't let caller get bad value
}
blkTbl->close(); // doesn't need to be open anymore
return es;
}
示例13: FindLinesByPoint
// 查找连接点junctionPt关联的分支图元(包含隐形的图元)
static void FindLinesByPoint( const AcGePoint3d& junctionPt, AcDbObjectIdArray& objIds )
{
AcDbBlockTable* pBlkTbl;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable( pBlkTbl, AcDb::kForRead );
AcDbBlockTableRecord* pBlkTblRcd;
pBlkTbl->getAt( ACDB_MODEL_SPACE, pBlkTblRcd, AcDb::kForRead );
pBlkTbl->close();
AcDbBlockTableRecordIterator* pBlkTblRcdItr;
pBlkTblRcd->newIterator( pBlkTblRcdItr );
for ( pBlkTblRcdItr->start(); !pBlkTblRcdItr->done(); pBlkTblRcdItr->step() )
{
// 不采用transaction的方法查找LinkedGE,
// 等价于排除当前正在以write状态编辑的LinkedGE
// 重要(***)
AcDbEntity* pEnt = 0;
if( Acad::eOk != pBlkTblRcdItr->getEntity( pEnt, AcDb::kForRead ) ) continue;
LinkedGE* pEdge = LinkedGE::cast( pEnt );
if( pEdge != 0 )
{
AcGePoint3d startPt, endPt;
pEdge->getSEPoint( startPt, endPt );
if( startPt == junctionPt || endPt == junctionPt )
{
objIds.append( pEdge->objectId() );
}
}
pEnt->close();
}
delete pBlkTblRcdItr;
pBlkTblRcd->close();
}
示例14: FilterDb
//0,不显示属性,1,显示属性,2,显示属性默认值
void CZhfPalette::FilterDb(AcDbDatabase* pDb, int iFilterMode)
{
if (iFilterMode==1)
{
return ;
}
Acad::ErrorStatus es ;
AcDbBlockTable* pBT = NULL ;
pDb->getBlockTable(pBT, AcDb::kForRead);
AcDbBlockTableRecord* pBTR = NULL;
es = pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForWrite);
pBT->close();
AcDbBlockTableRecordIterator* pIT;
es = pBTR->newIterator(pIT) ;
for (; !pIT->done(); pIT->step())
{
AcDbEntity* pEnt = NULL ;
if (Acad::eOk==pIT->getEntity(pEnt, AcDb::kForWrite))
{
if (pEnt->isKindOf(AcDbAttributeDefinition::desc()))
{
AcDbAttributeDefinition *pAttDef = AcDbAttributeDefinition::cast(pEnt);
if (iFilterMode==0)
{
pEnt->erase() ;
}
else if (iFilterMode>1)
{
if (pAttDef != NULL && !pAttDef->isConstant())
{
// We have a non-constant attribute definition,
// so build an attribute entity.
CString strShowVal ;
if (iFilterMode==2)
{
strShowVal = pAttDef->textString() ;
}
else if (iFilterMode==3)
{
strShowVal = pAttDef->prompt() ; //显示中文为乱码
}
pAttDef->setTag(strShowVal) ;
}
}
}
pEnt->close() ;
}
}
delete pIT;
pBTR->close();
}
示例15: append
bool append(AcDbEntity* pEntity)
{
AcDbBlockTable *pBlockTable;
AcApDocument* pDoc = acDocManager->curDocument();
Acad::ErrorStatus es = acDocManager->lockDocument(pDoc);
if (es != Acad::eOk) {
acedAlert("Failed to lock the document...");
return false;
}
AcDbDatabase* pDb = pDoc->database();
es = pDb->getBlockTable(pBlockTable, AcDb::kForRead);
if (es != Acad::eOk) {
acedAlert("Failed to get block table...");
return false;
}
AcDbBlockTableRecord *pBlockRec;
es = pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockRec, AcDb::kForWrite);
if (es != Acad::eOk) {
acedAlert("Failed to get block table record...");
pBlockTable->close();
return false;
}
es = pBlockRec->appendAcDbEntity(pEntity);
if (es != Acad::eOk) {
acedAlert("Failed to append entity...");
pBlockTable->close();
pBlockRec->close();
delete pEntity;
return false;
}
pBlockRec->close();
pBlockTable->close();
return true;
}