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


C++ AcDbDatabase::getSymbolTable方法代码示例

本文整理汇总了C++中AcDbDatabase::getSymbolTable方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbDatabase::getSymbolTable方法的具体用法?C++ AcDbDatabase::getSymbolTable怎么用?C++ AcDbDatabase::getSymbolTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AcDbDatabase的用法示例。


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

示例1: 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

示例2: insertPoints

bool insertPoints(std::map<std::wstring,AcGePoint3d>& m_Points, Adesk::Int16 pointStyle, double pointSize, double textHeight)
{
	
	AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
	AcCmColor pointColor;
	AcGePoint3d temp;
	AcDbPoint* tmp_point = nullptr;
	AcDbText* tmp_txt = nullptr;
	AcDbBlockTable* pBT = nullptr;
	AcDbBlockTableRecord* pBTR = nullptr;
	ACHAR* nrPct = nullptr;
	/*****************************************************************/
	pointColor.setColorIndex(7);
	Layer::Create(_T("pctContur"), pointColor, false, false, false);
	Layer::Create(_T("nrPct"), pointColor, false, false, false);
	Acad::ErrorStatus es = Acad::eOk;
	es = acdbHostApplicationServices()->workingDatabase()->setPdmode(pointStyle);
	es = acdbHostApplicationServices()->workingDatabase()->setPdsize(pointSize);

	/*****************************************************************/

	pDb->getSymbolTable(pBT, AcDb::kForRead);
	pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForWrite);
	pBT->close();

	std::map<std::wstring, AcGePoint3d>::iterator it;
	for (it = m_Points.begin(); it != m_Points.end();it++)
	{
		const wchar_t* key = it->first.c_str();
		tmp_point = new AcDbPoint;
		tmp_point->setPosition(it->second);
		tmp_point->setLayer(_T("pctContur"));
		
		tmp_txt = new AcDbText(it->second, key, AcDbObjectId::kNull, textHeight, 0);
		tmp_txt->setLayer(_T("nrPct"));
		

		pBTR->appendAcDbEntity(tmp_point);
		pBTR->appendAcDbEntity(tmp_txt);
		tmp_point->close();
		tmp_txt->close();
	}

	pBTR->close();

	return true;
}
开发者ID:cosmintaran,项目名称:CosminRepo,代码行数:47,代码来源:InventarCoordonate.cpp

示例3: OnTvSelChanged

void CLayerTreeDlg::OnTvSelChanged(NMHDR* pNMHDR)
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
	// TODO: Add your control notification handler code here

	TV_ITEM tvi = pNMTreeView->itemNew;
	HTREEITEM hItem = tvi.hItem;

	if(m_tree.ItemHasChildren(hItem)) 
	{
		return;
	}

	CString strLayerName = m_tree.GetItemText(hItem);

	Acad::ErrorStatus es = Acad::eOk;

	AcDbDatabase* pDB = acdbHostApplicationServices()->workingDatabase();

	if (NULL == pDB)
		return;

	AcDbLayerTable *pLyTable = NULL;
	AcDbLayerTableRecord *pLyRcd = NULL;

	es = pDB->getSymbolTable(pLyTable,AcDb::kForRead);            //获得当前数据库中层表指针
	if ( es != Acad::eOk ) 
	{
		acutPrintf("\n获取LayerTable的时候发生错误,请稍后再试。\n");
		return;
	}

	if ( !pLyTable->has(strLayerName) )
	{
		pLyTable->close();
		return;
	}

	pLyTable->close();

	SetCurrentLayer(strLayerName);
}
开发者ID:fredrikjonsson,项目名称:cadof72bian,代码行数:42,代码来源:LayerTreeDlg.cpp

示例4: createDatabase

void createDatabase()
{
	// Create a new Database.
	AcDbDatabase *pDb = new AcDbDatabase();

	// Get the BlockTable.
	AcDbBlockTable *pBTable = NULL;
	pDb->getSymbolTable(pBTable, AcDb::kForRead);

	// Get the ModelSpace.
	AcDbBlockTableRecord *pRecord = NULL;
	pBTable->getAt(ACDB_MODEL_SPACE, pRecord, AcDb::kForWrite);
	pBTable->close();

	// Create a new Circle.
	AcDbCircle *pCircle1 = new AcDbCircle(AcGePoint3d(100,100,0),
		AcGeVector3d(0,0,1),
		50.0);
	// Create another new Circle.
	AcDbCircle *pCircle2 = new AcDbCircle(AcGePoint3d(200,200,0),
		AcGeVector3d(0,0,1),
		30.0);

	// Append Circle1 to ModelSpace
	pRecord->appendAcDbEntity(pCircle1);
	pCircle1->close();

	// Append Circle2 to ModelSpace
	pRecord->appendAcDbEntity(pCircle2);
	pCircle2->close();

	pRecord->close();

	// Save to file
	// MUST append a DWG file extension.
	acutPrintf(_T("\nSave file to \"d:\\temp\\testfile.dwg\"."));
	pDb->saveAs(_T("d:\\temp\\testfile.dwg"));

	delete pDb;
}
开发者ID:kevinzhwl,项目名称:ZRXSDKMod,代码行数:40,代码来源:DatabaseOp.cpp

示例5: AcDbDatabase

void

createDwg()

{

    AcDbDatabase *pDb = new AcDbDatabase();

  

    AcDbBlockTable *pBtbl;

    pDb->getSymbolTable(pBtbl, AcDb::kForRead);



    AcDbBlockTableRecord *pBtblRcd;

    pBtbl->getAt(ACDB_MODEL_SPACE, pBtblRcd,

        AcDb::kForWrite);

    pBtbl->close();



    AcDbCircle *pCir1 = new AcDbCircle(AcGePoint3d(1,1,1),

                                       AcGeVector3d(0,0,1),

                                       1.0),

               *pCir2 = new AcDbCircle(AcGePoint3d(4,4,4),

                                       AcGeVector3d(0,0,1),

                                       2.0);



    pBtblRcd->appendAcDbEntity(pCir1);

    pCir1->close();

    

    pBtblRcd->appendAcDbEntity(pCir2);

    pCir2->close();

    pBtblRcd->close();



    // AcDbDatabase::saveAs() does NOT automatically

    // append a DWG file extension, so it

    // must be specified.

    //

    pDb->saveAs(_T("./test1.dwg"));

    delete pDb;

}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:67,代码来源:testdb.cpp

示例6: customAlignmentDraw

//---------------------------------------------------------------------------------------
//
//  功能: 路线绘制回调函数
//
//  输入参数:
//             AeccDisplayOrientation &viewMode
//             IAeccAlignment *pAlign
//             IAcadBlock *pAnonymousBlock 
//
//  返回值:bool
//
// 作  者:  
//
//  日期: 2007/08
//
//  修改记录:无
//
//---------------------------------------------------------------------------------------
bool customAlignmentDraw(const AeccDisplayOrientation &viewMode, IAeccAlignment *pAlign,
						 IAcadBlock *pAnonymousBlock )
{
	AcDbBlockTableRecord* blkRec;
	CString strName;
	CComBSTR bstrName;
	pAnonymousBlock->get_Name( &bstrName);
	strName = bstrName;
	AcDbBlockTable* blkTbl;

	AcDbDatabase* pDb = acdbCurDwg();
	Acad::ErrorStatus es = pDb->getSymbolTable(blkTbl, AcDb::kForRead);
	if (es != Acad::eOk){
		return false;
	}
	//// open named block
	es = blkTbl->getAt(strName, blkRec, AcDb::kForWrite);
	acutPrintf(_T("\nget block"));
	if (es != Acad::eOk) {
		blkTbl->close();    // doesn't need to be open anymore
		return false;
	}

	blkTbl->close();    // doesn't need to be open anymore

	CComQIPtr <IAeccAlignmentEntities> pAlignEntities;
	CComQIPtr <IAeccAlignmentEntity> pAlignEnt;
	CComQIPtr<IAeccAlignmentArc> pAlignArc;
	long iCount;
	pAlign->get_Entities(&pAlignEntities);

	if (pAlignEntities != NULL) {
		pAlignEntities->get_Count(&iCount);

		for (long i = 0; i < iCount; i++) {
			pAlignEnt.Release();
			pAlignEntities->Item(_variant_t(i), &pAlignEnt);
			pAlignArc.Release();
			pAlignArc = pAlignEnt;
			if (pAlignArc != NULL) {
				double radius;
				pAlignArc->get_Radius(&radius);
				//acutPrintf(_T("\nRadius: %f", radius));

				if (radius < 200) {
					double x;
					double y;
					double dStart;
					double dEnd;
					pAlignArc->get_StartingStation(&dStart);
					pAlignArc->get_EndingStation(&dEnd);
					for (double delta = dStart; delta < dEnd; delta += 3.0) {
						pAlign->PointLocation(delta, 0.0, &x, &y);
						AcGePoint3d pt(x,y,0);
						AcDbCircle* cir = new AcDbCircle(pt, AcGeVector3d::kZAxis, 5.0);
						cir->setColorIndex (1, Adesk::kTrue);
						blkRec->appendAcDbEntity(cir);
						cir->close();
					}
				}
			}
		}
	}
	blkRec->close();
	return (true) ;
}
开发者ID:guchanghai,项目名称:Cut,代码行数:84,代码来源:acrxEntryPoint.cpp

示例7: acutNewRb

void
refEditApiExample()
{

    AcDbObjectId transId;
    AcDbDatabase* pDb;
    char *fname;
    struct resbuf *rb;

    // Get a dwg file from the user.
    //
    rb = acutNewRb(RTSTR);
    int stat = acedGetFileD("Pick a drawing", NULL, "dwg", 0, rb);
    
    if ((stat != RTNORM) || (rb == NULL)) {
        acutPrintf("\nYou must pick a drawing file.");
        return;
    }

    fname = (char*)acad_malloc(strlen(rb->resval.rstring) + 1);
    strcpy(fname, rb->resval.rstring);
    acutRelRb(rb);
    
    // Open the dwg file.
    //
    pDb = new AcDbDatabase(Adesk::kFalse);
    if (pDb->readDwgFile(fname) != Acad::eOk) {
        acutPrintf("\nSorry, that draing is probably already open.");
        return;
    }

    // Get the Block Table and then the model space record.
    //
    AcDbBlockTable *pBlockTable;
    pDb->getSymbolTable(pBlockTable, AcDb::kForRead);
    AcDbBlockTableRecord *pOtherMsBtr;
    pBlockTable->getAt(ACDB_MODEL_SPACE, pOtherMsBtr, AcDb::kForRead);
    pBlockTable->close();

    // Create an iterator.
    //
    AcDbBlockTableRecordIterator *pIter;
    pOtherMsBtr->newIterator(pIter);

    // Set up an object ID array.
    //
    AcDbObjectIdArray objIdArray;

    // Iterate over the model space BTR. Look specifically 
    // for lines and append their object ID to the array.
    //
    for (pIter->start(); !pIter->done(); pIter->step()) {
        AcDbEntity *pEntity;
        pIter->getEntity(pEntity, AcDb::kForRead);

        // Look for only AcDbLine objects and add them to the 
        // object ID array.
        //
        if (pEntity->isKindOf(AcDbLine::desc())) {
            objIdArray.append(pEntity->objectId());
        }
        pEntity->close();
    }
    delete pIter;
    pOtherMsBtr->close();

    if (objIdArray.isEmpty()) {
        acad_free(fname);
        acutPrintf("\nYou must pick a drawing file that contains lines.");
        return;
    }

    // Now get the current database and the object ID for the
    // current database's model space BTR.
    //
    AcDbBlockTable *pThisBlockTable;
    acdbHostApplicationServices()->workingDatabase()
        ->getSymbolTable(pThisBlockTable, AcDb::kForRead);

    AcDbBlockTableRecord *pThisMsBtr;
    pThisBlockTable->getAt(ACDB_MODEL_SPACE, pThisMsBtr, AcDb::kForWrite);
    pThisBlockTable->close();
    
    AcDbObjectId id = pThisMsBtr->objectId();
    pThisMsBtr->close();


    // Create the long transaction. This will check all the entities 
    // out of the external database.
    //
    AcDbIdMapping errorMap;
    acapLongTransactionManagerPtr()->checkOut(transId, objIdArray, id, errorMap);

    // Now modify the color of these entities.
    //
    int colorIndex;
    acedGetInt("\nEnter color number to change entities to: ", &colorIndex);
    AcDbObject* pObj;
    if (acdbOpenObject(pObj, transId, AcDb::kForRead) == Acad::eOk) {

//.........这里部分代码省略.........
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:101,代码来源:AsdkLongTransSample.cpp

示例8: OnNMClickLayerTree

//-----------------------------------------------------------------------------
void CLayerTreeDlg::OnNMClickLayerTree(NMHDR *pNMHDR, LRESULT *pResult)
{
	// TODO: 在此添加控件通知处理程序代码
	*pResult = 0;

	UINT uFlag;
	CPoint pt;
	CString sSelLayer;
	HTREEITEM SelRoot,ParRoot,NexRoot;

	pt = CPoint(this->GetCurrentMessage()->pt);
	m_tree.ScreenToClient(&pt);
	SelRoot = m_tree.HitTest(pt,&uFlag);

	if (NULL == SelRoot)
		return;

	if (uFlag & TVHT_ONITEMSTATEICON)
	{
		BOOL bChecked = m_tree.GetCheck(SelRoot);
		//置反选中状态
		SetTreeCheck(SelRoot, !bChecked);

		//分析是否有必要对树枝进行调整
		ParRoot = m_tree.GetParentItem(SelRoot);
		while (ParRoot != NULL)
		{
			if (bChecked)
				m_tree.SetCheck(ParRoot,FALSE);//当前处在被选择状态即将被取消选择
			else
			{
				int k=0;//当前处在非选择状态即将有可能处于选择状态(标志位)
				NexRoot=m_tree.GetNextItem(ParRoot,TVGN_CHILD);
				if(NexRoot!=SelRoot)
				{
					if(!m_tree.GetCheck(NexRoot)) k=1;
				}
				if(k==0)
				{
					while(TRUE)
					{
						NexRoot=m_tree.GetNextItem(NexRoot,TVGN_NEXT);
						if(NexRoot==NULL) break;
						if(NexRoot==SelRoot) continue;
						if(!m_tree.GetCheck(NexRoot))
						{
							k=1;
							break;
						}
					}
				}
				if(k==0) m_tree.SetCheck(ParRoot);
			}
			ParRoot = m_tree.GetParentItem(ParRoot);
		}

		m_tree.SetCheck(SelRoot, bChecked);

		ShowLayer(SelRoot, !bChecked);

//		sendCommandToAutoCAD("redraw ");
	}

	else if(!m_tree.ItemHasChildren(SelRoot)) 
	{
		CString strLayerName = m_tree.GetItemText(SelRoot);

		Acad::ErrorStatus es = Acad::eOk;

		AcDbDatabase* pDB = acdbHostApplicationServices()->workingDatabase();

		if (NULL == pDB)
			return;

		AcDbLayerTable *pLyTable = NULL;
		AcDbLayerTableRecord *pLyRcd = NULL;

		es = pDB->getSymbolTable(pLyTable,AcDb::kForRead);            //获得当前数据库中层表指针
		if ( es != Acad::eOk ) 
		{
			acutPrintf("\n获取LayerTable的时候发生错误,请稍后再试。\n");
			return;
		}

		if ( !pLyTable->has(strLayerName) )
		{
			pLyTable->close();
			return;
		}

		pLyTable->close();

		SetCurrentLayer(strLayerName);
	}
}
开发者ID:fredrikjonsson,项目名称:cadof72bian,代码行数:96,代码来源:LayerTreeDlg.cpp


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