这篇教程C++ AcDbDatabase类代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AcDbDatabase类的典型用法代码示例。如果您正苦于以下问题:C++ AcDbDatabase类的具体用法?C++ AcDbDatabase怎么用?C++ AcDbDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。 在下文中一共展示了AcDbDatabase类的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: readDatabasevoid 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,
示例2: getDestDbvoidArxDbgUiTdcWblockClone::doInsertOption(AcDbDatabase* tmpDb){ AcDbDatabase* destDb = getDestDb(); if (destDb == NULL) { ArxDbgUiTdmDatabase dbox(tmpDb, this, _T("Wblock'd Database")); dbox.DoModal(); doSaveOption(tmpDb); } else { Acad::ErrorStatus es; // lock the document we are inserting into ArxDbgDocLockWrite docLock(destDb); if (docLock.lockAndSetCurrent() != Acad::eOk) return; es = destDb->insert(AcGeMatrix3d::kIdentity, tmpDb, false); if (es == Acad::eOk) { ArxDbgUiTdmDatabase dbox(destDb, this, _T("Wblock/Insert Database")); dbox.DoModal(); doSaveOption(destDb); } else { CString str; str.Format(_T("Insert failed: %s"), ArxDbgUtils::rxErrorStr(es)); ArxDbgUtils::stopAlertBox(str); } }}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:32,
示例3: SaveToFilebool CMakeBlkFile::SaveToFile(){ bool bRet = true; AcDbDatabase *pDwg = NULL; Acad::ErrorStatus es; es = acdbHostApplicationServices()->workingDatabase()->wblock(pDwg, m_objIdArrs, m_insertPt/*, AcDb::kDrcIgnore*/); if (es == Acad::eOk) { AcDb::AcDbDwgVersion dwgVer = acdbHostApplicationServices()->workingDatabase()->originalFileVersion(); es = pDwg->saveAs(m_strFileName,FALSE,dwgVer,0); if (es!=Acad::eOk) { bRet = false; } } if (pDwg != NULL) { delete pDwg; pDwg = NULL; } acTransactionManagerPtr()->queueForGraphicsFlush(); acTransactionManagerPtr()->flushGraphics();//刷新 acedUpdateDisplay(); return bRet;}
开发者ID:kanbang,项目名称:SVN,代码行数:27,
示例4: postToDatabaseAcad::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,
示例5: SetCurLaylervoid Additional_Class::SetCurLayler( AcDbObjectId curlayerID){ AcDbDatabase *pCurDb = NULL; pCurDb = acdbHostApplicationServices()->workingDatabase(); pCurDb->setClayer(curlayerID); return;}
开发者ID:TobeGodman,项目名称:AutoTrader,代码行数:7,
示例6: GetWorkingDBAcad::ErrorStatus TWArxLayerMan::Init(){ AcDbDatabase* pDb = GetWorkingDB(); Acad::ErrorStatus es = Acad::eOk; AcDbLayerTable* pLayerTb = NULL; es = pDb->getLayerTable( pLayerTb,AcDb::kForRead ); if( pLayerTb == NULL ) return es; pLayerTb->close(); AcDbLayerTableIterator* pIte = NULL; es = pLayerTb->newIterator( pIte ); if( pIte == NULL ) return es; m_vLayers.clear(); for ( pIte->start(); !pIte->done(); pIte->step()) { AcDbObjectId Id; es = pIte->getRecordId( Id ); if( es != Acad::eOk ) continue; m_vLayers.push_back( Id ); } TWFreePtr( pIte ); return es;}
开发者ID:jiangnanemail,项目名称:WorkingDB,代码行数:28,
示例7: acutPrintfvoidArxDbgUiTdcSysReactors::attachTransactionReactorToAll(){ if (m_transReactor) { AcDbDatabase* tmpDb; AcDbVoidPtrArray dbPtrs; ArxDbgUtils::getAllDatabases(dbPtrs); AcDbTransactionManager* tmpTrMgr; AcDbVoidPtrArray trMgrs; // keep track of ones we've attached to since some db's share transMgr acutPrintf(_T("/nAttaching Transaction Reactor to all active databases...")); int len = dbPtrs.length(); for (int i=0; i<len; i++) { tmpDb = static_cast<AcDbDatabase*>(dbPtrs[i]); tmpTrMgr = tmpDb->transactionManager(); if (tmpTrMgr && (trMgrs.contains(tmpTrMgr) == false)) { tmpTrMgr->addReactor(m_transReactor); trMgrs.append(tmpTrMgr); } else { CString str; acutPrintf("/nSkipping duplicate transaction manager for: (%s)", ArxDbgUtils::dbToStr(tmpDb, str)); } } }}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:29,
示例8: _TvoidArxDbgUiTdcInsert::OnAddExternalDwg(){ CString fname; Acad::ErrorStatus es; es = ArxDbgUtils::getFileNameForRead(_T("Drawing File"), NULL, _T("dwg"), fname, false, false); if (es == Acad::eOk) { if (hasDwgFile(m_extDwgNames, fname)) ArxDbgUtils::alertBox(_T("That DWG file is already in the list.")); else { AcDbDatabase* db = new AcDbDatabase(false, true); es = db->readDwgFile(fname); if (es == Acad::eOk) { m_dbPtrs.append(db); m_extDwgNames.Add(fname); CString str; ArxDbgUtils::dbToStr(db, str); m_lbSourceDb.AddString(str); m_lbDestDb.AddString(str); } else { CString str; str.Format(_T("ERROR: could not read DWG file: %s"), ArxDbgUtils::rxErrorStr(es)); ArxDbgUtils::alertBox(str); } } }}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:32,
示例9: acdbCurDwgAcad::ErrorStatus CTwArxDictionary::CreateSubDictionaryID( IN const AcDbObjectId& IdRoot, IN const CString& strKey, OUT AcDbObjectId& IdSubDic, IN AcRxClass* pRxObjType /*= AcDbDictionary::desc() */ ) const{ if( pRxObjType == NULL ) return Acad::eNullObjectPointer; Acad::ErrorStatus es = Acad::eOk; AcDbDictionary* pDicRoot = NULL; AcDbDatabase* pWdb = acdbCurDwg(); if( IdRoot.isNull() ) es = pWdb->getNamedObjectsDictionary( pDicRoot, AcDb::kForRead ); else es = acdbOpenObject( pDicRoot, IdRoot, AcDb::kForRead ); if( es != Acad::eOk ) return es; if( pDicRoot->has(strKey) ) { pDicRoot->getAt( strKey, IdSubDic ); pDicRoot->close(); return es; } pDicRoot->upgradeOpen(); AcDbObject* pObj = (AcDbObject*)pRxObjType->create(); es = pDicRoot->setAt( strKey, pObj, IdSubDic ); pObj->close(); pDicRoot->close(); return es;}
开发者ID:jiangnanemail,项目名称:WorkingDB,代码行数:30,
示例10: GetClientRectvoid CZhfPalette::AddControls(){ acDocManager->lockDocument(curDoc(), AcAp::kWrite, NULL, NULL, true) ; CRect rect ; GetClientRect(&rect) ; int iWidth = rect.Width() ; int iHeight = rect.Height() ; CFont * pFont = new CFont; pFont->CreateFont(14, // nHeight 0, // nWidth 0, // nEscapement 0, // nOrientation FW_NORMAL , // nWeight FALSE, // bItalic FALSE, // bUnderline 0, // cStrikeOut ANSI_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily _T("Arial")); // lpszFac int iIndex = 0 ; int iCount = m_strArrayFile.GetCount() ; for (int i=0; i<iCount; i++) { CString strFile = m_strArrayFile.GetAt(i) ; CGsPreviewCtrl* pCtrl = new CGsPreviewCtrl() ; pCtrl->m_iIndex = iIndex ; pCtrl->m_strDwgFile = strFile ; m_pArrayPreviewCtrl.Add(pCtrl) ; pCtrl->Create(_T(""), WS_CHILD|WS_VISIBLE|SS_CENTER|SS_SUNKEN, CRect(10, 10, 110, 110), this) ; AcDbDatabase* pDbSrc = new AcDbDatabase(false) ; if(Acad::eOk==pDbSrc->readDwgFile(strFile)) { AcDbDatabase* pDbTo = new AcDbDatabase() ; this->Wblock(pDbSrc, pDbTo) ; this->FilterDb(pDbTo, m_nArrayFilterMode.GetAt(i)) ; pCtrl->SetDatabase(pDbTo); } delete pDbSrc ; CStatic* pCtrlStatic = new CStatic() ; CString strFileName ; strFileName.Format(_T("%s"), m_strArrayFileName.GetAt(i)) ; m_pArrayStatic.Add(pCtrlStatic) ; pCtrlStatic->Create(strFileName, WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(10, 10, 40, 110), this) ; pCtrlStatic->SetFont(pFont) ; iIndex++ ; } acDocManager->unlockDocument(curDoc()) ; this->OnSize(0, iWidth, iHeight) ;}
开发者ID:luosin,项目名称:cad-2004-lzx,代码行数:59,
示例11: getAllSymbolRecordsIdsint getAllSymbolRecordsIds(AcRxClass* pTableClass, AcDbObjectIdArray & idaAll){ CLogger::Print(_T("*Call: getAllSymbolRecordsIds()")); Acad::ErrorStatus es; idaAll.setLogicalLength(0); AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase(); AcDbSymbolTable* pSymbolTable = NULL; if (AcRx::kEqual == pTableClass->comparedTo(AcDbBlockTable::desc())) { CLogger::Print(_T("> This is BlockTable!")); es = pDb->getBlockTable(pSymbolTable, AcDb::kForRead); } else if (AcRx::kEqual == pTableClass->comparedTo(AcDbLayerTable::desc())) { CLogger::Print(_T("> This is LayerTable!")); es = pDb->getLayerTable(pSymbolTable, AcDb::kForRead); } else if (AcRx::kEqual == pTableClass->comparedTo(AcDbLinetypeTable::desc())) { CLogger::Print(_T("> This is LinetypeTable!")); es = pDb->getLinetypeTable(pSymbolTable, AcDb::kForRead); } else if (AcRx::kEqual == pTableClass->comparedTo(AcDbTextStyleTable::desc())) { CLogger::Print(_T("> This is TextStyleTable!")); es = pDb->getTextStyleTable(pSymbolTable, AcDb::kForRead); } else { CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - This kind of SymbolTable is not supported!")); return -1; } if (Acad::eOk != es) { CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Fail to get SymbolTable!")); return -1; } //------------ // Get the SymbolTable's iterator. AcDbSymbolTableIterator* pSymbolTableIter = NULL; es = pSymbolTable->newIterator(pSymbolTableIter); pSymbolTable->close(); if (Acad::eOk != es) { CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Fail to get the SymbolTable's iterator!")); return -1; } //------------ // Steps through the SymbolTable's records. // Then get the SymbolTableRecord's ObjectID. for (; !pSymbolTableIter->done(); pSymbolTableIter->step()) { AcDbObjectId idObj = AcDbObjectId::kNull; if (Acad::eOk == pSymbolTableIter->getRecordId(idObj)) idaAll.append(idObj); } delete pSymbolTableIter; CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Count: %02d"), idaAll.length()); return idaAll.length();}
开发者ID:vuonganh1993,项目名称:arxlss,代码行数:58,
示例12: ads_MyDialog int ads_MyDialog() {// sample from brxtemplate//++-- See StdAfx for these types StringPairs LayerList; AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase(); pDb->layerTableId(); LayerTablePointer pLayerTable(pDb->layerTableId(),AcDb::kForRead); if(pLayerTable.openStatus() != eOk) { ads_retnil(); return( RSRSLT); } AcDbLayerTableIterator *pLayerTableIterator; pLayerTable->newIterator(pLayerTableIterator); //++-- iterate though and get our stuff for (pLayerTableIterator->start(); !pLayerTableIterator->done(); pLayerTableIterator->step()) { AcDbObjectId LayerId; TCHAR *LayerName; CString LayerColor; pLayerTableIterator->getRecordId(LayerId); LayerTableRecordPointer pLayerTableRecord(LayerId,AcDb::kForRead); pLayerTableRecord->getName(LayerName); AcCmColor clr = pLayerTableRecord->color(); LayerColor = clr.bookName(); LayerColor.Format(_T("Red = %03d Green = %03d Blue = %03d "), clr.red(), clr.green() , clr.blue()); LayerList.push_back(StringPair(String(LayerName), String(LayerColor))); } delete pLayerTableIterator; { // you should always call this before your diaog; CAcModuleResourceOverride resOverride; //show our dialog MyDialog dlg(LayerList,CWnd::FromHandle(adsw_acadMainWnd())); dlg.DoModal(); } ads_retnil(); return( RSRSLT); }
开发者ID:billmuell,项目名称:GeoMap,代码行数:56,
示例13: AddEntityToDataBasestatic void AddEntityToDataBase(AcDbEntity *pEnt) { AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase(); AcDbBlockTableRecordPointer pBTR(pDb->currentSpaceId(), AcDb::kForWrite); if (pEnt && Acad::eOk == pBTR.openStatus()) { pBTR->appendAcDbEntity(pEnt); pEnt->close(); } }
开发者ID:vpatrinica,项目名称:pernute,代码行数:10,
示例14: GetPredefinedStrings//OPM calls this function for each property to obtain a list of strings and cookies if they are available.//For our textstyle property we would like to display all the textstyles currently available in the database.//This function is declared on the IPerPropertyBrowsing interface. Our IOPMPropertyExtensionImpl//class implements this member by reading the values in the OPM property map. (You set this up in your//head file when you use BEGIN_OPMPROP_MAP, OPMPROP_ENTRY, END_OPMPROP_MAP macros.)//Since we need a dynamic list of entries in this drop down list and a static map cannot implement this, //we need to override this function a provide dynamic list of text styles to OPM.STDMETHODIMP CComPolygon::GetPredefinedStrings(DISPID dispID, CALPOLESTR *pCaStringsOut, CADWORD *pCaCookiesOut){ if (dispID != DISPID_TEXTSTYLENAME) return IOPMPropertyExtensionImpl<CComPolygon>::GetPredefinedStrings(dispID,pCaStringsOut,pCaCookiesOut); USES_CONVERSION; AcDbTextStyleTable* pTT; AcDbDatabase *pDb = m_objRef.objectId().database(); if (NULL == pDb) pDb = acdbHostApplicationServices()->workingDatabase(); if (pDb->getTextStyleTable(pTT,AcDb::kForRead)==Acad::eOk) { AcDbTextStyleTableIterator* pIter; if (pTT->newIterator(pIter)==Acad::eOk) { long size = 0; // Clear the array. mObjectIdArray.removeAll(); for (pIter->start();!pIter->done();pIter->step()) size++; pCaStringsOut->pElems = (LPOLESTR *)::CoTaskMemAlloc(sizeof(LPOLESTR) * size); pCaCookiesOut->pElems = (DWORD *)::CoTaskMemAlloc(sizeof(DWORD) * size); long i=0; for (pIter->start();!pIter->done();pIter->step()) { AcDbTextStyleTableRecord* pTTR; if (pIter->getRecord(pTTR,AcDb::kForRead)!=Acad::eOk) continue; const TCHAR* pName = NULL; if (pTTR->getName(pName)==Acad::eOk){ //we want to show the name of the textstyle as //it appears in the database pCaStringsOut->pElems[i] = ::SysAllocString(CT2W(pName)); pCaCookiesOut->pElems[i] = mObjectIdArray.append(pTTR->objectId()); } pTTR->close(); i++; } pCaStringsOut->cElems = i; pCaCookiesOut->cElems = i; } if (pIter) delete pIter; pTT->close(); } return S_OK;}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:57,
示例15: UpdateDatavoidArxDbgUiTdcInsert::OnInsertBlkDef(){ CString blkName; m_ebDestName1.GetWindowText(blkName); if (!acdbSNValid(blkName, false)) { CString str; str.Format(_T("%s is not a valid block name."), blkName); ArxDbgUtils::alertBox(str); return; } UpdateData(TRUE); bool isExternal; AcDbDatabase* sourceDb = getSourceDb(isExternal); AcDbDatabase* destDb = getDestDb(); ASSERT(sourceDb != destDb); Acad::ErrorStatus es; // lock the document we are inserting into ArxDbgDocLockWrite docLock(destDb); if (docLock.lockAndSetCurrent() != Acad::eOk) return; bool preserveSrcDb = intToBool(m_preserveOriginalDb); if (!preserveSrcDb && !isExternal) { ArxDbgUtils::alertBox(_T("Ignoring setting of /"Preserve source database/" since destroying/na database associated with a Document would be harsh.")); preserveSrcDb = true; } AcDbObjectId blkId; es = destDb->insert(blkId, blkName, sourceDb, preserveSrcDb); if (es == Acad::eOk) { ArxDbgUiTdmDatabase dbox(destDb, this, _T("Inserted Database")); dbox.DoModal(); doSaveOption(destDb); if (isExternal && !preserveSrcDb) reloadRaidedExternalDwg(sourceDb); } else { CString str; str.Format(_T("Insert failed: %s"), ArxDbgUtils::rxErrorStr(es)); ArxDbgUtils::stopAlertBox(str); }}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:50,
示例16: insertPointsbool 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,
示例17: addToDatabase// Add the given entity to the current DatabaseAcad::ErrorStatusaddToDatabase(AcDbEntity* pEnt, AcDbObjectId& objId){ Acad::ErrorStatus acadReturnValue = Acad::eOk; AcDbBlockTable* pBlockTable; AcDbBlockTableRecord* pSpaceRecord; AcDbDatabase *pCurDwg = acdbHostApplicationServices()->workingDatabase(); if (pCurDwg==NULL) return Acad::eNoDatabase; if ((acadReturnValue = pCurDwg->getBlockTable(pBlockTable, AcDb::kForRead)) != Acad::eOk) { acutPrintf(ACRX_T("/n acdbCurDwg()->getBlockTable() failed")); return acadReturnValue; } if ((acadReturnValue = pBlockTable->getAt(ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite)) != Acad::eOk) { acutPrintf(ACRX_T("/n AcDbBlockTable::getAt() failed")); return acadReturnValue; } // close the block table object if ((acadReturnValue = pBlockTable->close()) != Acad::eOk) { acutPrintf(ACRX_T("/n AcDbBlockTable::close() failed")); return acadReturnValue; } // append the entity to the display list if ((acadReturnValue = pSpaceRecord->appendAcDbEntity(objId, pEnt)) != Acad::eOk) { acutPrintf(ACRX_T("/n AcDbBlockTableRecord::appendAcDbEntity() failed")); return acadReturnValue; } // close the block table record object if ((acadReturnValue = pSpaceRecord->close()) != Acad::eOk) { acutPrintf(ACRX_T("/n AcDbBlockTableRecord::close() failed")); return acadReturnValue; } return acadReturnValue;}
开发者ID:Bohr27,项目名称:ObjectARXCore,代码行数:45,
示例18: GetSubDictionaryIDAcad::ErrorStatus CTwArxDictionary::GetSubDictionaryID( IN const AcDbObjectId& IdRoot, IN const CString& strKey, AcDbObjectId& IdSub, AcDbDatabase* pCurDB ) const{ Acad::ErrorStatus es = Acad::eOk; AcDbDictionary* pDicRoot = NULL; AcDbDatabase* pWdb = pCurDB; if( pWdb == NULL ) pWdb = acdbCurDwg(); if( IdRoot.isNull() ) es = pWdb->getNamedObjectsDictionary( pDicRoot, AcDb::kForRead ); else es = acdbOpenObject( pDicRoot, IdRoot, AcDb::kForRead ); if( pDicRoot == NULL ) return es; pDicRoot->close(); es = pDicRoot->getAt( strKey, IdSub ); return es;}
开发者ID:jiangnanemail,项目名称:WorkingDB,代码行数:19,
示例19: ASSERTvoidArxDbgUiTdcWblockClone::OnWblockBlkDef(){ // get the block we're suppose to be wblocking int index = m_puBlockDef.GetCurSel(); ASSERT(index != CB_ERR); CString str; AcDbObjectId blkDefId; if (!m_blockList.GetAtIndex(index, str, blkDefId)) { ASSERT(0); return; } AcDbDatabase* sourceDb = getSourceDb(); ASSERT(sourceDb != NULL); // lock the document we are wblocking from ArxDbgDocLockWrite docLock(sourceDb); if (docLock.lock() != Acad::eOk) return; // restore database to non-xref state (xes returns eOk if this // was necessary, and something else if it wasn't). Acad::ErrorStatus xes = sourceDb->restoreOriginalXrefSymbols(); AcDbDatabase* tmpDb = NULL; Acad::ErrorStatus es = sourceDb->wblock(tmpDb, blkDefId); if (xes ==Acad::eOk) xes = sourceDb->restoreForwardingXrefSymbols(); if (es == Acad::eOk) { doInsertOption(tmpDb); delete tmpDb; // we're done with it } else { CString str; str.Format(_T("Wblock failed: %s"), ArxDbgUtils::rxErrorStr(es)); ArxDbgUtils::stopAlertBox(str); delete tmpDb; // yes, a failed wblock can leave a partially created database! // so always delete it. }}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:43,
示例20: acdbHostApplicationServicesvoid 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,
示例21: attachDbReactor//// Attach the database reactor if one isn't attached already. // Then, start up the dialog.////void attachDbReactor(AcDbDatabase* pDb){ if(gbDisplayDialog) { AcDbDatabase* pWkDb = acdbHostApplicationServices()->workingDatabase(); assert(pWkDb == pDb); AcDbDatabase* pCurDb = curDoc()->database(); assert(pCurDb == pDb); acDocManager->lockDocument(curDoc(), AcAp::kWrite); gpDbReactor = new CDbModReactor(); pWkDb->addReactor(gpDbReactor); acutPrintf("/nAttached CDbModReactor to the current database./n"); acDocManager->unlockDocument(curDoc()); acedPostCommandPrompt(); } else endDlg();}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:25,
示例22: getSourceDbvoidArxDbgUiTdcWblockClone::OnWblockObjects() { AcDbDatabase* sourceDb = getSourceDb(); ASSERT(sourceDb != NULL); AcDbObjectIdArray objIds; m_cloneSet.getObjectsForDatabase(sourceDb, objIds); // unfortunately, wblock is a little restrictive on what // it will allow to be cloned automatically. So, we factor // out all the entities and allow those to be cloned, and // then our ArxDbgAppEditorReactor will handle the rest by hand. AcDbObjectIdArray okToClone, mustCloneByHand; divideCloneSet(objIds, mustCloneByHand, okToClone); // lock the document we are wblocking from ArxDbgDocLockWrite docLock(sourceDb); if (docLock.lock() != Acad::eOk) return; // restore database to non-xref state (xes returns eOk if this // was necessary, and something else if it wasn't). Acad::ErrorStatus xes = sourceDb->restoreOriginalXrefSymbols(); AcDbDatabase* tmpDb = NULL; Acad::ErrorStatus es = sourceDb->wblock(tmpDb, okToClone, m_basePt); if (xes ==Acad::eOk) xes = sourceDb->restoreForwardingXrefSymbols(); if (es == Acad::eOk) { doInsertOption(tmpDb); delete tmpDb; // we're done with it } else { CString str; str.Format(_T("Wblock failed: %s"), ArxDbgUtils::rxErrorStr(es)); ArxDbgUtils::stopAlertBox(str); delete tmpDb; // yes, a failed wblock can leave a partially created database! // so always delete it. }}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:41,
示例23: appendbool 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,
示例24: createDatabasevoid 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,
示例25: appendToSpace// everything went ok, append entity to the databaseHRESULT CPolyCommand::appendToSpace(){ AcDbObjectId obj(NULL); m_pBaseObj->AddToDb(obj,m_pDb->currentSpaceId(),"AsdkPoly"); return Acad::eOk;}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:8,
注:本文中的AcDbDatabase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AcDbEntity类代码示例 C++ AcDbBlockTableRecord类代码示例 |