コード例 #1
0
ファイル: BlockDraw_ConfigDlg.cpp プロジェクト: kanbang/TIDS
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();
}
コード例 #2
0
Acad::ErrorStatus
ArxDbgUtils::collectBlockIds(SdStrObjIdList& list, bool excludeMsPs,
                            bool excludeXref, bool excludeAnonymous, AcDbDatabase* db)
{
	ASSERT(db != NULL);

    Acad::ErrorStatus retCode = Acad::eInvalidInput;

    AcDbBlockTable* blkTbl;
	Acad::ErrorStatus es = db->getSymbolTable(blkTbl, AcDb::kForRead);
	if (es == Acad::eOk) {
            // get an iterator over this symbol Table
        AcDbBlockTableIterator* tblIter;
        es = blkTbl->newIterator(tblIter);
        ASSERT(tblIter != NULL);
        if (es == Acad::eOk) {
                // walk table and just collect all the objIds
                // of the entries
            AcDbObjectId tblRecId;
            for (; !tblIter->done(); tblIter->step()) {
                AcDbBlockTableRecord* blkRec;
                es = tblIter->getRecord(blkRec, AcDb::kForRead);
                if (es == Acad::eOk) {
                    if (excludeMsPs && blkRec->isLayout()) {
                        ;    // do nothing
					}
                    else if ((excludeXref) &&
                             ((blkRec->isFromExternalReference()) ||
                              (blkRec->isFromOverlayReference()))) {
                        ;    // do nothing
                    }
                    else if (excludeAnonymous && blkRec->isAnonymous()) {
                        ;    // do nothing
					}
                    else {
						const TCHAR* name;
						blkRec->getName(name);
                        list.AddAlpha(name, blkRec->objectId());
					}

                    blkRec->close();
                }
            }
            delete tblIter;
            retCode = Acad::eOk;
        }
        blkTbl->close();
    }
    return retCode;
}
コード例 #3
0
void AsdkAcUiDialogSample::DisplayBlocks() 
{

    AcDbBlockTable *pBlockTable;
    acdbHostApplicationServices()->workingDatabase()
        ->getSymbolTable(pBlockTable, AcDb::kForRead);

    // Iterate through the block table and disaply the names in the list box.
    const char *pName;
    AcDbBlockTableIterator *pBTItr;
    if (pBlockTable->newIterator(pBTItr) == Acad::eOk) {
        while (!pBTItr->done()) {
            AcDbBlockTableRecord *pRecord;
            if (pBTItr->getRecord(pRecord, AcDb::kForRead) == Acad::eOk) {
                pRecord->getName(pName);
                m_ctrlBlockListBox.InsertString(-1, pName);
                pRecord->close();
            }   
            pBTItr->step();
        }
    }
    pBlockTable->close();

}