当前位置: 首页>>代码示例>>C++>>正文


C++ AcDbBlockTable类代码示例

本文整理汇总了C++中AcDbBlockTable的典型用法代码示例。如果您正苦于以下问题:C++ AcDbBlockTable类的具体用法?C++ AcDbBlockTable怎么用?C++ AcDbBlockTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AcDbBlockTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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();
}
开发者ID:kanbang,项目名称:TIDS,代码行数:36,代码来源:EdgeJunctionClosure.cpp

示例2: acdbHostApplicationServices

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();
}
开发者ID:kanbang,项目名称:TIDS,代码行数:33,代码来源:BlockDraw_ConfigDlg.cpp

示例3: AcDbPolyline

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;
}
开发者ID:TobeGodman,项目名称:AutoTrader,代码行数:30,代码来源:Additional_Class.cpp

示例4: 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;
}
开发者ID:kevinzhwl,项目名称:ZRXSDKMod,代码行数:34,代码来源:DatabaseOp.cpp

示例5: AcDbTable

AcDbObjectId Additional_Class::Creat_Table(AcGePoint3d TablePoint, vector<CString> Title, double ColWidth, double RowHeight, double TextHeight)
{
	AcDbTable *pTable = new AcDbTable();
	AcDbObjectId TableID;
	pTable->setNumColumns(Title.size());
	pTable->setNumRows(1);
	pTable->setColumnWidth(ColWidth);
	pTable->setRowHeight(RowHeight);
	pTable->setDirection(AcGeVector3d(1,0,0));
	pTable->setNormal(AcGeVector3d(0,0,1));
	
	pTable->setPosition(TablePoint);
	AcDbBlockTable *pBlockTable;
	AcDbBlockTableRecord *pBlockTableRecord;
	acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
	pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);
	pBlockTableRecord->appendAcDbEntity(TableID, pTable);
	//pBlockTable->close();
	pBlockTableRecord->close();
	//pTable->setTextString(0,0, "桩 号");
	//pTable->setTextHeight(0,0,10);
	//pTable->setTextString(0,1, "X坐标值");
	//pTable->setTextHeight(0,1,10);
	//pTable->setTextString(0,2, "Y坐标值");
	//pTable->setTextHeight(0,2,10);
	//pTable->setTextString(0,3, "特性值");
	//pTable->setTextHeight(0,3,10);
	//pTable->setTextString(0,4, "长 度");
	//pTable->setTextHeight(0,4,10);
	pTable->close();
	return TableID;
}
开发者ID:TobeGodman,项目名称:AutoTrader,代码行数:32,代码来源:Additional_Class.cpp

示例6: 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) ;
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:31,代码来源:HlrArxSampleCommands.cpp

示例7: ASSERT

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;
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:27,代码来源:ArxDbgUtilsSymTbl.cpp

示例8: postToDatabase

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;
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:30,代码来源:Lab8CommandUtils.cpp

示例9: makeABlock

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();
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:35,代码来源:complex.cpp

示例10: 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;
}
开发者ID:vuonganh1993,项目名称:arxlss,代码行数:60,代码来源:LSS10.cpp

示例11: postToDb

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();
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:34,代码来源:utilui.cpp

示例12: 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();
}
开发者ID:luosin,项目名称:cad-2004-lzx,代码行数:56,代码来源:ZhfPalette.cpp

示例13: GetBlockTableRecord

AcDbBlockTableRecord* CArxHelper::GetBlockTableRecord(AcDbDatabase* pDatabase, BOOL OpenWrite)
{
	AcDbBlockTable* pBlockTable = NULL;
	pDatabase->getBlockTable(pBlockTable,AcDb::kForRead);
	AcDbBlockTableRecord* pBTR = NULL;
	if (pBlockTable)
	{
		pBlockTable->getAt(ACDB_MODEL_SPACE, pBTR, OpenWrite ? AcDb::kForWrite : AcDb::kForRead);
		pBlockTable->close();
	}
	return pBTR;
}
开发者ID:ninuo,项目名称:ArxWorkspace,代码行数:12,代码来源:ArxHelper2.cpp

示例14: while

void InteriorPointsConstructor::printFirstInteriorPoints(int color, bool flag)
{
	int i = 1;
	int j = 0;
		
		
		AcGePoint3dArray ptArr;
		ptArr.setLogicalLength(_interiorArray[i].length()+1);
		
		
		while (j < _interiorArray[i].length())
		{
			
			ptArr[j].set(_interiorArray[i][j].x, _interiorArray[i][j].y, _interiorArray[i][j].z);
			
			
		
			j++;
		}
		ptArr[j].set(_interiorArray[0][0].x, _interiorArray[0][0].y, _interiorArray[0][0].z);
			

		AcDb3dPolyline *pNewPline = new AcDb3dPolyline(AcDb::k3dSimplePoly , ptArr, Adesk::kFalse);
		
		pNewPline->setColorIndex(color);

		AcDbBlockTable *pBlockTable;
		AcDbBlockTableRecord *pBlockTableRecord;


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

		
		
		pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);


		AcDbObjectId plineObjId;
		pBlockTableRecord->appendAcDbEntity(plineObjId, pNewPline);
		
		pBlockTable->close();
		pBlockTableRecord->close();

		//pNewPline->setLayer(_T("0"));
		//pNewPline->setClosed(Adesk::kFalse);
		pNewPline->close();
		//}
		//delete pNewPline;
		
	
	
}
开发者ID:vpatrinica,项目名称:pernute,代码行数:52,代码来源:InteriorPointsConstructor.cpp

示例15: createPolyline

void
createPolyline()
{
    // Set four vertex locations for the pline.
    //
    AcGePoint3dArray ptArr;
    ptArr.setLogicalLength(4);
    for (int i = 0; i < 4; i++) {
        ptArr[i].set((double)(i/2), (double)(i%2), 0.0);
    }

    // Dynamically allocate an AcDb2dPolyline object,
    // given four vertex elements whose locations are supplied
    // in ptArr.  The polyline has no elevation, and is
    // explicitly set as closed.  The polyline is simple;
    // that is, not curve fit or a spline.  By default, the
    // widths are all 0.0 and there are no bulge factors.
    //
    AcDb2dPolyline *pNewPline = new AcDb2dPolyline(
        AcDb::k2dSimplePoly, ptArr, 0.0, Adesk::kTrue);

    pNewPline->setColorIndex(3);

    // Get a pointer to a Block Table object.
    //
    AcDbBlockTable *pBlockTable;
    acdbHostApplicationServices()->workingDatabase()
        ->getSymbolTable(pBlockTable, AcDb::kForRead);

    // Get a pointer to the MODEL_SPACE BlockTableRecord.
    //
    AcDbBlockTableRecord *pBlockTableRecord;
    pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
        AcDb::kForWrite);

    pBlockTable->close();

    // Append the pline object to the database and
    // obtain its Object ID.
    //
    AcDbObjectId plineObjId;
    pBlockTableRecord->appendAcDbEntity(plineObjId,
        pNewPline);

    pBlockTableRecord->close();

    // Make the pline object reside on layer "0".
    //
    pNewPline->setLayer("0");

    pNewPline->close();
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:52,代码来源:complex.cpp


注:本文中的AcDbBlockTable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。