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


C++ AcApDocument::database方法代码示例

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


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

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

}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:41,代码来源:squareui.cpp

示例2: LSS06

void LSS06()
{
	CLogger::Print(_T("-------------| START LOGGING LESSONS 06 |--------------"));

	//------------
	// Get the current DENKI project pointer, and number of files of project.
	if (!DenkiIsOpenProject()) {
		acutPrintf(ACRX_T("Denki project has not been opened yet!"));
		return;
	}

	ACHAR szMsg[256] = ACRX_T("\0");
	DenkiDwgProject* pCurProj = DenkiDwgProject::getCurrent();
	int nFileCount = pCurProj->count();
	if (nFileCount < 1) {
		CLogger::Print(_T("*Exit: There is no file within current project!"));
		return;
	}

	//------------
	// Get the 'Duplication Check Level' option of DENKI project.
	DenkiDuplicationCheckLevel CheckLvl = DenkiGetDuplicationCheckLevel(_T("NAME"));
	bool bChkInstNo = (CheckLvl == dclAsInstNumber) ? true : false;
	bool bChkBanNo = (CheckLvl == dclAsBanNumber) ? true : false;

	if (bChkInstNo) {
		bChkBanNo = true;
	}

	CLogger::Print(_T("> INS_NO: %s - BAN_NO: %s")
		, (bChkInstNo ? _T("Checked") : _T("Unchecked"))
		, (bChkBanNo ? _T("Checked") : _T("Unchecked")));

	//------------
	// Require to input BAN_NO, INST_NO, NAME keywords to search.
	ACHAR szNeedBanNo[256] = ACRX_T("\0");
	ACHAR szNeedInstNo[256] = ACRX_T("\0");
	ACHAR szNeedName[256] = ACRX_T("\0");

	if (bChkBanNo) {
		::LoadString(_hdllInstance, IDS_ASK_BANNO, szMsg, sizeof(szMsg)/sizeof(ACHAR));
		if (RTNORM != acedGetString(1, szMsg, szNeedBanNo)) {
			CLogger::Print(_T("*Exit: Fail to get the BAN_NO keyword."));
			return;
		}
	}

	if (bChkInstNo) {
		::LoadString(_hdllInstance, IDS_ASK_INSTNO, szMsg, sizeof(szMsg)/sizeof(ACHAR));
		if (RTNORM != acedGetString(1, szMsg, szNeedInstNo)) {
			CLogger::Print(_T("*Exit: Fail to get the INST_NO keyword."));
			return;
		}
	}

	::LoadString(_hdllInstance, IDS_ASK_NAME, szMsg, sizeof(szMsg)/sizeof(ACHAR));
	if (RTNORM != acedGetString(1, szMsg, szNeedName)) {
		CLogger::Print(_T("*Exit: Fail to get the NAME keyword."));
		return;
	}

	//------------
	// Steps through DENKI project's files.
	for (int nIndex = 0; nIndex < nFileCount; nIndex++) {
		CLogger::Print(_T("---- Index = %d ----"), nIndex);
		DenkiDwgProjectFile& file = pCurProj->getDwgAt(nIndex);
		if (!file.hasZuwaku()) {
			CLogger::Print(_T("Warn: File has not ZUWAKU. > Ignore"));
			continue;
		}

		// Get file path, and file name
		LPCASTR pszFileName = NULL;
		file.getFilePath(pszFileName);
		CLogger::Print(_T("> %s"), pszFileName);

		// Check whether or not file has got DENKI_ZUWAKU.
		DWORD dwFlags = 0;
		if (!file.getZuwakuFlags(dwFlags)) {
			CLogger::Print(_T("Warn: Fail to get the ZUWAKU flags > Ignore"));
			continue;
		}
		if (!(dwFlags & DENKI_ZUWAKU)) {
			CLogger::Print(_T("Warn: File has not DENKI_ZUWAKU. > Ignore"));
			continue;
		}

		// Get the current working database (Just to store).
		AcDbDatabase* pCurDb = acdbHostApplicationServices()->workingDatabase();

		Acad::ErrorStatus esResult;
		AcApDocument* pDoc = NULL;
		AcDbDatabase* pDb = NULL;
		bool bFromProject = false;
		bool bReadMyseft = false;

		// Look up the required database from managed documents.
		if (pDoc = findDocument(pszFileName)) {
			CLogger::Print(_T("Inform: found out the database from managed documents."));
			pDb = pDoc->database();
//.........这里部分代码省略.........
开发者ID:vuonganh1993,项目名称:arxlss,代码行数:101,代码来源:LSS06.cpp


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